Initial commit
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.content.Context;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.preference.PreferenceManager;
|
||||
import com.google.zxing.client.android.camera.CameraManager;
|
||||
import com.google.zxing.client.android.camera.FrontLightMode;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class AmbientLightManager implements SensorEventListener {
|
||||
private final Context a;
|
||||
private CameraManager b;
|
||||
private Sensor c;
|
||||
|
||||
public AmbientLightManager(Context context) {
|
||||
this.a = context;
|
||||
}
|
||||
|
||||
public void a(CameraManager cameraManager) {
|
||||
this.b = cameraManager;
|
||||
if (FrontLightMode.readPref(PreferenceManager.getDefaultSharedPreferences(this.a)) == FrontLightMode.AUTO) {
|
||||
SensorManager sensorManager = (SensorManager) this.a.getSystemService("sensor");
|
||||
this.c = sensorManager.getDefaultSensor(5);
|
||||
Sensor sensor = this.c;
|
||||
if (sensor != null) {
|
||||
sensorManager.registerListener(this, sensor, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.hardware.SensorEventListener
|
||||
public void onAccuracyChanged(Sensor sensor, int i) {
|
||||
}
|
||||
|
||||
@Override // android.hardware.SensorEventListener
|
||||
public void onSensorChanged(SensorEvent sensorEvent) {
|
||||
float f = sensorEvent.values[0];
|
||||
CameraManager cameraManager = this.b;
|
||||
if (cameraManager != null) {
|
||||
if (f <= 45.0f) {
|
||||
cameraManager.a(true);
|
||||
} else if (f >= 450.0f) {
|
||||
cameraManager.a(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
if (this.c != null) {
|
||||
((SensorManager) this.a.getSystemService("sensor")).unregisterListener(this);
|
||||
this.b = null;
|
||||
this.c = null;
|
||||
}
|
||||
}
|
||||
}
|
97
sources/com/google/zxing/client/android/BeepManager.java
Normal file
97
sources/com/google/zxing/client/android/BeepManager.java
Normal file
@@ -0,0 +1,97 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.Vibrator;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class BeepManager implements MediaPlayer.OnErrorListener, Closeable {
|
||||
private static final String e = BeepManager.class.getSimpleName();
|
||||
private final Activity a;
|
||||
private MediaPlayer b = null;
|
||||
private boolean c;
|
||||
private boolean d;
|
||||
|
||||
public BeepManager(Activity activity) {
|
||||
this.a = activity;
|
||||
b();
|
||||
}
|
||||
|
||||
public synchronized void a() {
|
||||
if (this.c && this.b != null) {
|
||||
this.b.start();
|
||||
}
|
||||
if (this.d) {
|
||||
((Vibrator) this.a.getSystemService("vibrator")).vibrate(200L);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void b() {
|
||||
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this.a);
|
||||
this.c = a(defaultSharedPreferences, this.a);
|
||||
this.d = defaultSharedPreferences.getBoolean("preferences_vibrate", false);
|
||||
if (this.c && this.b == null) {
|
||||
this.a.setVolumeControlStream(3);
|
||||
this.b = a(this.a);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.io.Closeable, java.lang.AutoCloseable
|
||||
public synchronized void close() {
|
||||
if (this.b != null) {
|
||||
this.b.release();
|
||||
this.b = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.media.MediaPlayer.OnErrorListener
|
||||
public synchronized boolean onError(MediaPlayer mediaPlayer, int i, int i2) {
|
||||
if (i == 100) {
|
||||
this.a.finish();
|
||||
} else {
|
||||
close();
|
||||
b();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean a(SharedPreferences sharedPreferences, Context context) {
|
||||
boolean z = sharedPreferences.getBoolean("preferences_play_beep", true);
|
||||
if (!z || ((AudioManager) context.getSystemService("audio")).getRingerMode() == 2) {
|
||||
return z;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private MediaPlayer a(Context context) {
|
||||
MediaPlayer mediaPlayer = new MediaPlayer();
|
||||
try {
|
||||
AssetFileDescriptor openRawResourceFd = context.getResources().openRawResourceFd(R$raw.beep);
|
||||
try {
|
||||
mediaPlayer.setDataSource(openRawResourceFd.getFileDescriptor(), openRawResourceFd.getStartOffset(), openRawResourceFd.getLength());
|
||||
mediaPlayer.setOnErrorListener(this);
|
||||
mediaPlayer.setAudioStreamType(3);
|
||||
mediaPlayer.setLooping(false);
|
||||
mediaPlayer.setVolume(0.1f, 0.1f);
|
||||
mediaPlayer.prepare();
|
||||
if (openRawResourceFd != null) {
|
||||
openRawResourceFd.close();
|
||||
}
|
||||
return mediaPlayer;
|
||||
} finally {
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
Log.w(e, e2);
|
||||
mediaPlayer.release();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
583
sources/com/google/zxing/client/android/CaptureActivity.java
Normal file
583
sources/com/google/zxing/client/android/CaptureActivity.java
Normal file
@@ -0,0 +1,583 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.ResultMetadataType;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.client.android.camera.CameraManager;
|
||||
import com.google.zxing.client.android.clipboard.ClipboardInterface;
|
||||
import com.google.zxing.client.android.history.HistoryManager;
|
||||
import com.google.zxing.client.android.result.ResultButtonListener;
|
||||
import com.google.zxing.client.android.result.ResultHandler;
|
||||
import com.google.zxing.client.android.result.ResultHandlerFactory;
|
||||
import com.google.zxing.client.android.result.supplement.SupplementalInfoRetriever;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class CaptureActivity extends Activity implements SurfaceHolder.Callback, ICaptureView {
|
||||
private static final String t = CaptureActivity.class.getSimpleName();
|
||||
private static final String[] u = {"http://zxing.appspot.com/scan", "zxing://scan/"};
|
||||
private static final Collection<ResultMetadataType> v = EnumSet.of(ResultMetadataType.ISSUE_NUMBER, ResultMetadataType.SUGGESTED_PRICE, ResultMetadataType.ERROR_CORRECTION_LEVEL, ResultMetadataType.POSSIBLE_COUNTRY);
|
||||
private CameraManager a;
|
||||
private CaptureActivityHandler b;
|
||||
private Result c;
|
||||
private ViewfinderView d;
|
||||
private TextView e;
|
||||
private View f;
|
||||
private Result g;
|
||||
private boolean h;
|
||||
private boolean i;
|
||||
private IntentSource j;
|
||||
private String k;
|
||||
private ScanFromWebPageManager l;
|
||||
private Collection<BarcodeFormat> m;
|
||||
private Map<DecodeHintType, ?> n;
|
||||
private String o;
|
||||
private HistoryManager p;
|
||||
private InactivityTimer q;
|
||||
private BeepManager r;
|
||||
private AmbientLightManager s;
|
||||
|
||||
/* renamed from: com.google.zxing.client.android.CaptureActivity$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] a = new int[IntentSource.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[IntentSource.NATIVE_APP_INTENT.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[IntentSource.PRODUCT_SEARCH_LINK.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
try {
|
||||
a[IntentSource.ZXING_LINK.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
try {
|
||||
a[IntentSource.NONE.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError unused4) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean a(String str) {
|
||||
if (str == null) {
|
||||
return false;
|
||||
}
|
||||
for (String str2 : u) {
|
||||
if (str.startsWith(str2)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private int b() {
|
||||
int rotation = getWindowManager().getDefaultDisplay().getRotation();
|
||||
return getResources().getConfiguration().orientation == 2 ? (rotation == 0 || rotation == 1) ? 0 : 8 : (rotation == 0 || rotation == 3) ? 1 : 9;
|
||||
}
|
||||
|
||||
private void c() {
|
||||
this.f.setVisibility(8);
|
||||
this.e.setText(R$string.msg_default_status);
|
||||
this.e.setVisibility(0);
|
||||
this.d.setVisibility(0);
|
||||
this.g = null;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.ICaptureView
|
||||
public ViewfinderView J() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.ICaptureView
|
||||
public CameraManager b0() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.ICaptureView
|
||||
public Handler getHandler() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onActivityResult(int i, int i2, Intent intent) {
|
||||
int intExtra;
|
||||
if (i2 != -1 || i != 47820 || this.p == null || (intExtra = intent.getIntExtra("ITEM_NUMBER", -1)) < 0) {
|
||||
return;
|
||||
}
|
||||
a(null, this.p.a(intExtra).b());
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
getWindow().addFlags(PeripheralType.SERVO);
|
||||
setContentView(R$layout.capture);
|
||||
this.h = false;
|
||||
this.q = new InactivityTimer(this);
|
||||
this.r = new BeepManager(this);
|
||||
this.s = new AmbientLightManager(this);
|
||||
PreferenceManager.setDefaultValues(this, R$xml.preferences, false);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onDestroy() {
|
||||
this.q.d();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
if (i != 4) {
|
||||
if (i != 27 && i != 80) {
|
||||
if (i == 24) {
|
||||
this.a.a(true);
|
||||
} else if (i == 25) {
|
||||
this.a.a(false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
IntentSource intentSource = this.j;
|
||||
if (intentSource == IntentSource.NATIVE_APP_INTENT) {
|
||||
setResult(0);
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
if ((intentSource == IntentSource.NONE || intentSource == IntentSource.ZXING_LINK) && this.g != null) {
|
||||
a(0L);
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onPause() {
|
||||
CaptureActivityHandler captureActivityHandler = this.b;
|
||||
if (captureActivityHandler != null) {
|
||||
captureActivityHandler.a();
|
||||
this.b = null;
|
||||
}
|
||||
this.q.b();
|
||||
this.s.a();
|
||||
this.r.close();
|
||||
this.a.a();
|
||||
if (!this.h) {
|
||||
((SurfaceView) findViewById(R$id.preview_view)).getHolder().removeCallback(this);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onResume() {
|
||||
int intExtra;
|
||||
super.onResume();
|
||||
this.p = new HistoryManager(this);
|
||||
this.p.e();
|
||||
this.a = new CameraManager(getApplication());
|
||||
this.d = (ViewfinderView) findViewById(R$id.viewfinder_view);
|
||||
this.d.setCameraManager(this.a);
|
||||
this.f = findViewById(R$id.result_view);
|
||||
this.e = (TextView) findViewById(R$id.status_view);
|
||||
this.b = null;
|
||||
this.g = null;
|
||||
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean z = true;
|
||||
if (defaultSharedPreferences.getBoolean("preferences_orientation", true)) {
|
||||
setRequestedOrientation(b());
|
||||
} else {
|
||||
Log.e("Test", "~~~~~~~~~~~~~~~~~~~~~~~setRequestedOrientation");
|
||||
setRequestedOrientation(6);
|
||||
}
|
||||
c();
|
||||
this.r.b();
|
||||
this.s.a(this.a);
|
||||
this.q.c();
|
||||
Intent intent = getIntent();
|
||||
if (!defaultSharedPreferences.getBoolean("preferences_copy_to_clipboard", true) || (intent != null && !intent.getBooleanExtra("SAVE_HISTORY", true))) {
|
||||
z = false;
|
||||
}
|
||||
this.i = z;
|
||||
this.j = IntentSource.NONE;
|
||||
this.k = null;
|
||||
this.l = null;
|
||||
this.m = null;
|
||||
this.o = null;
|
||||
if (intent != null) {
|
||||
String action = intent.getAction();
|
||||
String dataString = intent.getDataString();
|
||||
if ("com.google.zxing.client.android.SCAN".equals(action)) {
|
||||
this.j = IntentSource.NATIVE_APP_INTENT;
|
||||
this.m = DecodeFormatManager.a(intent);
|
||||
this.n = DecodeHintManager.a(intent);
|
||||
if (intent.hasExtra("SCAN_WIDTH") && intent.hasExtra("SCAN_HEIGHT")) {
|
||||
int intExtra2 = intent.getIntExtra("SCAN_WIDTH", 0);
|
||||
int intExtra3 = intent.getIntExtra("SCAN_HEIGHT", 0);
|
||||
if (intExtra2 > 0 && intExtra3 > 0) {
|
||||
this.a.a(intExtra2, intExtra3);
|
||||
}
|
||||
}
|
||||
if (intent.hasExtra("SCAN_CAMERA_ID") && (intExtra = intent.getIntExtra("SCAN_CAMERA_ID", -1)) >= 0) {
|
||||
this.a.a(intExtra);
|
||||
}
|
||||
String stringExtra = intent.getStringExtra("PROMPT_MESSAGE");
|
||||
if (stringExtra != null) {
|
||||
this.e.setText(stringExtra);
|
||||
}
|
||||
} else if (dataString != null && dataString.contains("http://www.google") && dataString.contains("/m/products/scan")) {
|
||||
this.j = IntentSource.PRODUCT_SEARCH_LINK;
|
||||
this.k = dataString;
|
||||
this.m = DecodeFormatManager.b;
|
||||
} else if (a(dataString)) {
|
||||
this.j = IntentSource.ZXING_LINK;
|
||||
this.k = dataString;
|
||||
Uri parse = Uri.parse(dataString);
|
||||
this.l = new ScanFromWebPageManager(parse);
|
||||
this.m = DecodeFormatManager.a(parse);
|
||||
this.n = DecodeHintManager.a(parse);
|
||||
}
|
||||
this.o = intent.getStringExtra("CHARACTER_SET");
|
||||
}
|
||||
SurfaceHolder holder = ((SurfaceView) findViewById(R$id.preview_view)).getHolder();
|
||||
if (this.h) {
|
||||
a(holder);
|
||||
} else {
|
||||
holder.addCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.SurfaceHolder.Callback
|
||||
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
|
||||
}
|
||||
|
||||
@Override // android.view.SurfaceHolder.Callback
|
||||
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
||||
if (surfaceHolder == null) {
|
||||
Log.e(t, "*** WARNING *** surfaceCreated() gave us a null surface!");
|
||||
}
|
||||
if (this.h) {
|
||||
return;
|
||||
}
|
||||
this.h = true;
|
||||
a(surfaceHolder);
|
||||
}
|
||||
|
||||
@Override // android.view.SurfaceHolder.Callback
|
||||
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
|
||||
this.h = false;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.ICaptureView
|
||||
public void w() {
|
||||
this.d.a();
|
||||
}
|
||||
|
||||
private void a(Bitmap bitmap, Result result) {
|
||||
if (this.b == null) {
|
||||
this.c = result;
|
||||
return;
|
||||
}
|
||||
if (result != null) {
|
||||
this.c = result;
|
||||
}
|
||||
Result result2 = this.c;
|
||||
if (result2 != null) {
|
||||
this.b.sendMessage(Message.obtain(this.b, R$id.decode_succeeded, result2));
|
||||
}
|
||||
this.c = null;
|
||||
}
|
||||
|
||||
private void b(Result result, ResultHandler resultHandler, Bitmap bitmap) {
|
||||
a(resultHandler);
|
||||
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (resultHandler.d() != null && defaultSharedPreferences.getBoolean("preferences_auto_open_web", false)) {
|
||||
resultHandler.b(resultHandler.d().intValue());
|
||||
return;
|
||||
}
|
||||
this.e.setVisibility(8);
|
||||
this.d.setVisibility(8);
|
||||
this.f.setVisibility(0);
|
||||
ImageView imageView = (ImageView) findViewById(R$id.barcode_image_view);
|
||||
if (bitmap == null) {
|
||||
imageView.setImageBitmap(BitmapFactory.decodeResource(getResources(), R$drawable.launcher_icon));
|
||||
} else {
|
||||
imageView.setImageBitmap(bitmap);
|
||||
}
|
||||
((TextView) findViewById(R$id.format_text_view)).setText(result.a().toString());
|
||||
((TextView) findViewById(R$id.type_text_view)).setText(resultHandler.h().toString());
|
||||
((TextView) findViewById(R$id.time_text_view)).setText(DateFormat.getDateTimeInstance(3, 3).format(Long.valueOf(result.f())));
|
||||
TextView textView = (TextView) findViewById(R$id.meta_text_view);
|
||||
View findViewById = findViewById(R$id.meta_text_view_label);
|
||||
textView.setVisibility(8);
|
||||
findViewById.setVisibility(8);
|
||||
Map<ResultMetadataType, Object> c = result.c();
|
||||
if (c != null) {
|
||||
StringBuilder sb = new StringBuilder(20);
|
||||
for (Map.Entry<ResultMetadataType, Object> entry : c.entrySet()) {
|
||||
if (v.contains(entry.getKey())) {
|
||||
sb.append(entry.getValue());
|
||||
sb.append('\n');
|
||||
}
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
sb.setLength(sb.length() - 1);
|
||||
textView.setText(sb);
|
||||
textView.setVisibility(0);
|
||||
findViewById.setVisibility(0);
|
||||
}
|
||||
}
|
||||
CharSequence e = resultHandler.e();
|
||||
TextView textView2 = (TextView) findViewById(R$id.contents_text_view);
|
||||
textView2.setText(e);
|
||||
textView2.setTextSize(2, Math.max(22, 32 - (e.length() / 4)));
|
||||
TextView textView3 = (TextView) findViewById(R$id.contents_supplement_text_view);
|
||||
textView3.setText("");
|
||||
textView3.setOnClickListener(null);
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("preferences_supplemental", true)) {
|
||||
SupplementalInfoRetriever.a(textView3, resultHandler.g(), this.p, this);
|
||||
}
|
||||
int c2 = resultHandler.c();
|
||||
ViewGroup viewGroup = (ViewGroup) findViewById(R$id.result_button_view);
|
||||
viewGroup.requestFocus();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
TextView textView4 = (TextView) viewGroup.getChildAt(i);
|
||||
if (i < c2) {
|
||||
textView4.setVisibility(0);
|
||||
textView4.setText(resultHandler.a(i));
|
||||
textView4.setOnClickListener(new ResultButtonListener(resultHandler, i));
|
||||
} else {
|
||||
textView4.setVisibility(8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.ICaptureView
|
||||
public void a(Result result, Bitmap bitmap, float f) {
|
||||
this.q.a();
|
||||
this.g = result;
|
||||
ResultHandler a = ResultHandlerFactory.a(this, this, result);
|
||||
boolean z = bitmap != null;
|
||||
if (z) {
|
||||
this.p.a(result, a);
|
||||
this.r.a();
|
||||
a(bitmap, f, result);
|
||||
}
|
||||
int i = AnonymousClass1.a[this.j.ordinal()];
|
||||
if (i == 1 || i == 2) {
|
||||
a(result, a, bitmap);
|
||||
return;
|
||||
}
|
||||
if (i == 3) {
|
||||
ScanFromWebPageManager scanFromWebPageManager = this.l;
|
||||
if (scanFromWebPageManager != null && scanFromWebPageManager.a()) {
|
||||
a(result, a, bitmap);
|
||||
return;
|
||||
} else {
|
||||
b(result, a, bitmap);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (i != 4) {
|
||||
return;
|
||||
}
|
||||
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (z && defaultSharedPreferences.getBoolean("preferences_bulk_mode", false)) {
|
||||
Toast.makeText(getApplicationContext(), getResources().getString(R$string.msg_bulk_mode_scanned) + " (" + result.e() + ')', 0).show();
|
||||
a(a);
|
||||
a(1000L);
|
||||
return;
|
||||
}
|
||||
b(result, a, bitmap);
|
||||
}
|
||||
|
||||
private void a(Bitmap bitmap, float f, Result result) {
|
||||
ResultPoint[] d = result.d();
|
||||
if (d == null || d.length <= 0) {
|
||||
return;
|
||||
}
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
Paint paint = new Paint();
|
||||
paint.setColor(getResources().getColor(R$color.result_points));
|
||||
if (d.length == 2) {
|
||||
paint.setStrokeWidth(4.0f);
|
||||
a(canvas, paint, d[0], d[1], f);
|
||||
return;
|
||||
}
|
||||
if (d.length == 4 && (result.a() == BarcodeFormat.UPC_A || result.a() == BarcodeFormat.EAN_13)) {
|
||||
a(canvas, paint, d[0], d[1], f);
|
||||
a(canvas, paint, d[2], d[3], f);
|
||||
return;
|
||||
}
|
||||
paint.setStrokeWidth(10.0f);
|
||||
for (ResultPoint resultPoint : d) {
|
||||
if (resultPoint != null) {
|
||||
canvas.drawPoint(resultPoint.a() * f, resultPoint.b() * f, paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(Canvas canvas, Paint paint, ResultPoint resultPoint, ResultPoint resultPoint2, float f) {
|
||||
if (resultPoint == null || resultPoint2 == null) {
|
||||
return;
|
||||
}
|
||||
canvas.drawLine(f * resultPoint.a(), f * resultPoint.b(), f * resultPoint2.a(), f * resultPoint2.b(), paint);
|
||||
}
|
||||
|
||||
private void a(Result result, ResultHandler resultHandler, Bitmap bitmap) {
|
||||
ScanFromWebPageManager scanFromWebPageManager;
|
||||
if (bitmap != null) {
|
||||
this.d.a(bitmap);
|
||||
}
|
||||
long longExtra = getIntent() != null ? getIntent().getLongExtra("RESULT_DISPLAY_DURATION_MS", 1500L) : 1500L;
|
||||
int i = 0;
|
||||
if (longExtra > 0) {
|
||||
String valueOf = String.valueOf(result);
|
||||
if (valueOf.length() > 32) {
|
||||
valueOf = valueOf.substring(0, 32) + " ...";
|
||||
}
|
||||
this.e.setText(getString(resultHandler.f()) + " : " + valueOf);
|
||||
}
|
||||
a(resultHandler);
|
||||
int i2 = AnonymousClass1.a[this.j.ordinal()];
|
||||
if (i2 != 1) {
|
||||
if (i2 != 2) {
|
||||
if (i2 == 3 && (scanFromWebPageManager = this.l) != null && scanFromWebPageManager.a()) {
|
||||
Object a = this.l.a(result, resultHandler);
|
||||
this.l = null;
|
||||
a(R$id.launch_product_query, a, longExtra);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
a(R$id.launch_product_query, this.k.substring(0, this.k.lastIndexOf("/scan")) + "?q=" + ((Object) resultHandler.e()) + "&source=zxing", longExtra);
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(getIntent().getAction());
|
||||
intent.addFlags(524288);
|
||||
intent.putExtra("SCAN_RESULT", result.toString());
|
||||
intent.putExtra("SCAN_RESULT_FORMAT", result.a().toString());
|
||||
byte[] b = result.b();
|
||||
if (b != null && b.length > 0) {
|
||||
intent.putExtra("SCAN_RESULT_BYTES", b);
|
||||
}
|
||||
Map<ResultMetadataType, Object> c = result.c();
|
||||
if (c != null) {
|
||||
if (c.containsKey(ResultMetadataType.UPC_EAN_EXTENSION)) {
|
||||
intent.putExtra("SCAN_RESULT_UPC_EAN_EXTENSION", c.get(ResultMetadataType.UPC_EAN_EXTENSION).toString());
|
||||
}
|
||||
Number number = (Number) c.get(ResultMetadataType.ORIENTATION);
|
||||
if (number != null) {
|
||||
intent.putExtra("SCAN_RESULT_ORIENTATION", number.intValue());
|
||||
}
|
||||
String str = (String) c.get(ResultMetadataType.ERROR_CORRECTION_LEVEL);
|
||||
if (str != null) {
|
||||
intent.putExtra("SCAN_RESULT_ERROR_CORRECTION_LEVEL", str);
|
||||
}
|
||||
Iterable iterable = (Iterable) c.get(ResultMetadataType.BYTE_SEGMENTS);
|
||||
if (iterable != null) {
|
||||
Iterator it = iterable.iterator();
|
||||
while (it.hasNext()) {
|
||||
intent.putExtra("SCAN_RESULT_BYTE_SEGMENTS_" + i, (byte[]) it.next());
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
a(R$id.return_scan_result, intent, longExtra);
|
||||
}
|
||||
|
||||
private void a(ResultHandler resultHandler) {
|
||||
if (!this.i || resultHandler.a()) {
|
||||
return;
|
||||
}
|
||||
ClipboardInterface.a(resultHandler.e(), this);
|
||||
}
|
||||
|
||||
private void a(int i, Object obj, long j) {
|
||||
CaptureActivityHandler captureActivityHandler = this.b;
|
||||
if (captureActivityHandler != null) {
|
||||
Message obtain = Message.obtain(captureActivityHandler, i, obj);
|
||||
if (j > 0) {
|
||||
this.b.sendMessageDelayed(obtain, j);
|
||||
} else {
|
||||
this.b.sendMessage(obtain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void a(SurfaceHolder surfaceHolder) {
|
||||
if (surfaceHolder != null) {
|
||||
if (this.a.f()) {
|
||||
Log.w(t, "initCamera() while already open -- late SurfaceView callback?");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.a.a(surfaceHolder);
|
||||
if (this.b == null) {
|
||||
this.b = new CaptureActivityHandler(this, this, this.m, this.n, this.o, this.a);
|
||||
}
|
||||
a(null, null);
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
Log.w(t, e);
|
||||
a();
|
||||
return;
|
||||
} catch (RuntimeException e2) {
|
||||
Log.w(t, "Unexpected error initializing camera", e2);
|
||||
a();
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("No SurfaceHolder provided");
|
||||
}
|
||||
|
||||
private void a() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(getString(R$string.scan_name));
|
||||
builder.setMessage(getString(R$string.msg_camera_framework_bug));
|
||||
builder.setPositiveButton(R$string.button_ok, new FinishListener(this));
|
||||
builder.setOnCancelListener(new FinishListener(this));
|
||||
builder.show();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.ICaptureView
|
||||
public void a(long j) {
|
||||
CaptureActivityHandler captureActivityHandler = this.b;
|
||||
if (captureActivityHandler != null) {
|
||||
captureActivityHandler.sendEmptyMessageDelayed(R$id.restart_preview, j);
|
||||
}
|
||||
c();
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.client.android.camera.CameraManager;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class CaptureActivityHandler extends Handler {
|
||||
private static final String f = CaptureActivityHandler.class.getSimpleName();
|
||||
private final Activity a;
|
||||
private final ICaptureView b;
|
||||
private final DecodeThread c;
|
||||
private State d;
|
||||
private final CameraManager e;
|
||||
|
||||
private enum State {
|
||||
PREVIEW,
|
||||
SUCCESS,
|
||||
DONE
|
||||
}
|
||||
|
||||
public CaptureActivityHandler(Activity activity, ICaptureView iCaptureView, Collection<BarcodeFormat> collection, Map<DecodeHintType, ?> map, String str, CameraManager cameraManager) {
|
||||
this.a = activity;
|
||||
this.b = iCaptureView;
|
||||
this.c = new DecodeThread(activity, iCaptureView, collection, map, str, new ViewfinderResultPointCallback(iCaptureView.J()));
|
||||
this.c.start();
|
||||
this.d = State.SUCCESS;
|
||||
this.e = cameraManager;
|
||||
cameraManager.g();
|
||||
b();
|
||||
}
|
||||
|
||||
private void b() {
|
||||
if (this.d == State.SUCCESS) {
|
||||
this.d = State.PREVIEW;
|
||||
this.e.a(this.c.a(), R$id.decode);
|
||||
this.b.w();
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.d = State.DONE;
|
||||
this.e.h();
|
||||
Message.obtain(this.c.a(), R$id.quit).sendToTarget();
|
||||
try {
|
||||
this.c.join(500L);
|
||||
} catch (InterruptedException unused) {
|
||||
}
|
||||
removeMessages(R$id.decode_succeeded);
|
||||
removeMessages(R$id.decode_failed);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:44:0x00d5, code lost:
|
||||
|
||||
if (r4.equals("com.android.browser") != false) goto L40;
|
||||
*/
|
||||
@Override // android.os.Handler
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public void handleMessage(android.os.Message r8) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 249
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.client.android.CaptureActivityHandler.handleMessage(android.os.Message):void");
|
||||
}
|
||||
}
|
9
sources/com/google/zxing/client/android/Contents.java
Normal file
9
sources/com/google/zxing/client/android/Contents.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Contents {
|
||||
public static final String[] a = {"phone", "secondary_phone", "tertiary_phone"};
|
||||
public static final String[] b = {"phone_type", "secondary_phone_type", "tertiary_phone_type"};
|
||||
public static final String[] c = {"email", "secondary_email", "tertiary_email"};
|
||||
public static final String[] d = {"email_type", "secondary_email_type", "tertiary_email_type"};
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class DecodeFormatManager {
|
||||
private static final Map<String, Set<BarcodeFormat>> i;
|
||||
private static final Pattern a = Pattern.compile(",");
|
||||
static final Set<BarcodeFormat> e = EnumSet.of(BarcodeFormat.QR_CODE);
|
||||
static final Set<BarcodeFormat> f = EnumSet.of(BarcodeFormat.DATA_MATRIX);
|
||||
static final Set<BarcodeFormat> g = EnumSet.of(BarcodeFormat.AZTEC);
|
||||
static final Set<BarcodeFormat> h = EnumSet.of(BarcodeFormat.PDF_417);
|
||||
public static final Set<BarcodeFormat> b = EnumSet.of(BarcodeFormat.UPC_A, BarcodeFormat.UPC_E, BarcodeFormat.EAN_13, BarcodeFormat.EAN_8, BarcodeFormat.RSS_14, BarcodeFormat.RSS_EXPANDED);
|
||||
static final Set<BarcodeFormat> c = EnumSet.of(BarcodeFormat.CODE_39, BarcodeFormat.CODE_93, BarcodeFormat.CODE_128, BarcodeFormat.ITF, BarcodeFormat.CODABAR);
|
||||
private static final Set<BarcodeFormat> d = EnumSet.copyOf((Collection) b);
|
||||
|
||||
static {
|
||||
d.addAll(c);
|
||||
i = new HashMap();
|
||||
i.put("ONE_D_MODE", d);
|
||||
i.put("PRODUCT_MODE", b);
|
||||
i.put("QR_CODE_MODE", e);
|
||||
i.put("DATA_MATRIX_MODE", f);
|
||||
i.put("AZTEC_MODE", g);
|
||||
i.put("PDF417_MODE", h);
|
||||
}
|
||||
|
||||
static Set<BarcodeFormat> a(Intent intent) {
|
||||
String stringExtra = intent.getStringExtra("SCAN_FORMATS");
|
||||
return a(stringExtra != null ? Arrays.asList(a.split(stringExtra)) : null, intent.getStringExtra("SCAN_MODE"));
|
||||
}
|
||||
|
||||
static Set<BarcodeFormat> a(Uri uri) {
|
||||
List<String> queryParameters = uri.getQueryParameters("SCAN_FORMATS");
|
||||
if (queryParameters != null && queryParameters.size() == 1 && queryParameters.get(0) != null) {
|
||||
queryParameters = Arrays.asList(a.split(queryParameters.get(0)));
|
||||
}
|
||||
return a(queryParameters, uri.getQueryParameter("SCAN_MODE"));
|
||||
}
|
||||
|
||||
private static Set<BarcodeFormat> a(Iterable<String> iterable, String str) {
|
||||
if (iterable != null) {
|
||||
EnumSet noneOf = EnumSet.noneOf(BarcodeFormat.class);
|
||||
try {
|
||||
Iterator<String> it = iterable.iterator();
|
||||
while (it.hasNext()) {
|
||||
noneOf.add(BarcodeFormat.valueOf(it.next()));
|
||||
}
|
||||
return noneOf;
|
||||
} catch (IllegalArgumentException unused) {
|
||||
}
|
||||
}
|
||||
if (str != null) {
|
||||
return i.get(str);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
119
sources/com/google/zxing/client/android/DecodeHandler.java
Normal file
119
sources/com/google/zxing/client/android/DecodeHandler.java
Normal file
@@ -0,0 +1,119 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.MultiFormatReader;
|
||||
import com.google.zxing.PlanarYUVLuminanceSource;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DecodeHandler extends Handler {
|
||||
private static final String d = DecodeHandler.class.getSimpleName();
|
||||
private final ICaptureView a;
|
||||
private boolean c = true;
|
||||
private final MultiFormatReader b = new MultiFormatReader();
|
||||
|
||||
DecodeHandler(Activity activity, ICaptureView iCaptureView, Map<DecodeHintType, Object> map) {
|
||||
this.b.a((Map<DecodeHintType, ?>) map);
|
||||
this.a = iCaptureView;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:15:0x0072 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:9:0x003b */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private void a(byte[] r8, int r9, int r10) {
|
||||
/*
|
||||
r7 = this;
|
||||
long r0 = java.lang.System.currentTimeMillis()
|
||||
com.google.zxing.client.android.ICaptureView r2 = r7.a
|
||||
com.google.zxing.client.android.camera.CameraManager r2 = r2.b0()
|
||||
com.google.zxing.PlanarYUVLuminanceSource r8 = r2.a(r8, r9, r10)
|
||||
if (r8 == 0) goto L32
|
||||
com.google.zxing.BinaryBitmap r9 = new com.google.zxing.BinaryBitmap
|
||||
com.google.zxing.common.HybridBinarizer r10 = new com.google.zxing.common.HybridBinarizer
|
||||
r10.<init>(r8)
|
||||
r9.<init>(r10)
|
||||
com.google.zxing.MultiFormatReader r10 = r7.b // Catch: java.lang.Throwable -> L26 com.google.zxing.ReaderException -> L2d
|
||||
com.google.zxing.Result r9 = r10.a(r9) // Catch: java.lang.Throwable -> L26 com.google.zxing.ReaderException -> L2d
|
||||
com.google.zxing.MultiFormatReader r10 = r7.b
|
||||
r10.reset()
|
||||
goto L33
|
||||
L26:
|
||||
r8 = move-exception
|
||||
com.google.zxing.MultiFormatReader r9 = r7.b
|
||||
r9.reset()
|
||||
throw r8
|
||||
L2d:
|
||||
com.google.zxing.MultiFormatReader r9 = r7.b
|
||||
r9.reset()
|
||||
L32:
|
||||
r9 = 0
|
||||
L33:
|
||||
com.google.zxing.client.android.ICaptureView r10 = r7.a
|
||||
android.os.Handler r10 = r10.getHandler()
|
||||
if (r9 == 0) goto L72
|
||||
long r2 = java.lang.System.currentTimeMillis()
|
||||
java.lang.String r4 = com.google.zxing.client.android.DecodeHandler.d
|
||||
java.lang.StringBuilder r5 = new java.lang.StringBuilder
|
||||
r5.<init>()
|
||||
java.lang.String r6 = "Found barcode in "
|
||||
r5.append(r6)
|
||||
long r2 = r2 - r0
|
||||
r5.append(r2)
|
||||
java.lang.String r0 = " ms"
|
||||
r5.append(r0)
|
||||
java.lang.String r0 = r5.toString()
|
||||
android.util.Log.d(r4, r0)
|
||||
if (r10 == 0) goto L7d
|
||||
int r0 = com.google.zxing.client.android.R$id.decode_succeeded
|
||||
android.os.Message r9 = android.os.Message.obtain(r10, r0, r9)
|
||||
android.os.Bundle r10 = new android.os.Bundle
|
||||
r10.<init>()
|
||||
a(r8, r10)
|
||||
r9.setData(r10)
|
||||
r9.sendToTarget()
|
||||
goto L7d
|
||||
L72:
|
||||
if (r10 == 0) goto L7d
|
||||
int r8 = com.google.zxing.client.android.R$id.decode_failed
|
||||
android.os.Message r8 = android.os.Message.obtain(r10, r8)
|
||||
r8.sendToTarget()
|
||||
L7d:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.client.android.DecodeHandler.a(byte[], int, int):void");
|
||||
}
|
||||
|
||||
@Override // android.os.Handler
|
||||
public void handleMessage(Message message) {
|
||||
if (message == null || !this.c) {
|
||||
return;
|
||||
}
|
||||
int i = message.what;
|
||||
if (i == R$id.decode) {
|
||||
a((byte[]) message.obj, message.arg1, message.arg2);
|
||||
} else if (i == R$id.quit) {
|
||||
this.c = false;
|
||||
Looper.myLooper().quit();
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(PlanarYUVLuminanceSource planarYUVLuminanceSource, Bundle bundle) {
|
||||
int[] h = planarYUVLuminanceSource.h();
|
||||
int g = planarYUVLuminanceSource.g();
|
||||
Bitmap createBitmap = Bitmap.createBitmap(h, 0, g, g, planarYUVLuminanceSource.f(), Bitmap.Config.ARGB_8888);
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
createBitmap.compress(Bitmap.CompressFormat.JPEG, 50, byteArrayOutputStream);
|
||||
bundle.putByteArray("barcode_bitmap", byteArrayOutputStream.toByteArray());
|
||||
bundle.putFloat("barcode_scaled_factor", g / planarYUVLuminanceSource.c());
|
||||
}
|
||||
}
|
138
sources/com/google/zxing/client/android/DecodeHintManager.java
Normal file
138
sources/com/google/zxing/client/android/DecodeHintManager.java
Normal file
@@ -0,0 +1,138 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.tencent.bugly.Bugly;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DecodeHintManager {
|
||||
private static final String a = "DecodeHintManager";
|
||||
private static final Pattern b = Pattern.compile(",");
|
||||
|
||||
private static Map<String, String> a(String str) {
|
||||
String str2;
|
||||
HashMap hashMap = new HashMap();
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= str.length()) {
|
||||
break;
|
||||
}
|
||||
if (str.charAt(i) == '&') {
|
||||
i++;
|
||||
} else {
|
||||
int indexOf = str.indexOf(38, i);
|
||||
int indexOf2 = str.indexOf(61, i);
|
||||
String str3 = "";
|
||||
if (indexOf < 0) {
|
||||
if (indexOf2 < 0) {
|
||||
str2 = Uri.decode(str.substring(i).replace('+', ' '));
|
||||
} else {
|
||||
String decode = Uri.decode(str.substring(i, indexOf2).replace('+', ' '));
|
||||
str3 = Uri.decode(str.substring(indexOf2 + 1).replace('+', ' '));
|
||||
str2 = decode;
|
||||
}
|
||||
if (!hashMap.containsKey(str2)) {
|
||||
hashMap.put(str2, str3);
|
||||
}
|
||||
} else {
|
||||
if (indexOf2 < 0 || indexOf2 > indexOf) {
|
||||
String decode2 = Uri.decode(str.substring(i, indexOf).replace('+', ' '));
|
||||
if (!hashMap.containsKey(decode2)) {
|
||||
hashMap.put(decode2, "");
|
||||
}
|
||||
} else {
|
||||
String decode3 = Uri.decode(str.substring(i, indexOf2).replace('+', ' '));
|
||||
String decode4 = Uri.decode(str.substring(indexOf2 + 1, indexOf).replace('+', ' '));
|
||||
if (!hashMap.containsKey(decode3)) {
|
||||
hashMap.put(decode3, decode4);
|
||||
}
|
||||
}
|
||||
i = indexOf + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
static Map<DecodeHintType, ?> a(Uri uri) {
|
||||
String str;
|
||||
String encodedQuery = uri.getEncodedQuery();
|
||||
if (encodedQuery == null || encodedQuery.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Map<String, String> a2 = a(encodedQuery);
|
||||
EnumMap enumMap = new EnumMap(DecodeHintType.class);
|
||||
for (DecodeHintType decodeHintType : DecodeHintType.values()) {
|
||||
if (decodeHintType != DecodeHintType.CHARACTER_SET && decodeHintType != DecodeHintType.NEED_RESULT_POINT_CALLBACK && decodeHintType != DecodeHintType.POSSIBLE_FORMATS && (str = a2.get(decodeHintType.name())) != null) {
|
||||
if (decodeHintType.getValueType().equals(Object.class)) {
|
||||
enumMap.put((EnumMap) decodeHintType, (DecodeHintType) str);
|
||||
} else if (decodeHintType.getValueType().equals(Void.class)) {
|
||||
enumMap.put((EnumMap) decodeHintType, (DecodeHintType) Boolean.TRUE);
|
||||
} else if (decodeHintType.getValueType().equals(String.class)) {
|
||||
enumMap.put((EnumMap) decodeHintType, (DecodeHintType) str);
|
||||
} else if (decodeHintType.getValueType().equals(Boolean.class)) {
|
||||
if (str.isEmpty()) {
|
||||
enumMap.put((EnumMap) decodeHintType, (DecodeHintType) Boolean.TRUE);
|
||||
} else if (!"0".equals(str) && !Bugly.SDK_IS_DEV.equalsIgnoreCase(str) && !"no".equalsIgnoreCase(str)) {
|
||||
enumMap.put((EnumMap) decodeHintType, (DecodeHintType) Boolean.TRUE);
|
||||
} else {
|
||||
enumMap.put((EnumMap) decodeHintType, (DecodeHintType) Boolean.FALSE);
|
||||
}
|
||||
} else if (decodeHintType.getValueType().equals(int[].class)) {
|
||||
if (!str.isEmpty() && str.charAt(str.length() - 1) == ',') {
|
||||
str = str.substring(0, str.length() - 1);
|
||||
}
|
||||
String[] split = b.split(str);
|
||||
int[] iArr = new int[split.length];
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
try {
|
||||
iArr[i] = Integer.parseInt(split[i]);
|
||||
} catch (NumberFormatException unused) {
|
||||
Log.w(a, "Skipping array of integers hint " + decodeHintType + " due to invalid numeric value");
|
||||
iArr = null;
|
||||
}
|
||||
}
|
||||
if (iArr != null) {
|
||||
enumMap.put((EnumMap) decodeHintType, (DecodeHintType) iArr);
|
||||
}
|
||||
} else {
|
||||
Log.w(a, "Unsupported hint type '" + decodeHintType + "' of type " + decodeHintType.getValueType());
|
||||
}
|
||||
}
|
||||
}
|
||||
return enumMap;
|
||||
}
|
||||
|
||||
static Map<DecodeHintType, Object> a(Intent intent) {
|
||||
Bundle extras = intent.getExtras();
|
||||
if (extras == null || extras.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
EnumMap enumMap = new EnumMap(DecodeHintType.class);
|
||||
for (DecodeHintType decodeHintType : DecodeHintType.values()) {
|
||||
if (decodeHintType != DecodeHintType.CHARACTER_SET && decodeHintType != DecodeHintType.NEED_RESULT_POINT_CALLBACK && decodeHintType != DecodeHintType.POSSIBLE_FORMATS) {
|
||||
String name = decodeHintType.name();
|
||||
if (extras.containsKey(name)) {
|
||||
if (decodeHintType.getValueType().equals(Void.class)) {
|
||||
enumMap.put((EnumMap) decodeHintType, (DecodeHintType) Boolean.TRUE);
|
||||
} else {
|
||||
Object obj = extras.get(name);
|
||||
if (decodeHintType.getValueType().isInstance(obj)) {
|
||||
enumMap.put((EnumMap) decodeHintType, (DecodeHintType) obj);
|
||||
} else {
|
||||
Log.w(a, "Ignoring hint " + decodeHintType + " because it is not a " + decodeHintType.getValueType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return enumMap;
|
||||
}
|
||||
}
|
75
sources/com/google/zxing/client/android/DecodeThread.java
Normal file
75
sources/com/google/zxing/client/android/DecodeThread.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.preference.PreferenceManager;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.ResultPointCallback;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DecodeThread extends Thread {
|
||||
private final Activity a;
|
||||
private final ICaptureView b;
|
||||
private Handler d;
|
||||
private final CountDownLatch e = new CountDownLatch(1);
|
||||
private final Map<DecodeHintType, Object> c = new EnumMap(DecodeHintType.class);
|
||||
|
||||
DecodeThread(Activity activity, ICaptureView iCaptureView, Collection<BarcodeFormat> collection, Map<DecodeHintType, ?> map, String str, ResultPointCallback resultPointCallback) {
|
||||
this.a = activity;
|
||||
this.b = iCaptureView;
|
||||
if (map != null) {
|
||||
this.c.putAll(map);
|
||||
}
|
||||
if (collection == null || collection.isEmpty()) {
|
||||
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
collection = EnumSet.noneOf(BarcodeFormat.class);
|
||||
if (defaultSharedPreferences.getBoolean("preferences_decode_1D_product", true)) {
|
||||
collection.addAll(DecodeFormatManager.b);
|
||||
}
|
||||
if (defaultSharedPreferences.getBoolean("preferences_decode_1D_industrial", true)) {
|
||||
collection.addAll(DecodeFormatManager.c);
|
||||
}
|
||||
if (defaultSharedPreferences.getBoolean("preferences_decode_QR", true)) {
|
||||
collection.addAll(DecodeFormatManager.e);
|
||||
}
|
||||
if (defaultSharedPreferences.getBoolean("preferences_decode_Data_Matrix", true)) {
|
||||
collection.addAll(DecodeFormatManager.f);
|
||||
}
|
||||
if (defaultSharedPreferences.getBoolean("preferences_decode_Aztec", false)) {
|
||||
collection.addAll(DecodeFormatManager.g);
|
||||
}
|
||||
if (defaultSharedPreferences.getBoolean("preferences_decode_PDF417", false)) {
|
||||
collection.addAll(DecodeFormatManager.h);
|
||||
}
|
||||
}
|
||||
this.c.put(DecodeHintType.POSSIBLE_FORMATS, collection);
|
||||
if (str != null) {
|
||||
this.c.put(DecodeHintType.CHARACTER_SET, str);
|
||||
}
|
||||
this.c.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
|
||||
}
|
||||
|
||||
Handler a() {
|
||||
try {
|
||||
this.e.await();
|
||||
} catch (InterruptedException unused) {
|
||||
}
|
||||
return this.d;
|
||||
}
|
||||
|
||||
@Override // java.lang.Thread, java.lang.Runnable
|
||||
public void run() {
|
||||
Looper.prepare();
|
||||
this.d = new DecodeHandler(this.a, this.b, this.c);
|
||||
this.e.countDown();
|
||||
Looper.loop();
|
||||
}
|
||||
}
|
27
sources/com/google/zxing/client/android/FinishListener.java
Normal file
27
sources/com/google/zxing/client/android/FinishListener.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class FinishListener implements DialogInterface.OnClickListener, DialogInterface.OnCancelListener {
|
||||
private final Activity a;
|
||||
|
||||
public FinishListener(Activity activity) {
|
||||
this.a = activity;
|
||||
}
|
||||
|
||||
private void a() {
|
||||
this.a.finish();
|
||||
}
|
||||
|
||||
@Override // android.content.DialogInterface.OnCancelListener
|
||||
public void onCancel(DialogInterface dialogInterface) {
|
||||
a();
|
||||
}
|
||||
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
a();
|
||||
}
|
||||
}
|
39
sources/com/google/zxing/client/android/HelpActivity.java
Normal file
39
sources/com/google/zxing/client/android/HelpActivity.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.webkit.WebView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class HelpActivity extends Activity {
|
||||
private static final String b = "file:///android_asset/html-" + LocaleManager.c() + '/';
|
||||
private WebView a;
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R$layout.help);
|
||||
this.a = (WebView) findViewById(R$id.help_contents);
|
||||
if (bundle != null) {
|
||||
this.a.restoreState(bundle);
|
||||
return;
|
||||
}
|
||||
this.a.loadUrl(b + "index.html");
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
if (i != 4 || !this.a.canGoBack()) {
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
this.a.goBack();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onSaveInstanceState(Bundle bundle) {
|
||||
super.onSaveInstanceState(bundle);
|
||||
this.a.saveState(bundle);
|
||||
}
|
||||
}
|
180
sources/com/google/zxing/client/android/HttpHelper.java
Normal file
180
sources/com/google/zxing/client/android/HttpHelper.java
Normal file
@@ -0,0 +1,180 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import com.ubt.jimu.diy.model.DiyPreviewStep;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class HttpHelper {
|
||||
private static final Collection<String> a = new HashSet(Arrays.asList("amzn.to", "bit.ly", "bitly.com", "fb.me", "goo.gl", "is.gd", "j.mp", "lnkd.in", "ow.ly", "R.BEETAGG.COM", "r.beetagg.com", "SCN.BY", "su.pr", "t.co", "tinyurl.com", "tr.im"));
|
||||
|
||||
/* renamed from: com.google.zxing.client.android.HttpHelper$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] a = new int[ContentType.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[ContentType.HTML.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[ContentType.JSON.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
try {
|
||||
a[ContentType.XML.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ContentType {
|
||||
HTML,
|
||||
JSON,
|
||||
XML,
|
||||
TEXT
|
||||
}
|
||||
|
||||
public static CharSequence a(String str, ContentType contentType) throws IOException {
|
||||
return a(str, contentType, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public static CharSequence a(String str, ContentType contentType, int i) throws IOException {
|
||||
int i2 = AnonymousClass1.a[contentType.ordinal()];
|
||||
return a(str, i2 != 1 ? i2 != 2 ? i2 != 3 ? "text/*,*/*" : "application/xml,text/*,*/*" : "application/json,text/*,*/*" : "application/xhtml+xml,text/html,text/*,*/*", i);
|
||||
}
|
||||
|
||||
private static CharSequence a(String str, String str2, int i) throws IOException {
|
||||
int i2 = 0;
|
||||
while (i2 < 5) {
|
||||
HttpURLConnection a2 = a(new URL(str));
|
||||
a2.setInstanceFollowRedirects(true);
|
||||
a2.setRequestProperty("Accept", str2);
|
||||
a2.setRequestProperty("Accept-Charset", "utf-8,*");
|
||||
a2.setRequestProperty("User-Agent", "ZXing (Android)");
|
||||
try {
|
||||
int a3 = a(a2);
|
||||
if (a3 == 200) {
|
||||
return a(a2, i);
|
||||
}
|
||||
if (a3 == 302) {
|
||||
String headerField = a2.getHeaderField("Location");
|
||||
if (headerField != null) {
|
||||
i2++;
|
||||
a2.disconnect();
|
||||
str = headerField;
|
||||
} else {
|
||||
throw new IOException("No Location");
|
||||
}
|
||||
} else {
|
||||
throw new IOException("Bad HTTP response: " + a3);
|
||||
}
|
||||
} finally {
|
||||
a2.disconnect();
|
||||
}
|
||||
}
|
||||
throw new IOException("Too many redirects");
|
||||
}
|
||||
|
||||
private static String a(URLConnection uRLConnection) {
|
||||
int indexOf;
|
||||
String headerField = uRLConnection.getHeaderField("Content-Type");
|
||||
return (headerField == null || (indexOf = headerField.indexOf("charset=")) < 0) ? "UTF-8" : headerField.substring(indexOf + 8);
|
||||
}
|
||||
|
||||
private static CharSequence a(URLConnection uRLConnection, int i) throws IOException {
|
||||
int read;
|
||||
String a2 = a(uRLConnection);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(uRLConnection.getInputStream(), a2);
|
||||
try {
|
||||
char[] cArr = new char[DataDecryptTool.DECRYPT_SP_FILE];
|
||||
while (sb.length() < i && (read = inputStreamReader.read(cArr)) > 0) {
|
||||
sb.append(cArr, 0, read);
|
||||
}
|
||||
inputStreamReader.close();
|
||||
inputStreamReader.close();
|
||||
return sb;
|
||||
} catch (Throwable th) {
|
||||
try {
|
||||
throw th;
|
||||
} catch (Throwable th2) {
|
||||
try {
|
||||
inputStreamReader.close();
|
||||
} catch (Throwable th3) {
|
||||
th.addSuppressed(th3);
|
||||
}
|
||||
throw th2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static URI a(URI uri) throws IOException {
|
||||
if (!a.contains(uri.getHost())) {
|
||||
return uri;
|
||||
}
|
||||
HttpURLConnection a2 = a(uri.toURL());
|
||||
a2.setInstanceFollowRedirects(false);
|
||||
a2.setDoInput(false);
|
||||
a2.setRequestMethod("HEAD");
|
||||
a2.setRequestProperty("User-Agent", "ZXing (Android)");
|
||||
try {
|
||||
int a3 = a(a2);
|
||||
if (a3 != 307) {
|
||||
switch (a3) {
|
||||
case 300:
|
||||
case DiyPreviewStep.TYPE_PROGRAM /* 301 */:
|
||||
case 302:
|
||||
case 303:
|
||||
break;
|
||||
default:
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
String headerField = a2.getHeaderField("Location");
|
||||
if (headerField != null) {
|
||||
try {
|
||||
return new URI(headerField);
|
||||
} catch (URISyntaxException unused) {
|
||||
}
|
||||
}
|
||||
return uri;
|
||||
} finally {
|
||||
a2.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private static HttpURLConnection a(URL url) throws IOException {
|
||||
try {
|
||||
URLConnection openConnection = url.openConnection();
|
||||
if (openConnection instanceof HttpURLConnection) {
|
||||
return (HttpURLConnection) openConnection;
|
||||
}
|
||||
throw new IOException("Expected HttpURLConnection but got " + openConnection.getClass());
|
||||
} catch (NullPointerException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static int a(HttpURLConnection httpURLConnection) throws IOException {
|
||||
try {
|
||||
httpURLConnection.connect();
|
||||
try {
|
||||
return httpURLConnection.getResponseCode();
|
||||
} catch (IllegalArgumentException | NullPointerException | StringIndexOutOfBoundsException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
} catch (RuntimeException e2) {
|
||||
throw new IOException(e2);
|
||||
}
|
||||
}
|
||||
}
|
21
sources/com/google/zxing/client/android/ICaptureView.java
Normal file
21
sources/com/google/zxing/client/android/ICaptureView.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Handler;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.android.camera.CameraManager;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ICaptureView {
|
||||
ViewfinderView J();
|
||||
|
||||
void a(long j);
|
||||
|
||||
void a(Result result, Bitmap bitmap, float f);
|
||||
|
||||
CameraManager b0();
|
||||
|
||||
Handler getHandler();
|
||||
|
||||
void w();
|
||||
}
|
100
sources/com/google/zxing/client/android/InactivityTimer.java
Normal file
100
sources/com/google/zxing/client/android/InactivityTimer.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class InactivityTimer {
|
||||
private static final String e = "InactivityTimer";
|
||||
private final Activity a;
|
||||
private final BroadcastReceiver b = new PowerStatusReceiver();
|
||||
private boolean c = false;
|
||||
private AsyncTask<Object, Object, Object> d;
|
||||
|
||||
private final class InactivityAsyncTask extends AsyncTask<Object, Object, Object> {
|
||||
private InactivityAsyncTask() {
|
||||
}
|
||||
|
||||
@Override // android.os.AsyncTask
|
||||
protected Object doInBackground(Object... objArr) {
|
||||
try {
|
||||
Thread.sleep(300000L);
|
||||
Log.i(InactivityTimer.e, "Finishing activity due to inactivity");
|
||||
InactivityTimer.this.a.finish();
|
||||
return null;
|
||||
} catch (InterruptedException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class PowerStatusReceiver extends BroadcastReceiver {
|
||||
private PowerStatusReceiver() {
|
||||
}
|
||||
|
||||
@Override // android.content.BroadcastReceiver
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if ("android.intent.action.BATTERY_CHANGED".equals(intent.getAction())) {
|
||||
if (intent.getIntExtra("plugged", -1) <= 0) {
|
||||
InactivityTimer.this.a();
|
||||
} else {
|
||||
InactivityTimer.this.f();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public InactivityTimer(Activity activity) {
|
||||
this.a = activity;
|
||||
a();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public synchronized void f() {
|
||||
AsyncTask<Object, Object, Object> asyncTask = this.d;
|
||||
if (asyncTask != null) {
|
||||
asyncTask.cancel(true);
|
||||
this.d = null;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void c() {
|
||||
if (this.c) {
|
||||
Log.w(e, "PowerStatusReceiver was already registered?");
|
||||
} else {
|
||||
this.a.registerReceiver(this.b, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
|
||||
this.c = true;
|
||||
}
|
||||
a();
|
||||
}
|
||||
|
||||
public void d() {
|
||||
f();
|
||||
}
|
||||
|
||||
public synchronized void a() {
|
||||
f();
|
||||
this.d = new InactivityAsyncTask();
|
||||
try {
|
||||
this.d.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Object[0]);
|
||||
} catch (RejectedExecutionException unused) {
|
||||
Log.w(e, "Couldn't schedule inactivity task; ignoring");
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void b() {
|
||||
f();
|
||||
if (this.c) {
|
||||
this.a.unregisterReceiver(this.b);
|
||||
this.c = false;
|
||||
} else {
|
||||
Log.w(e, "PowerStatusReceiver was never registered?");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
enum IntentSource {
|
||||
NATIVE_APP_INTENT,
|
||||
PRODUCT_SEARCH_LINK,
|
||||
ZXING_LINK,
|
||||
NONE
|
||||
}
|
107
sources/com/google/zxing/client/android/LocaleManager.java
Normal file
107
sources/com/google/zxing/client/android/LocaleManager.java
Normal file
@@ -0,0 +1,107 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.content.Context;
|
||||
import android.preference.PreferenceManager;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class LocaleManager {
|
||||
private static final Map<String, String> a = new HashMap();
|
||||
private static final Map<String, String> b;
|
||||
private static final Map<String, String> c;
|
||||
private static final Collection<String> d;
|
||||
|
||||
static {
|
||||
a.put("AR", "com.ar");
|
||||
a.put("AU", "com.au");
|
||||
a.put("BR", "com.br");
|
||||
a.put("BG", "bg");
|
||||
a.put(Locale.CANADA.getCountry(), "ca");
|
||||
a.put(Locale.CHINA.getCountry(), "cn");
|
||||
a.put("CZ", "cz");
|
||||
a.put("DK", "dk");
|
||||
a.put("FI", "fi");
|
||||
a.put(Locale.FRANCE.getCountry(), "fr");
|
||||
a.put(Locale.GERMANY.getCountry(), "de");
|
||||
a.put("GR", "gr");
|
||||
a.put("HU", "hu");
|
||||
a.put("ID", "co.id");
|
||||
a.put("IL", "co.il");
|
||||
a.put(Locale.ITALY.getCountry(), "it");
|
||||
a.put(Locale.JAPAN.getCountry(), "co.jp");
|
||||
a.put(Locale.KOREA.getCountry(), "co.kr");
|
||||
a.put("NL", "nl");
|
||||
a.put("PL", "pl");
|
||||
a.put("PT", "pt");
|
||||
a.put("RO", "ro");
|
||||
a.put("RU", "ru");
|
||||
a.put("SK", "sk");
|
||||
a.put("SI", "si");
|
||||
a.put("ES", "es");
|
||||
a.put("SE", "se");
|
||||
a.put("CH", "ch");
|
||||
a.put(Locale.TAIWAN.getCountry(), "tw");
|
||||
a.put("TR", "com.tr");
|
||||
a.put("UA", "com.ua");
|
||||
a.put(Locale.UK.getCountry(), "co.uk");
|
||||
a.put(Locale.US.getCountry(), "com");
|
||||
b = new HashMap();
|
||||
b.put("AU", "com.au");
|
||||
b.put(Locale.FRANCE.getCountry(), "fr");
|
||||
b.put(Locale.GERMANY.getCountry(), "de");
|
||||
b.put(Locale.ITALY.getCountry(), "it");
|
||||
b.put(Locale.JAPAN.getCountry(), "co.jp");
|
||||
b.put("NL", "nl");
|
||||
b.put("ES", "es");
|
||||
b.put("CH", "ch");
|
||||
b.put(Locale.UK.getCountry(), "co.uk");
|
||||
b.put(Locale.US.getCountry(), "com");
|
||||
c = a;
|
||||
d = Arrays.asList("de", "en", "es", "fa", "fr", "it", "ja", "ko", "nl", "pt", "ru", "uk", "zh-rCN", "zh");
|
||||
}
|
||||
|
||||
public static String a(Context context) {
|
||||
return a(c, context);
|
||||
}
|
||||
|
||||
private static String b() {
|
||||
Locale locale = Locale.getDefault();
|
||||
return locale == null ? "en" : Locale.SIMPLIFIED_CHINESE.equals(locale) ? "zh-rCN" : locale.getLanguage();
|
||||
}
|
||||
|
||||
public static String c(Context context) {
|
||||
return a(a, context);
|
||||
}
|
||||
|
||||
public static String d(Context context) {
|
||||
return a(b, context);
|
||||
}
|
||||
|
||||
public static boolean a(String str) {
|
||||
return str.startsWith("http://google.com/books") || str.startsWith("http://books.google.");
|
||||
}
|
||||
|
||||
static String c() {
|
||||
String b2 = b();
|
||||
return d.contains(b2) ? b2 : "en";
|
||||
}
|
||||
|
||||
private static String a() {
|
||||
Locale locale = Locale.getDefault();
|
||||
return locale == null ? "US" : locale.getCountry();
|
||||
}
|
||||
|
||||
private static String b(Context context) {
|
||||
String string = PreferenceManager.getDefaultSharedPreferences(context).getString("preferences_search_country", "-");
|
||||
return (string == null || string.isEmpty() || "-".equals(string)) ? a() : string;
|
||||
}
|
||||
|
||||
private static String a(Map<String, String> map, Context context) {
|
||||
String str = map.get(b(context));
|
||||
return str == null ? "com" : str;
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.R;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class PreferencesActivity extends Activity {
|
||||
@Override // android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
getFragmentManager().beginTransaction().replace(R.id.content, new PreferencesFragment()).commit();
|
||||
}
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceScreen;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class PreferencesFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private CheckBoxPreference[] a;
|
||||
|
||||
private final class CustomSearchURLValidator implements Preference.OnPreferenceChangeListener {
|
||||
private CustomSearchURLValidator() {
|
||||
}
|
||||
|
||||
private boolean a(Object obj) {
|
||||
if (obj == null) {
|
||||
return true;
|
||||
}
|
||||
String obj2 = obj.toString();
|
||||
if (obj2.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
return new URI(obj2.replaceAll("%[st]", "").replaceAll("%f(?![0-9a-f])", "")).getScheme() != null;
|
||||
} catch (URISyntaxException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.preference.Preference.OnPreferenceChangeListener
|
||||
public boolean onPreferenceChange(Preference preference, Object obj) {
|
||||
if (a(obj)) {
|
||||
return true;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(PreferencesFragment.this.getActivity());
|
||||
builder.setTitle(R$string.msg_error);
|
||||
builder.setMessage(R$string.msg_invalid_value);
|
||||
builder.setCancelable(true);
|
||||
builder.show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static CheckBoxPreference[] a(PreferenceScreen preferenceScreen, String... strArr) {
|
||||
CheckBoxPreference[] checkBoxPreferenceArr = new CheckBoxPreference[strArr.length];
|
||||
for (int i = 0; i < strArr.length; i++) {
|
||||
checkBoxPreferenceArr[i] = (CheckBoxPreference) preferenceScreen.findPreference(strArr[i]);
|
||||
}
|
||||
return checkBoxPreferenceArr;
|
||||
}
|
||||
|
||||
@Override // android.preference.PreferenceFragment, android.app.Fragment
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(R$xml.preferences);
|
||||
PreferenceScreen preferenceScreen = getPreferenceScreen();
|
||||
preferenceScreen.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
|
||||
this.a = a(preferenceScreen, "preferences_decode_1D_product", "preferences_decode_1D_industrial", "preferences_decode_QR", "preferences_decode_Data_Matrix", "preferences_decode_Aztec", "preferences_decode_PDF417");
|
||||
a();
|
||||
((EditTextPreference) preferenceScreen.findPreference("preferences_custom_product_search")).setOnPreferenceChangeListener(new CustomSearchURLValidator());
|
||||
}
|
||||
|
||||
@Override // android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String str) {
|
||||
a();
|
||||
}
|
||||
|
||||
private void a() {
|
||||
ArrayList arrayList = new ArrayList(this.a.length);
|
||||
for (CheckBoxPreference checkBoxPreference : this.a) {
|
||||
if (checkBoxPreference.isChecked()) {
|
||||
arrayList.add(checkBoxPreference);
|
||||
}
|
||||
}
|
||||
boolean z = arrayList.size() <= 1;
|
||||
for (CheckBoxPreference checkBoxPreference2 : this.a) {
|
||||
checkBoxPreference2.setEnabled((z && arrayList.contains(checkBoxPreference2)) ? false : true);
|
||||
}
|
||||
}
|
||||
}
|
102
sources/com/google/zxing/client/android/R$color.java
Normal file
102
sources/com/google/zxing/client/android/R$color.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$color {
|
||||
public static final int abc_background_cache_hint_selector_material_dark = 2131099648;
|
||||
public static final int abc_background_cache_hint_selector_material_light = 2131099649;
|
||||
public static final int abc_btn_colored_borderless_text_material = 2131099650;
|
||||
public static final int abc_btn_colored_text_material = 2131099651;
|
||||
public static final int abc_color_highlight_material = 2131099652;
|
||||
public static final int abc_hint_foreground_material_dark = 2131099653;
|
||||
public static final int abc_hint_foreground_material_light = 2131099654;
|
||||
public static final int abc_input_method_navigation_guard = 2131099655;
|
||||
public static final int abc_primary_text_disable_only_material_dark = 2131099656;
|
||||
public static final int abc_primary_text_disable_only_material_light = 2131099657;
|
||||
public static final int abc_primary_text_material_dark = 2131099658;
|
||||
public static final int abc_primary_text_material_light = 2131099659;
|
||||
public static final int abc_search_url_text = 2131099660;
|
||||
public static final int abc_search_url_text_normal = 2131099661;
|
||||
public static final int abc_search_url_text_pressed = 2131099662;
|
||||
public static final int abc_search_url_text_selected = 2131099663;
|
||||
public static final int abc_secondary_text_material_dark = 2131099664;
|
||||
public static final int abc_secondary_text_material_light = 2131099665;
|
||||
public static final int abc_tint_btn_checkable = 2131099666;
|
||||
public static final int abc_tint_default = 2131099667;
|
||||
public static final int abc_tint_edittext = 2131099668;
|
||||
public static final int abc_tint_seek_thumb = 2131099669;
|
||||
public static final int abc_tint_spinner = 2131099670;
|
||||
public static final int abc_tint_switch_track = 2131099671;
|
||||
public static final int accent_material_dark = 2131099672;
|
||||
public static final int accent_material_light = 2131099673;
|
||||
public static final int background_floating_material_dark = 2131099675;
|
||||
public static final int background_floating_material_light = 2131099676;
|
||||
public static final int background_material_dark = 2131099677;
|
||||
public static final int background_material_light = 2131099678;
|
||||
public static final int bright_foreground_disabled_material_dark = 2131099745;
|
||||
public static final int bright_foreground_disabled_material_light = 2131099746;
|
||||
public static final int bright_foreground_inverse_material_dark = 2131099747;
|
||||
public static final int bright_foreground_inverse_material_light = 2131099748;
|
||||
public static final int bright_foreground_material_dark = 2131099749;
|
||||
public static final int bright_foreground_material_light = 2131099750;
|
||||
public static final int button_material_dark = 2131099755;
|
||||
public static final int button_material_light = 2131099756;
|
||||
public static final int contents_text = 2131099836;
|
||||
public static final int dim_foreground_disabled_material_dark = 2131099851;
|
||||
public static final int dim_foreground_disabled_material_light = 2131099852;
|
||||
public static final int dim_foreground_material_dark = 2131099853;
|
||||
public static final int dim_foreground_material_light = 2131099854;
|
||||
public static final int encode_view = 2131099856;
|
||||
public static final int error_color_material_dark = 2131099857;
|
||||
public static final int error_color_material_light = 2131099858;
|
||||
public static final int foreground_material_dark = 2131099859;
|
||||
public static final int foreground_material_light = 2131099860;
|
||||
public static final int highlighted_text_material_dark = 2131099863;
|
||||
public static final int highlighted_text_material_light = 2131099864;
|
||||
public static final int laser_end = 2131099874;
|
||||
public static final int laser_start = 2131099875;
|
||||
public static final int material_blue_grey_800 = 2131099887;
|
||||
public static final int material_blue_grey_900 = 2131099888;
|
||||
public static final int material_blue_grey_950 = 2131099889;
|
||||
public static final int material_deep_teal_200 = 2131099890;
|
||||
public static final int material_deep_teal_500 = 2131099891;
|
||||
public static final int material_grey_100 = 2131099892;
|
||||
public static final int material_grey_300 = 2131099893;
|
||||
public static final int material_grey_50 = 2131099894;
|
||||
public static final int material_grey_600 = 2131099895;
|
||||
public static final int material_grey_800 = 2131099896;
|
||||
public static final int material_grey_850 = 2131099897;
|
||||
public static final int material_grey_900 = 2131099898;
|
||||
public static final int notification_action_color_filter = 2131099926;
|
||||
public static final int notification_icon_bg_color = 2131099927;
|
||||
public static final int possible_result_points = 2131099929;
|
||||
public static final int primary_dark_material_dark = 2131099930;
|
||||
public static final int primary_dark_material_light = 2131099931;
|
||||
public static final int primary_material_dark = 2131099932;
|
||||
public static final int primary_material_light = 2131099933;
|
||||
public static final int primary_text_default_material_dark = 2131099934;
|
||||
public static final int primary_text_default_material_light = 2131099935;
|
||||
public static final int primary_text_disabled_material_dark = 2131099936;
|
||||
public static final int primary_text_disabled_material_light = 2131099937;
|
||||
public static final int result_minor_text = 2131099941;
|
||||
public static final int result_points = 2131099942;
|
||||
public static final int result_text = 2131099943;
|
||||
public static final int result_view = 2131099944;
|
||||
public static final int ripple_material_dark = 2131099945;
|
||||
public static final int ripple_material_light = 2131099946;
|
||||
public static final int secondary_text_default_material_dark = 2131099947;
|
||||
public static final int secondary_text_default_material_light = 2131099948;
|
||||
public static final int secondary_text_disabled_material_dark = 2131099949;
|
||||
public static final int secondary_text_disabled_material_light = 2131099950;
|
||||
public static final int status_text = 2131099957;
|
||||
public static final int switch_thumb_disabled_material_dark = 2131099958;
|
||||
public static final int switch_thumb_disabled_material_light = 2131099959;
|
||||
public static final int switch_thumb_material_dark = 2131099960;
|
||||
public static final int switch_thumb_material_light = 2131099961;
|
||||
public static final int switch_thumb_normal_material_dark = 2131099962;
|
||||
public static final int switch_thumb_normal_material_light = 2131099963;
|
||||
public static final int tooltip_background_dark = 2131099980;
|
||||
public static final int tooltip_background_light = 2131099981;
|
||||
public static final int transparent = 2131099985;
|
||||
public static final int viewfinder_laser = 2131100053;
|
||||
public static final int viewfinder_mask = 2131100054;
|
||||
}
|
123
sources/com/google/zxing/client/android/R$dimen.java
Normal file
123
sources/com/google/zxing/client/android/R$dimen.java
Normal file
@@ -0,0 +1,123 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$dimen {
|
||||
public static final int abc_action_bar_content_inset_material = 2131165184;
|
||||
public static final int abc_action_bar_content_inset_with_nav = 2131165185;
|
||||
public static final int abc_action_bar_default_height_material = 2131165186;
|
||||
public static final int abc_action_bar_default_padding_end_material = 2131165187;
|
||||
public static final int abc_action_bar_default_padding_start_material = 2131165188;
|
||||
public static final int abc_action_bar_elevation_material = 2131165189;
|
||||
public static final int abc_action_bar_icon_vertical_padding_material = 2131165190;
|
||||
public static final int abc_action_bar_overflow_padding_end_material = 2131165191;
|
||||
public static final int abc_action_bar_overflow_padding_start_material = 2131165192;
|
||||
public static final int abc_action_bar_stacked_max_height = 2131165193;
|
||||
public static final int abc_action_bar_stacked_tab_max_width = 2131165194;
|
||||
public static final int abc_action_bar_subtitle_bottom_margin_material = 2131165195;
|
||||
public static final int abc_action_bar_subtitle_top_margin_material = 2131165196;
|
||||
public static final int abc_action_button_min_height_material = 2131165197;
|
||||
public static final int abc_action_button_min_width_material = 2131165198;
|
||||
public static final int abc_action_button_min_width_overflow_material = 2131165199;
|
||||
public static final int abc_alert_dialog_button_bar_height = 2131165200;
|
||||
public static final int abc_alert_dialog_button_dimen = 2131165201;
|
||||
public static final int abc_button_inset_horizontal_material = 2131165202;
|
||||
public static final int abc_button_inset_vertical_material = 2131165203;
|
||||
public static final int abc_button_padding_horizontal_material = 2131165204;
|
||||
public static final int abc_button_padding_vertical_material = 2131165205;
|
||||
public static final int abc_cascading_menus_min_smallest_width = 2131165206;
|
||||
public static final int abc_config_prefDialogWidth = 2131165207;
|
||||
public static final int abc_control_corner_material = 2131165208;
|
||||
public static final int abc_control_inset_material = 2131165209;
|
||||
public static final int abc_control_padding_material = 2131165210;
|
||||
public static final int abc_dialog_corner_radius_material = 2131165211;
|
||||
public static final int abc_dialog_fixed_height_major = 2131165212;
|
||||
public static final int abc_dialog_fixed_height_minor = 2131165213;
|
||||
public static final int abc_dialog_fixed_width_major = 2131165214;
|
||||
public static final int abc_dialog_fixed_width_minor = 2131165215;
|
||||
public static final int abc_dialog_list_padding_bottom_no_buttons = 2131165216;
|
||||
public static final int abc_dialog_list_padding_top_no_title = 2131165217;
|
||||
public static final int abc_dialog_min_width_major = 2131165218;
|
||||
public static final int abc_dialog_min_width_minor = 2131165219;
|
||||
public static final int abc_dialog_padding_material = 2131165220;
|
||||
public static final int abc_dialog_padding_top_material = 2131165221;
|
||||
public static final int abc_dialog_title_divider_material = 2131165222;
|
||||
public static final int abc_disabled_alpha_material_dark = 2131165223;
|
||||
public static final int abc_disabled_alpha_material_light = 2131165224;
|
||||
public static final int abc_dropdownitem_icon_width = 2131165225;
|
||||
public static final int abc_dropdownitem_text_padding_left = 2131165226;
|
||||
public static final int abc_dropdownitem_text_padding_right = 2131165227;
|
||||
public static final int abc_edit_text_inset_bottom_material = 2131165228;
|
||||
public static final int abc_edit_text_inset_horizontal_material = 2131165229;
|
||||
public static final int abc_edit_text_inset_top_material = 2131165230;
|
||||
public static final int abc_floating_window_z = 2131165231;
|
||||
public static final int abc_list_item_padding_horizontal_material = 2131165232;
|
||||
public static final int abc_panel_menu_list_width = 2131165233;
|
||||
public static final int abc_progress_bar_height_material = 2131165234;
|
||||
public static final int abc_search_view_preferred_height = 2131165235;
|
||||
public static final int abc_search_view_preferred_width = 2131165236;
|
||||
public static final int abc_seekbar_track_background_height_material = 2131165237;
|
||||
public static final int abc_seekbar_track_progress_height_material = 2131165238;
|
||||
public static final int abc_select_dialog_padding_start_material = 2131165239;
|
||||
public static final int abc_switch_padding = 2131165240;
|
||||
public static final int abc_text_size_body_1_material = 2131165241;
|
||||
public static final int abc_text_size_body_2_material = 2131165242;
|
||||
public static final int abc_text_size_button_material = 2131165243;
|
||||
public static final int abc_text_size_caption_material = 2131165244;
|
||||
public static final int abc_text_size_display_1_material = 2131165245;
|
||||
public static final int abc_text_size_display_2_material = 2131165246;
|
||||
public static final int abc_text_size_display_3_material = 2131165247;
|
||||
public static final int abc_text_size_display_4_material = 2131165248;
|
||||
public static final int abc_text_size_headline_material = 2131165249;
|
||||
public static final int abc_text_size_large_material = 2131165250;
|
||||
public static final int abc_text_size_medium_material = 2131165251;
|
||||
public static final int abc_text_size_menu_header_material = 2131165252;
|
||||
public static final int abc_text_size_menu_material = 2131165253;
|
||||
public static final int abc_text_size_small_material = 2131165254;
|
||||
public static final int abc_text_size_subhead_material = 2131165255;
|
||||
public static final int abc_text_size_subtitle_material_toolbar = 2131165256;
|
||||
public static final int abc_text_size_title_material = 2131165257;
|
||||
public static final int abc_text_size_title_material_toolbar = 2131165258;
|
||||
public static final int compat_button_inset_horizontal_material = 2131165503;
|
||||
public static final int compat_button_inset_vertical_material = 2131165504;
|
||||
public static final int compat_button_padding_horizontal_material = 2131165505;
|
||||
public static final int compat_button_padding_vertical_material = 2131165506;
|
||||
public static final int compat_control_corner_material = 2131165507;
|
||||
public static final int compat_notification_large_icon_max_height = 2131165508;
|
||||
public static final int compat_notification_large_icon_max_width = 2131165509;
|
||||
public static final int corner_width = 2131165555;
|
||||
public static final int disabled_alpha_material_dark = 2131165654;
|
||||
public static final int disabled_alpha_material_light = 2131165655;
|
||||
public static final int half_padding = 2131169818;
|
||||
public static final int highlight_alpha_material_colored = 2131169820;
|
||||
public static final int highlight_alpha_material_dark = 2131169821;
|
||||
public static final int highlight_alpha_material_light = 2131169822;
|
||||
public static final int hint_alpha_material_dark = 2131169823;
|
||||
public static final int hint_alpha_material_light = 2131169824;
|
||||
public static final int hint_pressed_alpha_material_dark = 2131169825;
|
||||
public static final int hint_pressed_alpha_material_light = 2131169826;
|
||||
public static final int laser_height = 2131169908;
|
||||
public static final int notification_action_icon_size = 2131172010;
|
||||
public static final int notification_action_text_size = 2131172011;
|
||||
public static final int notification_big_circle_margin = 2131172012;
|
||||
public static final int notification_content_margin_start = 2131172013;
|
||||
public static final int notification_large_icon_height = 2131172014;
|
||||
public static final int notification_large_icon_width = 2131172015;
|
||||
public static final int notification_main_column_padding_top = 2131172016;
|
||||
public static final int notification_media_narrow_margin = 2131172017;
|
||||
public static final int notification_right_icon_size = 2131172018;
|
||||
public static final int notification_right_side_padding_top = 2131172019;
|
||||
public static final int notification_small_icon_background_padding = 2131172020;
|
||||
public static final int notification_small_icon_size_as_large = 2131172021;
|
||||
public static final int notification_subtext_size = 2131172022;
|
||||
public static final int notification_top_pad = 2131172023;
|
||||
public static final int notification_top_pad_large_text = 2131172024;
|
||||
public static final int standard_padding = 2131172184;
|
||||
public static final int tooltip_corner_radius = 2131172288;
|
||||
public static final int tooltip_horizontal_padding = 2131172289;
|
||||
public static final int tooltip_margin = 2131172290;
|
||||
public static final int tooltip_precise_anchor_extra_offset = 2131172291;
|
||||
public static final int tooltip_precise_anchor_threshold = 2131172292;
|
||||
public static final int tooltip_vertical_padding = 2131172293;
|
||||
public static final int tooltip_y_offset_non_touch = 2131172294;
|
||||
public static final int tooltip_y_offset_touch = 2131172295;
|
||||
}
|
106
sources/com/google/zxing/client/android/R$drawable.java
Normal file
106
sources/com/google/zxing/client/android/R$drawable.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$drawable {
|
||||
public static final int abc_ab_share_pack_mtrl_alpha = 2131230726;
|
||||
public static final int abc_action_bar_item_background_material = 2131230727;
|
||||
public static final int abc_btn_borderless_material = 2131230728;
|
||||
public static final int abc_btn_check_material = 2131230729;
|
||||
public static final int abc_btn_check_to_on_mtrl_000 = 2131230730;
|
||||
public static final int abc_btn_check_to_on_mtrl_015 = 2131230731;
|
||||
public static final int abc_btn_colored_material = 2131230732;
|
||||
public static final int abc_btn_default_mtrl_shape = 2131230733;
|
||||
public static final int abc_btn_radio_material = 2131230734;
|
||||
public static final int abc_btn_radio_to_on_mtrl_000 = 2131230735;
|
||||
public static final int abc_btn_radio_to_on_mtrl_015 = 2131230736;
|
||||
public static final int abc_btn_switch_to_on_mtrl_00001 = 2131230737;
|
||||
public static final int abc_btn_switch_to_on_mtrl_00012 = 2131230738;
|
||||
public static final int abc_cab_background_internal_bg = 2131230739;
|
||||
public static final int abc_cab_background_top_material = 2131230740;
|
||||
public static final int abc_cab_background_top_mtrl_alpha = 2131230741;
|
||||
public static final int abc_control_background_material = 2131230742;
|
||||
public static final int abc_dialog_material_background = 2131230743;
|
||||
public static final int abc_edit_text_material = 2131230744;
|
||||
public static final int abc_ic_ab_back_material = 2131230745;
|
||||
public static final int abc_ic_arrow_drop_right_black_24dp = 2131230746;
|
||||
public static final int abc_ic_clear_material = 2131230747;
|
||||
public static final int abc_ic_commit_search_api_mtrl_alpha = 2131230748;
|
||||
public static final int abc_ic_go_search_api_material = 2131230749;
|
||||
public static final int abc_ic_menu_copy_mtrl_am_alpha = 2131230750;
|
||||
public static final int abc_ic_menu_cut_mtrl_alpha = 2131230751;
|
||||
public static final int abc_ic_menu_overflow_material = 2131230752;
|
||||
public static final int abc_ic_menu_paste_mtrl_am_alpha = 2131230753;
|
||||
public static final int abc_ic_menu_selectall_mtrl_alpha = 2131230754;
|
||||
public static final int abc_ic_menu_share_mtrl_alpha = 2131230755;
|
||||
public static final int abc_ic_search_api_material = 2131230756;
|
||||
public static final int abc_ic_star_black_16dp = 2131230757;
|
||||
public static final int abc_ic_star_black_36dp = 2131230758;
|
||||
public static final int abc_ic_star_black_48dp = 2131230759;
|
||||
public static final int abc_ic_star_half_black_16dp = 2131230760;
|
||||
public static final int abc_ic_star_half_black_36dp = 2131230761;
|
||||
public static final int abc_ic_star_half_black_48dp = 2131230762;
|
||||
public static final int abc_ic_voice_search_api_material = 2131230763;
|
||||
public static final int abc_item_background_holo_dark = 2131230764;
|
||||
public static final int abc_item_background_holo_light = 2131230765;
|
||||
public static final int abc_list_divider_material = 2131230766;
|
||||
public static final int abc_list_divider_mtrl_alpha = 2131230767;
|
||||
public static final int abc_list_focused_holo = 2131230768;
|
||||
public static final int abc_list_longpressed_holo = 2131230769;
|
||||
public static final int abc_list_pressed_holo_dark = 2131230770;
|
||||
public static final int abc_list_pressed_holo_light = 2131230771;
|
||||
public static final int abc_list_selector_background_transition_holo_dark = 2131230772;
|
||||
public static final int abc_list_selector_background_transition_holo_light = 2131230773;
|
||||
public static final int abc_list_selector_disabled_holo_dark = 2131230774;
|
||||
public static final int abc_list_selector_disabled_holo_light = 2131230775;
|
||||
public static final int abc_list_selector_holo_dark = 2131230776;
|
||||
public static final int abc_list_selector_holo_light = 2131230777;
|
||||
public static final int abc_menu_hardkey_panel_mtrl_mult = 2131230778;
|
||||
public static final int abc_popup_background_mtrl_mult = 2131230779;
|
||||
public static final int abc_ratingbar_indicator_material = 2131230780;
|
||||
public static final int abc_ratingbar_material = 2131230781;
|
||||
public static final int abc_ratingbar_small_material = 2131230782;
|
||||
public static final int abc_scrubber_control_off_mtrl_alpha = 2131230783;
|
||||
public static final int abc_scrubber_control_to_pressed_mtrl_000 = 2131230784;
|
||||
public static final int abc_scrubber_control_to_pressed_mtrl_005 = 2131230785;
|
||||
public static final int abc_scrubber_primary_mtrl_alpha = 2131230786;
|
||||
public static final int abc_scrubber_track_mtrl_alpha = 2131230787;
|
||||
public static final int abc_seekbar_thumb_material = 2131230788;
|
||||
public static final int abc_seekbar_tick_mark_material = 2131230789;
|
||||
public static final int abc_seekbar_track_material = 2131230790;
|
||||
public static final int abc_spinner_mtrl_am_alpha = 2131230791;
|
||||
public static final int abc_spinner_textfield_background_material = 2131230792;
|
||||
public static final int abc_switch_thumb_material = 2131230793;
|
||||
public static final int abc_switch_track_mtrl_alpha = 2131230794;
|
||||
public static final int abc_tab_indicator_material = 2131230795;
|
||||
public static final int abc_tab_indicator_mtrl_alpha = 2131230796;
|
||||
public static final int abc_text_cursor_material = 2131230797;
|
||||
public static final int abc_text_select_handle_left_mtrl_dark = 2131230798;
|
||||
public static final int abc_text_select_handle_left_mtrl_light = 2131230799;
|
||||
public static final int abc_text_select_handle_middle_mtrl_dark = 2131230800;
|
||||
public static final int abc_text_select_handle_middle_mtrl_light = 2131230801;
|
||||
public static final int abc_text_select_handle_right_mtrl_dark = 2131230802;
|
||||
public static final int abc_text_select_handle_right_mtrl_light = 2131230803;
|
||||
public static final int abc_textfield_activated_mtrl_alpha = 2131230804;
|
||||
public static final int abc_textfield_default_mtrl_alpha = 2131230805;
|
||||
public static final int abc_textfield_search_activated_mtrl_alpha = 2131230806;
|
||||
public static final int abc_textfield_search_default_mtrl_alpha = 2131230807;
|
||||
public static final int abc_textfield_search_material = 2131230808;
|
||||
public static final int abc_vector_test = 2131230809;
|
||||
public static final int launcher_icon = 2131231482;
|
||||
public static final int notification_action_background = 2131231536;
|
||||
public static final int notification_bg = 2131231537;
|
||||
public static final int notification_bg_low = 2131231538;
|
||||
public static final int notification_bg_low_normal = 2131231539;
|
||||
public static final int notification_bg_low_pressed = 2131231540;
|
||||
public static final int notification_bg_normal = 2131231541;
|
||||
public static final int notification_bg_normal_pressed = 2131231542;
|
||||
public static final int notification_icon_background = 2131231543;
|
||||
public static final int notification_template_icon_bg = 2131231544;
|
||||
public static final int notification_template_icon_low_bg = 2131231545;
|
||||
public static final int notification_tile_bg = 2131231546;
|
||||
public static final int notify_panel_notification_icon_bg = 2131231547;
|
||||
public static final int scan_ic_top_left = 2131231661;
|
||||
public static final int share_via_barcode = 2131231763;
|
||||
public static final int tooltip_frame_dark = 2131231823;
|
||||
public static final int tooltip_frame_light = 2131231824;
|
||||
}
|
155
sources/com/google/zxing/client/android/R$id.java
Normal file
155
sources/com/google/zxing/client/android/R$id.java
Normal file
@@ -0,0 +1,155 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$id {
|
||||
public static final int action_bar = 2131296272;
|
||||
public static final int action_bar_activity_content = 2131296273;
|
||||
public static final int action_bar_container = 2131296274;
|
||||
public static final int action_bar_root = 2131296275;
|
||||
public static final int action_bar_spinner = 2131296276;
|
||||
public static final int action_bar_subtitle = 2131296277;
|
||||
public static final int action_bar_title = 2131296278;
|
||||
public static final int action_container = 2131296279;
|
||||
public static final int action_context_bar = 2131296280;
|
||||
public static final int action_divider = 2131296281;
|
||||
public static final int action_image = 2131296282;
|
||||
public static final int action_menu_divider = 2131296283;
|
||||
public static final int action_menu_presenter = 2131296284;
|
||||
public static final int action_mode_bar = 2131296285;
|
||||
public static final int action_mode_bar_stub = 2131296286;
|
||||
public static final int action_mode_close_button = 2131296287;
|
||||
public static final int action_text = 2131296288;
|
||||
public static final int actions = 2131296289;
|
||||
public static final int activity_chooser_view_content = 2131296290;
|
||||
public static final int add = 2131296309;
|
||||
public static final int alertTitle = 2131296315;
|
||||
public static final int app_picker_list_item_icon = 2131296323;
|
||||
public static final int app_picker_list_item_label = 2131296324;
|
||||
public static final int async = 2131296326;
|
||||
public static final int barcode_image_view = 2131296337;
|
||||
public static final int blocking = 2131296343;
|
||||
public static final int bookmark_title = 2131296346;
|
||||
public static final int bookmark_url = 2131296347;
|
||||
public static final int bottom = 2131296348;
|
||||
public static final int buttonPanel = 2131296399;
|
||||
public static final int checkbox = 2131296449;
|
||||
public static final int chronometer = 2131296452;
|
||||
public static final int content = 2131296481;
|
||||
public static final int contentPanel = 2131296485;
|
||||
public static final int contents_supplement_text_view = 2131296489;
|
||||
public static final int contents_text_view = 2131296490;
|
||||
public static final int custom = 2131296508;
|
||||
public static final int customPanel = 2131296509;
|
||||
public static final int decode = 2131296522;
|
||||
public static final int decode_failed = 2131296523;
|
||||
public static final int decode_succeeded = 2131296524;
|
||||
public static final int decor_content_parent = 2131296525;
|
||||
public static final int default_activity_button = 2131296526;
|
||||
public static final int edit_query = 2131296556;
|
||||
public static final int end = 2131296567;
|
||||
public static final int expand_activities_button = 2131296594;
|
||||
public static final int expanded_menu = 2131296595;
|
||||
public static final int forever = 2131296644;
|
||||
public static final int format_text_view = 2131296645;
|
||||
public static final int group_divider = 2131296671;
|
||||
public static final int help_contents = 2131296693;
|
||||
public static final int history_detail = 2131296694;
|
||||
public static final int history_title = 2131296695;
|
||||
public static final int home = 2131296696;
|
||||
public static final int icon = 2131296701;
|
||||
public static final int icon_group = 2131296702;
|
||||
public static final int image = 2131296817;
|
||||
public static final int image_view = 2131296820;
|
||||
public static final int info = 2131296971;
|
||||
public static final int italic = 2131296980;
|
||||
public static final int launch_product_query = 2131297048;
|
||||
public static final int left = 2131297071;
|
||||
public static final int line1 = 2131297087;
|
||||
public static final int line3 = 2131297088;
|
||||
public static final int listMode = 2131297089;
|
||||
public static final int list_item = 2131297090;
|
||||
public static final int menu_encode = 2131297156;
|
||||
public static final int menu_help = 2131297157;
|
||||
public static final int menu_history = 2131297158;
|
||||
public static final int menu_history_clear_text = 2131297159;
|
||||
public static final int menu_history_send = 2131297160;
|
||||
public static final int menu_settings = 2131297161;
|
||||
public static final int menu_share = 2131297162;
|
||||
public static final int message = 2131297163;
|
||||
public static final int meta_text_view = 2131297165;
|
||||
public static final int meta_text_view_label = 2131297166;
|
||||
public static final int multiply = 2131297181;
|
||||
public static final int none = 2131297193;
|
||||
public static final int normal = 2131297194;
|
||||
public static final int notification_background = 2131297195;
|
||||
public static final int notification_main_column = 2131297196;
|
||||
public static final int notification_main_column_container = 2131297197;
|
||||
public static final int page_number_view = 2131297211;
|
||||
public static final int parentPanel = 2131297216;
|
||||
public static final int preview_view = 2131297251;
|
||||
public static final int progress_circular = 2131297255;
|
||||
public static final int progress_horizontal = 2131297256;
|
||||
public static final int query_button = 2131297279;
|
||||
public static final int query_text_view = 2131297280;
|
||||
public static final int quit = 2131297282;
|
||||
public static final int radio = 2131297284;
|
||||
public static final int restart_preview = 2131297300;
|
||||
public static final int result_button_view = 2131297301;
|
||||
public static final int result_list_view = 2131297302;
|
||||
public static final int result_view = 2131297303;
|
||||
public static final int return_scan_result = 2131297304;
|
||||
public static final int right = 2131297305;
|
||||
public static final int right_icon = 2131297308;
|
||||
public static final int right_side = 2131297309;
|
||||
public static final int screen = 2131297445;
|
||||
public static final int scrollIndicatorDown = 2131297447;
|
||||
public static final int scrollIndicatorUp = 2131297448;
|
||||
public static final int scrollView = 2131297449;
|
||||
public static final int search_badge = 2131297451;
|
||||
public static final int search_bar = 2131297452;
|
||||
public static final int search_button = 2131297453;
|
||||
public static final int search_close_btn = 2131297454;
|
||||
public static final int search_edit_frame = 2131297455;
|
||||
public static final int search_go_btn = 2131297456;
|
||||
public static final int search_mag_icon = 2131297457;
|
||||
public static final int search_plate = 2131297458;
|
||||
public static final int search_src_text = 2131297459;
|
||||
public static final int search_voice_btn = 2131297460;
|
||||
public static final int select_dialog_listview = 2131297462;
|
||||
public static final int share_app_button = 2131297470;
|
||||
public static final int share_bookmark_button = 2131297471;
|
||||
public static final int share_clipboard_button = 2131297472;
|
||||
public static final int share_contact_button = 2131297473;
|
||||
public static final int share_text_view = 2131297474;
|
||||
public static final int shortcut = 2131297475;
|
||||
public static final int snippet_view = 2131297489;
|
||||
public static final int spacer = 2131297490;
|
||||
public static final int split_action_bar = 2131297493;
|
||||
public static final int src_atop = 2131297496;
|
||||
public static final int src_in = 2131297497;
|
||||
public static final int src_over = 2131297498;
|
||||
public static final int start = 2131297500;
|
||||
public static final int status_view = 2131297505;
|
||||
public static final int submenuarrow = 2131297512;
|
||||
public static final int submit_area = 2131297513;
|
||||
public static final int tabMode = 2131297522;
|
||||
public static final int tag_transition_group = 2131297528;
|
||||
public static final int tag_unhandled_key_event_manager = 2131297529;
|
||||
public static final int tag_unhandled_key_listeners = 2131297530;
|
||||
public static final int text = 2131297537;
|
||||
public static final int text2 = 2131297538;
|
||||
public static final int textSpacerNoButtons = 2131297539;
|
||||
public static final int textSpacerNoTitle = 2131297540;
|
||||
public static final int time = 2131297551;
|
||||
public static final int time_text_view = 2131297553;
|
||||
public static final int title = 2131297555;
|
||||
public static final int titleDividerNoCustom = 2131297556;
|
||||
public static final int title_template = 2131297565;
|
||||
public static final int top = 2131297568;
|
||||
public static final int topPanel = 2131297569;
|
||||
public static final int type_text_view = 2131297891;
|
||||
public static final int uniform = 2131297895;
|
||||
public static final int up = 2131297898;
|
||||
public static final int viewfinder_view = 2131297954;
|
||||
public static final int wrap_content = 2131297986;
|
||||
}
|
53
sources/com/google/zxing/client/android/R$layout.java
Normal file
53
sources/com/google/zxing/client/android/R$layout.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$layout {
|
||||
public static final int abc_action_bar_title_item = 2131492864;
|
||||
public static final int abc_action_bar_up_container = 2131492865;
|
||||
public static final int abc_action_menu_item_layout = 2131492866;
|
||||
public static final int abc_action_menu_layout = 2131492867;
|
||||
public static final int abc_action_mode_bar = 2131492868;
|
||||
public static final int abc_action_mode_close_item_material = 2131492869;
|
||||
public static final int abc_activity_chooser_view = 2131492870;
|
||||
public static final int abc_activity_chooser_view_list_item = 2131492871;
|
||||
public static final int abc_alert_dialog_button_bar_material = 2131492872;
|
||||
public static final int abc_alert_dialog_material = 2131492873;
|
||||
public static final int abc_alert_dialog_title_material = 2131492874;
|
||||
public static final int abc_cascading_menu_item_layout = 2131492875;
|
||||
public static final int abc_dialog_title_material = 2131492876;
|
||||
public static final int abc_expanded_menu_layout = 2131492877;
|
||||
public static final int abc_list_menu_item_checkbox = 2131492878;
|
||||
public static final int abc_list_menu_item_icon = 2131492879;
|
||||
public static final int abc_list_menu_item_layout = 2131492880;
|
||||
public static final int abc_list_menu_item_radio = 2131492881;
|
||||
public static final int abc_popup_menu_header_item_layout = 2131492882;
|
||||
public static final int abc_popup_menu_item_layout = 2131492883;
|
||||
public static final int abc_screen_content_include = 2131492884;
|
||||
public static final int abc_screen_simple = 2131492885;
|
||||
public static final int abc_screen_simple_overlay_action_mode = 2131492886;
|
||||
public static final int abc_screen_toolbar = 2131492887;
|
||||
public static final int abc_search_dropdown_item_icons_2line = 2131492888;
|
||||
public static final int abc_search_view = 2131492889;
|
||||
public static final int abc_select_dialog_material = 2131492890;
|
||||
public static final int abc_tooltip = 2131492891;
|
||||
public static final int app_picker_list_item = 2131493001;
|
||||
public static final int bookmark_picker_list_item = 2131493009;
|
||||
public static final int capture = 2131493014;
|
||||
public static final int encode = 2131493071;
|
||||
public static final int help = 2131493139;
|
||||
public static final int history_list_item = 2131493140;
|
||||
public static final int notification_action = 2131493288;
|
||||
public static final int notification_action_tombstone = 2131493289;
|
||||
public static final int notification_template_custom_big = 2131493296;
|
||||
public static final int notification_template_icon_group = 2131493297;
|
||||
public static final int notification_template_part_chronometer = 2131493301;
|
||||
public static final int notification_template_part_time = 2131493302;
|
||||
public static final int search_book_contents = 2131493345;
|
||||
public static final int search_book_contents_header = 2131493346;
|
||||
public static final int search_book_contents_list_item = 2131493347;
|
||||
public static final int select_dialog_item_material = 2131493348;
|
||||
public static final int select_dialog_multichoice_material = 2131493349;
|
||||
public static final int select_dialog_singlechoice_material = 2131493350;
|
||||
public static final int share = 2131493353;
|
||||
public static final int support_simple_spinner_dropdown_item = 2131493355;
|
||||
}
|
8
sources/com/google/zxing/client/android/R$menu.java
Normal file
8
sources/com/google/zxing/client/android/R$menu.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$menu {
|
||||
public static final int capture = 2131558400;
|
||||
public static final int encode = 2131558401;
|
||||
public static final int history = 2131558402;
|
||||
}
|
6
sources/com/google/zxing/client/android/R$raw.java
Normal file
6
sources/com/google/zxing/client/android/R$raw.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$raw {
|
||||
public static final int beep = 2131755008;
|
||||
}
|
171
sources/com/google/zxing/client/android/R$string.java
Normal file
171
sources/com/google/zxing/client/android/R$string.java
Normal file
@@ -0,0 +1,171 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$string {
|
||||
public static final int abc_action_bar_home_description = 2131820553;
|
||||
public static final int abc_action_bar_up_description = 2131820554;
|
||||
public static final int abc_action_menu_overflow_description = 2131820555;
|
||||
public static final int abc_action_mode_done = 2131820556;
|
||||
public static final int abc_activity_chooser_view_see_all = 2131820557;
|
||||
public static final int abc_activitychooserview_choose_application = 2131820558;
|
||||
public static final int abc_capital_off = 2131820559;
|
||||
public static final int abc_capital_on = 2131820560;
|
||||
public static final int abc_font_family_body_1_material = 2131820561;
|
||||
public static final int abc_font_family_body_2_material = 2131820562;
|
||||
public static final int abc_font_family_button_material = 2131820563;
|
||||
public static final int abc_font_family_caption_material = 2131820564;
|
||||
public static final int abc_font_family_display_1_material = 2131820565;
|
||||
public static final int abc_font_family_display_2_material = 2131820566;
|
||||
public static final int abc_font_family_display_3_material = 2131820567;
|
||||
public static final int abc_font_family_display_4_material = 2131820568;
|
||||
public static final int abc_font_family_headline_material = 2131820569;
|
||||
public static final int abc_font_family_menu_material = 2131820570;
|
||||
public static final int abc_font_family_subhead_material = 2131820571;
|
||||
public static final int abc_font_family_title_material = 2131820572;
|
||||
public static final int abc_menu_alt_shortcut_label = 2131820573;
|
||||
public static final int abc_menu_ctrl_shortcut_label = 2131820574;
|
||||
public static final int abc_menu_delete_shortcut_label = 2131820575;
|
||||
public static final int abc_menu_enter_shortcut_label = 2131820576;
|
||||
public static final int abc_menu_function_shortcut_label = 2131820577;
|
||||
public static final int abc_menu_meta_shortcut_label = 2131820578;
|
||||
public static final int abc_menu_shift_shortcut_label = 2131820579;
|
||||
public static final int abc_menu_space_shortcut_label = 2131820580;
|
||||
public static final int abc_menu_sym_shortcut_label = 2131820581;
|
||||
public static final int abc_prepend_shortcut_label = 2131820582;
|
||||
public static final int abc_search_hint = 2131820583;
|
||||
public static final int abc_searchview_description_clear = 2131820584;
|
||||
public static final int abc_searchview_description_query = 2131820585;
|
||||
public static final int abc_searchview_description_search = 2131820586;
|
||||
public static final int abc_searchview_description_submit = 2131820587;
|
||||
public static final int abc_searchview_description_voice = 2131820588;
|
||||
public static final int abc_shareactionprovider_share_with = 2131820589;
|
||||
public static final int abc_shareactionprovider_share_with_application = 2131820590;
|
||||
public static final int abc_toolbar_collapse_description = 2131820591;
|
||||
public static final int app_picker_name = 2131820657;
|
||||
public static final int bookmark_picker_name = 2131820681;
|
||||
public static final int button_add_calendar = 2131820697;
|
||||
public static final int button_add_contact = 2131820698;
|
||||
public static final int button_book_search = 2131820699;
|
||||
public static final int button_cancel = 2131820700;
|
||||
public static final int button_custom_product_search = 2131820701;
|
||||
public static final int button_dial = 2131820702;
|
||||
public static final int button_email = 2131820703;
|
||||
public static final int button_get_directions = 2131820704;
|
||||
public static final int button_mms = 2131820705;
|
||||
public static final int button_ok = 2131820706;
|
||||
public static final int button_open_browser = 2131820707;
|
||||
public static final int button_product_search = 2131820708;
|
||||
public static final int button_search_book_contents = 2131820709;
|
||||
public static final int button_share_app = 2131820710;
|
||||
public static final int button_share_bookmark = 2131820711;
|
||||
public static final int button_share_by_email = 2131820712;
|
||||
public static final int button_share_by_sms = 2131820713;
|
||||
public static final int button_share_clipboard = 2131820714;
|
||||
public static final int button_share_contact = 2131820715;
|
||||
public static final int button_show_map = 2131820716;
|
||||
public static final int button_sms = 2131820717;
|
||||
public static final int button_web_search = 2131820724;
|
||||
public static final int button_wifi = 2131820725;
|
||||
public static final int contents_contact = 2131820852;
|
||||
public static final int contents_email = 2131820853;
|
||||
public static final int contents_location = 2131820854;
|
||||
public static final int contents_phone = 2131820855;
|
||||
public static final int contents_sms = 2131820856;
|
||||
public static final int contents_text = 2131820857;
|
||||
public static final int history_clear_one_history_text = 2131821130;
|
||||
public static final int history_clear_text = 2131821131;
|
||||
public static final int history_email_title = 2131821132;
|
||||
public static final int history_empty = 2131821133;
|
||||
public static final int history_empty_detail = 2131821134;
|
||||
public static final int history_send = 2131821135;
|
||||
public static final int history_title = 2131821136;
|
||||
public static final int menu_encode_mecard = 2131821246;
|
||||
public static final int menu_encode_vcard = 2131821247;
|
||||
public static final int menu_help = 2131821248;
|
||||
public static final int menu_history = 2131821249;
|
||||
public static final int menu_settings = 2131821250;
|
||||
public static final int menu_share = 2131821251;
|
||||
public static final int msg_bulk_mode_scanned = 2131821263;
|
||||
public static final int msg_camera_framework_bug = 2131821264;
|
||||
public static final int msg_default_format = 2131821266;
|
||||
public static final int msg_default_meta = 2131821267;
|
||||
public static final int msg_default_mms_subject = 2131821268;
|
||||
public static final int msg_default_status = 2131821269;
|
||||
public static final int msg_default_time = 2131821270;
|
||||
public static final int msg_default_type = 2131821271;
|
||||
public static final int msg_encode_contents_failed = 2131821272;
|
||||
public static final int msg_error = 2131821273;
|
||||
public static final int msg_google_books = 2131821274;
|
||||
public static final int msg_google_product = 2131821275;
|
||||
public static final int msg_intent_failed = 2131821276;
|
||||
public static final int msg_invalid_value = 2131821277;
|
||||
public static final int msg_redirect = 2131821278;
|
||||
public static final int msg_sbc_book_not_searchable = 2131821279;
|
||||
public static final int msg_sbc_failed = 2131821280;
|
||||
public static final int msg_sbc_no_page_returned = 2131821281;
|
||||
public static final int msg_sbc_page = 2131821282;
|
||||
public static final int msg_sbc_results = 2131821283;
|
||||
public static final int msg_sbc_searching_book = 2131821284;
|
||||
public static final int msg_sbc_snippet_unavailable = 2131821285;
|
||||
public static final int msg_share_explanation = 2131821286;
|
||||
public static final int msg_share_text = 2131821287;
|
||||
public static final int msg_sure = 2131821288;
|
||||
public static final int msg_unmount_usb = 2131821289;
|
||||
public static final int preferences_actions_title = 2131821382;
|
||||
public static final int preferences_auto_focus_title = 2131821383;
|
||||
public static final int preferences_auto_open_web_title = 2131821384;
|
||||
public static final int preferences_bulk_mode_summary = 2131821385;
|
||||
public static final int preferences_bulk_mode_title = 2131821386;
|
||||
public static final int preferences_copy_to_clipboard_title = 2131821387;
|
||||
public static final int preferences_custom_product_search_summary = 2131821388;
|
||||
public static final int preferences_custom_product_search_title = 2131821389;
|
||||
public static final int preferences_decode_1D_industrial_title = 2131821390;
|
||||
public static final int preferences_decode_1D_product_title = 2131821391;
|
||||
public static final int preferences_decode_Aztec_title = 2131821392;
|
||||
public static final int preferences_decode_Data_Matrix_title = 2131821393;
|
||||
public static final int preferences_decode_PDF417_title = 2131821394;
|
||||
public static final int preferences_decode_QR_title = 2131821395;
|
||||
public static final int preferences_device_bug_workarounds_title = 2131821396;
|
||||
public static final int preferences_disable_barcode_scene_mode_title = 2131821397;
|
||||
public static final int preferences_disable_continuous_focus_summary = 2131821398;
|
||||
public static final int preferences_disable_continuous_focus_title = 2131821399;
|
||||
public static final int preferences_disable_exposure_title = 2131821400;
|
||||
public static final int preferences_disable_metering_title = 2131821401;
|
||||
public static final int preferences_front_light_auto = 2131821402;
|
||||
public static final int preferences_front_light_off = 2131821403;
|
||||
public static final int preferences_front_light_on = 2131821404;
|
||||
public static final int preferences_front_light_summary = 2131821405;
|
||||
public static final int preferences_front_light_title = 2131821406;
|
||||
public static final int preferences_general_title = 2131821407;
|
||||
public static final int preferences_history_summary = 2131821408;
|
||||
public static final int preferences_history_title = 2131821409;
|
||||
public static final int preferences_invert_scan_summary = 2131821410;
|
||||
public static final int preferences_invert_scan_title = 2131821411;
|
||||
public static final int preferences_name = 2131821412;
|
||||
public static final int preferences_orientation_title = 2131821413;
|
||||
public static final int preferences_play_beep_title = 2131821414;
|
||||
public static final int preferences_remember_duplicates_summary = 2131821415;
|
||||
public static final int preferences_remember_duplicates_title = 2131821416;
|
||||
public static final int preferences_result_title = 2131821417;
|
||||
public static final int preferences_scanning_title = 2131821418;
|
||||
public static final int preferences_search_country = 2131821419;
|
||||
public static final int preferences_supplemental_summary = 2131821420;
|
||||
public static final int preferences_supplemental_title = 2131821421;
|
||||
public static final int preferences_vibrate_title = 2131821422;
|
||||
public static final int result_address_book = 2131821471;
|
||||
public static final int result_calendar = 2131821472;
|
||||
public static final int result_email_address = 2131821473;
|
||||
public static final int result_geo = 2131821474;
|
||||
public static final int result_isbn = 2131821475;
|
||||
public static final int result_product = 2131821476;
|
||||
public static final int result_sms = 2131821477;
|
||||
public static final int result_tel = 2131821478;
|
||||
public static final int result_text = 2131821479;
|
||||
public static final int result_uri = 2131821480;
|
||||
public static final int result_wifi = 2131821481;
|
||||
public static final int sbc_name = 2131821488;
|
||||
public static final int scan_name = 2131821491;
|
||||
public static final int search_menu_title = 2131821508;
|
||||
public static final int status_bar_notification_info_overflow = 2131821607;
|
||||
public static final int wifi_changing_network = 2131821779;
|
||||
}
|
6
sources/com/google/zxing/client/android/R$xml.java
Normal file
6
sources/com/google/zxing/client/android/R$xml.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$xml {
|
||||
public static final int preferences = 2132082692;
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.net.Uri;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.android.result.ResultHandler;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class ScanFromWebPageManager {
|
||||
private static final CharSequence c = "{CODE}";
|
||||
private static final CharSequence d = "{RAWCODE}";
|
||||
private static final CharSequence e = "{META}";
|
||||
private static final CharSequence f = "{FORMAT}";
|
||||
private static final CharSequence g = "{TYPE}";
|
||||
private final String a;
|
||||
private final boolean b;
|
||||
|
||||
ScanFromWebPageManager(Uri uri) {
|
||||
this.a = uri.getQueryParameter("ret");
|
||||
this.b = uri.getQueryParameter("raw") != null;
|
||||
}
|
||||
|
||||
boolean a() {
|
||||
return this.a != null;
|
||||
}
|
||||
|
||||
String a(Result result, ResultHandler resultHandler) {
|
||||
return a(e, String.valueOf(result.c()), a(g, resultHandler.h().toString(), a(f, result.a().toString(), a(d, result.e(), a(c, this.b ? result.e() : resultHandler.e(), this.a)))));
|
||||
}
|
||||
|
||||
private static String a(CharSequence charSequence, CharSequence charSequence2, String str) {
|
||||
if (charSequence2 == null) {
|
||||
charSequence2 = "";
|
||||
}
|
||||
try {
|
||||
charSequence2 = URLEncoder.encode(charSequence2.toString(), "UTF-8");
|
||||
} catch (UnsupportedEncodingException unused) {
|
||||
}
|
||||
return str.replace(charSequence, charSequence2);
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.ResultPointCallback;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class ViewfinderResultPointCallback implements ResultPointCallback {
|
||||
private final ViewfinderView a;
|
||||
|
||||
ViewfinderResultPointCallback(ViewfinderView viewfinderView) {
|
||||
this.a = viewfinderView;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.ResultPointCallback
|
||||
public void a(ResultPoint resultPoint) {
|
||||
this.a.a(resultPoint);
|
||||
}
|
||||
}
|
142
sources/com/google/zxing/client/android/ViewfinderView.java
Normal file
142
sources/com/google/zxing/client/android/ViewfinderView.java
Normal file
@@ -0,0 +1,142 @@
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.client.android.camera.CameraManager;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ViewfinderView extends View {
|
||||
private static final int[] i = {0, 64, PeripheralType.SERVO, 192, 255, 192, PeripheralType.SERVO, 64};
|
||||
private CameraManager a;
|
||||
private final Paint b;
|
||||
private Bitmap c;
|
||||
private final int d;
|
||||
private final int e;
|
||||
private final int[] f;
|
||||
private int g;
|
||||
private List<ResultPoint> h;
|
||||
|
||||
public ViewfinderView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.b = new Paint(1);
|
||||
Resources resources = getResources();
|
||||
this.d = resources.getColor(R$color.viewfinder_mask);
|
||||
this.e = resources.getColor(R$color.result_view);
|
||||
resources.getColor(R$color.possible_result_points);
|
||||
this.f = new int[]{getResources().getColor(R$color.laser_start), getResources().getColor(R$color.laser_end), getResources().getColor(R$color.laser_start)};
|
||||
this.g = 0;
|
||||
this.h = new ArrayList(5);
|
||||
}
|
||||
|
||||
private void a(Canvas canvas, Rect rect) {
|
||||
int width = canvas.getWidth();
|
||||
int height = canvas.getHeight();
|
||||
int dimensionPixelSize = getResources().getDimensionPixelSize(R$dimen.corner_width);
|
||||
this.b.setColor(this.c != null ? this.e : this.d);
|
||||
float f = width;
|
||||
canvas.drawRect(0.0f, 0.0f, f, rect.top, this.b);
|
||||
canvas.drawRect(0.0f, rect.top, rect.left, rect.bottom + 1, this.b);
|
||||
canvas.drawRect(rect.right + 1, rect.top, f, rect.bottom + 1, this.b);
|
||||
canvas.drawRect(0.0f, rect.bottom + 1, f, height, this.b);
|
||||
this.b.setAlpha(255);
|
||||
Bitmap decodeResource = BitmapFactory.decodeResource(getResources(), R$drawable.scan_ic_top_left);
|
||||
Rect rect2 = new Rect(0, 0, decodeResource.getWidth(), decodeResource.getHeight());
|
||||
int i2 = rect.left;
|
||||
int i3 = rect.top;
|
||||
canvas.drawBitmap(decodeResource, (Rect) null, new Rect(i2, i3, i2 + dimensionPixelSize, i3 + dimensionPixelSize), this.b);
|
||||
canvas.save();
|
||||
int i4 = dimensionPixelSize / 2;
|
||||
canvas.rotate(90.0f, rect.right - i4, rect.top + i4);
|
||||
int i5 = rect.right;
|
||||
int i6 = rect.top;
|
||||
canvas.drawBitmap(decodeResource, rect2, new Rect(i5 - dimensionPixelSize, i6, i5, i6 + dimensionPixelSize), this.b);
|
||||
canvas.restore();
|
||||
canvas.save();
|
||||
canvas.rotate(180.0f, rect.right - i4, rect.bottom - i4);
|
||||
int i7 = rect.right;
|
||||
int i8 = rect.bottom;
|
||||
canvas.drawBitmap(decodeResource, rect2, new Rect(i7 - dimensionPixelSize, i8 - dimensionPixelSize, i7, i8), this.b);
|
||||
canvas.restore();
|
||||
canvas.save();
|
||||
canvas.rotate(270.0f, rect.left + i4, rect.bottom - i4);
|
||||
int i9 = rect.left;
|
||||
int i10 = rect.bottom;
|
||||
canvas.drawBitmap(decodeResource, rect2, new Rect(i9, i10 - dimensionPixelSize, dimensionPixelSize + i9, i10), this.b);
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
private void b(Canvas canvas, Rect rect) {
|
||||
this.b.setAlpha(i[this.g]);
|
||||
this.g = (this.g + 1) % i.length;
|
||||
int height = (rect.height() / 2) + rect.top;
|
||||
int dimensionPixelSize = getResources().getDimensionPixelSize(R$dimen.laser_height) / 2;
|
||||
this.b.setShader(new LinearGradient(rect.left + 2, height - 1, rect.right - 1, height + 2, this.f, (float[]) null, Shader.TileMode.REPEAT));
|
||||
canvas.drawRect(rect.left + 2, height - dimensionPixelSize, rect.right - 1, height + dimensionPixelSize, this.b);
|
||||
this.b.setShader(null);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
@SuppressLint({"DrawAllocation"})
|
||||
public void onDraw(Canvas canvas) {
|
||||
CameraManager cameraManager = this.a;
|
||||
if (cameraManager == null) {
|
||||
return;
|
||||
}
|
||||
Rect c = cameraManager.c();
|
||||
Rect d = this.a.d();
|
||||
if (c == null || d == null) {
|
||||
return;
|
||||
}
|
||||
a(canvas, c);
|
||||
if (this.c != null) {
|
||||
this.b.setAlpha(160);
|
||||
canvas.drawBitmap(this.c, (Rect) null, c, this.b);
|
||||
} else {
|
||||
b(canvas, c);
|
||||
postInvalidateDelayed(80L, c.left - 6, c.top - 6, c.right + 6, c.bottom + 6);
|
||||
}
|
||||
}
|
||||
|
||||
public void setCameraManager(CameraManager cameraManager) {
|
||||
this.a = cameraManager;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
Bitmap bitmap = this.c;
|
||||
this.c = null;
|
||||
if (bitmap != null) {
|
||||
bitmap.recycle();
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void a(Bitmap bitmap) {
|
||||
this.c = bitmap;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void a(ResultPoint resultPoint) {
|
||||
List<ResultPoint> list = this.h;
|
||||
synchronized (list) {
|
||||
list.add(resultPoint);
|
||||
int size = list.size();
|
||||
if (size > 20) {
|
||||
list.subList(0, size - 10).clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
package com.google.zxing.client.android.book;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import com.google.zxing.client.android.LocaleManager;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class BrowseBookListener implements AdapterView.OnItemClickListener {
|
||||
private final SearchBookContentsActivity a;
|
||||
private final List<SearchBookContentsResult> b;
|
||||
|
||||
BrowseBookListener(SearchBookContentsActivity searchBookContentsActivity, List<SearchBookContentsResult> list) {
|
||||
this.a = searchBookContentsActivity;
|
||||
this.b = list;
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemClickListener
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
|
||||
int i2;
|
||||
if (i >= 1 && (i2 = i - 1) < this.b.size()) {
|
||||
String a = this.b.get(i2).a();
|
||||
String e = SearchBookContentsResult.e();
|
||||
if (!LocaleManager.a(this.a.a()) || a.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String a2 = this.a.a();
|
||||
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("http://books.google." + LocaleManager.a(this.a) + "/books?id=" + a2.substring(a2.indexOf(61) + 1) + "&pg=" + a + "&vq=" + e));
|
||||
intent.addFlags(524288);
|
||||
this.a.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,218 @@
|
||||
package com.google.zxing.client.android.book;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.client.android.HttpHelper;
|
||||
import com.google.zxing.client.android.LocaleManager;
|
||||
import com.google.zxing.client.android.R$id;
|
||||
import com.google.zxing.client.android.R$layout;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.tencent.bugly.Bugly;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class SearchBookContentsActivity extends Activity {
|
||||
private static final String i = SearchBookContentsActivity.class.getSimpleName();
|
||||
private static final Pattern j = Pattern.compile("<.*?>");
|
||||
private static final Pattern k = Pattern.compile("<");
|
||||
private static final Pattern l = Pattern.compile(">");
|
||||
private static final Pattern m = Pattern.compile("'");
|
||||
private static final Pattern n = Pattern.compile(""");
|
||||
private String a;
|
||||
private EditText b;
|
||||
private View c;
|
||||
private ListView d;
|
||||
private TextView e;
|
||||
private AsyncTask<String, ?, ?> f;
|
||||
private final View.OnClickListener g = new View.OnClickListener() { // from class: com.google.zxing.client.android.book.SearchBookContentsActivity.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
SearchBookContentsActivity.this.h();
|
||||
}
|
||||
};
|
||||
private final View.OnKeyListener h = new View.OnKeyListener() { // from class: com.google.zxing.client.android.book.SearchBookContentsActivity.2
|
||||
@Override // android.view.View.OnKeyListener
|
||||
public boolean onKey(View view, int i2, KeyEvent keyEvent) {
|
||||
if (i2 != 66 || keyEvent.getAction() != 0) {
|
||||
return false;
|
||||
}
|
||||
SearchBookContentsActivity.this.h();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void h() {
|
||||
String obj = this.b.getText().toString();
|
||||
if (obj == null || obj.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
AsyncTask<String, ?, ?> asyncTask = this.f;
|
||||
if (asyncTask != null) {
|
||||
asyncTask.cancel(true);
|
||||
}
|
||||
this.f = new NetworkTask();
|
||||
this.f.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, obj, this.a);
|
||||
this.e.setText(R$string.msg_sbc_searching_book);
|
||||
this.d.setAdapter((ListAdapter) null);
|
||||
this.b.setEnabled(false);
|
||||
this.c.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
Intent intent = getIntent();
|
||||
if (intent == null || !"com.google.zxing.client.android.SEARCH_BOOK_CONTENTS".equals(intent.getAction())) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
this.a = intent.getStringExtra("ISBN");
|
||||
if (LocaleManager.a(this.a)) {
|
||||
setTitle(getString(R$string.sbc_name));
|
||||
} else {
|
||||
setTitle(getString(R$string.sbc_name) + ": ISBN " + this.a);
|
||||
}
|
||||
setContentView(R$layout.search_book_contents);
|
||||
this.b = (EditText) findViewById(R$id.query_text_view);
|
||||
String stringExtra = intent.getStringExtra("QUERY");
|
||||
if (stringExtra != null && !stringExtra.isEmpty()) {
|
||||
this.b.setText(stringExtra);
|
||||
}
|
||||
this.b.setOnKeyListener(this.h);
|
||||
this.c = findViewById(R$id.query_button);
|
||||
this.c.setOnClickListener(this.g);
|
||||
this.d = (ListView) findViewById(R$id.result_list_view);
|
||||
this.e = (TextView) LayoutInflater.from(this).inflate(R$layout.search_book_contents_header, (ViewGroup) this.d, false);
|
||||
this.d.addHeaderView(this.e);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onPause() {
|
||||
AsyncTask<String, ?, ?> asyncTask = this.f;
|
||||
if (asyncTask != null) {
|
||||
asyncTask.cancel(true);
|
||||
this.f = null;
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
this.b.selectAll();
|
||||
}
|
||||
|
||||
String a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
private final class NetworkTask extends AsyncTask<String, Object, JSONObject> {
|
||||
private NetworkTask() {
|
||||
}
|
||||
|
||||
private void b(JSONObject jSONObject) {
|
||||
try {
|
||||
int i = jSONObject.getInt("number_of_results");
|
||||
SearchBookContentsActivity.this.e.setText(SearchBookContentsActivity.this.getString(R$string.msg_sbc_results) + " : " + i);
|
||||
if (i <= 0) {
|
||||
if (Bugly.SDK_IS_DEV.equals(jSONObject.optString("searchable"))) {
|
||||
SearchBookContentsActivity.this.e.setText(R$string.msg_sbc_book_not_searchable);
|
||||
}
|
||||
SearchBookContentsActivity.this.d.setAdapter((ListAdapter) null);
|
||||
return;
|
||||
}
|
||||
JSONArray jSONArray = jSONObject.getJSONArray("search_results");
|
||||
SearchBookContentsResult.a(SearchBookContentsActivity.this.b.getText().toString());
|
||||
ArrayList arrayList = new ArrayList(i);
|
||||
for (int i2 = 0; i2 < i; i2++) {
|
||||
arrayList.add(c(jSONArray.getJSONObject(i2)));
|
||||
}
|
||||
SearchBookContentsActivity.this.d.setOnItemClickListener(new BrowseBookListener(SearchBookContentsActivity.this, arrayList));
|
||||
SearchBookContentsActivity.this.d.setAdapter((ListAdapter) new SearchBookContentsAdapter(SearchBookContentsActivity.this, arrayList));
|
||||
} catch (JSONException e) {
|
||||
Log.w(SearchBookContentsActivity.i, "Bad JSON from book search", e);
|
||||
SearchBookContentsActivity.this.d.setAdapter((ListAdapter) null);
|
||||
SearchBookContentsActivity.this.e.setText(R$string.msg_sbc_failed);
|
||||
}
|
||||
}
|
||||
|
||||
private SearchBookContentsResult c(JSONObject jSONObject) {
|
||||
String str;
|
||||
String str2;
|
||||
boolean z = false;
|
||||
try {
|
||||
String string = jSONObject.getString("page_id");
|
||||
String optString = jSONObject.optString("page_number");
|
||||
String optString2 = jSONObject.optString("snippet_text");
|
||||
if (optString == null || optString.isEmpty()) {
|
||||
str = "";
|
||||
} else {
|
||||
str = SearchBookContentsActivity.this.getString(R$string.msg_sbc_page) + ' ' + optString;
|
||||
}
|
||||
if (optString2 != null && !optString2.isEmpty()) {
|
||||
z = true;
|
||||
}
|
||||
if (z) {
|
||||
str2 = SearchBookContentsActivity.n.matcher(SearchBookContentsActivity.m.matcher(SearchBookContentsActivity.l.matcher(SearchBookContentsActivity.k.matcher(SearchBookContentsActivity.j.matcher(optString2).replaceAll("")).replaceAll("<")).replaceAll(">")).replaceAll("'")).replaceAll("\"");
|
||||
} else {
|
||||
str2 = '(' + SearchBookContentsActivity.this.getString(R$string.msg_sbc_snippet_unavailable) + ')';
|
||||
}
|
||||
return new SearchBookContentsResult(string, str, str2, z);
|
||||
} catch (JSONException e) {
|
||||
Log.w(SearchBookContentsActivity.i, e);
|
||||
return new SearchBookContentsResult(SearchBookContentsActivity.this.getString(R$string.msg_sbc_no_page_returned), "", "", false);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.os.AsyncTask
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public JSONObject doInBackground(String... strArr) {
|
||||
String str;
|
||||
try {
|
||||
String str2 = strArr[0];
|
||||
String str3 = strArr[1];
|
||||
if (LocaleManager.a(str3)) {
|
||||
str = "http://www.google.com/books?id=" + str3.substring(str3.indexOf(61) + 1) + "&jscmd=SearchWithinVolume2&q=" + str2;
|
||||
} else {
|
||||
str = "http://www.google.com/books?vid=isbn" + str3 + "&jscmd=SearchWithinVolume2&q=" + str2;
|
||||
}
|
||||
return new JSONObject(HttpHelper.a(str, HttpHelper.ContentType.JSON).toString());
|
||||
} catch (IOException | JSONException e) {
|
||||
Log.w(SearchBookContentsActivity.i, "Error accessing book search", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.os.AsyncTask
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onPostExecute(JSONObject jSONObject) {
|
||||
if (jSONObject == null) {
|
||||
SearchBookContentsActivity.this.e.setText(R$string.msg_sbc_failed);
|
||||
} else {
|
||||
b(jSONObject);
|
||||
}
|
||||
SearchBookContentsActivity.this.b.setEnabled(true);
|
||||
SearchBookContentsActivity.this.b.selectAll();
|
||||
SearchBookContentsActivity.this.c.setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package com.google.zxing.client.android.book;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import com.google.zxing.client.android.R$layout;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class SearchBookContentsAdapter extends ArrayAdapter<SearchBookContentsResult> {
|
||||
SearchBookContentsAdapter(Context context, List<SearchBookContentsResult> list) {
|
||||
super(context, R$layout.search_book_contents_list_item, 0, list);
|
||||
}
|
||||
|
||||
@Override // android.widget.ArrayAdapter, android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
View view2;
|
||||
SearchBookContentsListItem searchBookContentsListItem;
|
||||
if (view != null) {
|
||||
boolean z = view instanceof SearchBookContentsListItem;
|
||||
view2 = view;
|
||||
if (z) {
|
||||
searchBookContentsListItem = (SearchBookContentsListItem) view;
|
||||
}
|
||||
return view2;
|
||||
}
|
||||
searchBookContentsListItem = (SearchBookContentsListItem) LayoutInflater.from(getContext()).inflate(R$layout.search_book_contents_list_item, viewGroup, false);
|
||||
searchBookContentsListItem.set(getItem(i));
|
||||
view2 = searchBookContentsListItem;
|
||||
return view2;
|
||||
}
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
package com.google.zxing.client.android.book;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.client.android.R$id;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class SearchBookContentsListItem extends LinearLayout {
|
||||
private TextView a;
|
||||
private TextView b;
|
||||
|
||||
SearchBookContentsListItem(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
this.a = (TextView) findViewById(R$id.page_number_view);
|
||||
this.b = (TextView) findViewById(R$id.snippet_view);
|
||||
}
|
||||
|
||||
public void set(SearchBookContentsResult searchBookContentsResult) {
|
||||
this.a.setText(searchBookContentsResult.b());
|
||||
String c = searchBookContentsResult.c();
|
||||
if (c.isEmpty()) {
|
||||
this.b.setText("");
|
||||
return;
|
||||
}
|
||||
if (!searchBookContentsResult.d()) {
|
||||
this.b.setText(c);
|
||||
return;
|
||||
}
|
||||
String lowerCase = SearchBookContentsResult.e().toLowerCase(Locale.getDefault());
|
||||
String lowerCase2 = c.toLowerCase(Locale.getDefault());
|
||||
SpannableString spannableString = new SpannableString(c);
|
||||
StyleSpan styleSpan = new StyleSpan(1);
|
||||
int length = lowerCase.length();
|
||||
int i = 0;
|
||||
while (true) {
|
||||
int indexOf = lowerCase2.indexOf(lowerCase, i);
|
||||
if (indexOf < 0) {
|
||||
this.b.setText(spannableString);
|
||||
return;
|
||||
} else {
|
||||
int i2 = indexOf + length;
|
||||
spannableString.setSpan(styleSpan, indexOf, i2, 0);
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SearchBookContentsListItem(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package com.google.zxing.client.android.book;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class SearchBookContentsResult {
|
||||
private static String e;
|
||||
private final String a;
|
||||
private final String b;
|
||||
private final String c;
|
||||
private final boolean d;
|
||||
|
||||
SearchBookContentsResult(String str, String str2, String str3, boolean z) {
|
||||
this.a = str;
|
||||
this.b = str2;
|
||||
this.c = str3;
|
||||
this.d = z;
|
||||
}
|
||||
|
||||
public static void a(String str) {
|
||||
e = str;
|
||||
}
|
||||
|
||||
public static String e() {
|
||||
return e;
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public String c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public String a() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
@@ -0,0 +1,106 @@
|
||||
package com.google.zxing.client.android.camera;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.hardware.Camera;
|
||||
import android.os.AsyncTask;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AutoFocusManager implements Camera.AutoFocusCallback {
|
||||
private static final String f = AutoFocusManager.class.getSimpleName();
|
||||
private static final Collection<String> g = new ArrayList(2);
|
||||
private boolean a;
|
||||
private boolean b;
|
||||
private final boolean c;
|
||||
private final Camera d;
|
||||
private AsyncTask<?, ?, ?> e;
|
||||
|
||||
private final class AutoFocusTask extends AsyncTask<Object, Object, Object> {
|
||||
private AutoFocusTask() {
|
||||
}
|
||||
|
||||
@Override // android.os.AsyncTask
|
||||
protected Object doInBackground(Object... objArr) {
|
||||
try {
|
||||
Thread.sleep(2000L);
|
||||
} catch (InterruptedException unused) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
AutoFocusManager.this.a();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
g.add("auto");
|
||||
g.add("macro");
|
||||
}
|
||||
|
||||
AutoFocusManager(Context context, Camera camera) {
|
||||
this.d = camera;
|
||||
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
String focusMode = camera.getParameters().getFocusMode();
|
||||
this.c = defaultSharedPreferences.getBoolean("preferences_auto_focus", true) && g.contains(focusMode);
|
||||
Log.i(f, "Current focus mode '" + focusMode + "'; use auto focus? " + this.c);
|
||||
a();
|
||||
}
|
||||
|
||||
private synchronized void c() {
|
||||
if (!this.a && this.e == null) {
|
||||
AutoFocusTask autoFocusTask = new AutoFocusTask();
|
||||
try {
|
||||
autoFocusTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Object[0]);
|
||||
this.e = autoFocusTask;
|
||||
} catch (RejectedExecutionException e) {
|
||||
Log.w(f, "Could not request auto focus", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void d() {
|
||||
if (this.e != null) {
|
||||
if (this.e.getStatus() != AsyncTask.Status.FINISHED) {
|
||||
this.e.cancel(true);
|
||||
}
|
||||
this.e = null;
|
||||
}
|
||||
}
|
||||
|
||||
synchronized void a() {
|
||||
if (this.c) {
|
||||
this.e = null;
|
||||
if (!this.a && !this.b) {
|
||||
try {
|
||||
this.d.autoFocus(this);
|
||||
this.b = true;
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(f, "Unexpected exception while focusing", e);
|
||||
c();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
synchronized void b() {
|
||||
this.a = true;
|
||||
if (this.c) {
|
||||
d();
|
||||
try {
|
||||
this.d.cancelAutoFocus();
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(f, "Unexpected exception while cancelling focusing", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.hardware.Camera.AutoFocusCallback
|
||||
public synchronized void onAutoFocus(boolean z, Camera camera) {
|
||||
this.b = false;
|
||||
c();
|
||||
}
|
||||
}
|
@@ -0,0 +1,163 @@
|
||||
package com.google.zxing.client.android.camera;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Point;
|
||||
import android.hardware.Camera;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.WindowManager;
|
||||
import com.google.zxing.client.android.camera.open.CameraFacing;
|
||||
import com.google.zxing.client.android.camera.open.OpenCamera;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class CameraConfigurationManager {
|
||||
private final Context a;
|
||||
private int b;
|
||||
private int c;
|
||||
private Point d;
|
||||
private Point e;
|
||||
private Point f;
|
||||
private Point g;
|
||||
|
||||
CameraConfigurationManager(Context context) {
|
||||
this.a = context;
|
||||
}
|
||||
|
||||
void a(OpenCamera openCamera) {
|
||||
int i;
|
||||
Camera.Parameters parameters = openCamera.a().getParameters();
|
||||
Display defaultDisplay = ((WindowManager) this.a.getSystemService("window")).getDefaultDisplay();
|
||||
int rotation = defaultDisplay.getRotation();
|
||||
if (rotation == 0) {
|
||||
i = 0;
|
||||
} else if (rotation == 1) {
|
||||
i = 90;
|
||||
} else if (rotation == 2) {
|
||||
i = 180;
|
||||
} else if (rotation == 3) {
|
||||
i = 270;
|
||||
} else {
|
||||
if (rotation % 90 != 0) {
|
||||
throw new IllegalArgumentException("Bad rotation: " + rotation);
|
||||
}
|
||||
i = (rotation + 360) % 360;
|
||||
}
|
||||
Log.i("CameraConfiguration", "Display at: " + i);
|
||||
int c = openCamera.c();
|
||||
Log.i("CameraConfiguration", "Camera at: " + c);
|
||||
if (openCamera.b() == CameraFacing.FRONT) {
|
||||
c = (360 - c) % 360;
|
||||
Log.i("CameraConfiguration", "Front camera overriden to: " + c);
|
||||
}
|
||||
this.c = ((c + 360) - i) % 360;
|
||||
Log.i("CameraConfiguration", "Final display orientation: " + this.c);
|
||||
if (openCamera.b() == CameraFacing.FRONT) {
|
||||
Log.i("CameraConfiguration", "Compensating rotation for front camera");
|
||||
this.b = (360 - this.c) % 360;
|
||||
} else {
|
||||
this.b = this.c;
|
||||
}
|
||||
Log.i("CameraConfiguration", "Clockwise rotation from display to camera: " + this.b);
|
||||
Point point = new Point();
|
||||
defaultDisplay.getSize(point);
|
||||
this.d = point;
|
||||
Log.i("CameraConfiguration", "Screen resolution in current orientation: " + this.d);
|
||||
this.e = CameraConfigurationUtils.a(parameters, this.d);
|
||||
Log.i("CameraConfiguration", "Camera resolution: " + this.e);
|
||||
this.f = CameraConfigurationUtils.a(parameters, this.d);
|
||||
Log.i("CameraConfiguration", "Best available preview size: " + this.f);
|
||||
Point point2 = this.d;
|
||||
boolean z = point2.x < point2.y;
|
||||
Point point3 = this.f;
|
||||
if (z == (point3.x < point3.y)) {
|
||||
this.g = this.f;
|
||||
} else {
|
||||
Point point4 = this.f;
|
||||
this.g = new Point(point4.y, point4.x);
|
||||
}
|
||||
Log.i("CameraConfiguration", "Preview size on screen: " + this.g);
|
||||
}
|
||||
|
||||
Point b() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
void a(OpenCamera openCamera, boolean z) {
|
||||
Camera a = openCamera.a();
|
||||
Camera.Parameters parameters = a.getParameters();
|
||||
if (parameters == null) {
|
||||
Log.w("CameraConfiguration", "Device error: no camera parameters are available. Proceeding without configuration.");
|
||||
return;
|
||||
}
|
||||
Log.i("CameraConfiguration", "Initial camera parameters: " + parameters.flatten());
|
||||
if (z) {
|
||||
Log.w("CameraConfiguration", "In camera config safe mode -- most settings will not be honored");
|
||||
}
|
||||
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this.a);
|
||||
a(parameters, defaultSharedPreferences, z);
|
||||
CameraConfigurationUtils.a(parameters, defaultSharedPreferences.getBoolean("preferences_auto_focus", true), defaultSharedPreferences.getBoolean("preferences_disable_continuous_focus", true), z);
|
||||
if (!z) {
|
||||
if (defaultSharedPreferences.getBoolean("preferences_invert_scan", false)) {
|
||||
CameraConfigurationUtils.c(parameters);
|
||||
}
|
||||
if (!defaultSharedPreferences.getBoolean("preferences_disable_barcode_scene_mode", true)) {
|
||||
CameraConfigurationUtils.a(parameters);
|
||||
}
|
||||
if (!defaultSharedPreferences.getBoolean("preferences_disable_metering", true)) {
|
||||
CameraConfigurationUtils.e(parameters);
|
||||
CameraConfigurationUtils.b(parameters);
|
||||
CameraConfigurationUtils.d(parameters);
|
||||
}
|
||||
parameters.setRecordingHint(true);
|
||||
}
|
||||
Point point = this.f;
|
||||
parameters.setPreviewSize(point.x, point.y);
|
||||
a.setParameters(parameters);
|
||||
a.setDisplayOrientation(this.c);
|
||||
Camera.Size previewSize = a.getParameters().getPreviewSize();
|
||||
if (previewSize != null) {
|
||||
Point point2 = this.f;
|
||||
if (point2.x == previewSize.width && point2.y == previewSize.height) {
|
||||
return;
|
||||
}
|
||||
Log.w("CameraConfiguration", "Camera said it supported preview size " + this.f.x + 'x' + this.f.y + ", but after setting it, preview size is " + previewSize.width + 'x' + previewSize.height);
|
||||
Point point3 = this.f;
|
||||
point3.x = previewSize.width;
|
||||
point3.y = previewSize.height;
|
||||
}
|
||||
}
|
||||
|
||||
Point a() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
boolean a(Camera camera) {
|
||||
Camera.Parameters parameters;
|
||||
if (camera == null || (parameters = camera.getParameters()) == null) {
|
||||
return false;
|
||||
}
|
||||
String flashMode = parameters.getFlashMode();
|
||||
return "on".equals(flashMode) || "torch".equals(flashMode);
|
||||
}
|
||||
|
||||
void a(Camera camera, boolean z) {
|
||||
Camera.Parameters parameters = camera.getParameters();
|
||||
a(parameters, z, false);
|
||||
camera.setParameters(parameters);
|
||||
}
|
||||
|
||||
private void a(Camera.Parameters parameters, SharedPreferences sharedPreferences, boolean z) {
|
||||
a(parameters, FrontLightMode.readPref(sharedPreferences) == FrontLightMode.ON, z);
|
||||
}
|
||||
|
||||
private void a(Camera.Parameters parameters, boolean z, boolean z2) {
|
||||
CameraConfigurationUtils.b(parameters, z);
|
||||
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this.a);
|
||||
if (z2 || defaultSharedPreferences.getBoolean("preferences_disable_exposure", true)) {
|
||||
return;
|
||||
}
|
||||
CameraConfigurationUtils.a(parameters, z);
|
||||
}
|
||||
}
|
@@ -0,0 +1,233 @@
|
||||
package com.google.zxing.client.android.camera;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.hardware.Camera;
|
||||
import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@TargetApi(15)
|
||||
/* loaded from: classes.dex */
|
||||
public final class CameraConfigurationUtils {
|
||||
static {
|
||||
Pattern.compile(";");
|
||||
}
|
||||
|
||||
public static void a(Camera.Parameters parameters, boolean z, boolean z2, boolean z3) {
|
||||
List<String> supportedFocusModes = parameters.getSupportedFocusModes();
|
||||
String a = z ? (z3 || z2) ? a("focus mode", supportedFocusModes, "auto") : a("focus mode", supportedFocusModes, "continuous-picture", "continuous-video", "auto") : null;
|
||||
if (!z3 && a == null) {
|
||||
a = a("focus mode", supportedFocusModes, "macro", "edof");
|
||||
}
|
||||
if (a != null) {
|
||||
if (!a.equals(parameters.getFocusMode())) {
|
||||
parameters.setFocusMode(a);
|
||||
return;
|
||||
}
|
||||
Log.i("CameraConfiguration", "Focus mode already set to " + a);
|
||||
}
|
||||
}
|
||||
|
||||
public static void b(Camera.Parameters parameters, boolean z) {
|
||||
List<String> supportedFlashModes = parameters.getSupportedFlashModes();
|
||||
String a = z ? a("flash mode", supportedFlashModes, "torch", "on") : a("flash mode", supportedFlashModes, "off");
|
||||
if (a != null) {
|
||||
if (a.equals(parameters.getFlashMode())) {
|
||||
Log.i("CameraConfiguration", "Flash mode already set to " + a);
|
||||
return;
|
||||
}
|
||||
Log.i("CameraConfiguration", "Setting flash mode to " + a);
|
||||
parameters.setFlashMode(a);
|
||||
}
|
||||
}
|
||||
|
||||
public static void c(Camera.Parameters parameters) {
|
||||
if ("negative".equals(parameters.getColorEffect())) {
|
||||
Log.i("CameraConfiguration", "Negative effect already set");
|
||||
return;
|
||||
}
|
||||
String a = a("color effect", parameters.getSupportedColorEffects(), "negative");
|
||||
if (a != null) {
|
||||
parameters.setColorEffect(a);
|
||||
}
|
||||
}
|
||||
|
||||
public static void d(Camera.Parameters parameters) {
|
||||
if (parameters.getMaxNumMeteringAreas() <= 0) {
|
||||
Log.i("CameraConfiguration", "Device does not support metering areas");
|
||||
return;
|
||||
}
|
||||
Log.i("CameraConfiguration", "Old metering areas: " + parameters.getMeteringAreas());
|
||||
List<Camera.Area> a = a(400);
|
||||
Log.i("CameraConfiguration", "Setting metering area to : " + a(a));
|
||||
parameters.setMeteringAreas(a);
|
||||
}
|
||||
|
||||
public static void e(Camera.Parameters parameters) {
|
||||
if (!parameters.isVideoStabilizationSupported()) {
|
||||
Log.i("CameraConfiguration", "This device does not support video stabilization");
|
||||
} else if (parameters.getVideoStabilization()) {
|
||||
Log.i("CameraConfiguration", "Video stabilization already enabled");
|
||||
} else {
|
||||
Log.i("CameraConfiguration", "Enabling video stabilization...");
|
||||
parameters.setVideoStabilization(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(Camera.Parameters parameters, boolean z) {
|
||||
int minExposureCompensation = parameters.getMinExposureCompensation();
|
||||
int maxExposureCompensation = parameters.getMaxExposureCompensation();
|
||||
float exposureCompensationStep = parameters.getExposureCompensationStep();
|
||||
if (minExposureCompensation != 0 || maxExposureCompensation != 0) {
|
||||
if (exposureCompensationStep > 0.0f) {
|
||||
int round = Math.round((z ? 0.0f : 1.5f) / exposureCompensationStep);
|
||||
float f = exposureCompensationStep * round;
|
||||
int max = Math.max(Math.min(round, maxExposureCompensation), minExposureCompensation);
|
||||
if (parameters.getExposureCompensation() == max) {
|
||||
Log.i("CameraConfiguration", "Exposure compensation already set to " + max + " / " + f);
|
||||
return;
|
||||
}
|
||||
Log.i("CameraConfiguration", "Setting exposure compensation to " + max + " / " + f);
|
||||
parameters.setExposureCompensation(max);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Log.i("CameraConfiguration", "Camera does not support exposure compensation");
|
||||
}
|
||||
|
||||
public static void b(Camera.Parameters parameters) {
|
||||
if (parameters.getMaxNumFocusAreas() > 0) {
|
||||
Log.i("CameraConfiguration", "Old focus areas: " + a(parameters.getFocusAreas()));
|
||||
List<Camera.Area> a = a(400);
|
||||
Log.i("CameraConfiguration", "Setting focus area to : " + a(a));
|
||||
parameters.setFocusAreas(a);
|
||||
return;
|
||||
}
|
||||
Log.i("CameraConfiguration", "Device does not support focus areas");
|
||||
}
|
||||
|
||||
private static List<Camera.Area> a(int i) {
|
||||
int i2 = -i;
|
||||
return Collections.singletonList(new Camera.Area(new Rect(i2, i2, i, i), 1));
|
||||
}
|
||||
|
||||
public static void a(Camera.Parameters parameters) {
|
||||
if ("barcode".equals(parameters.getSceneMode())) {
|
||||
Log.i("CameraConfiguration", "Barcode scene mode already set");
|
||||
return;
|
||||
}
|
||||
String a = a("scene mode", parameters.getSupportedSceneModes(), "barcode");
|
||||
if (a != null) {
|
||||
parameters.setSceneMode(a);
|
||||
}
|
||||
}
|
||||
|
||||
public static Point a(Camera.Parameters parameters, Point point) {
|
||||
List<Camera.Size> supportedPreviewSizes = parameters.getSupportedPreviewSizes();
|
||||
if (supportedPreviewSizes == null) {
|
||||
Log.w("CameraConfiguration", "Device returned no supported preview sizes; using default");
|
||||
Camera.Size previewSize = parameters.getPreviewSize();
|
||||
if (previewSize != null) {
|
||||
return new Point(previewSize.width, previewSize.height);
|
||||
}
|
||||
throw new IllegalStateException("Parameters contained no preview size!");
|
||||
}
|
||||
ArrayList<Camera.Size> arrayList = new ArrayList(supportedPreviewSizes);
|
||||
Collections.sort(arrayList, new Comparator<Camera.Size>() { // from class: com.google.zxing.client.android.camera.CameraConfigurationUtils.1
|
||||
@Override // java.util.Comparator
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public int compare(Camera.Size size, Camera.Size size2) {
|
||||
int i = size.height * size.width;
|
||||
int i2 = size2.height * size2.width;
|
||||
if (i2 < i) {
|
||||
return -1;
|
||||
}
|
||||
return i2 > i ? 1 : 0;
|
||||
}
|
||||
});
|
||||
if (Log.isLoggable("CameraConfiguration", 4)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Camera.Size size : arrayList) {
|
||||
sb.append(size.width);
|
||||
sb.append('x');
|
||||
sb.append(size.height);
|
||||
sb.append(' ');
|
||||
}
|
||||
Log.i("CameraConfiguration", "Supported preview sizes: " + ((Object) sb));
|
||||
}
|
||||
double d = point.x / point.y;
|
||||
Iterator it = arrayList.iterator();
|
||||
while (true) {
|
||||
if (it.hasNext()) {
|
||||
Camera.Size size2 = (Camera.Size) it.next();
|
||||
int i = size2.width;
|
||||
int i2 = size2.height;
|
||||
if (i * i2 < 153600) {
|
||||
it.remove();
|
||||
} else {
|
||||
boolean z = i < i2;
|
||||
int i3 = z ? i2 : i;
|
||||
int i4 = z ? i : i2;
|
||||
if (Math.abs((i3 / i4) - d) > 0.15d) {
|
||||
it.remove();
|
||||
} else if (i3 == point.x && i4 == point.y) {
|
||||
Point point2 = new Point(i, i2);
|
||||
Log.i("CameraConfiguration", "Found preview size exactly matching screen size: " + point2);
|
||||
return point2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!arrayList.isEmpty()) {
|
||||
Camera.Size size3 = (Camera.Size) arrayList.get(0);
|
||||
Point point3 = new Point(size3.width, size3.height);
|
||||
Log.i("CameraConfiguration", "Using largest suitable preview size: " + point3);
|
||||
return point3;
|
||||
}
|
||||
Camera.Size previewSize2 = parameters.getPreviewSize();
|
||||
if (previewSize2 != null) {
|
||||
Point point4 = new Point(previewSize2.width, previewSize2.height);
|
||||
Log.i("CameraConfiguration", "No suitable preview sizes, using default: " + point4);
|
||||
return point4;
|
||||
}
|
||||
throw new IllegalStateException("Parameters contained no preview size!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(String str, Collection<String> collection, String... strArr) {
|
||||
Log.i("CameraConfiguration", "Requesting " + str + " value from among: " + Arrays.toString(strArr));
|
||||
Log.i("CameraConfiguration", "Supported " + str + " values: " + collection);
|
||||
if (collection != null) {
|
||||
for (String str2 : strArr) {
|
||||
if (collection.contains(str2)) {
|
||||
Log.i("CameraConfiguration", "Can set " + str + " to: " + str2);
|
||||
return str2;
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.i("CameraConfiguration", "No supported values match");
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String a(Iterable<Camera.Area> iterable) {
|
||||
if (iterable == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Camera.Area area : iterable) {
|
||||
sb.append(area.rect);
|
||||
sb.append(':');
|
||||
sb.append(area.weight);
|
||||
sb.append(' ');
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,232 @@
|
||||
package com.google.zxing.client.android.camera;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.hardware.Camera;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
import com.google.zxing.PlanarYUVLuminanceSource;
|
||||
import com.google.zxing.client.android.camera.open.CameraFacing;
|
||||
import com.google.zxing.client.android.camera.open.OpenCamera;
|
||||
import com.google.zxing.client.android.camera.open.OpenCameraInterface;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class CameraManager {
|
||||
private static final String m = "CameraManager";
|
||||
private final Context a;
|
||||
private final CameraConfigurationManager b;
|
||||
private OpenCamera c;
|
||||
private AutoFocusManager d;
|
||||
private Rect e;
|
||||
private Rect f;
|
||||
private boolean g;
|
||||
private boolean h;
|
||||
private int i = -1;
|
||||
private int j;
|
||||
private int k;
|
||||
private final PreviewCallback l;
|
||||
|
||||
public CameraManager(Context context) {
|
||||
this.a = context;
|
||||
this.b = new CameraConfigurationManager(context);
|
||||
this.l = new PreviewCallback(this.b);
|
||||
}
|
||||
|
||||
public synchronized void a(SurfaceHolder surfaceHolder) throws IOException {
|
||||
OpenCamera openCamera = this.c;
|
||||
if (openCamera == null) {
|
||||
openCamera = OpenCameraInterface.a(this.i);
|
||||
if (openCamera == null) {
|
||||
throw new IOException("Camera.open() failed to return object from driver");
|
||||
}
|
||||
this.c = openCamera;
|
||||
}
|
||||
if (!this.g) {
|
||||
this.g = true;
|
||||
this.b.a(openCamera);
|
||||
if (this.j > 0 && this.k > 0) {
|
||||
a(this.j, this.k);
|
||||
this.j = 0;
|
||||
this.k = 0;
|
||||
}
|
||||
}
|
||||
Camera a = openCamera.a();
|
||||
Camera.Parameters parameters = a.getParameters();
|
||||
String flatten = parameters == null ? null : parameters.flatten();
|
||||
try {
|
||||
this.b.a(openCamera, false);
|
||||
} catch (RuntimeException unused) {
|
||||
Log.w(m, "Camera rejected parameters. Setting only minimal safe-mode parameters");
|
||||
Log.i(m, "Resetting to saved camera params: " + flatten);
|
||||
if (flatten != null) {
|
||||
Camera.Parameters parameters2 = a.getParameters();
|
||||
parameters2.unflatten(flatten);
|
||||
try {
|
||||
a.setParameters(parameters2);
|
||||
this.b.a(openCamera, true);
|
||||
} catch (RuntimeException unused2) {
|
||||
Log.w(m, "Camera rejected even safe-mode parameters! No configuration");
|
||||
}
|
||||
}
|
||||
}
|
||||
a.setPreviewDisplay(surfaceHolder);
|
||||
}
|
||||
|
||||
public CameraFacing b() {
|
||||
OpenCamera openCamera = this.c;
|
||||
return openCamera != null ? openCamera.b() : CameraFacing.BACK;
|
||||
}
|
||||
|
||||
public synchronized Rect c() {
|
||||
if (this.e == null) {
|
||||
if (this.c == null) {
|
||||
return null;
|
||||
}
|
||||
Point b = this.b.b();
|
||||
if (b == null) {
|
||||
return null;
|
||||
}
|
||||
int a = a(b.x, 240, 1200);
|
||||
int a2 = a(b.y, 240, 675);
|
||||
int i = (b.x - a) / 2;
|
||||
int i2 = (b.y - a2) / 2;
|
||||
this.e = new Rect(i, i2, a + i, a2 + i2);
|
||||
Log.d(m, "Calculated framing rect: " + this.e);
|
||||
}
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public synchronized Rect d() {
|
||||
if (this.f == null) {
|
||||
Rect c = c();
|
||||
if (c == null) {
|
||||
return null;
|
||||
}
|
||||
Rect rect = new Rect(c);
|
||||
Point a = this.b.a();
|
||||
Point b = this.b.b();
|
||||
if (a != null && b != null) {
|
||||
rect.left = (rect.left * a.x) / b.x;
|
||||
rect.right = (rect.right * a.x) / b.x;
|
||||
rect.top = (rect.top * a.y) / b.y;
|
||||
rect.bottom = (rect.bottom * a.y) / b.y;
|
||||
this.f = rect;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public int e() {
|
||||
OpenCamera openCamera = this.c;
|
||||
if (openCamera != null) {
|
||||
return openCamera.c();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public synchronized boolean f() {
|
||||
return this.c != null;
|
||||
}
|
||||
|
||||
public synchronized void g() {
|
||||
OpenCamera openCamera = this.c;
|
||||
if (openCamera != null && !this.h) {
|
||||
openCamera.a().startPreview();
|
||||
this.h = true;
|
||||
this.d = new AutoFocusManager(this.a, openCamera.a());
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void h() {
|
||||
if (this.d != null) {
|
||||
this.d.b();
|
||||
this.d = null;
|
||||
}
|
||||
if (this.c != null && this.h) {
|
||||
this.c.a().stopPreview();
|
||||
this.l.a(null, 0);
|
||||
this.h = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
OpenCamera openCamera = this.c;
|
||||
if (openCamera != null) {
|
||||
openCamera.a().setDisplayOrientation(i);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void a() {
|
||||
if (this.c != null) {
|
||||
this.c.a().release();
|
||||
this.c = null;
|
||||
this.e = null;
|
||||
this.f = null;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void a(boolean z) {
|
||||
OpenCamera openCamera = this.c;
|
||||
if (openCamera != null && z != this.b.a(openCamera.a())) {
|
||||
boolean z2 = this.d != null;
|
||||
if (z2) {
|
||||
this.d.b();
|
||||
this.d = null;
|
||||
}
|
||||
this.b.a(openCamera.a(), z);
|
||||
if (z2) {
|
||||
this.d = new AutoFocusManager(this.a, openCamera.a());
|
||||
this.d.a();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void a(Handler handler, int i) {
|
||||
OpenCamera openCamera = this.c;
|
||||
if (openCamera != null && this.h) {
|
||||
this.l.a(handler, i);
|
||||
openCamera.a().setOneShotPreviewCallback(this.l);
|
||||
}
|
||||
}
|
||||
|
||||
private static int a(int i, int i2, int i3) {
|
||||
int i4 = (i * 9) / 20;
|
||||
return i4 < i2 ? i2 : i4 > i3 ? i3 : i4;
|
||||
}
|
||||
|
||||
public synchronized void a(int i) {
|
||||
this.i = i;
|
||||
}
|
||||
|
||||
public synchronized void a(int i, int i2) {
|
||||
if (this.g) {
|
||||
Point b = this.b.b();
|
||||
if (i > b.x) {
|
||||
i = b.x;
|
||||
}
|
||||
if (i2 > b.y) {
|
||||
i2 = b.y;
|
||||
}
|
||||
int i3 = (b.x - i) / 2;
|
||||
int i4 = (b.y - i2) / 2;
|
||||
this.e = new Rect(i3, i4, i + i3, i2 + i4);
|
||||
Log.d(m, "Calculated manual framing rect: " + this.e);
|
||||
this.f = null;
|
||||
} else {
|
||||
this.j = i;
|
||||
this.k = i2;
|
||||
}
|
||||
}
|
||||
|
||||
public PlanarYUVLuminanceSource a(byte[] bArr, int i, int i2) {
|
||||
Rect d = d();
|
||||
if (d == null) {
|
||||
return null;
|
||||
}
|
||||
return new PlanarYUVLuminanceSource(bArr, i, i2, d.left, d.top, d.width(), d.height(), false);
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.google.zxing.client.android.camera;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum FrontLightMode {
|
||||
ON,
|
||||
AUTO,
|
||||
OFF;
|
||||
|
||||
private static FrontLightMode parse(String str) {
|
||||
return str == null ? OFF : valueOf(str);
|
||||
}
|
||||
|
||||
public static FrontLightMode readPref(SharedPreferences sharedPreferences) {
|
||||
return parse(sharedPreferences.getString("preferences_front_light_mode", OFF.toString()));
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
package com.google.zxing.client.android.camera;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.hardware.Camera;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class PreviewCallback implements Camera.PreviewCallback {
|
||||
private static final String d = PreviewCallback.class.getSimpleName();
|
||||
private final CameraConfigurationManager a;
|
||||
private Handler b;
|
||||
private int c;
|
||||
|
||||
PreviewCallback(CameraConfigurationManager cameraConfigurationManager) {
|
||||
this.a = cameraConfigurationManager;
|
||||
}
|
||||
|
||||
void a(Handler handler, int i) {
|
||||
this.b = handler;
|
||||
this.c = i;
|
||||
}
|
||||
|
||||
@Override // android.hardware.Camera.PreviewCallback
|
||||
public void onPreviewFrame(byte[] bArr, Camera camera) {
|
||||
Point a = this.a.a();
|
||||
Handler handler = this.b;
|
||||
if (a == null || handler == null) {
|
||||
Log.d(d, "Got preview callback, but no handler or resolution available");
|
||||
} else {
|
||||
handler.obtainMessage(this.c, a.x, a.y, bArr).sendToTarget();
|
||||
this.b = null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package com.google.zxing.client.android.camera.open;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum CameraFacing {
|
||||
BACK,
|
||||
FRONT
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package com.google.zxing.client.android.camera.open;
|
||||
|
||||
import android.hardware.Camera;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class OpenCamera {
|
||||
private final int a;
|
||||
private final Camera b;
|
||||
private final CameraFacing c;
|
||||
private final int d;
|
||||
|
||||
public OpenCamera(int i, Camera camera, CameraFacing cameraFacing, int i2) {
|
||||
this.a = i;
|
||||
this.b = camera;
|
||||
this.c = cameraFacing;
|
||||
this.d = i2;
|
||||
}
|
||||
|
||||
public Camera a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public CameraFacing b() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Camera #" + this.a + " : " + this.c + ',' + this.d;
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package com.google.zxing.client.android.camera.open;
|
||||
|
||||
import android.hardware.Camera;
|
||||
import android.util.Log;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class OpenCameraInterface {
|
||||
private static final String a = "com.google.zxing.client.android.camera.open.OpenCameraInterface";
|
||||
|
||||
public static OpenCamera a(int i) {
|
||||
int numberOfCameras = Camera.getNumberOfCameras();
|
||||
if (numberOfCameras == 0) {
|
||||
Log.w(a, "No cameras!");
|
||||
return null;
|
||||
}
|
||||
if (i >= numberOfCameras) {
|
||||
Log.w(a, "Requested camera does not exist: " + i);
|
||||
return null;
|
||||
}
|
||||
if (i <= -1) {
|
||||
i = 0;
|
||||
while (i < numberOfCameras) {
|
||||
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
|
||||
Camera.getCameraInfo(i, cameraInfo);
|
||||
if (CameraFacing.values()[cameraInfo.facing] == CameraFacing.BACK) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (i == numberOfCameras) {
|
||||
Log.i(a, "No camera facing " + CameraFacing.BACK + "; returning camera #0");
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
Log.i(a, "Opening camera #" + i);
|
||||
Camera.CameraInfo cameraInfo2 = new Camera.CameraInfo();
|
||||
Camera.getCameraInfo(i, cameraInfo2);
|
||||
Camera open = Camera.open(i);
|
||||
if (open == null) {
|
||||
return null;
|
||||
}
|
||||
return new OpenCamera(i, open, CameraFacing.values()[cameraInfo2.facing], cameraInfo2.orientation);
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package com.google.zxing.client.android.clipboard;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ClipboardInterface {
|
||||
private static final String a = "ClipboardInterface";
|
||||
|
||||
public static void a(CharSequence charSequence, Context context) {
|
||||
if (charSequence != null) {
|
||||
try {
|
||||
a(context).setPrimaryClip(ClipData.newPlainText(null, charSequence));
|
||||
} catch (IllegalStateException | NullPointerException | SecurityException e) {
|
||||
Log.w(a, "Clipboard bug", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static CharSequence b(Context context) {
|
||||
ClipData primaryClip = a(context).getPrimaryClip();
|
||||
if (c(context)) {
|
||||
return primaryClip.getItemAt(0).coerceToText(context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean c(Context context) {
|
||||
ClipData primaryClip = a(context).getPrimaryClip();
|
||||
return primaryClip != null && primaryClip.getItemCount() > 0;
|
||||
}
|
||||
|
||||
private static ClipboardManager a(Context context) {
|
||||
return (ClipboardManager) context.getSystemService("clipboard");
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
package com.google.zxing.client.android.encode;
|
||||
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class ContactEncoder {
|
||||
ContactEncoder() {
|
||||
}
|
||||
|
||||
static void a(StringBuilder sb, StringBuilder sb2, String str, String str2, Formatter formatter, char c) {
|
||||
String b = b(str2);
|
||||
if (b != null) {
|
||||
sb.append(str);
|
||||
sb.append(formatter.a(b, 0));
|
||||
sb.append(c);
|
||||
sb2.append(b);
|
||||
sb2.append('\n');
|
||||
}
|
||||
}
|
||||
|
||||
static String b(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
String trim = str.trim();
|
||||
if (trim.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return trim;
|
||||
}
|
||||
|
||||
abstract String[] a(List<String> list, String str, List<String> list2, List<String> list3, List<String> list4, List<String> list5, List<String> list6, String str2);
|
||||
|
||||
static void a(StringBuilder sb, StringBuilder sb2, String str, List<String> list, int i, Formatter formatter, Formatter formatter2, char c) {
|
||||
if (list == null) {
|
||||
return;
|
||||
}
|
||||
HashSet hashSet = new HashSet(2);
|
||||
int i2 = 0;
|
||||
for (int i3 = 0; i3 < list.size(); i3++) {
|
||||
String b = b(list.get(i3));
|
||||
if (b != null && !b.isEmpty() && !hashSet.contains(b)) {
|
||||
sb.append(str);
|
||||
sb.append(formatter2.a(b, i3));
|
||||
sb.append(c);
|
||||
sb2.append(formatter == null ? b : formatter.a(b, i3));
|
||||
sb2.append('\n');
|
||||
i2++;
|
||||
if (i2 == i) {
|
||||
return;
|
||||
} else {
|
||||
hashSet.add(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static String a(String str) {
|
||||
return PhoneNumberUtils.formatNumber(str);
|
||||
}
|
||||
}
|
@@ -0,0 +1,185 @@
|
||||
package com.google.zxing.client.android.encode;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.client.android.FinishListener;
|
||||
import com.google.zxing.client.android.R$id;
|
||||
import com.google.zxing.client.android.R$layout;
|
||||
import com.google.zxing.client.android.R$menu;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class EncodeActivity extends Activity {
|
||||
private static final String b = EncodeActivity.class.getSimpleName();
|
||||
private static final Pattern c = Pattern.compile("[^A-Za-z0-9]");
|
||||
private QRCodeEncoder a;
|
||||
|
||||
private void a() {
|
||||
QRCodeEncoder qRCodeEncoder = this.a;
|
||||
if (qRCodeEncoder == null) {
|
||||
Log.w(b, "No existing barcode to send?");
|
||||
return;
|
||||
}
|
||||
String b2 = qRCodeEncoder.b();
|
||||
if (b2 == null) {
|
||||
Log.w(b, "No existing barcode to send?");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Bitmap a = qRCodeEncoder.a();
|
||||
if (a == null) {
|
||||
return;
|
||||
}
|
||||
File file = new File(new File(Environment.getExternalStorageDirectory(), "BarcodeScanner"), "Barcodes");
|
||||
if (!file.exists() && !file.mkdirs()) {
|
||||
Log.w(b, "Couldn't make dir " + file);
|
||||
a(R$string.msg_unmount_usb);
|
||||
return;
|
||||
}
|
||||
File file2 = new File(file, ((Object) a(b2)) + ".png");
|
||||
if (!file2.delete()) {
|
||||
Log.w(b, "Could not delete " + file2);
|
||||
}
|
||||
try {
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(file2);
|
||||
try {
|
||||
a.compress(Bitmap.CompressFormat.PNG, 0, fileOutputStream);
|
||||
fileOutputStream.close();
|
||||
Intent intent = new Intent("android.intent.action.SEND", Uri.parse("mailto:"));
|
||||
intent.putExtra("android.intent.extra.SUBJECT", getString(R$string.scan_name) + " - " + qRCodeEncoder.d());
|
||||
intent.putExtra("android.intent.extra.TEXT", b2);
|
||||
intent.putExtra("android.intent.extra.STREAM", Uri.parse("file://" + file2.getAbsolutePath()));
|
||||
intent.setType("image/png");
|
||||
intent.addFlags(524288);
|
||||
startActivity(Intent.createChooser(intent, null));
|
||||
} finally {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.w(b, "Couldn't access file " + file2 + " due to " + e);
|
||||
a(R$string.msg_unmount_usb);
|
||||
}
|
||||
} catch (WriterException e2) {
|
||||
Log.w(b, e2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
Intent intent = getIntent();
|
||||
if (intent == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
String action = intent.getAction();
|
||||
if ("com.google.zxing.client.android.ENCODE".equals(action) || "android.intent.action.SEND".equals(action)) {
|
||||
setContentView(R$layout.encode);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R$menu.encode, menu);
|
||||
QRCodeEncoder qRCodeEncoder = this.a;
|
||||
int i = qRCodeEncoder != null && qRCodeEncoder.e() ? R$string.menu_encode_mecard : R$string.menu_encode_vcard;
|
||||
MenuItem findItem = menu.findItem(R$id.menu_encode);
|
||||
findItem.setTitle(i);
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
findItem.setVisible("CONTACT_TYPE".equals(intent.getStringExtra("ENCODE_TYPE")));
|
||||
}
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public boolean onOptionsItemSelected(MenuItem menuItem) {
|
||||
Intent intent;
|
||||
int itemId = menuItem.getItemId();
|
||||
if (itemId == R$id.menu_share) {
|
||||
a();
|
||||
return true;
|
||||
}
|
||||
if (itemId != R$id.menu_encode || (intent = getIntent()) == null) {
|
||||
return false;
|
||||
}
|
||||
intent.putExtra("USE_VCARD", !this.a.e());
|
||||
intent.addFlags(67108864);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Display defaultDisplay = ((WindowManager) getSystemService("window")).getDefaultDisplay();
|
||||
Point point = new Point();
|
||||
defaultDisplay.getSize(point);
|
||||
int i = point.x;
|
||||
int i2 = point.y;
|
||||
if (i >= i2) {
|
||||
i = i2;
|
||||
}
|
||||
int i3 = (i * 7) / 8;
|
||||
Intent intent = getIntent();
|
||||
if (intent == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.a = new QRCodeEncoder(this, intent, i3, intent.getBooleanExtra("USE_VCARD", false));
|
||||
Bitmap a = this.a.a();
|
||||
if (a == null) {
|
||||
Log.w(b, "Could not encode barcode");
|
||||
a(R$string.msg_encode_contents_failed);
|
||||
this.a = null;
|
||||
return;
|
||||
}
|
||||
((ImageView) findViewById(R$id.image_view)).setImageBitmap(a);
|
||||
TextView textView = (TextView) findViewById(R$id.contents_text_view);
|
||||
if (intent.getBooleanExtra("ENCODE_SHOW_CONTENTS", true)) {
|
||||
textView.setText(this.a.c());
|
||||
setTitle(this.a.d());
|
||||
} else {
|
||||
textView.setText("");
|
||||
setTitle("");
|
||||
}
|
||||
} catch (WriterException e) {
|
||||
Log.w(b, "Could not encode barcode", e);
|
||||
a(R$string.msg_encode_contents_failed);
|
||||
this.a = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static CharSequence a(CharSequence charSequence) {
|
||||
String replaceAll = c.matcher(charSequence).replaceAll("_");
|
||||
return replaceAll.length() > 24 ? replaceAll.substring(0, 24) : replaceAll;
|
||||
}
|
||||
|
||||
private void a(int i) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(i);
|
||||
builder.setPositiveButton(R$string.button_ok, new FinishListener(this));
|
||||
builder.setOnCancelListener(new FinishListener(this));
|
||||
builder.show();
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.google.zxing.client.android.encode;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface Formatter {
|
||||
CharSequence a(CharSequence charSequence, int i);
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package com.google.zxing.client.android.encode;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class MECARDContactEncoder extends ContactEncoder {
|
||||
|
||||
private static final class MECARDFieldFormatter implements Formatter {
|
||||
private static final Pattern a = Pattern.compile("([\\\\:;])");
|
||||
private static final Pattern b = Pattern.compile("\\n");
|
||||
|
||||
private MECARDFieldFormatter() {
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.encode.Formatter
|
||||
public CharSequence a(CharSequence charSequence, int i) {
|
||||
return ':' + b.matcher(a.matcher(charSequence).replaceAll("\\\\$1")).replaceAll("");
|
||||
}
|
||||
}
|
||||
|
||||
private static final class MECARDNameDisplayFormatter implements Formatter {
|
||||
private static final Pattern a = Pattern.compile(",");
|
||||
|
||||
private MECARDNameDisplayFormatter() {
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.encode.Formatter
|
||||
public CharSequence a(CharSequence charSequence, int i) {
|
||||
return a.matcher(charSequence).replaceAll("");
|
||||
}
|
||||
}
|
||||
|
||||
private static final class MECARDTelDisplayFormatter implements Formatter {
|
||||
private static final Pattern a = Pattern.compile("[^0-9+]+");
|
||||
|
||||
private MECARDTelDisplayFormatter() {
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.encode.Formatter
|
||||
public CharSequence a(CharSequence charSequence, int i) {
|
||||
return a.matcher(ContactEncoder.a(charSequence.toString())).replaceAll("");
|
||||
}
|
||||
}
|
||||
|
||||
MECARDContactEncoder() {
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.encode.ContactEncoder
|
||||
public String[] a(List<String> list, String str, List<String> list2, List<String> list3, List<String> list4, List<String> list5, List<String> list6, String str2) {
|
||||
StringBuilder sb = new StringBuilder(100);
|
||||
sb.append("MECARD:");
|
||||
StringBuilder sb2 = new StringBuilder(100);
|
||||
MECARDFieldFormatter mECARDFieldFormatter = new MECARDFieldFormatter();
|
||||
ContactEncoder.a(sb, sb2, "N", list, 1, (Formatter) new MECARDNameDisplayFormatter(), (Formatter) mECARDFieldFormatter, ';');
|
||||
ContactEncoder.a(sb, sb2, "ORG", str, mECARDFieldFormatter, ';');
|
||||
ContactEncoder.a(sb, sb2, "ADR", list2, 1, (Formatter) null, (Formatter) mECARDFieldFormatter, ';');
|
||||
ContactEncoder.a(sb, sb2, "TEL", list3, Integer.MAX_VALUE, (Formatter) new MECARDTelDisplayFormatter(), (Formatter) mECARDFieldFormatter, ';');
|
||||
ContactEncoder.a(sb, sb2, "EMAIL", list5, Integer.MAX_VALUE, (Formatter) null, (Formatter) mECARDFieldFormatter, ';');
|
||||
ContactEncoder.a(sb, sb2, "URL", list6, Integer.MAX_VALUE, (Formatter) null, (Formatter) mECARDFieldFormatter, ';');
|
||||
ContactEncoder.a(sb, sb2, "NOTE", str2, mECARDFieldFormatter, ';');
|
||||
sb.append(';');
|
||||
return new String[]{sb.toString(), sb2.toString()};
|
||||
}
|
||||
}
|
@@ -0,0 +1,406 @@
|
||||
package com.google.zxing.client.android.encode;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.MultiFormatWriter;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.client.android.Contents;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.result.AddressBookParsedResult;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
import com.google.zxing.client.result.ResultParser;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.unity3d.ads.metadata.MediationMetaData;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class QRCodeEncoder {
|
||||
private static final String h = "QRCodeEncoder";
|
||||
private final Context a;
|
||||
private String b;
|
||||
private String c;
|
||||
private String d;
|
||||
private BarcodeFormat e;
|
||||
private final int f;
|
||||
private final boolean g;
|
||||
|
||||
QRCodeEncoder(Context context, Intent intent, int i, boolean z) throws WriterException {
|
||||
this.a = context;
|
||||
this.f = i;
|
||||
this.g = z;
|
||||
String action = intent.getAction();
|
||||
if ("com.google.zxing.client.android.ENCODE".equals(action)) {
|
||||
b(intent);
|
||||
} else if ("android.intent.action.SEND".equals(action)) {
|
||||
a(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(Intent intent) throws WriterException {
|
||||
if (intent.hasExtra("android.intent.extra.STREAM")) {
|
||||
c(intent);
|
||||
} else {
|
||||
d(intent);
|
||||
}
|
||||
}
|
||||
|
||||
String b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
String c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
String d() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
boolean e() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
private void b(Intent intent) {
|
||||
String stringExtra = intent.getStringExtra("ENCODE_FORMAT");
|
||||
this.e = null;
|
||||
if (stringExtra != null) {
|
||||
try {
|
||||
this.e = BarcodeFormat.valueOf(stringExtra);
|
||||
} catch (IllegalArgumentException unused) {
|
||||
}
|
||||
}
|
||||
BarcodeFormat barcodeFormat = this.e;
|
||||
if (barcodeFormat == null || barcodeFormat == BarcodeFormat.QR_CODE) {
|
||||
String stringExtra2 = intent.getStringExtra("ENCODE_TYPE");
|
||||
if (stringExtra2 == null || stringExtra2.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
this.e = BarcodeFormat.QR_CODE;
|
||||
a(intent, stringExtra2);
|
||||
return;
|
||||
}
|
||||
String stringExtra3 = intent.getStringExtra("ENCODE_DATA");
|
||||
if (stringExtra3 == null || stringExtra3.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
this.b = stringExtra3;
|
||||
this.c = stringExtra3;
|
||||
this.d = this.a.getString(R$string.contents_text);
|
||||
}
|
||||
|
||||
private void c(Intent intent) throws WriterException {
|
||||
this.e = BarcodeFormat.QR_CODE;
|
||||
Bundle extras = intent.getExtras();
|
||||
if (extras == null) {
|
||||
throw new WriterException("No extras");
|
||||
}
|
||||
Uri uri = (Uri) extras.getParcelable("android.intent.extra.STREAM");
|
||||
if (uri == null) {
|
||||
throw new WriterException("No EXTRA_STREAM");
|
||||
}
|
||||
ByteArrayOutputStream byteArrayOutputStream = null;
|
||||
try {
|
||||
try {
|
||||
InputStream openInputStream = this.a.getContentResolver().openInputStream(uri);
|
||||
try {
|
||||
if (openInputStream == null) {
|
||||
throw new WriterException("Can't open stream for " + uri);
|
||||
}
|
||||
ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream();
|
||||
try {
|
||||
byte[] bArr = new byte[2048];
|
||||
while (true) {
|
||||
int read = openInputStream.read(bArr);
|
||||
if (read <= 0) {
|
||||
break;
|
||||
} else {
|
||||
byteArrayOutputStream2.write(bArr, 0, read);
|
||||
}
|
||||
}
|
||||
byte[] byteArray = byteArrayOutputStream2.toByteArray();
|
||||
String str = new String(byteArray, 0, byteArray.length, StandardCharsets.UTF_8);
|
||||
if (openInputStream != null) {
|
||||
try {
|
||||
openInputStream.close();
|
||||
} catch (IOException e) {
|
||||
e = e;
|
||||
throw new WriterException(e);
|
||||
} catch (Throwable th) {
|
||||
byteArrayOutputStream = byteArrayOutputStream2;
|
||||
th = th;
|
||||
if (byteArrayOutputStream != null) {
|
||||
try {
|
||||
byteArrayOutputStream.close();
|
||||
} catch (IOException e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
try {
|
||||
byteArrayOutputStream2.close();
|
||||
} catch (IOException e3) {
|
||||
e3.printStackTrace();
|
||||
}
|
||||
Log.d(h, "Encoding share intent content:");
|
||||
Log.d(h, str);
|
||||
ParsedResult c = ResultParser.c(new Result(str, byteArray, null, BarcodeFormat.QR_CODE));
|
||||
if (!(c instanceof AddressBookParsedResult)) {
|
||||
throw new WriterException("Result was not an address");
|
||||
}
|
||||
a((AddressBookParsedResult) c);
|
||||
String str2 = this.b;
|
||||
if (str2 == null || str2.isEmpty()) {
|
||||
throw new WriterException("No content to encode");
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
try {
|
||||
throw th;
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
} catch (Throwable th3) {
|
||||
th = th3;
|
||||
}
|
||||
} catch (IOException e4) {
|
||||
e = e4;
|
||||
}
|
||||
} catch (Throwable th4) {
|
||||
th = th4;
|
||||
}
|
||||
}
|
||||
|
||||
private void d(Intent intent) throws WriterException {
|
||||
String b = ContactEncoder.b(intent.getStringExtra("android.intent.extra.TEXT"));
|
||||
if (b == null && (b = ContactEncoder.b(intent.getStringExtra("android.intent.extra.HTML_TEXT"))) == null && (b = ContactEncoder.b(intent.getStringExtra("android.intent.extra.SUBJECT"))) == null) {
|
||||
String[] stringArrayExtra = intent.getStringArrayExtra("android.intent.extra.EMAIL");
|
||||
b = stringArrayExtra != null ? ContactEncoder.b(stringArrayExtra[0]) : "?";
|
||||
}
|
||||
if (b == null || b.isEmpty()) {
|
||||
throw new WriterException("Empty EXTRA_TEXT");
|
||||
}
|
||||
this.b = b;
|
||||
this.e = BarcodeFormat.QR_CODE;
|
||||
if (intent.hasExtra("android.intent.extra.SUBJECT")) {
|
||||
this.c = intent.getStringExtra("android.intent.extra.SUBJECT");
|
||||
} else if (intent.hasExtra("android.intent.extra.TITLE")) {
|
||||
this.c = intent.getStringExtra("android.intent.extra.TITLE");
|
||||
} else {
|
||||
this.c = this.b;
|
||||
}
|
||||
this.d = this.a.getString(R$string.contents_text);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
private void a(Intent intent, String str) {
|
||||
char c;
|
||||
Bundle bundleExtra;
|
||||
switch (str.hashCode()) {
|
||||
case -1309271157:
|
||||
if (str.equals("PHONE_TYPE")) {
|
||||
c = 2;
|
||||
break;
|
||||
}
|
||||
c = 65535;
|
||||
break;
|
||||
case -670199783:
|
||||
if (str.equals("CONTACT_TYPE")) {
|
||||
c = 4;
|
||||
break;
|
||||
}
|
||||
c = 65535;
|
||||
break;
|
||||
case 709220992:
|
||||
if (str.equals("SMS_TYPE")) {
|
||||
c = 3;
|
||||
break;
|
||||
}
|
||||
c = 65535;
|
||||
break;
|
||||
case 1349204356:
|
||||
if (str.equals("LOCATION_TYPE")) {
|
||||
c = 5;
|
||||
break;
|
||||
}
|
||||
c = 65535;
|
||||
break;
|
||||
case 1778595596:
|
||||
if (str.equals("TEXT_TYPE")) {
|
||||
c = 0;
|
||||
break;
|
||||
}
|
||||
c = 65535;
|
||||
break;
|
||||
case 1833351709:
|
||||
if (str.equals("EMAIL_TYPE")) {
|
||||
c = 1;
|
||||
break;
|
||||
}
|
||||
c = 65535;
|
||||
break;
|
||||
default:
|
||||
c = 65535;
|
||||
break;
|
||||
}
|
||||
if (c == 0) {
|
||||
String stringExtra = intent.getStringExtra("ENCODE_DATA");
|
||||
if (stringExtra == null || stringExtra.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
this.b = stringExtra;
|
||||
this.c = stringExtra;
|
||||
this.d = this.a.getString(R$string.contents_text);
|
||||
return;
|
||||
}
|
||||
if (c == 1) {
|
||||
String b = ContactEncoder.b(intent.getStringExtra("ENCODE_DATA"));
|
||||
if (b != null) {
|
||||
this.b = "mailto:" + b;
|
||||
this.c = b;
|
||||
this.d = this.a.getString(R$string.contents_email);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (c == 2) {
|
||||
String b2 = ContactEncoder.b(intent.getStringExtra("ENCODE_DATA"));
|
||||
if (b2 != null) {
|
||||
this.b = "tel:" + b2;
|
||||
this.c = ContactEncoder.a(b2);
|
||||
this.d = this.a.getString(R$string.contents_phone);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (c == 3) {
|
||||
String b3 = ContactEncoder.b(intent.getStringExtra("ENCODE_DATA"));
|
||||
if (b3 != null) {
|
||||
this.b = "sms:" + b3;
|
||||
this.c = ContactEncoder.a(b3);
|
||||
this.d = this.a.getString(R$string.contents_sms);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (c == 4) {
|
||||
Bundle bundleExtra2 = intent.getBundleExtra("ENCODE_DATA");
|
||||
if (bundleExtra2 != null) {
|
||||
String string = bundleExtra2.getString(MediationMetaData.KEY_NAME);
|
||||
String string2 = bundleExtra2.getString("company");
|
||||
String string3 = bundleExtra2.getString("postal");
|
||||
List<String> a = a(bundleExtra2, Contents.a);
|
||||
List<String> a2 = a(bundleExtra2, Contents.b);
|
||||
List<String> a3 = a(bundleExtra2, Contents.c);
|
||||
String string4 = bundleExtra2.getString("URL_KEY");
|
||||
String[] a4 = (this.g ? new VCardContactEncoder() : new MECARDContactEncoder()).a(Collections.singletonList(string), string2, Collections.singletonList(string3), a, a2, a3, string4 == null ? null : Collections.singletonList(string4), bundleExtra2.getString("NOTE_KEY"));
|
||||
if (a4[1].isEmpty()) {
|
||||
return;
|
||||
}
|
||||
this.b = a4[0];
|
||||
this.c = a4[1];
|
||||
this.d = this.a.getString(R$string.contents_contact);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (c == 5 && (bundleExtra = intent.getBundleExtra("ENCODE_DATA")) != null) {
|
||||
float f = bundleExtra.getFloat("LAT", Float.MAX_VALUE);
|
||||
float f2 = bundleExtra.getFloat("LONG", Float.MAX_VALUE);
|
||||
if (f == Float.MAX_VALUE || f2 == Float.MAX_VALUE) {
|
||||
return;
|
||||
}
|
||||
this.b = "geo:" + f + ',' + f2;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(f);
|
||||
sb.append(",");
|
||||
sb.append(f2);
|
||||
this.c = sb.toString();
|
||||
this.d = this.a.getString(R$string.contents_location);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> a(Bundle bundle, String[] strArr) {
|
||||
ArrayList arrayList = new ArrayList(strArr.length);
|
||||
for (String str : strArr) {
|
||||
Object obj = bundle.get(str);
|
||||
arrayList.add(obj == null ? null : obj.toString());
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private void a(AddressBookParsedResult addressBookParsedResult) {
|
||||
String[] a = (this.g ? new VCardContactEncoder() : new MECARDContactEncoder()).a(a(addressBookParsedResult.j()), addressBookParsedResult.m(), a(addressBookParsedResult.d()), a(addressBookParsedResult.n()), (List<String>) null, a(addressBookParsedResult.g()), a(addressBookParsedResult.r()), (String) null);
|
||||
if (a[1].isEmpty()) {
|
||||
return;
|
||||
}
|
||||
this.b = a[0];
|
||||
this.c = a[1];
|
||||
this.d = this.a.getString(R$string.contents_contact);
|
||||
}
|
||||
|
||||
private static List<String> a(String[] strArr) {
|
||||
if (strArr == null) {
|
||||
return null;
|
||||
}
|
||||
return Arrays.asList(strArr);
|
||||
}
|
||||
|
||||
Bitmap a() throws WriterException {
|
||||
EnumMap enumMap;
|
||||
String str = this.b;
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
String a = a(str);
|
||||
if (a != null) {
|
||||
EnumMap enumMap2 = new EnumMap(EncodeHintType.class);
|
||||
enumMap2.put((EnumMap) EncodeHintType.CHARACTER_SET, (EncodeHintType) a);
|
||||
enumMap = enumMap2;
|
||||
} else {
|
||||
enumMap = null;
|
||||
}
|
||||
try {
|
||||
BitMatrix a2 = new MultiFormatWriter().a(str, this.e, this.f, this.f, enumMap);
|
||||
int k = a2.k();
|
||||
int i = a2.i();
|
||||
int[] iArr = new int[k * i];
|
||||
for (int i2 = 0; i2 < i; i2++) {
|
||||
int i3 = i2 * k;
|
||||
for (int i4 = 0; i4 < k; i4++) {
|
||||
iArr[i3 + i4] = a2.b(i4, i2) ? -16777216 : -1;
|
||||
}
|
||||
}
|
||||
Bitmap createBitmap = Bitmap.createBitmap(k, i, Bitmap.Config.ARGB_8888);
|
||||
createBitmap.setPixels(iArr, 0, k, 0, 0, k, i);
|
||||
return createBitmap;
|
||||
} catch (IllegalArgumentException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(CharSequence charSequence) {
|
||||
for (int i = 0; i < charSequence.length(); i++) {
|
||||
if (charSequence.charAt(i) > 255) {
|
||||
return "UTF-8";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,117 @@
|
||||
package com.google.zxing.client.android.encode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class VCardContactEncoder extends ContactEncoder {
|
||||
VCardContactEncoder() {
|
||||
}
|
||||
|
||||
private static String a(int i) {
|
||||
if (i == 10 || i == 17 || i == 18) {
|
||||
return "work";
|
||||
}
|
||||
switch (i) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 5:
|
||||
case 6:
|
||||
return "home";
|
||||
case 3:
|
||||
case 4:
|
||||
return "work";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String b(int i) {
|
||||
if (i == 4 || i == 5) {
|
||||
return "fax";
|
||||
}
|
||||
if (i == 6) {
|
||||
return "pager";
|
||||
}
|
||||
if (i == 13) {
|
||||
return "fax";
|
||||
}
|
||||
if (i == 16) {
|
||||
return "textphone";
|
||||
}
|
||||
if (i == 18) {
|
||||
return "pager";
|
||||
}
|
||||
if (i != 20) {
|
||||
return null;
|
||||
}
|
||||
return "text";
|
||||
}
|
||||
|
||||
private static Integer c(String str) {
|
||||
try {
|
||||
return Integer.valueOf(str);
|
||||
} catch (NumberFormatException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.encode.ContactEncoder
|
||||
public String[] a(List<String> list, String str, List<String> list2, List<String> list3, List<String> list4, List<String> list5, List<String> list6, String str2) {
|
||||
StringBuilder sb = new StringBuilder(100);
|
||||
sb.append("BEGIN:VCARD");
|
||||
sb.append('\n');
|
||||
sb.append("VERSION:3.0");
|
||||
sb.append('\n');
|
||||
StringBuilder sb2 = new StringBuilder(100);
|
||||
VCardFieldFormatter vCardFieldFormatter = new VCardFieldFormatter();
|
||||
ContactEncoder.a(sb, sb2, "N", list, 1, (Formatter) null, (Formatter) vCardFieldFormatter, '\n');
|
||||
ContactEncoder.a(sb, sb2, "ORG", str, vCardFieldFormatter, '\n');
|
||||
ContactEncoder.a(sb, sb2, "ADR", list2, 1, (Formatter) null, (Formatter) vCardFieldFormatter, '\n');
|
||||
List<Map<String, Set<String>>> a = a(list3, list4);
|
||||
ContactEncoder.a(sb, sb2, "TEL", list3, Integer.MAX_VALUE, (Formatter) new VCardTelDisplayFormatter(a), (Formatter) new VCardFieldFormatter(a), '\n');
|
||||
ContactEncoder.a(sb, sb2, "EMAIL", list5, Integer.MAX_VALUE, (Formatter) null, (Formatter) vCardFieldFormatter, '\n');
|
||||
ContactEncoder.a(sb, sb2, "URL", list6, Integer.MAX_VALUE, (Formatter) null, (Formatter) vCardFieldFormatter, '\n');
|
||||
ContactEncoder.a(sb, sb2, "NOTE", str2, vCardFieldFormatter, '\n');
|
||||
sb.append("END:VCARD");
|
||||
sb.append('\n');
|
||||
return new String[]{sb.toString(), sb2.toString()};
|
||||
}
|
||||
|
||||
private static List<Map<String, Set<String>>> a(Collection<String> collection, List<String> list) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (int i = 0; i < collection.size(); i++) {
|
||||
if (list.size() <= i) {
|
||||
arrayList.add(null);
|
||||
} else {
|
||||
HashMap hashMap = new HashMap();
|
||||
arrayList.add(hashMap);
|
||||
HashSet hashSet = new HashSet();
|
||||
hashMap.put("TYPE", hashSet);
|
||||
String str = list.get(i);
|
||||
Integer c = c(str);
|
||||
if (c == null) {
|
||||
hashSet.add(str);
|
||||
} else {
|
||||
String b = b(c.intValue());
|
||||
String a = a(c.intValue());
|
||||
if (b != null) {
|
||||
hashSet.add(b);
|
||||
}
|
||||
if (a != null) {
|
||||
hashSet.add(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
package com.google.zxing.client.android.encode;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class VCardFieldFormatter implements Formatter {
|
||||
private static final Pattern b = Pattern.compile("([\\\\,;])");
|
||||
private static final Pattern c = Pattern.compile("\\n");
|
||||
private final List<Map<String, Set<String>>> a;
|
||||
|
||||
VCardFieldFormatter() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.encode.Formatter
|
||||
public CharSequence a(CharSequence charSequence, int i) {
|
||||
String replaceAll = c.matcher(b.matcher(charSequence).replaceAll("\\\\$1")).replaceAll("");
|
||||
List<Map<String, Set<String>>> list = this.a;
|
||||
return a(replaceAll, (list == null || list.size() <= i) ? null : this.a.get(i));
|
||||
}
|
||||
|
||||
VCardFieldFormatter(List<Map<String, Set<String>>> list) {
|
||||
this.a = list;
|
||||
}
|
||||
|
||||
private static CharSequence a(CharSequence charSequence, Map<String, Set<String>> map) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (map != null) {
|
||||
for (Map.Entry<String, Set<String>> entry : map.entrySet()) {
|
||||
Set<String> value = entry.getValue();
|
||||
if (value != null && !value.isEmpty()) {
|
||||
sb.append(';');
|
||||
sb.append(entry.getKey());
|
||||
sb.append('=');
|
||||
if (value.size() > 1) {
|
||||
sb.append('\"');
|
||||
}
|
||||
Iterator<String> it = value.iterator();
|
||||
sb.append(it.next());
|
||||
while (it.hasNext()) {
|
||||
sb.append(',');
|
||||
sb.append(it.next());
|
||||
}
|
||||
if (value.size() > 1) {
|
||||
sb.append('\"');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.append(':');
|
||||
sb.append(charSequence);
|
||||
return sb;
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package com.google.zxing.client.android.encode;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class VCardTelDisplayFormatter implements Formatter {
|
||||
private final List<Map<String, Set<String>>> a;
|
||||
|
||||
VCardTelDisplayFormatter(List<Map<String, Set<String>>> list) {
|
||||
this.a = list;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.encode.Formatter
|
||||
public CharSequence a(CharSequence charSequence, int i) {
|
||||
String a = ContactEncoder.a(charSequence.toString());
|
||||
List<Map<String, Set<String>>> list = this.a;
|
||||
return a(a, (list == null || list.size() <= i) ? null : this.a.get(i));
|
||||
}
|
||||
|
||||
private static CharSequence a(CharSequence charSequence, Map<String, Set<String>> map) {
|
||||
if (map == null || map.isEmpty()) {
|
||||
return charSequence;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Iterator<Map.Entry<String, Set<String>>> it = map.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Set<String> value = it.next().getValue();
|
||||
if (value != null && !value.isEmpty()) {
|
||||
Iterator<String> it2 = value.iterator();
|
||||
sb.append(it2.next());
|
||||
while (it2.hasNext()) {
|
||||
sb.append(',');
|
||||
sb.append(it2.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
sb.append(' ');
|
||||
}
|
||||
sb.append(charSequence);
|
||||
return sb;
|
||||
}
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package com.google.zxing.client.android.history;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DBHelper extends SQLiteOpenHelper {
|
||||
DBHelper(Context context) {
|
||||
super(context, "barcode_scanner_history.db", (SQLiteDatabase.CursorFactory) null, 5);
|
||||
}
|
||||
|
||||
@Override // android.database.sqlite.SQLiteOpenHelper
|
||||
public void onCreate(SQLiteDatabase sQLiteDatabase) {
|
||||
sQLiteDatabase.execSQL("CREATE TABLE history (id INTEGER PRIMARY KEY, text TEXT, format TEXT, display TEXT, timestamp INTEGER, details TEXT);");
|
||||
}
|
||||
|
||||
@Override // android.database.sqlite.SQLiteOpenHelper
|
||||
public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
|
||||
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS history");
|
||||
onCreate(sQLiteDatabase);
|
||||
}
|
||||
}
|
@@ -0,0 +1,138 @@
|
||||
package com.google.zxing.client.android.history;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ListActivity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import com.google.zxing.client.android.CaptureActivity;
|
||||
import com.google.zxing.client.android.R$id;
|
||||
import com.google.zxing.client.android.R$menu;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class HistoryActivity extends ListActivity {
|
||||
private static final String d = HistoryActivity.class.getSimpleName();
|
||||
private HistoryManager a;
|
||||
private ArrayAdapter<HistoryItem> b;
|
||||
private CharSequence c;
|
||||
|
||||
@Override // android.app.Activity
|
||||
public boolean onContextItemSelected(MenuItem menuItem) {
|
||||
this.a.b(menuItem.getItemId());
|
||||
a();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
this.a = new HistoryManager(this);
|
||||
this.b = new HistoryItemAdapter(this);
|
||||
setListAdapter(this.b);
|
||||
registerForContextMenu(getListView());
|
||||
this.c = getTitle();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.View.OnCreateContextMenuListener
|
||||
public void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) {
|
||||
int i = ((AdapterView.AdapterContextMenuInfo) contextMenuInfo).position;
|
||||
if (i >= this.b.getCount() || this.b.getItem(i).b() != null) {
|
||||
contextMenu.add(0, i, i, R$string.history_clear_one_history_text);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (this.a.d()) {
|
||||
getMenuInflater().inflate(R$menu.history, menu);
|
||||
}
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override // android.app.ListActivity
|
||||
protected void onListItemClick(ListView listView, View view, int i, long j) {
|
||||
if (this.b.getItem(i).b() != null) {
|
||||
Intent intent = new Intent(this, (Class<?>) CaptureActivity.class);
|
||||
intent.putExtra("ITEM_NUMBER", i);
|
||||
setResult(-1, intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public boolean onOptionsItemSelected(MenuItem menuItem) {
|
||||
int itemId = menuItem.getItemId();
|
||||
if (itemId == R$id.menu_history_send) {
|
||||
Uri c = HistoryManager.c(this.a.a().toString());
|
||||
if (c == null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(R$string.msg_unmount_usb);
|
||||
builder.setPositiveButton(R$string.button_ok, (DialogInterface.OnClickListener) null);
|
||||
builder.show();
|
||||
} else {
|
||||
Intent intent = new Intent("android.intent.action.SEND", Uri.parse("mailto:"));
|
||||
intent.addFlags(524288);
|
||||
String string = getResources().getString(R$string.history_email_title);
|
||||
intent.putExtra("android.intent.extra.SUBJECT", string);
|
||||
intent.putExtra("android.intent.extra.TEXT", string);
|
||||
intent.putExtra("android.intent.extra.STREAM", c);
|
||||
intent.setType("text/csv");
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.w(d, e.toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (itemId != R$id.menu_history_clear_text) {
|
||||
return super.onOptionsItemSelected(menuItem);
|
||||
}
|
||||
AlertDialog.Builder builder2 = new AlertDialog.Builder(this);
|
||||
builder2.setMessage(R$string.msg_sure);
|
||||
builder2.setCancelable(true);
|
||||
builder2.setPositiveButton(R$string.button_ok, new DialogInterface.OnClickListener() { // from class: com.google.zxing.client.android.history.HistoryActivity.1
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
HistoryActivity.this.a.c();
|
||||
dialogInterface.dismiss();
|
||||
HistoryActivity.this.finish();
|
||||
}
|
||||
});
|
||||
builder2.setNegativeButton(R$string.button_cancel, (DialogInterface.OnClickListener) null);
|
||||
builder2.show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
a();
|
||||
}
|
||||
|
||||
private void a() {
|
||||
List<HistoryItem> b = this.a.b();
|
||||
this.b.clear();
|
||||
Iterator<T> it = b.iterator();
|
||||
while (it.hasNext()) {
|
||||
this.b.add((HistoryItem) it.next());
|
||||
}
|
||||
setTitle(((Object) this.c) + " (" + this.b.getCount() + ')');
|
||||
if (this.b.isEmpty()) {
|
||||
this.b.add(new HistoryItem(null, null, null));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.google.zxing.client.android.history;
|
||||
|
||||
import com.google.zxing.Result;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class HistoryItem {
|
||||
private final Result a;
|
||||
private final String b;
|
||||
private final String c;
|
||||
|
||||
HistoryItem(Result result, String str, String str2) {
|
||||
this.a = result;
|
||||
this.b = str;
|
||||
this.c = str2;
|
||||
}
|
||||
|
||||
public String a() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String str = this.b;
|
||||
if (str == null || str.isEmpty()) {
|
||||
sb.append(this.a.e());
|
||||
} else {
|
||||
sb.append(this.b);
|
||||
}
|
||||
String str2 = this.c;
|
||||
if (str2 != null && !str2.isEmpty()) {
|
||||
sb.append(" : ");
|
||||
sb.append(this.c);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Result b() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
package com.google.zxing.client.android.history;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.android.R$id;
|
||||
import com.google.zxing.client.android.R$layout;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class HistoryItemAdapter extends ArrayAdapter<HistoryItem> {
|
||||
private final Context a;
|
||||
|
||||
HistoryItemAdapter(Context context) {
|
||||
super(context, R$layout.history_list_item, new ArrayList());
|
||||
this.a = context;
|
||||
}
|
||||
|
||||
@Override // android.widget.ArrayAdapter, android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
String string;
|
||||
String string2;
|
||||
if (!(view instanceof LinearLayout)) {
|
||||
view = LayoutInflater.from(this.a).inflate(R$layout.history_list_item, viewGroup, false);
|
||||
}
|
||||
HistoryItem item = getItem(i);
|
||||
Result b = item.b();
|
||||
if (b != null) {
|
||||
string = b.e();
|
||||
string2 = item.a();
|
||||
} else {
|
||||
Resources resources = getContext().getResources();
|
||||
string = resources.getString(R$string.history_empty);
|
||||
string2 = resources.getString(R$string.history_empty_detail);
|
||||
}
|
||||
((TextView) view.findViewById(R$id.history_title)).setText(string);
|
||||
((TextView) view.findViewById(R$id.history_detail)).setText(string2);
|
||||
return view;
|
||||
}
|
||||
}
|
@@ -0,0 +1,358 @@
|
||||
package com.google.zxing.client.android.history;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.database.CursorIndexOutOfBoundsException;
|
||||
import android.database.SQLException;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.android.result.ResultHandler;
|
||||
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class HistoryManager {
|
||||
private static final String c = "HistoryManager";
|
||||
private static final String[] d = {"text", "display", "format", "timestamp", "details"};
|
||||
private static final String[] e = {"COUNT(1)"};
|
||||
private static final String[] f = {JockstickDataConverter.ID};
|
||||
private static final String[] g = {JockstickDataConverter.ID, "details"};
|
||||
private static final Pattern h = Pattern.compile("\"", 16);
|
||||
private final Activity a;
|
||||
private final boolean b;
|
||||
|
||||
public HistoryManager(Activity activity) {
|
||||
this.a = activity;
|
||||
this.b = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean("preferences_history", true);
|
||||
}
|
||||
|
||||
public HistoryItem a(int i) {
|
||||
SQLiteDatabase readableDatabase = new DBHelper(this.a).getReadableDatabase();
|
||||
try {
|
||||
Cursor query = readableDatabase.query("history", d, null, null, null, null, "timestamp DESC");
|
||||
try {
|
||||
query.move(i + 1);
|
||||
String string = query.getString(0);
|
||||
String string2 = query.getString(1);
|
||||
String string3 = query.getString(2);
|
||||
long j = query.getLong(3);
|
||||
HistoryItem historyItem = new HistoryItem(new Result(string, null, null, BarcodeFormat.valueOf(string3), j), string2, query.getString(4));
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
if (readableDatabase != null) {
|
||||
readableDatabase.close();
|
||||
}
|
||||
return historyItem;
|
||||
} finally {
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
try {
|
||||
throw th;
|
||||
} catch (Throwable th2) {
|
||||
if (readableDatabase != null) {
|
||||
try {
|
||||
readableDatabase.close();
|
||||
} catch (Throwable th3) {
|
||||
th.addSuppressed(th3);
|
||||
}
|
||||
}
|
||||
throw th2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<HistoryItem> b() {
|
||||
DBHelper dBHelper = new DBHelper(this.a);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
try {
|
||||
SQLiteDatabase readableDatabase = dBHelper.getReadableDatabase();
|
||||
try {
|
||||
Cursor query = readableDatabase.query("history", d, null, null, null, null, "timestamp DESC");
|
||||
while (query.moveToNext()) {
|
||||
try {
|
||||
String string = query.getString(0);
|
||||
String string2 = query.getString(1);
|
||||
String string3 = query.getString(2);
|
||||
long j = query.getLong(3);
|
||||
arrayList.add(new HistoryItem(new Result(string, null, null, BarcodeFormat.valueOf(string3), j), string2, query.getString(4)));
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
if (readableDatabase != null) {
|
||||
readableDatabase.close();
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} catch (CursorIndexOutOfBoundsException e2) {
|
||||
Log.w(c, e2);
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
void c() {
|
||||
try {
|
||||
SQLiteDatabase writableDatabase = new DBHelper(this.a).getWritableDatabase();
|
||||
try {
|
||||
writableDatabase.delete("history", null, null);
|
||||
if (writableDatabase != null) {
|
||||
writableDatabase.close();
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} catch (SQLException e2) {
|
||||
Log.w(c, e2);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
try {
|
||||
SQLiteDatabase readableDatabase = new DBHelper(this.a).getReadableDatabase();
|
||||
try {
|
||||
Cursor query = readableDatabase.query("history", e, null, null, null, null, null);
|
||||
try {
|
||||
query.moveToFirst();
|
||||
boolean z = query.getInt(0) > 0;
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
if (readableDatabase != null) {
|
||||
readableDatabase.close();
|
||||
}
|
||||
return z;
|
||||
} finally {
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} catch (SQLException e2) {
|
||||
Log.w(c, e2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void e() {
|
||||
try {
|
||||
SQLiteDatabase writableDatabase = new DBHelper(this.a).getWritableDatabase();
|
||||
try {
|
||||
Cursor query = writableDatabase.query("history", f, null, null, null, null, "timestamp DESC");
|
||||
try {
|
||||
query.move(2000);
|
||||
while (query.moveToNext()) {
|
||||
String string = query.getString(0);
|
||||
Log.i(c, "Deleting scan history ID " + string);
|
||||
writableDatabase.delete("history", "id=" + string, null);
|
||||
}
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
if (writableDatabase != null) {
|
||||
writableDatabase.close();
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} catch (SQLException e2) {
|
||||
Log.w(c, e2);
|
||||
}
|
||||
}
|
||||
|
||||
static Uri c(String str) {
|
||||
File file = new File(new File(Environment.getExternalStorageDirectory(), "BarcodeScanner"), "History");
|
||||
if (!file.mkdirs() && !file.isDirectory()) {
|
||||
Log.w(c, "Couldn't make dir " + file);
|
||||
return null;
|
||||
}
|
||||
File file2 = new File(file, "history-" + System.currentTimeMillis() + ".csv");
|
||||
try {
|
||||
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream(file2), StandardCharsets.UTF_8);
|
||||
try {
|
||||
outputStreamWriter.write(str);
|
||||
outputStreamWriter.close();
|
||||
Uri parse = Uri.parse("file://" + file2.getAbsolutePath());
|
||||
outputStreamWriter.close();
|
||||
return parse;
|
||||
} finally {
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
Log.w(c, "Couldn't access file " + file2 + " due to " + e2);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Result result, ResultHandler resultHandler) {
|
||||
if (!this.a.getIntent().getBooleanExtra("SAVE_HISTORY", true) || resultHandler.a() || !this.b) {
|
||||
return;
|
||||
}
|
||||
if (!PreferenceManager.getDefaultSharedPreferences(this.a).getBoolean("preferences_remember_duplicates", false)) {
|
||||
a(result.e());
|
||||
}
|
||||
ContentValues contentValues = new ContentValues();
|
||||
contentValues.put("text", result.e());
|
||||
contentValues.put("format", result.a().toString());
|
||||
contentValues.put("display", resultHandler.e().toString());
|
||||
contentValues.put("timestamp", Long.valueOf(System.currentTimeMillis()));
|
||||
try {
|
||||
SQLiteDatabase writableDatabase = new DBHelper(this.a).getWritableDatabase();
|
||||
try {
|
||||
writableDatabase.insert("history", "timestamp", contentValues);
|
||||
if (writableDatabase != null) {
|
||||
writableDatabase.close();
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} catch (SQLException e2) {
|
||||
Log.w(c, e2);
|
||||
}
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
try {
|
||||
SQLiteDatabase writableDatabase = new DBHelper(this.a).getWritableDatabase();
|
||||
try {
|
||||
Cursor query = writableDatabase.query("history", f, null, null, null, null, "timestamp DESC");
|
||||
try {
|
||||
query.move(i + 1);
|
||||
writableDatabase.delete("history", "id=" + query.getString(0), null);
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
if (writableDatabase != null) {
|
||||
writableDatabase.close();
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} catch (SQLException e2) {
|
||||
Log.w(c, e2);
|
||||
}
|
||||
}
|
||||
|
||||
private static String b(String str) {
|
||||
return str == null ? "" : h.matcher(str).replaceAll("\"\"");
|
||||
}
|
||||
|
||||
public void a(String str, String str2) {
|
||||
String str3;
|
||||
String str4;
|
||||
try {
|
||||
SQLiteDatabase writableDatabase = new DBHelper(this.a).getWritableDatabase();
|
||||
try {
|
||||
Cursor query = writableDatabase.query("history", g, "text=?", new String[]{str}, null, null, "timestamp DESC", "1");
|
||||
try {
|
||||
if (query.moveToNext()) {
|
||||
str3 = query.getString(0);
|
||||
str4 = query.getString(1);
|
||||
} else {
|
||||
str3 = null;
|
||||
str4 = null;
|
||||
}
|
||||
if (str3 != null) {
|
||||
if (str4 != null) {
|
||||
if (str4.contains(str2)) {
|
||||
str2 = null;
|
||||
} else {
|
||||
str2 = str4 + " : " + str2;
|
||||
}
|
||||
}
|
||||
if (str2 != null) {
|
||||
ContentValues contentValues = new ContentValues();
|
||||
contentValues.put("details", str2);
|
||||
writableDatabase.update("history", contentValues, "id=?", new String[]{str3});
|
||||
}
|
||||
}
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
if (writableDatabase != null) {
|
||||
writableDatabase.close();
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} catch (SQLException e2) {
|
||||
Log.w(c, e2);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(String str) {
|
||||
try {
|
||||
SQLiteDatabase writableDatabase = new DBHelper(this.a).getWritableDatabase();
|
||||
try {
|
||||
writableDatabase.delete("history", "text=?", new String[]{str});
|
||||
if (writableDatabase != null) {
|
||||
writableDatabase.close();
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} catch (SQLException e2) {
|
||||
Log.w(c, e2);
|
||||
}
|
||||
}
|
||||
|
||||
CharSequence a() {
|
||||
SQLiteDatabase readableDatabase;
|
||||
Cursor query;
|
||||
StringBuilder sb = new StringBuilder(1000);
|
||||
try {
|
||||
readableDatabase = new DBHelper(this.a).getReadableDatabase();
|
||||
try {
|
||||
query = readableDatabase.query("history", d, null, null, null, null, "timestamp DESC");
|
||||
} finally {
|
||||
}
|
||||
} catch (SQLException e2) {
|
||||
Log.w(c, e2);
|
||||
}
|
||||
try {
|
||||
DateFormat dateTimeInstance = DateFormat.getDateTimeInstance(2, 2);
|
||||
while (query.moveToNext()) {
|
||||
sb.append('\"');
|
||||
sb.append(b(query.getString(0)));
|
||||
sb.append("\",");
|
||||
sb.append('\"');
|
||||
sb.append(b(query.getString(1)));
|
||||
sb.append("\",");
|
||||
sb.append('\"');
|
||||
sb.append(b(query.getString(2)));
|
||||
sb.append("\",");
|
||||
sb.append('\"');
|
||||
sb.append(b(query.getString(3)));
|
||||
sb.append("\",");
|
||||
long j = query.getLong(3);
|
||||
sb.append('\"');
|
||||
sb.append(b(dateTimeInstance.format(Long.valueOf(j))));
|
||||
sb.append("\",");
|
||||
sb.append('\"');
|
||||
sb.append(b(query.getString(4)));
|
||||
sb.append("\"\r\n");
|
||||
}
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
if (readableDatabase != null) {
|
||||
readableDatabase.close();
|
||||
}
|
||||
return sb;
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,153 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.StyleSpan;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.result.AddressBookParsedResult;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class AddressBookResultHandler extends ResultHandler {
|
||||
private static final DateFormat[] n = {new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH), new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.ENGLISH), new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH), new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH)};
|
||||
private static final int[] o;
|
||||
private final boolean[] l;
|
||||
private int m;
|
||||
|
||||
static {
|
||||
for (DateFormat dateFormat : n) {
|
||||
dateFormat.setLenient(false);
|
||||
}
|
||||
o = new int[]{R$string.button_add_contact, R$string.button_show_map, R$string.button_dial, R$string.button_email};
|
||||
}
|
||||
|
||||
public AddressBookResultHandler(Activity activity, ParsedResult parsedResult) {
|
||||
super(activity, parsedResult);
|
||||
AddressBookParsedResult addressBookParsedResult = (AddressBookParsedResult) parsedResult;
|
||||
String[] d = addressBookParsedResult.d();
|
||||
String[] n2 = addressBookParsedResult.n();
|
||||
String[] g = addressBookParsedResult.g();
|
||||
this.l = new boolean[4];
|
||||
boolean[] zArr = this.l;
|
||||
zArr[0] = true;
|
||||
zArr[1] = (d == null || d.length <= 0 || d[0] == null || d[0].isEmpty()) ? false : true;
|
||||
this.l[2] = n2 != null && n2.length > 0;
|
||||
this.l[3] = g != null && g.length > 0;
|
||||
this.m = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (this.l[i]) {
|
||||
this.m++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int c(int i) {
|
||||
if (i < this.m) {
|
||||
int i2 = -1;
|
||||
for (int i3 = 0; i3 < 4; i3++) {
|
||||
if (this.l[i3]) {
|
||||
i2++;
|
||||
}
|
||||
if (i2 == i) {
|
||||
return i3;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static long n(String str) {
|
||||
DateFormat[] dateFormatArr = n;
|
||||
for (int i = 0; i < dateFormatArr.length; i++) {
|
||||
try {
|
||||
return dateFormatArr[i].parse(str).getTime();
|
||||
} catch (ParseException unused) {
|
||||
}
|
||||
}
|
||||
return -1L;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int a(int i) {
|
||||
return o[c(i)];
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public void b(int i) {
|
||||
AddressBookParsedResult addressBookParsedResult = (AddressBookParsedResult) g();
|
||||
String[] d = addressBookParsedResult.d();
|
||||
String str = (d == null || d.length < 1) ? null : d[0];
|
||||
String[] c = addressBookParsedResult.c();
|
||||
String str2 = (c == null || c.length < 1) ? null : c[0];
|
||||
int c2 = c(i);
|
||||
if (c2 == 0) {
|
||||
a(addressBookParsedResult.j(), addressBookParsedResult.k(), addressBookParsedResult.p(), addressBookParsedResult.n(), addressBookParsedResult.o(), addressBookParsedResult.g(), addressBookParsedResult.f(), addressBookParsedResult.l(), addressBookParsedResult.i(), str, str2, addressBookParsedResult.m(), addressBookParsedResult.q(), addressBookParsedResult.r(), addressBookParsedResult.e(), addressBookParsedResult.h());
|
||||
return;
|
||||
}
|
||||
if (c2 == 1) {
|
||||
i(str);
|
||||
} else if (c2 == 2) {
|
||||
a(addressBookParsedResult.n()[0]);
|
||||
} else {
|
||||
if (c2 != 3) {
|
||||
return;
|
||||
}
|
||||
a(addressBookParsedResult.g(), null, null, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public CharSequence e() {
|
||||
AddressBookParsedResult addressBookParsedResult = (AddressBookParsedResult) g();
|
||||
StringBuilder sb = new StringBuilder(100);
|
||||
ParsedResult.a(addressBookParsedResult.j(), sb);
|
||||
int length = sb.length();
|
||||
String p = addressBookParsedResult.p();
|
||||
if (p != null && !p.isEmpty()) {
|
||||
sb.append("\n(");
|
||||
sb.append(p);
|
||||
sb.append(')');
|
||||
}
|
||||
ParsedResult.a(addressBookParsedResult.q(), sb);
|
||||
ParsedResult.a(addressBookParsedResult.m(), sb);
|
||||
ParsedResult.a(addressBookParsedResult.d(), sb);
|
||||
String[] n2 = addressBookParsedResult.n();
|
||||
if (n2 != null) {
|
||||
for (String str : n2) {
|
||||
if (str != null) {
|
||||
ParsedResult.a(ResultHandler.m(str), sb);
|
||||
}
|
||||
}
|
||||
}
|
||||
ParsedResult.a(addressBookParsedResult.g(), sb);
|
||||
ParsedResult.a(addressBookParsedResult.r(), sb);
|
||||
String e = addressBookParsedResult.e();
|
||||
if (e != null && !e.isEmpty()) {
|
||||
long n3 = n(e);
|
||||
if (n3 >= 0) {
|
||||
ParsedResult.a(DateFormat.getDateInstance(2).format(Long.valueOf(n3)), sb);
|
||||
}
|
||||
}
|
||||
ParsedResult.a(addressBookParsedResult.l(), sb);
|
||||
if (length <= 0) {
|
||||
return sb.toString();
|
||||
}
|
||||
SpannableString spannableString = new SpannableString(sb.toString());
|
||||
spannableString.setSpan(new StyleSpan(1), 0, length, 0);
|
||||
return spannableString;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int f() {
|
||||
return R$string.result_address_book;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int c() {
|
||||
return this.m;
|
||||
}
|
||||
}
|
@@ -0,0 +1,118 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.result.CalendarParsedResult;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
import com.tencent.open.SocialConstants;
|
||||
import java.text.DateFormat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class CalendarResultHandler extends ResultHandler {
|
||||
private static final String l = "CalendarResultHandler";
|
||||
private static final int[] m = {R$string.button_add_calendar};
|
||||
|
||||
public CalendarResultHandler(Activity activity, ParsedResult parsedResult) {
|
||||
super(activity, parsedResult);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int a(int i) {
|
||||
return m[i];
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public void b(int i) {
|
||||
String str;
|
||||
if (i == 0) {
|
||||
CalendarParsedResult calendarParsedResult = (CalendarParsedResult) g();
|
||||
String d = calendarParsedResult.d();
|
||||
String g = calendarParsedResult.g();
|
||||
if (g != null) {
|
||||
if (d == null) {
|
||||
str = g;
|
||||
a(calendarParsedResult.i(), calendarParsedResult.h(), calendarParsedResult.k(), calendarParsedResult.e(), calendarParsedResult.f(), str, calendarParsedResult.c());
|
||||
} else {
|
||||
d = d + '\n' + g;
|
||||
}
|
||||
}
|
||||
str = d;
|
||||
a(calendarParsedResult.i(), calendarParsedResult.h(), calendarParsedResult.k(), calendarParsedResult.e(), calendarParsedResult.f(), str, calendarParsedResult.c());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int c() {
|
||||
return m.length;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public CharSequence e() {
|
||||
CalendarParsedResult calendarParsedResult = (CalendarParsedResult) g();
|
||||
StringBuilder sb = new StringBuilder(100);
|
||||
ParsedResult.a(calendarParsedResult.i(), sb);
|
||||
long h = calendarParsedResult.h();
|
||||
ParsedResult.a(a(calendarParsedResult.k(), h), sb);
|
||||
long e = calendarParsedResult.e();
|
||||
if (e >= 0) {
|
||||
if (calendarParsedResult.j() && h != e) {
|
||||
e -= 86400000;
|
||||
}
|
||||
ParsedResult.a(a(calendarParsedResult.j(), e), sb);
|
||||
}
|
||||
ParsedResult.a(calendarParsedResult.f(), sb);
|
||||
ParsedResult.a(calendarParsedResult.g(), sb);
|
||||
ParsedResult.a(calendarParsedResult.c(), sb);
|
||||
ParsedResult.a(calendarParsedResult.d(), sb);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int f() {
|
||||
return R$string.result_calendar;
|
||||
}
|
||||
|
||||
private void a(String str, long j, boolean z, long j2, String str2, String str3, String[] strArr) {
|
||||
Intent intent = new Intent("android.intent.action.INSERT");
|
||||
intent.setType("vnd.android.cursor.item/event");
|
||||
intent.putExtra("beginTime", j);
|
||||
if (z) {
|
||||
intent.putExtra("allDay", true);
|
||||
}
|
||||
if (j2 >= 0) {
|
||||
j = j2;
|
||||
} else if (z) {
|
||||
j += 86400000;
|
||||
}
|
||||
intent.putExtra("endTime", j);
|
||||
intent.putExtra("title", str);
|
||||
intent.putExtra("eventLocation", str2);
|
||||
intent.putExtra(SocialConstants.PARAM_COMMENT, str3);
|
||||
if (strArr != null) {
|
||||
intent.putExtra("android.intent.extra.EMAIL", strArr);
|
||||
}
|
||||
try {
|
||||
b(intent);
|
||||
} catch (ActivityNotFoundException unused) {
|
||||
Log.w(l, "No calendar app available that responds to android.intent.action.INSERT");
|
||||
intent.setAction("android.intent.action.EDIT");
|
||||
a(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(boolean z, long j) {
|
||||
DateFormat dateTimeInstance;
|
||||
if (j < 0) {
|
||||
return null;
|
||||
}
|
||||
if (z) {
|
||||
dateTimeInstance = DateFormat.getDateInstance(2);
|
||||
} else {
|
||||
dateTimeInstance = DateFormat.getDateTimeInstance(2, 2);
|
||||
}
|
||||
return dateTimeInstance.format(Long.valueOf(j));
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.result.EmailAddressParsedResult;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class EmailAddressResultHandler extends ResultHandler {
|
||||
private static final int[] l = {R$string.button_email, R$string.button_add_contact};
|
||||
|
||||
public EmailAddressResultHandler(Activity activity, ParsedResult parsedResult) {
|
||||
super(activity, parsedResult);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int a(int i) {
|
||||
return l[i];
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public void b(int i) {
|
||||
EmailAddressParsedResult emailAddressParsedResult = (EmailAddressParsedResult) g();
|
||||
if (i == 0) {
|
||||
a(emailAddressParsedResult.g(), emailAddressParsedResult.e(), emailAddressParsedResult.c(), emailAddressParsedResult.f(), emailAddressParsedResult.d());
|
||||
} else {
|
||||
if (i != 1) {
|
||||
return;
|
||||
}
|
||||
a(emailAddressParsedResult.g(), (String[]) null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int c() {
|
||||
return l.length;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int f() {
|
||||
return R$string.result_email_address;
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.result.GeoParsedResult;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class GeoResultHandler extends ResultHandler {
|
||||
private static final int[] l = {R$string.button_show_map, R$string.button_get_directions};
|
||||
|
||||
public GeoResultHandler(Activity activity, ParsedResult parsedResult) {
|
||||
super(activity, parsedResult);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int a(int i) {
|
||||
return l[i];
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public void b(int i) {
|
||||
GeoParsedResult geoParsedResult = (GeoParsedResult) g();
|
||||
if (i == 0) {
|
||||
e(geoParsedResult.c());
|
||||
} else {
|
||||
if (i != 1) {
|
||||
return;
|
||||
}
|
||||
a(geoParsedResult.d(), geoParsedResult.e());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int c() {
|
||||
return l.length;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int f() {
|
||||
return R$string.result_geo;
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.result.ISBNParsedResult;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ISBNResultHandler extends ResultHandler {
|
||||
private static final int[] l = {R$string.button_product_search, R$string.button_book_search, R$string.button_search_book_contents, R$string.button_custom_product_search};
|
||||
|
||||
public ISBNResultHandler(Activity activity, ParsedResult parsedResult, Result result) {
|
||||
super(activity, parsedResult, result);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int a(int i) {
|
||||
return l[i];
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public void b(int i) {
|
||||
ISBNParsedResult iSBNParsedResult = (ISBNParsedResult) g();
|
||||
if (i == 0) {
|
||||
f(iSBNParsedResult.c());
|
||||
return;
|
||||
}
|
||||
if (i == 1) {
|
||||
d(iSBNParsedResult.c());
|
||||
} else if (i == 2) {
|
||||
h(iSBNParsedResult.c());
|
||||
} else {
|
||||
if (i != 3) {
|
||||
return;
|
||||
}
|
||||
g(c(iSBNParsedResult.c()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int c() {
|
||||
return i() ? l.length : l.length - 1;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int f() {
|
||||
return R$string.result_isbn;
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.result.ExpandedProductParsedResult;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
import com.google.zxing.client.result.ProductParsedResult;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ProductResultHandler extends ResultHandler {
|
||||
private static final int[] l = {R$string.button_product_search, R$string.button_web_search, R$string.button_custom_product_search};
|
||||
|
||||
public ProductResultHandler(Activity activity, ParsedResult parsedResult, Result result) {
|
||||
super(activity, parsedResult, result);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int a(int i) {
|
||||
return l[i];
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public void b(int i) {
|
||||
String a = a(g());
|
||||
if (i == 0) {
|
||||
f(a);
|
||||
} else if (i == 1) {
|
||||
l(a);
|
||||
} else {
|
||||
if (i != 2) {
|
||||
return;
|
||||
}
|
||||
g(c(a));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int c() {
|
||||
return i() ? l.length : l.length - 1;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int f() {
|
||||
return R$string.result_product;
|
||||
}
|
||||
|
||||
private static String a(ParsedResult parsedResult) {
|
||||
if (parsedResult instanceof ProductParsedResult) {
|
||||
return ((ProductParsedResult) parsedResult).c();
|
||||
}
|
||||
if (parsedResult instanceof ExpandedProductParsedResult) {
|
||||
return ((ExpandedProductParsedResult) parsedResult).c();
|
||||
}
|
||||
throw new IllegalArgumentException(parsedResult.getClass().toString());
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ResultButtonListener implements View.OnClickListener {
|
||||
private final ResultHandler a;
|
||||
private final int b;
|
||||
|
||||
public ResultButtonListener(ResultHandler resultHandler, int i) {
|
||||
this.a = resultHandler;
|
||||
this.b = i;
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
this.a.b(this.b);
|
||||
}
|
||||
}
|
@@ -0,0 +1,390 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ContentValues;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Parcelable;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.ContactsContract;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.util.Log;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.android.Contents;
|
||||
import com.google.zxing.client.android.LocaleManager;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.android.book.SearchBookContentsActivity;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
import com.google.zxing.client.result.ParsedResultType;
|
||||
import com.google.zxing.client.result.ResultParser;
|
||||
import com.ubt.jimu.blockly.command.BlocklyCommandController;
|
||||
import com.unity3d.ads.metadata.MediationMetaData;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class ResultHandler {
|
||||
private static final String e = "ResultHandler";
|
||||
private static final String[] f = {"home", "work", "mobile"};
|
||||
private static final String[] g = {"home", "work", "mobile", "fax", "pager", "main"};
|
||||
private static final String[] h = {"home", "work"};
|
||||
private static final int[] i = {1, 2, 4};
|
||||
private static final int[] j = {1, 3, 2, 4, 6, 12};
|
||||
private static final int[] k = {1, 2};
|
||||
private final ParsedResult a;
|
||||
private final Activity b;
|
||||
private final Result c;
|
||||
private final String d;
|
||||
|
||||
ResultHandler(Activity activity, ParsedResult parsedResult) {
|
||||
this(activity, parsedResult, null);
|
||||
}
|
||||
|
||||
static String m(String str) {
|
||||
return PhoneNumberUtils.formatNumber(str);
|
||||
}
|
||||
|
||||
private static int n(String str) {
|
||||
return a(str, h, k);
|
||||
}
|
||||
|
||||
private static int o(String str) {
|
||||
return a(str, f, i);
|
||||
}
|
||||
|
||||
private static int p(String str) {
|
||||
return a(str, g, j);
|
||||
}
|
||||
|
||||
public abstract int a(int i2);
|
||||
|
||||
final void a(String[] strArr, String[] strArr2) {
|
||||
a(null, null, null, null, null, strArr, strArr2, null, null, null, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Activity b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public abstract void b(int i2);
|
||||
|
||||
public abstract int c();
|
||||
|
||||
final String c(String str) {
|
||||
if (this.d == null) {
|
||||
return str;
|
||||
}
|
||||
try {
|
||||
str = URLEncoder.encode(str, "UTF-8");
|
||||
} catch (UnsupportedEncodingException unused) {
|
||||
}
|
||||
String str2 = this.d;
|
||||
Result result = this.c;
|
||||
if (result != null) {
|
||||
str2 = str2.replaceFirst("%f(?![0-9a-f])", result.a().toString());
|
||||
if (str2.contains("%t")) {
|
||||
str2 = str2.replace("%t", ResultParser.c(this.c).b().toString());
|
||||
}
|
||||
}
|
||||
return str2.replace("%s", str);
|
||||
}
|
||||
|
||||
public Integer d() {
|
||||
return null;
|
||||
}
|
||||
|
||||
final void d(String str) {
|
||||
a(new Intent("android.intent.action.VIEW", Uri.parse("http://books.google." + LocaleManager.a(this.b) + "/books?vid=isbn" + str)));
|
||||
}
|
||||
|
||||
public CharSequence e() {
|
||||
return this.a.a().replace("\r", "");
|
||||
}
|
||||
|
||||
public abstract int f();
|
||||
|
||||
final void f(String str) {
|
||||
a(new Intent("android.intent.action.VIEW", Uri.parse("http://www.google." + LocaleManager.d(this.b) + "/m/products?q=" + str + "&source=zxing")));
|
||||
}
|
||||
|
||||
public final ParsedResult g() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public final ParsedResultType h() {
|
||||
return this.a.b();
|
||||
}
|
||||
|
||||
final boolean i() {
|
||||
return this.d != null;
|
||||
}
|
||||
|
||||
final void j(String str) {
|
||||
a(null, null, null, null, str);
|
||||
}
|
||||
|
||||
final void k(String str) {
|
||||
b("smsto:", str);
|
||||
}
|
||||
|
||||
final void l(String str) {
|
||||
Intent intent = new Intent("android.intent.action.WEB_SEARCH");
|
||||
intent.putExtra(BlocklyCommandController.QUERY, str);
|
||||
a(intent);
|
||||
}
|
||||
|
||||
ResultHandler(Activity activity, ParsedResult parsedResult, Result result) {
|
||||
this.a = parsedResult;
|
||||
this.b = activity;
|
||||
this.c = result;
|
||||
this.d = j();
|
||||
}
|
||||
|
||||
private String j() {
|
||||
String string = PreferenceManager.getDefaultSharedPreferences(this.b).getString("preferences_custom_product_search", null);
|
||||
if (string == null || !string.trim().isEmpty()) {
|
||||
return string;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
final void a(String[] strArr, String[] strArr2, String str, String[] strArr3, String[] strArr4, String[] strArr5, String[] strArr6, String str2, String str3, String str4, String str5, String str6, String str7, String[] strArr7, String str8, String[] strArr8) {
|
||||
int n;
|
||||
int o;
|
||||
int p;
|
||||
Intent intent = new Intent("android.intent.action.INSERT_OR_EDIT", ContactsContract.Contacts.CONTENT_URI);
|
||||
intent.setType("vnd.android.cursor.item/contact");
|
||||
a(intent, MediationMetaData.KEY_NAME, (strArr == null || strArr.length <= 0) ? null : strArr[0]);
|
||||
a(intent, "phonetic_name", str);
|
||||
if (strArr3 != null) {
|
||||
int min = Math.min(strArr3.length, Contents.a.length);
|
||||
for (int i2 = 0; i2 < min; i2++) {
|
||||
a(intent, Contents.a[i2], strArr3[i2]);
|
||||
if (strArr4 != null && i2 < strArr4.length && (p = p(strArr4[i2])) >= 0) {
|
||||
intent.putExtra(Contents.b[i2], p);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strArr5 != null) {
|
||||
int min2 = Math.min(strArr5.length, Contents.c.length);
|
||||
for (int i3 = 0; i3 < min2; i3++) {
|
||||
a(intent, Contents.c[i3], strArr5[i3]);
|
||||
if (strArr6 != null && i3 < strArr6.length && (o = o(strArr6[i3])) >= 0) {
|
||||
intent.putExtra(Contents.d[i3], o);
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayList<? extends Parcelable> arrayList = new ArrayList<>();
|
||||
if (strArr7 != null) {
|
||||
int length = strArr7.length;
|
||||
int i4 = 0;
|
||||
while (true) {
|
||||
if (i4 >= length) {
|
||||
break;
|
||||
}
|
||||
String str9 = strArr7[i4];
|
||||
if (str9 != null && !str9.isEmpty()) {
|
||||
ContentValues contentValues = new ContentValues(2);
|
||||
contentValues.put("mimetype", "vnd.android.cursor.item/website");
|
||||
contentValues.put("data1", str9);
|
||||
arrayList.add(contentValues);
|
||||
break;
|
||||
}
|
||||
i4++;
|
||||
}
|
||||
}
|
||||
if (str8 != null) {
|
||||
ContentValues contentValues2 = new ContentValues(3);
|
||||
contentValues2.put("mimetype", "vnd.android.cursor.item/contact_event");
|
||||
contentValues2.put("data2", (Integer) 3);
|
||||
contentValues2.put("data1", str8);
|
||||
arrayList.add(contentValues2);
|
||||
}
|
||||
if (strArr2 != null) {
|
||||
int length2 = strArr2.length;
|
||||
int i5 = 0;
|
||||
while (true) {
|
||||
if (i5 >= length2) {
|
||||
break;
|
||||
}
|
||||
String str10 = strArr2[i5];
|
||||
if (str10 != null && !str10.isEmpty()) {
|
||||
ContentValues contentValues3 = new ContentValues(3);
|
||||
contentValues3.put("mimetype", "vnd.android.cursor.item/nickname");
|
||||
contentValues3.put("data2", (Integer) 1);
|
||||
contentValues3.put("data1", str10);
|
||||
arrayList.add(contentValues3);
|
||||
break;
|
||||
}
|
||||
i5++;
|
||||
}
|
||||
}
|
||||
if (!arrayList.isEmpty()) {
|
||||
intent.putParcelableArrayListExtra("data", arrayList);
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (str2 != null) {
|
||||
sb.append('\n');
|
||||
sb.append(str2);
|
||||
}
|
||||
if (strArr8 != null && strArr8.length >= 2) {
|
||||
sb.append('\n');
|
||||
sb.append(strArr8[0]);
|
||||
sb.append(',');
|
||||
sb.append(strArr8[1]);
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
a(intent, "notes", sb.substring(1));
|
||||
}
|
||||
if (str3 == null || !str3.startsWith("xmpp:")) {
|
||||
a(intent, "im_handle", str3);
|
||||
} else {
|
||||
intent.putExtra("im_protocol", 7);
|
||||
intent.putExtra("im_handle", str3.substring(5));
|
||||
}
|
||||
a(intent, "postal", str4);
|
||||
if (str5 != null && (n = n(str5)) >= 0) {
|
||||
intent.putExtra("postal_type", n);
|
||||
}
|
||||
a(intent, "company", str6);
|
||||
a(intent, "job_title", str7);
|
||||
a(intent);
|
||||
}
|
||||
|
||||
final void b(String[] strArr, String[] strArr2) {
|
||||
a(null, null, null, strArr, strArr2, null, null, null, null, null, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
final void g(String str) {
|
||||
if (str.startsWith("HTTP://")) {
|
||||
str = "http" + str.substring(4);
|
||||
} else if (str.startsWith("HTTPS://")) {
|
||||
str = "https" + str.substring(5);
|
||||
}
|
||||
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
|
||||
try {
|
||||
a(intent);
|
||||
} catch (ActivityNotFoundException unused) {
|
||||
Log.w(e, "Nothing available to handle " + intent);
|
||||
}
|
||||
}
|
||||
|
||||
final void h(String str) {
|
||||
Intent intent = new Intent("com.google.zxing.client.android.SEARCH_BOOK_CONTENTS");
|
||||
intent.setClassName(this.b, SearchBookContentsActivity.class.getName());
|
||||
a(intent, "ISBN", str);
|
||||
a(intent);
|
||||
}
|
||||
|
||||
final void i(String str) {
|
||||
a(new Intent("android.intent.action.VIEW", Uri.parse("geo:0,0?q=" + Uri.encode(str))));
|
||||
}
|
||||
|
||||
private void b(String str, String str2) {
|
||||
Intent intent = new Intent("android.intent.action.SENDTO", Uri.parse(str));
|
||||
a(intent, "sms_body", str2);
|
||||
intent.putExtra("compose_mode", true);
|
||||
a(intent);
|
||||
}
|
||||
|
||||
final void e(String str) {
|
||||
a(new Intent("android.intent.action.VIEW", Uri.parse(str)));
|
||||
}
|
||||
|
||||
private void b(String str, String str2, String str3) {
|
||||
Intent intent = new Intent("android.intent.action.SENDTO", Uri.parse(str));
|
||||
if (str2 != null && !str2.isEmpty()) {
|
||||
a(intent, "subject", str2);
|
||||
} else {
|
||||
a(intent, "subject", this.b.getString(R$string.msg_default_mms_subject));
|
||||
}
|
||||
a(intent, "sms_body", str3);
|
||||
intent.putExtra("compose_mode", true);
|
||||
a(intent);
|
||||
}
|
||||
|
||||
final void b(String str) {
|
||||
a(new Intent("android.intent.action.DIAL", Uri.parse(str)));
|
||||
}
|
||||
|
||||
final void b(Intent intent) {
|
||||
if (intent != null) {
|
||||
intent.addFlags(524288);
|
||||
this.b.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private static int a(String str, String[] strArr, int[] iArr) {
|
||||
if (str == null) {
|
||||
return -1;
|
||||
}
|
||||
for (int i2 = 0; i2 < strArr.length; i2++) {
|
||||
String str2 = strArr[i2];
|
||||
if (str.startsWith(str2) || str.startsWith(str2.toUpperCase(Locale.ENGLISH))) {
|
||||
return iArr[i2];
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
final void a(String[] strArr, String[] strArr2, String[] strArr3, String str, String str2) {
|
||||
Intent intent = new Intent("android.intent.action.SEND", Uri.parse("mailto:"));
|
||||
if (strArr != null && strArr.length != 0) {
|
||||
intent.putExtra("android.intent.extra.EMAIL", strArr);
|
||||
}
|
||||
if (strArr2 != null && strArr2.length != 0) {
|
||||
intent.putExtra("android.intent.extra.CC", strArr2);
|
||||
}
|
||||
if (strArr3 != null && strArr3.length != 0) {
|
||||
intent.putExtra("android.intent.extra.BCC", strArr3);
|
||||
}
|
||||
a(intent, "android.intent.extra.SUBJECT", str);
|
||||
a(intent, "android.intent.extra.TEXT", str2);
|
||||
intent.setType("text/plain");
|
||||
a(intent);
|
||||
}
|
||||
|
||||
final void a(String str, String str2) {
|
||||
b("smsto:" + str, str2);
|
||||
}
|
||||
|
||||
final void a(String str, String str2, String str3) {
|
||||
b("mmsto:" + str, str2, str3);
|
||||
}
|
||||
|
||||
final void a(String str) {
|
||||
a(new Intent("android.intent.action.DIAL", Uri.parse("tel:" + str)));
|
||||
}
|
||||
|
||||
final void a(double d, double d2) {
|
||||
a(new Intent("android.intent.action.VIEW", Uri.parse("http://maps.google." + LocaleManager.c(this.b) + "/maps?f=d&daddr=" + d + ',' + d2)));
|
||||
}
|
||||
|
||||
final void a(Intent intent) {
|
||||
try {
|
||||
b(intent);
|
||||
} catch (ActivityNotFoundException unused) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this.b);
|
||||
builder.setTitle(R$string.scan_name);
|
||||
builder.setMessage(R$string.msg_intent_failed);
|
||||
builder.setPositiveButton(R$string.button_ok, (DialogInterface.OnClickListener) null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(Intent intent, String str, String str2) {
|
||||
if (str2 == null || str2.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
intent.putExtra(str, str2);
|
||||
}
|
||||
}
|
@@ -0,0 +1,92 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.android.ICaptureView;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
import com.google.zxing.client.result.ParsedResultType;
|
||||
import com.google.zxing.client.result.ResultParser;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ResultHandlerFactory {
|
||||
|
||||
/* renamed from: com.google.zxing.client.android.result.ResultHandlerFactory$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] a = new int[ParsedResultType.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[ParsedResultType.ADDRESSBOOK.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[ParsedResultType.EMAIL_ADDRESS.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
try {
|
||||
a[ParsedResultType.PRODUCT.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
try {
|
||||
a[ParsedResultType.URI.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError unused4) {
|
||||
}
|
||||
try {
|
||||
a[ParsedResultType.WIFI.ordinal()] = 5;
|
||||
} catch (NoSuchFieldError unused5) {
|
||||
}
|
||||
try {
|
||||
a[ParsedResultType.GEO.ordinal()] = 6;
|
||||
} catch (NoSuchFieldError unused6) {
|
||||
}
|
||||
try {
|
||||
a[ParsedResultType.TEL.ordinal()] = 7;
|
||||
} catch (NoSuchFieldError unused7) {
|
||||
}
|
||||
try {
|
||||
a[ParsedResultType.SMS.ordinal()] = 8;
|
||||
} catch (NoSuchFieldError unused8) {
|
||||
}
|
||||
try {
|
||||
a[ParsedResultType.CALENDAR.ordinal()] = 9;
|
||||
} catch (NoSuchFieldError unused9) {
|
||||
}
|
||||
try {
|
||||
a[ParsedResultType.ISBN.ordinal()] = 10;
|
||||
} catch (NoSuchFieldError unused10) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ResultHandler a(Activity activity, ICaptureView iCaptureView, Result result) {
|
||||
ParsedResult a = a(result);
|
||||
switch (AnonymousClass1.a[a.b().ordinal()]) {
|
||||
case 1:
|
||||
return new AddressBookResultHandler(activity, a);
|
||||
case 2:
|
||||
return new EmailAddressResultHandler(activity, a);
|
||||
case 3:
|
||||
return new ProductResultHandler(activity, a, result);
|
||||
case 4:
|
||||
return new URIResultHandler(activity, a);
|
||||
case 5:
|
||||
return new WifiResultHandler(activity, iCaptureView, a);
|
||||
case 6:
|
||||
return new GeoResultHandler(activity, a);
|
||||
case 7:
|
||||
return new TelResultHandler(activity, a);
|
||||
case 8:
|
||||
return new SMSResultHandler(activity, a);
|
||||
case 9:
|
||||
return new CalendarResultHandler(activity, a);
|
||||
case 10:
|
||||
return new ISBNResultHandler(activity, a, result);
|
||||
default:
|
||||
return new TextResultHandler(activity, a, result);
|
||||
}
|
||||
}
|
||||
|
||||
private static ParsedResult a(Result result) {
|
||||
return ResultParser.c(result);
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
import com.google.zxing.client.result.SMSParsedResult;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class SMSResultHandler extends ResultHandler {
|
||||
private static final int[] l = {R$string.button_sms, R$string.button_mms};
|
||||
|
||||
public SMSResultHandler(Activity activity, ParsedResult parsedResult) {
|
||||
super(activity, parsedResult);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int a(int i) {
|
||||
return l[i];
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public void b(int i) {
|
||||
SMSParsedResult sMSParsedResult = (SMSParsedResult) g();
|
||||
String str = sMSParsedResult.d()[0];
|
||||
if (i == 0) {
|
||||
a(str, sMSParsedResult.c());
|
||||
} else {
|
||||
if (i != 1) {
|
||||
return;
|
||||
}
|
||||
a(str, sMSParsedResult.e(), sMSParsedResult.c());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int c() {
|
||||
return l.length;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public CharSequence e() {
|
||||
SMSParsedResult sMSParsedResult = (SMSParsedResult) g();
|
||||
String[] d = sMSParsedResult.d();
|
||||
String[] strArr = new String[d.length];
|
||||
for (int i = 0; i < d.length; i++) {
|
||||
strArr[i] = ResultHandler.m(d[i]);
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(50);
|
||||
ParsedResult.a(strArr, sb);
|
||||
ParsedResult.a(sMSParsedResult.e(), sb);
|
||||
ParsedResult.a(sMSParsedResult.c(), sb);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int f() {
|
||||
return R$string.result_sms;
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
import com.google.zxing.client.result.TelParsedResult;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class TelResultHandler extends ResultHandler {
|
||||
private static final int[] l = {R$string.button_dial, R$string.button_add_contact};
|
||||
|
||||
public TelResultHandler(Activity activity, ParsedResult parsedResult) {
|
||||
super(activity, parsedResult);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int a(int i) {
|
||||
return l[i];
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public void b(int i) {
|
||||
TelParsedResult telParsedResult = (TelParsedResult) g();
|
||||
if (i == 0) {
|
||||
b(telParsedResult.d());
|
||||
b().finish();
|
||||
} else {
|
||||
if (i != 1) {
|
||||
return;
|
||||
}
|
||||
b(new String[]{telParsedResult.c()}, (String[]) null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int c() {
|
||||
return l.length;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public CharSequence e() {
|
||||
return ResultHandler.m(g().a().replace("\r", ""));
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int f() {
|
||||
return R$string.result_tel;
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class TextResultHandler extends ResultHandler {
|
||||
private static final int[] l = {R$string.button_web_search, R$string.button_share_by_email, R$string.button_share_by_sms, R$string.button_custom_product_search};
|
||||
|
||||
public TextResultHandler(Activity activity, ParsedResult parsedResult, Result result) {
|
||||
super(activity, parsedResult, result);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int a(int i) {
|
||||
return l[i];
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public void b(int i) {
|
||||
String a = g().a();
|
||||
if (i == 0) {
|
||||
l(a);
|
||||
return;
|
||||
}
|
||||
if (i == 1) {
|
||||
j(a);
|
||||
} else if (i == 2) {
|
||||
k(a);
|
||||
} else {
|
||||
if (i != 3) {
|
||||
return;
|
||||
}
|
||||
g(c(a));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int c() {
|
||||
return i() ? l.length : l.length - 1;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int f() {
|
||||
return R$string.result_text;
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.google.zxing.client.android.LocaleManager;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
import com.google.zxing.client.result.URIParsedResult;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class URIResultHandler extends ResultHandler {
|
||||
private static final String[] l = {"otpauth:"};
|
||||
private static final int[] m = {R$string.button_open_browser, R$string.button_share_by_email, R$string.button_share_by_sms, R$string.button_search_book_contents};
|
||||
|
||||
public URIResultHandler(Activity activity, ParsedResult parsedResult) {
|
||||
super(activity, parsedResult);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int a(int i) {
|
||||
return m[i];
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public void b(int i) {
|
||||
String c = ((URIParsedResult) g()).c();
|
||||
if (i == 0) {
|
||||
g(c);
|
||||
return;
|
||||
}
|
||||
if (i == 1) {
|
||||
j(c);
|
||||
} else if (i == 2) {
|
||||
k(c);
|
||||
} else {
|
||||
if (i != 3) {
|
||||
return;
|
||||
}
|
||||
h(c);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int c() {
|
||||
return LocaleManager.a(((URIParsedResult) g()).c()) ? m.length : m.length - 1;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public Integer d() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int f() {
|
||||
return R$string.result_uri;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public boolean a() {
|
||||
String lowerCase = ((URIParsedResult) g()).c().toLowerCase(Locale.ENGLISH);
|
||||
for (String str : l) {
|
||||
if (lowerCase.startsWith(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package com.google.zxing.client.android.result;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
import com.google.zxing.client.android.ICaptureView;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.android.wifi.WifiConfigManager;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
import com.google.zxing.client.result.WifiParsedResult;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class WifiResultHandler extends ResultHandler {
|
||||
private static final String m = "WifiResultHandler";
|
||||
private final ICaptureView l;
|
||||
|
||||
public WifiResultHandler(Activity activity, ICaptureView iCaptureView, ParsedResult parsedResult) {
|
||||
super(activity, parsedResult);
|
||||
this.l = iCaptureView;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int a(int i) {
|
||||
return R$string.button_wifi;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public void b(int i) {
|
||||
if (i == 0) {
|
||||
WifiParsedResult wifiParsedResult = (WifiParsedResult) g();
|
||||
WifiManager wifiManager = (WifiManager) b().getApplicationContext().getSystemService("wifi");
|
||||
if (wifiManager == null) {
|
||||
Log.w(m, "No WifiManager available from device");
|
||||
return;
|
||||
}
|
||||
final Activity b = b();
|
||||
b.runOnUiThread(new Runnable(this) { // from class: com.google.zxing.client.android.result.WifiResultHandler.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
Toast.makeText(b.getApplicationContext(), R$string.wifi_changing_network, 0).show();
|
||||
}
|
||||
});
|
||||
new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiParsedResult);
|
||||
this.l.a(0L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int c() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public CharSequence e() {
|
||||
WifiParsedResult wifiParsedResult = (WifiParsedResult) g();
|
||||
return wifiParsedResult.i() + " (" + wifiParsedResult.f() + ')';
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.ResultHandler
|
||||
public int f() {
|
||||
return R$string.result_wifi;
|
||||
}
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
package com.google.zxing.client.android.result.supplement;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.client.android.HttpHelper;
|
||||
import com.google.zxing.client.android.LocaleManager;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.android.history.HistoryManager;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class BookResultInfoRetriever extends SupplementalInfoRetriever {
|
||||
private final String f;
|
||||
private final String g;
|
||||
private final Context h;
|
||||
|
||||
BookResultInfoRetriever(TextView textView, String str, HistoryManager historyManager, Context context) {
|
||||
super(textView, historyManager);
|
||||
this.f = str;
|
||||
this.g = context.getString(R$string.msg_google_books);
|
||||
this.h = context;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.supplement.SupplementalInfoRetriever
|
||||
void a() throws IOException {
|
||||
JSONObject jSONObject;
|
||||
ArrayList arrayList;
|
||||
CharSequence a = HttpHelper.a("https://www.googleapis.com/books/v1/volumes?q=isbn:" + this.f, HttpHelper.ContentType.JSON);
|
||||
if (a.length() == 0) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
JSONArray optJSONArray = ((JSONObject) new JSONTokener(a.toString()).nextValue()).optJSONArray("items");
|
||||
if (optJSONArray != null) {
|
||||
if (optJSONArray.isNull(0) || (jSONObject = ((JSONObject) optJSONArray.get(0)).getJSONObject("volumeInfo")) == null) {
|
||||
return;
|
||||
}
|
||||
String optString = jSONObject.optString("title");
|
||||
String optString2 = jSONObject.optString("pageCount");
|
||||
JSONArray optJSONArray2 = jSONObject.optJSONArray("authors");
|
||||
String str = null;
|
||||
if (optJSONArray2 == null || optJSONArray2.isNull(0)) {
|
||||
arrayList = null;
|
||||
} else {
|
||||
arrayList = new ArrayList(optJSONArray2.length());
|
||||
for (int i = 0; i < optJSONArray2.length(); i++) {
|
||||
arrayList.add(optJSONArray2.getString(i));
|
||||
}
|
||||
}
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
SupplementalInfoRetriever.a(optString, arrayList2);
|
||||
SupplementalInfoRetriever.a(arrayList, arrayList2);
|
||||
if (optString2 != null && !optString2.isEmpty()) {
|
||||
str = optString2 + "pp.";
|
||||
}
|
||||
SupplementalInfoRetriever.a(str, arrayList2);
|
||||
String str2 = "http://www.google." + LocaleManager.a(this.h) + "/search?tbm=bks&source=zxing&q=";
|
||||
a(this.f, this.g, (String[]) arrayList2.toArray(SupplementalInfoRetriever.e), str2 + this.f);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package com.google.zxing.client.android.result.supplement;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.client.android.HttpHelper;
|
||||
import com.google.zxing.client.android.LocaleManager;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.android.history.HistoryManager;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class ProductResultInfoRetriever extends SupplementalInfoRetriever {
|
||||
private static final Pattern[] i = {Pattern.compile(",event\\)\">([^<]+)</a></h3>.+<span class=psrp>([^<]+)</span>"), Pattern.compile("owb63p\">([^<]+).+zdi3pb\">([^<]+)")};
|
||||
private final String f;
|
||||
private final String g;
|
||||
private final Context h;
|
||||
|
||||
ProductResultInfoRetriever(TextView textView, String str, HistoryManager historyManager, Context context) {
|
||||
super(textView, historyManager);
|
||||
this.f = str;
|
||||
this.g = context.getString(R$string.msg_google_product);
|
||||
this.h = context;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.supplement.SupplementalInfoRetriever
|
||||
void a() throws IOException {
|
||||
String str = "https://www.google." + LocaleManager.d(this.h) + "/m/products?ie=utf8&oe=utf8&scoring=p&source=zxing&q=" + URLEncoder.encode(this.f, "UTF-8");
|
||||
CharSequence a = HttpHelper.a(str, HttpHelper.ContentType.HTML);
|
||||
for (Pattern pattern : i) {
|
||||
Matcher matcher = pattern.matcher(a);
|
||||
if (matcher.find()) {
|
||||
a(this.f, this.g, new String[]{a(matcher.group(1)), a(matcher.group(2))}, str);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(String str) {
|
||||
return Html.fromHtml(str).toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,139 @@
|
||||
package com.google.zxing.client.android.result.supplement;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.Log;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.client.android.history.HistoryManager;
|
||||
import com.google.zxing.client.result.ISBNParsedResult;
|
||||
import com.google.zxing.client.result.ParsedResult;
|
||||
import com.google.zxing.client.result.ProductParsedResult;
|
||||
import com.google.zxing.client.result.URIParsedResult;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class SupplementalInfoRetriever extends AsyncTask<Object, Object, Object> {
|
||||
static final String[] e = new String[0];
|
||||
private final WeakReference<TextView> a;
|
||||
private final WeakReference<HistoryManager> b;
|
||||
private final Collection<Spannable> c = new ArrayList();
|
||||
private final Collection<String[]> d = new ArrayList();
|
||||
|
||||
SupplementalInfoRetriever(TextView textView, HistoryManager historyManager) {
|
||||
this.a = new WeakReference<>(textView);
|
||||
this.b = new WeakReference<>(historyManager);
|
||||
}
|
||||
|
||||
public static void a(TextView textView, ParsedResult parsedResult, HistoryManager historyManager, Context context) {
|
||||
try {
|
||||
if (parsedResult instanceof URIParsedResult) {
|
||||
new URIResultInfoRetriever(textView, (URIParsedResult) parsedResult, historyManager, context).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Object[0]);
|
||||
new TitleRetriever(textView, (URIParsedResult) parsedResult, historyManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Object[0]);
|
||||
} else if (parsedResult instanceof ProductParsedResult) {
|
||||
new ProductResultInfoRetriever(textView, ((ProductParsedResult) parsedResult).d(), historyManager, context).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Object[0]);
|
||||
} else if (parsedResult instanceof ISBNParsedResult) {
|
||||
String c = ((ISBNParsedResult) parsedResult).c();
|
||||
new ProductResultInfoRetriever(textView, c, historyManager, context).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Object[0]);
|
||||
new BookResultInfoRetriever(textView, c, historyManager, context).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Object[0]);
|
||||
}
|
||||
} catch (RejectedExecutionException unused) {
|
||||
}
|
||||
}
|
||||
|
||||
abstract void a() throws IOException;
|
||||
|
||||
@Override // android.os.AsyncTask
|
||||
public final Object doInBackground(Object... objArr) {
|
||||
try {
|
||||
a();
|
||||
return null;
|
||||
} catch (IOException e2) {
|
||||
Log.w("SupplementalInfo", e2);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.os.AsyncTask
|
||||
protected final void onPostExecute(Object obj) {
|
||||
TextView textView = this.a.get();
|
||||
if (textView != null) {
|
||||
Iterator<Spannable> it = this.c.iterator();
|
||||
while (it.hasNext()) {
|
||||
textView.append(it.next());
|
||||
}
|
||||
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
HistoryManager historyManager = this.b.get();
|
||||
if (historyManager != null) {
|
||||
for (String[] strArr : this.d) {
|
||||
historyManager.a(strArr[0], strArr[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final void a(String str, String str2, String[] strArr, String str3) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (str2 != null) {
|
||||
sb.append(str2);
|
||||
sb.append(' ');
|
||||
}
|
||||
int length = sb.length();
|
||||
boolean z = true;
|
||||
for (String str4 : strArr) {
|
||||
if (z) {
|
||||
sb.append(str4);
|
||||
z = false;
|
||||
} else {
|
||||
sb.append(" [");
|
||||
sb.append(str4);
|
||||
sb.append(']');
|
||||
}
|
||||
}
|
||||
int length2 = sb.length();
|
||||
String sb2 = sb.toString();
|
||||
SpannableString spannableString = new SpannableString(sb2 + "\n\n");
|
||||
if (str3 != null) {
|
||||
if (str3.startsWith("HTTP://")) {
|
||||
str3 = "http" + str3.substring(4);
|
||||
} else if (str3.startsWith("HTTPS://")) {
|
||||
str3 = "https" + str3.substring(5);
|
||||
}
|
||||
spannableString.setSpan(new URLSpan(str3), length, length2, 33);
|
||||
}
|
||||
this.c.add(spannableString);
|
||||
this.d.add(new String[]{str, sb2});
|
||||
}
|
||||
|
||||
static void a(String str, Collection<String> collection) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
collection.add(str);
|
||||
}
|
||||
|
||||
static void a(Collection<String> collection, Collection<String> collection2) {
|
||||
if (collection == null || collection.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
boolean z = true;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String str : collection) {
|
||||
if (z) {
|
||||
z = false;
|
||||
} else {
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(str);
|
||||
}
|
||||
collection2.add(sb.toString());
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package com.google.zxing.client.android.result.supplement;
|
||||
|
||||
import android.text.Html;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.client.android.HttpHelper;
|
||||
import com.google.zxing.client.android.history.HistoryManager;
|
||||
import com.google.zxing.client.result.URIParsedResult;
|
||||
import com.ubt.jimu.base.util.FileUtil;
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class TitleRetriever extends SupplementalInfoRetriever {
|
||||
private static final Pattern g = Pattern.compile("<title>([^<]+)");
|
||||
private final String f;
|
||||
|
||||
TitleRetriever(TextView textView, URIParsedResult uRIParsedResult, HistoryManager historyManager) {
|
||||
super(textView, historyManager);
|
||||
this.f = uRIParsedResult.c();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.supplement.SupplementalInfoRetriever
|
||||
void a() {
|
||||
String group;
|
||||
try {
|
||||
CharSequence a = HttpHelper.a(this.f, HttpHelper.ContentType.HTML, FileUtil.ZIP_BUFFER_SIZE);
|
||||
if (a == null || a.length() <= 0) {
|
||||
return;
|
||||
}
|
||||
Matcher matcher = g.matcher(a);
|
||||
if (!matcher.find() || (group = matcher.group(1)) == null || group.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String obj = Html.fromHtml(group).toString();
|
||||
if (obj.length() > 100) {
|
||||
obj = obj.substring(0, 100) + "...";
|
||||
}
|
||||
String str = this.f;
|
||||
a(str, (String) null, new String[]{obj}, str);
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package com.google.zxing.client.android.result.supplement;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.client.android.HttpHelper;
|
||||
import com.google.zxing.client.android.R$string;
|
||||
import com.google.zxing.client.android.history.HistoryManager;
|
||||
import com.google.zxing.client.result.URIParsedResult;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class URIResultInfoRetriever extends SupplementalInfoRetriever {
|
||||
private final URIParsedResult f;
|
||||
private final String g;
|
||||
|
||||
URIResultInfoRetriever(TextView textView, URIParsedResult uRIParsedResult, HistoryManager historyManager, Context context) {
|
||||
super(textView, historyManager);
|
||||
this.g = context.getString(R$string.msg_redirect);
|
||||
this.f = uRIParsedResult;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.result.supplement.SupplementalInfoRetriever
|
||||
void a() throws IOException {
|
||||
try {
|
||||
URI uri = new URI(this.f.c());
|
||||
URI a = HttpHelper.a(uri);
|
||||
URI uri2 = uri;
|
||||
int i = 0;
|
||||
while (true) {
|
||||
int i2 = i + 1;
|
||||
if (i >= 5 || uri2.equals(a)) {
|
||||
return;
|
||||
}
|
||||
a(this.f.a(), (String) null, new String[]{this.g + " : " + a}, a.toString());
|
||||
uri2 = a;
|
||||
a = HttpHelper.a(a);
|
||||
i = i2;
|
||||
}
|
||||
} catch (URISyntaxException unused) {
|
||||
}
|
||||
}
|
||||
}
|
45
sources/com/google/zxing/client/android/share/AppInfo.java
Normal file
45
sources/com/google/zxing/client/android/share/AppInfo.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.google.zxing.client.android.share;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AppInfo implements Comparable<AppInfo> {
|
||||
private final String a;
|
||||
private final String b;
|
||||
private final Drawable c;
|
||||
|
||||
AppInfo(String str, String str2, Drawable drawable) {
|
||||
this.a = str;
|
||||
this.b = str2;
|
||||
this.c = drawable;
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public int compareTo(AppInfo appInfo) {
|
||||
return this.b.compareTo(appInfo.b);
|
||||
}
|
||||
|
||||
Drawable c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
String d() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof AppInfo) {
|
||||
return this.b.equals(((AppInfo) obj).b);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.b.hashCode();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package com.google.zxing.client.android.share;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.view.View;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class AppPickerActivity extends ListActivity {
|
||||
private AsyncTask<Object, Object, List<AppInfo>> a;
|
||||
|
||||
@Override // android.app.ListActivity
|
||||
protected void onListItemClick(ListView listView, View view, int i, long j) {
|
||||
ListAdapter listAdapter = getListAdapter();
|
||||
if (i < 0 || i >= listAdapter.getCount()) {
|
||||
setResult(0);
|
||||
} else {
|
||||
String d = ((AppInfo) listAdapter.getItem(i)).d();
|
||||
Intent intent = new Intent();
|
||||
intent.addFlags(524288);
|
||||
intent.putExtra("url", "market://details?id=" + d);
|
||||
setResult(-1, intent);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onPause() {
|
||||
AsyncTask<Object, Object, List<AppInfo>> asyncTask = this.a;
|
||||
if (asyncTask != null) {
|
||||
asyncTask.cancel(true);
|
||||
this.a = null;
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
this.a = new LoadPackagesAsyncTask(this);
|
||||
this.a.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Object[0]);
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
package com.google.zxing.client.android.share;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.client.android.R$id;
|
||||
import com.google.zxing.client.android.R$layout;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class BookmarkAdapter extends BaseAdapter {
|
||||
private final Context a;
|
||||
private final List<String[]> b;
|
||||
|
||||
BookmarkAdapter(Context context, List<String[]> list) {
|
||||
this.a = context;
|
||||
this.b = list;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getCount() {
|
||||
return this.b.size();
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public Object getItem(int i) {
|
||||
return this.b.get(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
if (!(view instanceof LinearLayout)) {
|
||||
view = LayoutInflater.from(this.a).inflate(R$layout.bookmark_picker_list_item, viewGroup, false);
|
||||
}
|
||||
String[] strArr = this.b.get(i);
|
||||
((TextView) view.findViewById(R$id.bookmark_title)).setText(strArr[0]);
|
||||
((TextView) view.findViewById(R$id.bookmark_url)).setText(strArr[1]);
|
||||
return view;
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
package com.google.zxing.client.android.share;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class BookmarkPickerActivity extends ListActivity {
|
||||
private static final String b = BookmarkPickerActivity.class.getSimpleName();
|
||||
private static final String[] c = {"title", "url"};
|
||||
private static final Uri d = Uri.parse("content://browser/bookmarks");
|
||||
private final List<String[]> a = new ArrayList();
|
||||
|
||||
@Override // android.app.ListActivity
|
||||
protected void onListItemClick(ListView listView, View view, int i, long j) {
|
||||
String[] strArr = this.a.get(i);
|
||||
Intent intent = new Intent();
|
||||
intent.addFlags(524288);
|
||||
intent.putExtra("title", strArr[0]);
|
||||
intent.putExtra("url", strArr[1]);
|
||||
setResult(-1, intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
this.a.clear();
|
||||
Cursor query = getContentResolver().query(d, c, "bookmark = 1 AND url IS NOT NULL", null, null);
|
||||
try {
|
||||
if (query == null) {
|
||||
Log.w(b, "No cursor returned for bookmark query");
|
||||
finish();
|
||||
if (query != null) {
|
||||
query.close();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
while (query.moveToNext()) {
|
||||
this.a.add(new String[]{query.getString(0), query.getString(1)});
|
||||
}
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
setListAdapter(new BookmarkAdapter(this, this.a));
|
||||
} catch (Throwable th) {
|
||||
try {
|
||||
throw th;
|
||||
} catch (Throwable th2) {
|
||||
if (query != null) {
|
||||
try {
|
||||
query.close();
|
||||
} catch (Throwable th3) {
|
||||
th.addSuppressed(th3);
|
||||
}
|
||||
}
|
||||
throw th2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,80 @@
|
||||
package com.google.zxing.client.android.share;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.content.pm.PackageItemInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import com.google.zxing.client.android.R$id;
|
||||
import com.google.zxing.client.android.R$layout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class LoadPackagesAsyncTask extends AsyncTask<Object, Object, List<AppInfo>> {
|
||||
private static final String[] b = {"com.google.android.apps."};
|
||||
private static final String[] c = {"com.android.", "android", "com.google.android.", "com.htc"};
|
||||
private final ListActivity a;
|
||||
|
||||
LoadPackagesAsyncTask(ListActivity listActivity) {
|
||||
this.a = listActivity;
|
||||
}
|
||||
|
||||
private static boolean a(String str) {
|
||||
if (str == null) {
|
||||
return true;
|
||||
}
|
||||
for (String str2 : b) {
|
||||
if (str.startsWith(str2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (String str3 : c) {
|
||||
if (str.startsWith(str3)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.os.AsyncTask
|
||||
public List<AppInfo> doInBackground(Object... objArr) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
PackageManager packageManager = this.a.getPackageManager();
|
||||
for (PackageItemInfo packageItemInfo : packageManager.getInstalledApplications(0)) {
|
||||
String str = packageItemInfo.packageName;
|
||||
if (!a(str)) {
|
||||
CharSequence loadLabel = packageItemInfo.loadLabel(packageManager);
|
||||
Drawable loadIcon = packageItemInfo.loadIcon(packageManager);
|
||||
if (loadLabel != null) {
|
||||
arrayList.add(new AppInfo(str, loadLabel.toString(), loadIcon));
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(arrayList);
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.os.AsyncTask
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onPostExecute(final List<AppInfo> list) {
|
||||
this.a.setListAdapter(new ArrayAdapter<AppInfo>(this, this.a, R$layout.app_picker_list_item, R$id.app_picker_list_item_label, list) { // from class: com.google.zxing.client.android.share.LoadPackagesAsyncTask.1
|
||||
@Override // android.widget.ArrayAdapter, android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
View view2 = super.getView(i, view, viewGroup);
|
||||
Drawable c2 = ((AppInfo) list.get(i)).c();
|
||||
if (c2 != null) {
|
||||
((ImageView) view2.findViewById(R$id.app_picker_list_item_icon)).setImageDrawable(c2);
|
||||
}
|
||||
return view2;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
254
sources/com/google/zxing/client/android/share/ShareActivity.java
Normal file
254
sources/com/google/zxing/client/android/share/ShareActivity.java
Normal file
@@ -0,0 +1,254 @@
|
||||
package com.google.zxing.client.android.share;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.client.android.Contents;
|
||||
import com.google.zxing.client.android.R$id;
|
||||
import com.google.zxing.client.android.R$layout;
|
||||
import com.google.zxing.client.android.clipboard.ClipboardInterface;
|
||||
import com.liulishuo.filedownloader.model.FileDownloadModel;
|
||||
import com.unity3d.ads.metadata.MediationMetaData;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ShareActivity extends Activity {
|
||||
private View a;
|
||||
private final View.OnClickListener b = new View.OnClickListener() { // from class: com.google.zxing.client.android.share.ShareActivity.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent("android.intent.action.PICK", ContactsContract.Contacts.CONTENT_URI);
|
||||
intent.addFlags(524288);
|
||||
ShareActivity.this.startActivityForResult(intent, 1);
|
||||
}
|
||||
};
|
||||
private final View.OnClickListener c = new View.OnClickListener() { // from class: com.google.zxing.client.android.share.ShareActivity.2
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent("android.intent.action.PICK");
|
||||
intent.addFlags(524288);
|
||||
intent.setClassName(ShareActivity.this, BookmarkPickerActivity.class.getName());
|
||||
ShareActivity.this.startActivityForResult(intent, 0);
|
||||
}
|
||||
};
|
||||
private final View.OnClickListener d = new View.OnClickListener() { // from class: com.google.zxing.client.android.share.ShareActivity.3
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent("android.intent.action.PICK");
|
||||
intent.addFlags(524288);
|
||||
intent.setClassName(ShareActivity.this, AppPickerActivity.class.getName());
|
||||
ShareActivity.this.startActivityForResult(intent, 2);
|
||||
}
|
||||
};
|
||||
private final View.OnClickListener e = new View.OnClickListener() { // from class: com.google.zxing.client.android.share.ShareActivity.4
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
CharSequence b = ClipboardInterface.b(ShareActivity.this);
|
||||
if (b != null) {
|
||||
ShareActivity.this.a(b.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
private final View.OnKeyListener f = new View.OnKeyListener() { // from class: com.google.zxing.client.android.share.ShareActivity.5
|
||||
@Override // android.view.View.OnKeyListener
|
||||
public boolean onKey(View view, int i, KeyEvent keyEvent) {
|
||||
if (i != 66 || keyEvent.getAction() != 0) {
|
||||
return false;
|
||||
}
|
||||
String charSequence = ((TextView) view).getText().toString();
|
||||
if (charSequence == null || charSequence.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
ShareActivity.this.a(charSequence);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
private static String b(String str) {
|
||||
if (str.indexOf(10) >= 0) {
|
||||
str = str.replace("\n", " ");
|
||||
}
|
||||
return str.indexOf(13) >= 0 ? str.replace("\r", " ") : str;
|
||||
}
|
||||
|
||||
private void c(String str) {
|
||||
if (str == null) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent("com.google.zxing.client.android.ENCODE");
|
||||
intent.addFlags(524288);
|
||||
intent.putExtra("ENCODE_TYPE", "TEXT_TYPE");
|
||||
intent.putExtra("ENCODE_DATA", str);
|
||||
intent.putExtra("ENCODE_FORMAT", BarcodeFormat.QR_CODE.toString());
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onActivityResult(int i, int i2, Intent intent) {
|
||||
if (i2 == -1) {
|
||||
if (i != 0) {
|
||||
if (i == 1) {
|
||||
a(intent.getData());
|
||||
return;
|
||||
} else if (i != 2) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
c(intent.getStringExtra("url"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R$layout.share);
|
||||
findViewById(R$id.share_contact_button).setOnClickListener(this.b);
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
findViewById(R$id.share_bookmark_button).setEnabled(false);
|
||||
} else {
|
||||
findViewById(R$id.share_bookmark_button).setOnClickListener(this.c);
|
||||
}
|
||||
findViewById(R$id.share_app_button).setOnClickListener(this.d);
|
||||
this.a = findViewById(R$id.share_clipboard_button);
|
||||
this.a.setOnClickListener(this.e);
|
||||
findViewById(R$id.share_text_view).setOnKeyListener(this.f);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
this.a.setEnabled(ClipboardInterface.c(this));
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a(String str) {
|
||||
Intent intent = new Intent("com.google.zxing.client.android.ENCODE");
|
||||
intent.addFlags(524288);
|
||||
intent.putExtra("ENCODE_TYPE", "TEXT_TYPE");
|
||||
intent.putExtra("ENCODE_DATA", str);
|
||||
intent.putExtra("ENCODE_FORMAT", BarcodeFormat.QR_CODE.toString());
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private void a(Uri uri) {
|
||||
String string;
|
||||
if (uri == null) {
|
||||
return;
|
||||
}
|
||||
ContentResolver contentResolver = getContentResolver();
|
||||
Cursor query = contentResolver.query(uri, null, null, null, null);
|
||||
if (query != null) {
|
||||
try {
|
||||
if (query.moveToFirst()) {
|
||||
String string2 = query.getString(query.getColumnIndex(FileDownloadModel.ID));
|
||||
String string3 = query.getString(query.getColumnIndex("display_name"));
|
||||
boolean z = query.getInt(query.getColumnIndex("has_phone_number")) > 0;
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
Bundle bundle = new Bundle();
|
||||
if (string3 != null && !string3.isEmpty()) {
|
||||
bundle.putString(MediationMetaData.KEY_NAME, b(string3));
|
||||
}
|
||||
if (z) {
|
||||
query = contentResolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, "contact_id=" + string2, null, null);
|
||||
if (query != null) {
|
||||
try {
|
||||
int columnIndex = query.getColumnIndex("data1");
|
||||
int columnIndex2 = query.getColumnIndex("data2");
|
||||
for (int i = 0; query.moveToNext() && i < Contents.a.length; i++) {
|
||||
String string4 = query.getString(columnIndex);
|
||||
if (string4 != null && !string4.isEmpty()) {
|
||||
bundle.putString(Contents.a[i], b(string4));
|
||||
}
|
||||
bundle.putInt(Contents.b[i], query.getInt(columnIndex2));
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
try {
|
||||
throw th;
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
}
|
||||
Cursor query2 = contentResolver.query(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_URI, null, "contact_id=" + string2, null, null);
|
||||
if (query2 != null) {
|
||||
try {
|
||||
if (query2.moveToNext() && (string = query2.getString(query2.getColumnIndex("data1"))) != null && !string.isEmpty()) {
|
||||
bundle.putString("postal", b(string));
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
try {
|
||||
throw th2;
|
||||
} finally {
|
||||
if (query2 != null) {
|
||||
try {
|
||||
query2.close();
|
||||
} catch (Throwable th3) {
|
||||
th2.addSuppressed(th3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (query2 != null) {
|
||||
query2.close();
|
||||
}
|
||||
query = contentResolver.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, "contact_id=" + string2, null, null);
|
||||
if (query != null) {
|
||||
try {
|
||||
int columnIndex3 = query.getColumnIndex("data1");
|
||||
for (int i2 = 0; query.moveToNext() && i2 < Contents.c.length; i2++) {
|
||||
String string5 = query.getString(columnIndex3);
|
||||
if (string5 != null && !string5.isEmpty()) {
|
||||
bundle.putString(Contents.c[i2], b(string5));
|
||||
}
|
||||
}
|
||||
} catch (Throwable th4) {
|
||||
try {
|
||||
throw th4;
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
Intent intent = new Intent("com.google.zxing.client.android.ENCODE");
|
||||
intent.addFlags(524288);
|
||||
intent.putExtra("ENCODE_TYPE", "CONTACT_TYPE");
|
||||
intent.putExtra("ENCODE_DATA", bundle);
|
||||
intent.putExtra("ENCODE_FORMAT", BarcodeFormat.QR_CODE.toString());
|
||||
startActivity(intent);
|
||||
return;
|
||||
}
|
||||
} catch (Throwable th42) {
|
||||
try {
|
||||
throw th42;
|
||||
} finally {
|
||||
if (query != null) {
|
||||
try {
|
||||
query.close();
|
||||
} catch (Throwable th5) {
|
||||
th42.addSuppressed(th5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package com.google.zxing.client.android.wifi;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
enum NetworkType {
|
||||
WEP,
|
||||
WPA,
|
||||
NO_PASSWORD,
|
||||
WPA2_EAP;
|
||||
|
||||
/* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
|
||||
static NetworkType a(String str) {
|
||||
if (str == null) {
|
||||
return NO_PASSWORD;
|
||||
}
|
||||
char c = 65535;
|
||||
switch (str.hashCode()) {
|
||||
case -1039816366:
|
||||
if (str.equals("nopass")) {
|
||||
c = 4;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 85826:
|
||||
if (str.equals("WEP")) {
|
||||
c = 3;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 86152:
|
||||
if (str.equals("WPA")) {
|
||||
c = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2670762:
|
||||
if (str.equals("WPA2")) {
|
||||
c = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1194974097:
|
||||
if (str.equals("WPA2-EAP")) {
|
||||
c = 2;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (c == 0 || c == 1) {
|
||||
return WPA;
|
||||
}
|
||||
if (c == 2) {
|
||||
return WPA2_EAP;
|
||||
}
|
||||
if (c == 3) {
|
||||
return WEP;
|
||||
}
|
||||
if (c == 4) {
|
||||
return NO_PASSWORD;
|
||||
}
|
||||
throw new IllegalArgumentException(str);
|
||||
}
|
||||
}
|
@@ -0,0 +1,337 @@
|
||||
package com.google.zxing.client.android.wifi;
|
||||
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import com.google.zxing.client.result.WifiParsedResult;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class WifiConfigManager extends AsyncTask<WifiParsedResult, Object, Object> {
|
||||
private static final String b = WifiConfigManager.class.getSimpleName();
|
||||
private static final Pattern c = Pattern.compile("[0-9A-Fa-f]+");
|
||||
private final WifiManager a;
|
||||
|
||||
/* renamed from: com.google.zxing.client.android.wifi.WifiConfigManager$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] a = new int[NetworkType.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[NetworkType.WEP.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[NetworkType.WPA.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
try {
|
||||
a[NetworkType.WPA2_EAP.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public WifiConfigManager(WifiManager wifiManager) {
|
||||
this.a = wifiManager;
|
||||
}
|
||||
|
||||
private static void b(WifiManager wifiManager, WifiParsedResult wifiParsedResult) {
|
||||
WifiConfiguration a = a(wifiParsedResult);
|
||||
a.wepKeys[0] = a(wifiParsedResult.g(), 10, 26, 58);
|
||||
a.wepTxKeyIndex = 0;
|
||||
a.allowedAuthAlgorithms.set(1);
|
||||
a.allowedKeyManagement.set(0);
|
||||
a.allowedGroupCiphers.set(2);
|
||||
a.allowedGroupCiphers.set(3);
|
||||
a.allowedGroupCiphers.set(0);
|
||||
a.allowedGroupCiphers.set(1);
|
||||
a(wifiManager, a);
|
||||
}
|
||||
|
||||
private static void c(WifiManager wifiManager, WifiParsedResult wifiParsedResult) {
|
||||
WifiConfiguration a = a(wifiParsedResult);
|
||||
a.preSharedKey = a(wifiParsedResult.g(), 64);
|
||||
a.allowedAuthAlgorithms.set(0);
|
||||
a.allowedProtocols.set(0);
|
||||
a.allowedProtocols.set(1);
|
||||
a.allowedKeyManagement.set(1);
|
||||
a.allowedKeyManagement.set(2);
|
||||
a.allowedPairwiseCiphers.set(1);
|
||||
a.allowedPairwiseCiphers.set(2);
|
||||
a.allowedGroupCiphers.set(2);
|
||||
a.allowedGroupCiphers.set(3);
|
||||
a(wifiManager, a);
|
||||
}
|
||||
|
||||
private static void d(WifiManager wifiManager, WifiParsedResult wifiParsedResult) {
|
||||
WifiConfiguration a = a(wifiParsedResult);
|
||||
a.preSharedKey = a(wifiParsedResult.g(), 64);
|
||||
a.allowedAuthAlgorithms.set(0);
|
||||
a.allowedProtocols.set(1);
|
||||
a.allowedKeyManagement.set(2);
|
||||
a.allowedPairwiseCiphers.set(1);
|
||||
a.allowedPairwiseCiphers.set(2);
|
||||
a.allowedGroupCiphers.set(2);
|
||||
a.allowedGroupCiphers.set(3);
|
||||
a.enterpriseConfig.setIdentity(wifiParsedResult.e());
|
||||
a.enterpriseConfig.setAnonymousIdentity(wifiParsedResult.c());
|
||||
a.enterpriseConfig.setPassword(wifiParsedResult.g());
|
||||
a.enterpriseConfig.setEapMethod(b(wifiParsedResult.d()));
|
||||
a.enterpriseConfig.setPhase2Method(c(wifiParsedResult.h()));
|
||||
a(wifiManager, a);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.os.AsyncTask
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public Object doInBackground(WifiParsedResult... wifiParsedResultArr) {
|
||||
int i = 0;
|
||||
WifiParsedResult wifiParsedResult = wifiParsedResultArr[0];
|
||||
if (!this.a.isWifiEnabled()) {
|
||||
Log.i(b, "Enabling wi-fi...");
|
||||
if (!this.a.setWifiEnabled(true)) {
|
||||
Log.w(b, "Wi-fi could not be enabled!");
|
||||
return null;
|
||||
}
|
||||
Log.i(b, "Wi-fi enabled");
|
||||
while (!this.a.isWifiEnabled()) {
|
||||
if (i >= 10) {
|
||||
Log.i(b, "Took too long to enable wi-fi, quitting");
|
||||
return null;
|
||||
}
|
||||
Log.i(b, "Still waiting for wi-fi to enable...");
|
||||
try {
|
||||
Thread.sleep(1000L);
|
||||
} catch (InterruptedException unused) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
try {
|
||||
NetworkType a = NetworkType.a(wifiParsedResult.f());
|
||||
if (a == NetworkType.NO_PASSWORD) {
|
||||
a(this.a, wifiParsedResult);
|
||||
} else {
|
||||
String g = wifiParsedResult.g();
|
||||
if (g != null && !g.isEmpty()) {
|
||||
int i2 = AnonymousClass1.a[a.ordinal()];
|
||||
if (i2 == 1) {
|
||||
b(this.a, wifiParsedResult);
|
||||
} else if (i2 == 2) {
|
||||
c(this.a, wifiParsedResult);
|
||||
} else if (i2 == 3) {
|
||||
d(this.a, wifiParsedResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} catch (IllegalArgumentException unused2) {
|
||||
Log.w(b, "Bad network type");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
private static int b(String str) {
|
||||
char c2;
|
||||
if (str == null) {
|
||||
return -1;
|
||||
}
|
||||
switch (str.hashCode()) {
|
||||
case 79645:
|
||||
if (str.equals("PWD")) {
|
||||
c2 = 2;
|
||||
break;
|
||||
}
|
||||
c2 = 65535;
|
||||
break;
|
||||
case 83163:
|
||||
if (str.equals("TLS")) {
|
||||
c2 = 3;
|
||||
break;
|
||||
}
|
||||
c2 = 65535;
|
||||
break;
|
||||
case 2402104:
|
||||
if (str.equals("NONE")) {
|
||||
c2 = 0;
|
||||
break;
|
||||
}
|
||||
c2 = 65535;
|
||||
break;
|
||||
case 2451684:
|
||||
if (str.equals("PEAP")) {
|
||||
c2 = 1;
|
||||
break;
|
||||
}
|
||||
c2 = 65535;
|
||||
break;
|
||||
case 2585607:
|
||||
if (str.equals("TTLS")) {
|
||||
c2 = 4;
|
||||
break;
|
||||
}
|
||||
c2 = 65535;
|
||||
break;
|
||||
default:
|
||||
c2 = 65535;
|
||||
break;
|
||||
}
|
||||
if (c2 == 0) {
|
||||
return -1;
|
||||
}
|
||||
if (c2 == 1) {
|
||||
return 0;
|
||||
}
|
||||
if (c2 == 2) {
|
||||
return 3;
|
||||
}
|
||||
if (c2 == 3) {
|
||||
return 1;
|
||||
}
|
||||
if (c2 == 4) {
|
||||
return 2;
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown value for EAP method: " + str);
|
||||
}
|
||||
|
||||
/* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
|
||||
private static int c(String str) {
|
||||
if (str == null) {
|
||||
return 0;
|
||||
}
|
||||
char c2 = 65535;
|
||||
switch (str.hashCode()) {
|
||||
case -2011803142:
|
||||
if (str.equals("MSCHAP")) {
|
||||
c2 = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case -607533546:
|
||||
if (str.equals("MSCHAPV2")) {
|
||||
c2 = 2;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 70902:
|
||||
if (str.equals("GTC")) {
|
||||
c2 = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 78975:
|
||||
if (str.equals("PAP")) {
|
||||
c2 = 4;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2402104:
|
||||
if (str.equals("NONE")) {
|
||||
c2 = 3;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (c2 == 0) {
|
||||
return 4;
|
||||
}
|
||||
if (c2 == 1) {
|
||||
return 2;
|
||||
}
|
||||
if (c2 == 2) {
|
||||
return 3;
|
||||
}
|
||||
if (c2 == 3) {
|
||||
return 0;
|
||||
}
|
||||
if (c2 == 4) {
|
||||
return 1;
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown value for phase 2 method: " + str);
|
||||
}
|
||||
|
||||
private static void a(WifiManager wifiManager, WifiConfiguration wifiConfiguration) {
|
||||
Integer a = a(wifiManager, wifiConfiguration.SSID);
|
||||
if (a != null) {
|
||||
Log.i(b, "Removing old configuration for network " + wifiConfiguration.SSID);
|
||||
wifiManager.removeNetwork(a.intValue());
|
||||
wifiManager.saveConfiguration();
|
||||
}
|
||||
int addNetwork = wifiManager.addNetwork(wifiConfiguration);
|
||||
if (addNetwork >= 0) {
|
||||
if (wifiManager.enableNetwork(addNetwork, true)) {
|
||||
Log.i(b, "Associating to network " + wifiConfiguration.SSID);
|
||||
wifiManager.saveConfiguration();
|
||||
return;
|
||||
}
|
||||
Log.w(b, "Failed to enable network " + wifiConfiguration.SSID);
|
||||
return;
|
||||
}
|
||||
Log.w(b, "Unable to add network " + wifiConfiguration.SSID);
|
||||
}
|
||||
|
||||
private static WifiConfiguration a(WifiParsedResult wifiParsedResult) {
|
||||
WifiConfiguration wifiConfiguration = new WifiConfiguration();
|
||||
wifiConfiguration.allowedAuthAlgorithms.clear();
|
||||
wifiConfiguration.allowedGroupCiphers.clear();
|
||||
wifiConfiguration.allowedKeyManagement.clear();
|
||||
wifiConfiguration.allowedPairwiseCiphers.clear();
|
||||
wifiConfiguration.allowedProtocols.clear();
|
||||
wifiConfiguration.SSID = a(wifiParsedResult.i(), new int[0]);
|
||||
wifiConfiguration.hiddenSSID = wifiParsedResult.j();
|
||||
return wifiConfiguration;
|
||||
}
|
||||
|
||||
private static void a(WifiManager wifiManager, WifiParsedResult wifiParsedResult) {
|
||||
WifiConfiguration a = a(wifiParsedResult);
|
||||
a.allowedKeyManagement.set(0);
|
||||
a(wifiManager, a);
|
||||
}
|
||||
|
||||
private static Integer a(WifiManager wifiManager, String str) {
|
||||
List<WifiConfiguration> configuredNetworks = wifiManager.getConfiguredNetworks();
|
||||
if (configuredNetworks == null) {
|
||||
return null;
|
||||
}
|
||||
for (WifiConfiguration wifiConfiguration : configuredNetworks) {
|
||||
String str2 = wifiConfiguration.SSID;
|
||||
if (str2 != null && str2.equals(str)) {
|
||||
return Integer.valueOf(wifiConfiguration.networkId);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String a(String str, int... iArr) {
|
||||
return a((CharSequence) str, iArr) ? str : a(str);
|
||||
}
|
||||
|
||||
private static String a(String str) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (str.charAt(0) == '\"' && str.charAt(str.length() - 1) == '\"') {
|
||||
return str;
|
||||
}
|
||||
return '\"' + str + '\"';
|
||||
}
|
||||
|
||||
private static boolean a(CharSequence charSequence, int... iArr) {
|
||||
if (charSequence != null && c.matcher(charSequence).matches()) {
|
||||
if (iArr.length == 0) {
|
||||
return true;
|
||||
}
|
||||
for (int i : iArr) {
|
||||
if (charSequence.length() == i) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user