2021-06-27 20:44:35 +00:00
|
|
|
package e0.a.a.a;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.res.TypedArray;
|
|
|
|
import android.graphics.Rect;
|
|
|
|
import android.hardware.Camera;
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.FrameLayout;
|
|
|
|
import android.widget.RelativeLayout;
|
|
|
|
import androidx.annotation.ColorInt;
|
|
|
|
import me.dm7.barcodescanner.core.R;
|
|
|
|
/* compiled from: BarcodeScannerView */
|
|
|
|
public abstract class a extends FrameLayout implements Camera.PreviewCallback {
|
|
|
|
public int A = 0;
|
|
|
|
public float B = 0.1f;
|
|
|
|
public e i;
|
|
|
|
public d j;
|
|
|
|
public f k;
|
|
|
|
public Rect l;
|
|
|
|
public c m;
|
|
|
|
public Boolean n;
|
|
|
|
public boolean o = true;
|
|
|
|
public boolean p = true;
|
|
|
|
public boolean q = true;
|
|
|
|
@ColorInt
|
|
|
|
public int r = getResources().getColor(R.a.viewfinder_laser);
|
|
|
|
@ColorInt
|
|
|
|
|
|
|
|
/* renamed from: s reason: collision with root package name */
|
2021-07-13 20:23:20 +00:00
|
|
|
public int f2708s = getResources().getColor(R.a.viewfinder_border);
|
2021-06-27 20:44:35 +00:00
|
|
|
public int t = getResources().getColor(R.a.viewfinder_mask);
|
|
|
|
public int u = getResources().getInteger(R.b.viewfinder_border_width);
|
|
|
|
public int v = getResources().getInteger(R.b.viewfinder_border_length);
|
|
|
|
public boolean w = false;
|
|
|
|
|
|
|
|
/* renamed from: x reason: collision with root package name */
|
2021-07-13 20:23:20 +00:00
|
|
|
public int f2709x = 0;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
|
|
|
/* renamed from: y reason: collision with root package name */
|
2021-07-13 20:23:20 +00:00
|
|
|
public boolean f2710y = false;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
|
|
|
/* renamed from: z reason: collision with root package name */
|
2021-07-13 20:23:20 +00:00
|
|
|
public float f2711z = 1.0f;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
|
|
|
/* JADX INFO: finally extract failed */
|
|
|
|
public a(Context context, AttributeSet attributeSet) {
|
|
|
|
super(context, attributeSet);
|
|
|
|
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, R.c.BarcodeScannerView, 0, 0);
|
|
|
|
try {
|
|
|
|
setShouldScaleToFill(obtainStyledAttributes.getBoolean(R.c.BarcodeScannerView_shouldScaleToFill, true));
|
|
|
|
this.q = obtainStyledAttributes.getBoolean(R.c.BarcodeScannerView_laserEnabled, this.q);
|
|
|
|
this.r = obtainStyledAttributes.getColor(R.c.BarcodeScannerView_laserColor, this.r);
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f2708s = obtainStyledAttributes.getColor(R.c.BarcodeScannerView_borderColor, this.f2708s);
|
2021-06-27 20:44:35 +00:00
|
|
|
this.t = obtainStyledAttributes.getColor(R.c.BarcodeScannerView_maskColor, this.t);
|
|
|
|
this.u = obtainStyledAttributes.getDimensionPixelSize(R.c.BarcodeScannerView_borderWidth, this.u);
|
|
|
|
this.v = obtainStyledAttributes.getDimensionPixelSize(R.c.BarcodeScannerView_borderLength, this.v);
|
|
|
|
this.w = obtainStyledAttributes.getBoolean(R.c.BarcodeScannerView_roundedCorner, this.w);
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f2709x = obtainStyledAttributes.getDimensionPixelSize(R.c.BarcodeScannerView_cornerRadius, this.f2709x);
|
|
|
|
this.f2710y = obtainStyledAttributes.getBoolean(R.c.BarcodeScannerView_squaredFinder, this.f2710y);
|
|
|
|
this.f2711z = obtainStyledAttributes.getFloat(R.c.BarcodeScannerView_borderAlpha, this.f2711z);
|
2021-06-27 20:44:35 +00:00
|
|
|
this.A = obtainStyledAttributes.getDimensionPixelSize(R.c.BarcodeScannerView_finderOffset, this.A);
|
|
|
|
obtainStyledAttributes.recycle();
|
|
|
|
g gVar = new g(getContext());
|
2021-07-13 20:23:20 +00:00
|
|
|
gVar.setBorderColor(this.f2708s);
|
2021-06-27 20:44:35 +00:00
|
|
|
gVar.setLaserColor(this.r);
|
|
|
|
gVar.setLaserEnabled(this.q);
|
|
|
|
gVar.setBorderStrokeWidth(this.u);
|
|
|
|
gVar.setBorderLineLength(this.v);
|
|
|
|
gVar.setMaskColor(this.t);
|
|
|
|
gVar.setBorderCornerRounded(this.w);
|
2021-07-13 20:23:20 +00:00
|
|
|
gVar.setBorderCornerRadius(this.f2709x);
|
|
|
|
gVar.setSquareViewFinder(this.f2710y);
|
2021-06-27 20:44:35 +00:00
|
|
|
gVar.setViewFinderOffset(this.A);
|
|
|
|
this.k = gVar;
|
|
|
|
} catch (Throwable th) {
|
|
|
|
obtainStyledAttributes.recycle();
|
|
|
|
throw th;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a() {
|
|
|
|
if (this.i != null) {
|
|
|
|
this.j.e();
|
|
|
|
d dVar = this.j;
|
|
|
|
dVar.i = null;
|
|
|
|
dVar.o = null;
|
|
|
|
this.i.a.release();
|
|
|
|
this.i = null;
|
|
|
|
}
|
|
|
|
c cVar = this.m;
|
|
|
|
if (cVar != null) {
|
|
|
|
cVar.quit();
|
|
|
|
this.m = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean getFlash() {
|
|
|
|
e eVar = this.i;
|
2021-06-27 20:53:42 +00:00
|
|
|
return eVar != null && c.q.a.k.a.D(eVar.a) && this.i.a.getParameters().getFlashMode().equals("torch");
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getRotationCount() {
|
|
|
|
return this.j.getDisplayOrientation() / 90;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAspectTolerance(float f) {
|
|
|
|
this.B = f;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAutoFocus(boolean z2) {
|
|
|
|
this.o = z2;
|
|
|
|
d dVar = this.j;
|
|
|
|
if (dVar != null) {
|
|
|
|
dVar.setAutoFocus(z2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setBorderAlpha(float f) {
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f2711z = f;
|
2021-06-27 20:44:35 +00:00
|
|
|
((g) this.k).setBorderAlpha(f);
|
|
|
|
g gVar = (g) this.k;
|
|
|
|
gVar.a();
|
|
|
|
gVar.invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setBorderColor(int i) {
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f2708s = i;
|
2021-06-27 20:44:35 +00:00
|
|
|
((g) this.k).setBorderColor(i);
|
|
|
|
g gVar = (g) this.k;
|
|
|
|
gVar.a();
|
|
|
|
gVar.invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setBorderCornerRadius(int i) {
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f2709x = i;
|
2021-06-27 20:44:35 +00:00
|
|
|
((g) this.k).setBorderCornerRadius(i);
|
|
|
|
g gVar = (g) this.k;
|
|
|
|
gVar.a();
|
|
|
|
gVar.invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setBorderLineLength(int i) {
|
|
|
|
this.v = i;
|
|
|
|
((g) this.k).setBorderLineLength(i);
|
|
|
|
g gVar = (g) this.k;
|
|
|
|
gVar.a();
|
|
|
|
gVar.invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setBorderStrokeWidth(int i) {
|
|
|
|
this.u = i;
|
|
|
|
((g) this.k).setBorderStrokeWidth(i);
|
|
|
|
g gVar = (g) this.k;
|
|
|
|
gVar.a();
|
|
|
|
gVar.invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setFlash(boolean z2) {
|
|
|
|
this.n = Boolean.valueOf(z2);
|
|
|
|
e eVar = this.i;
|
2021-06-27 20:53:42 +00:00
|
|
|
if (eVar != null && c.q.a.k.a.D(eVar.a)) {
|
2021-06-27 20:44:35 +00:00
|
|
|
Camera.Parameters parameters = this.i.a.getParameters();
|
|
|
|
if (z2) {
|
|
|
|
if (!parameters.getFlashMode().equals("torch")) {
|
|
|
|
parameters.setFlashMode("torch");
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else if (!parameters.getFlashMode().equals("off")) {
|
|
|
|
parameters.setFlashMode("off");
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.i.a.setParameters(parameters);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setIsBorderCornerRounded(boolean z2) {
|
|
|
|
this.w = z2;
|
|
|
|
((g) this.k).setBorderCornerRounded(z2);
|
|
|
|
g gVar = (g) this.k;
|
|
|
|
gVar.a();
|
|
|
|
gVar.invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLaserColor(int i) {
|
|
|
|
this.r = i;
|
|
|
|
((g) this.k).setLaserColor(i);
|
|
|
|
g gVar = (g) this.k;
|
|
|
|
gVar.a();
|
|
|
|
gVar.invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLaserEnabled(boolean z2) {
|
|
|
|
this.q = z2;
|
|
|
|
((g) this.k).setLaserEnabled(z2);
|
|
|
|
g gVar = (g) this.k;
|
|
|
|
gVar.a();
|
|
|
|
gVar.invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setMaskColor(int i) {
|
|
|
|
this.t = i;
|
|
|
|
((g) this.k).setMaskColor(i);
|
|
|
|
g gVar = (g) this.k;
|
|
|
|
gVar.a();
|
|
|
|
gVar.invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setShouldScaleToFill(boolean z2) {
|
|
|
|
this.p = z2;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSquareViewFinder(boolean z2) {
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f2710y = z2;
|
2021-06-27 20:44:35 +00:00
|
|
|
((g) this.k).setSquareViewFinder(z2);
|
|
|
|
g gVar = (g) this.k;
|
|
|
|
gVar.a();
|
|
|
|
gVar.invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setupCameraPreview(e eVar) {
|
|
|
|
this.i = eVar;
|
|
|
|
if (eVar != null) {
|
|
|
|
setupLayout(eVar);
|
|
|
|
g gVar = (g) this.k;
|
|
|
|
gVar.a();
|
|
|
|
gVar.invalidate();
|
|
|
|
Boolean bool = this.n;
|
|
|
|
if (bool != null) {
|
|
|
|
setFlash(bool.booleanValue());
|
|
|
|
}
|
|
|
|
setAutoFocus(this.o);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void setupLayout(e eVar) {
|
|
|
|
removeAllViews();
|
|
|
|
d dVar = new d(getContext(), eVar, this);
|
|
|
|
this.j = dVar;
|
|
|
|
dVar.setAspectTolerance(this.B);
|
|
|
|
this.j.setShouldScaleToFill(this.p);
|
|
|
|
if (!this.p) {
|
|
|
|
RelativeLayout relativeLayout = new RelativeLayout(getContext());
|
|
|
|
relativeLayout.setGravity(17);
|
|
|
|
relativeLayout.setBackgroundColor(-16777216);
|
|
|
|
relativeLayout.addView(this.j);
|
|
|
|
addView(relativeLayout);
|
|
|
|
} else {
|
|
|
|
addView(this.j);
|
|
|
|
}
|
|
|
|
f fVar = this.k;
|
|
|
|
if (fVar instanceof View) {
|
|
|
|
addView((View) fVar);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
throw new IllegalArgumentException("IViewFinder object returned by 'createViewFinderView()' should be instance of android.view.View");
|
|
|
|
}
|
|
|
|
}
|