76 lines
2.9 KiB
Java
76 lines
2.9 KiB
Java
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();
|
|
}
|
|
}
|