what-the-bank/sources/o/eDH.java

101 lines
3.2 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.content.Context;
import android.hardware.Camera;
import android.view.Display;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import java.io.IOException;
/* loaded from: classes5.dex */
public final class eDH implements SurfaceHolder.Callback, Camera.PreviewCallback {
public Camera a;
public SurfaceHolder b;
public int c = 1;
public Context d;
public int e;
public HBt f;
/* loaded from: classes5.dex */
public interface HBt {
void b(byte[] bArr);
}
@Override // android.view.SurfaceHolder.Callback
public final void surfaceCreated(SurfaceHolder surfaceHolder) {
}
public eDH(Context context) {
this.d = context;
}
public final void apV_(FrameLayout frameLayout) {
this.c = 1;
Display defaultDisplay = ((WindowManager) this.d.getSystemService("window")).getDefaultDisplay();
SurfaceView surfaceView = new SurfaceView(this.d);
SurfaceHolder holder = surfaceView.getHolder();
this.b = holder;
holder.setType(3);
int max = Math.max(defaultDisplay.getWidth(), defaultDisplay.getHeight());
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams((int) ((max * 3.0f) / 4.0f), max);
surfaceView.setLayoutParams(layoutParams);
frameLayout.addView(surfaceView);
ViewGroup.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) frameLayout.getLayoutParams();
layoutParams2.width = ((ViewGroup.LayoutParams) layoutParams).width;
layoutParams2.height = ((ViewGroup.LayoutParams) layoutParams).height;
frameLayout.setLayoutParams(layoutParams2);
}
public final void d() {
if (this.a != null) {
try {
this.e = fLA.d(this.d, this.c);
this.a.setPreviewDisplay(this.b);
this.a.setDisplayOrientation(this.e);
this.a.setPreviewCallback(this);
this.a.startPreview();
} catch (IOException e) {
guQ.e(e);
}
}
}
@Override // android.view.SurfaceHolder.Callback
public final void surfaceDestroyed(SurfaceHolder surfaceHolder) {
Camera camera = this.a;
if (camera != null) {
camera.stopPreview();
}
try {
Camera camera2 = this.a;
if (camera2 != null) {
camera2.release();
this.a = null;
}
} catch (Exception e) {
guQ.e(e);
}
this.b.removeCallback(this);
}
@Override // android.hardware.Camera.PreviewCallback
public final void onPreviewFrame(byte[] bArr, Camera camera) {
this.f.b(bArr);
}
@Override // android.view.SurfaceHolder.Callback
public final void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
Camera camera = this.a;
if (camera != null) {
if (camera != null) {
camera.stopPreview();
}
d();
}
}
}