133 lines
4.1 KiB
Java
133 lines
4.1 KiB
Java
package com.journeyapps.barcodescanner;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.util.AttributeSet;
|
|
import android.view.KeyEvent;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.TextView;
|
|
import java.util.List;
|
|
import o.C17083tlK;
|
|
import o.C17725zIe;
|
|
import o.InterfaceC14590fwA;
|
|
import o.InterfaceC15330gnf;
|
|
import o.Xad;
|
|
import o.qCz;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class DecoratedBarcodeView extends FrameLayout {
|
|
private TextView a;
|
|
private ViewfinderView b;
|
|
public BarcodeView d;
|
|
private Sts e;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public interface Sts {
|
|
}
|
|
|
|
/* loaded from: classes3.dex */
|
|
class RVV implements InterfaceC15330gnf {
|
|
private DecoratedBarcodeView a;
|
|
private InterfaceC15330gnf b;
|
|
|
|
public RVV(DecoratedBarcodeView decoratedBarcodeView, InterfaceC15330gnf interfaceC15330gnf) {
|
|
this.a = decoratedBarcodeView;
|
|
this.b = interfaceC15330gnf;
|
|
}
|
|
|
|
@Override // o.InterfaceC15330gnf
|
|
public final void c(C17725zIe c17725zIe) {
|
|
this.b.c(c17725zIe);
|
|
}
|
|
|
|
@Override // o.InterfaceC15330gnf
|
|
public final void e(List<qCz> list) {
|
|
for (qCz qcz : list) {
|
|
ViewfinderView viewfinderView = this.a.b;
|
|
if (viewfinderView.a.size() < 20) {
|
|
viewfinderView.a.add(qcz);
|
|
}
|
|
}
|
|
this.b.e(list);
|
|
}
|
|
}
|
|
|
|
public DecoratedBarcodeView(Context context) {
|
|
super(context);
|
|
Oq_(null);
|
|
}
|
|
|
|
public DecoratedBarcodeView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
Oq_(attributeSet);
|
|
}
|
|
|
|
public DecoratedBarcodeView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
Oq_(attributeSet);
|
|
}
|
|
|
|
private void Oq_(AttributeSet attributeSet) {
|
|
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, C17083tlK.ojQ.zxing_view);
|
|
int resourceId = obtainStyledAttributes.getResourceId(C17083tlK.ojQ.zxing_view_zxing_scanner_layout, C17083tlK.HBt.zxing_barcode_scanner);
|
|
obtainStyledAttributes.recycle();
|
|
inflate(getContext(), resourceId, this);
|
|
BarcodeView barcodeView = (BarcodeView) findViewById(C17083tlK.LWm.zxing_barcode_surface);
|
|
this.d = barcodeView;
|
|
if (barcodeView == null) {
|
|
throw new IllegalArgumentException("There is no a com.journeyapps.barcodescanner.BarcodeView on provided layout with the id \"zxing_barcode_surface\".");
|
|
}
|
|
barcodeView.Op_(attributeSet);
|
|
ViewfinderView viewfinderView = (ViewfinderView) findViewById(C17083tlK.LWm.zxing_viewfinder_view);
|
|
this.b = viewfinderView;
|
|
if (viewfinderView == null) {
|
|
throw new IllegalArgumentException("There is no a com.journeyapps.barcodescanner.ViewfinderView on provided layout with the id \"zxing_viewfinder_view\".");
|
|
}
|
|
viewfinderView.setCameraPreview(this.d);
|
|
this.a = (TextView) findViewById(C17083tlK.LWm.zxing_status_view);
|
|
}
|
|
|
|
public void setCameraSettings(Xad xad) {
|
|
this.d.setCameraSettings(xad);
|
|
}
|
|
|
|
public void setDecoderFactory(InterfaceC14590fwA interfaceC14590fwA) {
|
|
this.d.setDecoderFactory(interfaceC14590fwA);
|
|
}
|
|
|
|
public void setStatusText(String str) {
|
|
TextView textView = this.a;
|
|
if (textView != null) {
|
|
textView.setText(str);
|
|
}
|
|
}
|
|
|
|
public void setTorchOn() {
|
|
this.d.setTorch(true);
|
|
}
|
|
|
|
public void setTorchOff() {
|
|
this.d.setTorch(false);
|
|
}
|
|
|
|
@Override // android.view.View, android.view.KeyEvent.Callback
|
|
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
|
if (i == 24) {
|
|
setTorchOn();
|
|
return true;
|
|
}
|
|
if (i == 25) {
|
|
setTorchOff();
|
|
return true;
|
|
}
|
|
if (i == 27 || i == 80) {
|
|
return true;
|
|
}
|
|
return super.onKeyDown(i, keyEvent);
|
|
}
|
|
|
|
public void setTorchListener(Sts sts) {
|
|
this.e = sts;
|
|
}
|
|
}
|