导航菜单

页面标题

页面副标题

Minits v4.9.3.32 - CameraActivity.java 源代码

正在查看: Minits v4.9.3.32 应用的 CameraActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.xone.android.framework.activities;

import B0.h;
import C.b0;
import C.d0;
import C0.b;
import N0.B0;
import N0.I;
import N0.Z;
import U.x0;
import android.R;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Chronometer;
import android.widget.LinearLayout;
import android.widget.MediaController;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.VideoView;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.constraintlayout.widget.ConstraintLayout;
import b8.C0462l;
import b8.C0466m;
import bb.AbstractC0515a;
import com.xone.android.framework.AbstractC0563e;
import com.xone.android.framework.AbstractC0564f;
import com.xone.android.framework.AbstractC0565g;
import com.xone.android.framework.AbstractC0568j;
import com.xone.android.framework.activities.CameraActivity;
import com.xone.android.framework.views.XOneCameraView;
import com.xone.android.framework.xoneApp;
import com.xone.android.utils.Utils;
import com.xone.interfaces.IXoneObject;
import eb.AbstractC0665a;
import fa.ThreadFactoryC0686d;
import fb.AbstractC0698k;
import g.c;
import h8.C0738c;
import ha.AbstractC0751f;
import ha.q;
import ha.r;
import ha.u;
import hc.D;
import j$.util.Objects;
import java.io.File;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import n8.k;
import org.mozilla.javascript.JavaScriptException;
import ra.e;
import ra.f;
import ua.F;
import ua.InterfaceC1011A;
import ua.InterfaceC1043p;
import ua.InterfaceC1049s0;
import ua.K0;
import ua.L0;
import ua.U0;
import va.C1066a;
import w7.s;

@SuppressLint({"UnsafeOptInUsageError"})
public final class CameraActivity extends c implements F, InterfaceC1011A, InterfaceC1043p, C9.a {
    public View.OnClickListener A;
    public boolean B;
    public a C;
    public final List l = new ArrayList();
    public ExecutorService m;
    public AlertDialog n;
    public XOneCameraView o;
    public AppCompatImageView p;
    public VideoView q;
    public Chronometer r;
    public AppCompatButton s;
    public AppCompatButton t;
    public AppCompatButton u;
    public AppCompatButton v;
    public AppCompatButton w;
    public MediaController x;
    public File y;
    public int z;

    public enum a {
        FilePreview,
        PhotoCapture,
        VideoCapture
    }

    public static B0 K0(View view, B0 b0) {
        b f = b0.f(B0.o.d());
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
        marginLayoutParams.topMargin = f.b;
        marginLayoutParams.leftMargin = f.a;
        marginLayoutParams.bottomMargin = f.d;
        marginLayoutParams.rightMargin = f.c;
        view.setLayoutParams(marginLayoutParams);
        return B0.b;
    }

    public void L1() {
        if (r1()) {
            Z1();
        } else {
            setResult(0);
            finish();
        }
    }

    public void Q1(d0 d0Var) {
        try {
            b(d0Var);
        } finally {
            f1();
        }
    }

    public void R1(b0.h hVar) {
        try {
            try {
                File file = this.y;
                if (file == null) {
                    throw new IllegalStateException("Target photo path not set");
                }
                File parentFile = file.getParentFile();
                if (parentFile != null && !parentFile.exists() && !parentFile.mkdirs()) {
                    throw new IOException("Cannot create parent directory " + parentFile.getAbsolutePath());
                }
                Uri a2 = hVar.a();
                if (a2 == null) {
                    throw new NullPointerException("Empty file uri");
                }
                b2(a2);
                f1();
            } catch (Exception e) {
                e.printStackTrace();
                f1();
            }
        } catch (Throwable th) {
            f1();
            throw th;
        }
    }

    public void X1(x0 x0Var) {
        if (x0Var instanceof x0.a) {
            x0.a aVar = (x0.a) x0Var;
            try {
                try {
                    g2();
                    File file = this.y;
                    if (file == null) {
                        throw new IllegalStateException("Target video path not set");
                    }
                    File parentFile = file.getParentFile();
                    if (parentFile != null && !parentFile.exists() && !parentFile.mkdirs()) {
                        throw new IOException("Cannot create parent directory " + parentFile.getAbsolutePath());
                    }
                    Throwable i = aVar.i();
                    if (i != null) {
                        throw AbstractC0751f.e(i);
                    }
                    b2(aVar.k().a());
                    f1();
                } catch (Exception e) {
                    b(e);
                    f1();
                }
            } catch (Throwable th) {
                f1();
                throw th;
            }
        }
    }

    private Typeface g1() {
        return h.g(getApplicationContext(), u.a);
    }

    private void g2() {
        if (Utils.s3()) {
            h2();
        } else {
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    CameraActivity.this.h2();
                }
            });
        }
    }

    private AlertDialog i1(Throwable th) {
        return j1(th, null);
    }

    public static String l1(Uri uri) {
        String path = uri.getPath();
        if (TextUtils.isEmpty(path)) {
            throw new IllegalArgumentException("Cannot obtain file path from uri " + uri);
        }
        File file = new File(path);
        if (!file.exists()) {
            throw new IllegalArgumentException("File " + file.getAbsolutePath() + " does not exist");
        }
        if (!file.isFile()) {
            throw new IllegalArgumentException("Path " + file.getAbsolutePath() + " is not a file");
        }
        if (file.canRead()) {
            return file.getAbsolutePath();
        }
        throw new IllegalArgumentException("Cannot read file " + file.getAbsolutePath());
    }

    public static String o1(int i) {
        String valueOf = String.valueOf(i / 60);
        String valueOf2 = String.valueOf(i % 60);
        if (valueOf.length() == 1) {
            valueOf = "0" + valueOf;
        }
        if (valueOf2.length() == 1) {
            valueOf2 = "0" + valueOf2;
        }
        return valueOf + ":" + valueOf2;
    }

    private String q1(U0 u0) {
        StringBuilder sb2 = new StringBuilder();
        if (Utils.d3(xoneApp.Z0())) {
            String message = u0.getMessage();
            if (TextUtils.isEmpty(message)) {
                message = Utils.M2(u0);
            }
            sb2.append("VBScript runtime exception.\n");
            sb2.append("Message: ");
            sb2.append(message);
        } else {
            sb2.append(getText(w7.h.f));
        }
        return sb2.toString();
    }

    public final void A1(View view) {
        T1();
    }

    public final void B1(int i, int i2, View view) {
        W1(i, i2);
    }

    public final void C1(LinearLayout linearLayout, View view) {
        V1(linearLayout);
    }

    public final void D1(DialogInterface dialogInterface, int i) {
        setResult(0);
        finish();
    }

    public final void E1(DialogInterface dialogInterface, int i) {
        try {
            Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
            intent.setData(Uri.fromParts("package", getPackageName(), null));
            startActivity(intent);
            finish();
        } catch (Exception e) {
            b(e);
        }
    }

    @Override
    public boolean G() {
        Configuration configuration = getResources().getConfiguration();
        return configuration != null && configuration.orientation == 2;
    }

    public final void G1(Uri uri, View view) {
        S1(uri);
    }

    public final void H1(Uri uri, View view) {
        K1(uri);
    }

    @Override
    public void J(final Throwable th, final DialogInterface.OnClickListener onClickListener) {
        th.printStackTrace();
        if (c()) {
            Utils.l("XOneAndroidFramework", "An error has happened while CameraActivity was being destroyed");
            return;
        }
        if (!Utils.s3()) {
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    CameraActivity.this.z1(th, onClickListener);
                }
            });
            return;
        }
        AlertDialog create = k1(th, null, onClickListener).create();
        this.n = create;
        create.show();
        TextView textView = (TextView) this.n.findViewById(R.id.message);
        if (textView != null) {
            textView.setTypeface(g1());
        }
    }

    public final void I1(Uri uri) {
        try {
            AppCompatImageView m1 = m1();
            int width = m1.getWidth();
            int height = m1.getHeight();
            if (width >= 0 && height >= 0) {
                String l1 = l1(uri);
                BitmapFactory.Options d = r.d(l1);
                BitmapFactory.Options options = new BitmapFactory.Options();
                options.inSampleSize = r.k(d, width, height);
                m1.setImageBitmap(BitmapFactory.decodeFile(l1, options));
                return;
            }
            m1.setImageURI(uri);
        } catch (Exception e) {
            b(e);
        }
    }

    public final void K1(Uri uri) {
        Z0(uri);
    }

    public final void M1(SeekBar seekBar, int i, boolean z) {
        try {
            this.o.setExposureCompensation(Integer.valueOf(i));
        } catch (Exception e) {
            b(e);
        }
    }

    public final void N1(View view) {
        char c;
        XOneCameraView xOneCameraView = this.o;
        if (xOneCameraView == null) {
            return;
        }
        try {
            String flashMode = xOneCameraView.getFlashMode();
            int hashCode = flashMode.hashCode();
            if (hashCode == 3551) {
                if (flashMode.equals("on")) {
                    c = 0;
                }
                c = 65535;
            } else if (hashCode != 109935) {
                if (hashCode == 3005871 && flashMode.equals("auto")) {
                    c = 2;
                }
                c = 65535;
            } else {
                if (flashMode.equals("off")) {
                    c = 1;
                }
                c = 65535;
            }
            if (c == 0) {
                this.o.setFlashMode("off");
                view.setBackgroundResource(AbstractC0563e.G);
            } else if (c != 1) {
                this.o.setFlashMode("on");
                view.setBackgroundResource(AbstractC0563e.H);
            } else {
                this.o.setFlashMode("auto");
                view.setBackgroundResource(AbstractC0563e.F);
            }
        } catch (Exception e) {
            b(e);
        }
    }

    public final void O1(View view) {
        try {
            int i = this.z;
            if (i == 0) {
                this.z = 5;
                view.setBackgroundResource(AbstractC0563e.S);
            } else if (i == 5) {
                this.z = 10;
                view.setBackgroundResource(AbstractC0563e.T);
            } else {
                if (i != 10) {
                    return;
                }
                this.z = 0;
                view.setBackgroundResource(AbstractC0563e.R);
            }
        } catch (Exception e) {
            b(e);
        }
    }

    public final void P1() {
        AppCompatButton appCompatButton;
        try {
            for (int i = this.z; i > 0; i--) {
                if (this.o != null && (appCompatButton = this.s) != null) {
                    appCompatButton.setText(String.valueOf(i));
                    TimeUnit.SECONDS.sleep(1L);
                    if (i - 1 == 0) {
                        this.s.setText(String.valueOf(0));
                    }
                }
                return;
            }
            XOneCameraView xOneCameraView = this.o;
            if (xOneCameraView == null) {
                return;
            }
            xOneCameraView.S1("ph_" + UUID.randomUUID().toString() + ".jpg", new C0462l(this), new C0466m(this));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public final void S1(Uri uri) {
        b1(uri);
        Z1();
    }

    public final void T1() {
        try {
            e1();
            int i = this.z;
            if (i != 0) {
                if (i == 5 || i == 10) {
                    if (this.m == null) {
                        this.m = Executors.newSingleThreadExecutor(new ThreadFactoryC0686d("CameraTimerThread"));
                    }
                    this.m.submit(new Runnable() {
                        @Override
                        public final void run() {
                            CameraActivity.this.P1();
                        }
                    });
                    return;
                }
                return;
            }
            this.o.S1("ph_" + UUID.randomUUID().toString() + ".jpg", new C0462l(this), new C0466m(this));
        } catch (Exception e) {
            b(e);
        }
    }

    public final void U1(View view) {
        XOneCameraView xOneCameraView = this.o;
        if (xOneCameraView == null) {
            return;
        }
        try {
            xOneCameraView.toggleCamera();
        } catch (Exception e) {
            b(e);
        }
    }

    public final void V1(LinearLayout linearLayout) {
        try {
            int visibility = linearLayout.getVisibility();
            if (visibility == 0) {
                linearLayout.setVisibility(8);
                return;
            }
            if (visibility != 8 && visibility != 4) {
                return;
            }
            linearLayout.setVisibility(0);
        } catch (Exception e) {
            b(e);
        }
    }

    public final void W1(int i, int i2) {
        try {
            if (!this.o.W0()) {
                this.o.J1(this.y.getAbsolutePath(), "720p", true, i, i2, new M0.a() {
                    public final void accept(Object obj) {
                        CameraActivity.this.X1((U.x0) obj);
                    }
                });
                e2();
                this.s.setBackgroundResource(AbstractC0563e.M);
                return;
            }
            this.o.stopRecording();
            EditViewHyper editViewHyper = (EditViewHyper) xoneApp.Z0().g();
            if (editViewHyper == null) {
                throw new IllegalStateException("Last edit view not found");
            }
            g2();
            editViewHyper.t5(this.o.getTargetVideo());
            this.s.setBackgroundResource(AbstractC0563e.L);
        } catch (Exception e) {
            b(e);
        }
    }

    public final void Y1(SeekBar seekBar, int i, boolean z) {
        try {
            this.o.setZoomPercent(i);
        } catch (Exception e) {
            b(e);
        }
    }

    public final void Z0(Uri uri) {
        Intent intent = new Intent();
        intent.setData(uri);
        setResult(-1, intent);
        finish();
    }

    public final void Z1() {
        if (Utils.s3()) {
            a2();
        } else {
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    CameraActivity.this.a2();
                }
            });
        }
    }

    @Override
    public void a(C9.h hVar) {
        if (this.l.contains(hVar)) {
            return;
        }
        this.l.add(hVar);
    }

    public final MediaController a1(VideoView videoView) {
        ConstraintLayout findViewById = findViewById(AbstractC0564f.k);
        MediaController mediaController = (MediaController) findViewById.findViewById(AbstractC0564f.m);
        if (mediaController != null) {
            mediaController.setVisibility(0);
            return mediaController;
        }
        MediaController mediaController2 = new MediaController(videoView.getContext());
        mediaController2.setFocusableInTouchMode(false);
        mediaController2.setId(AbstractC0564f.m);
        mediaController2.setVisibility(0);
        ((ViewGroup) mediaController2.getParent()).removeView(mediaController2);
        ConstraintLayout.b bVar = new ConstraintLayout.b(-1, -2);
        bVar.k = AbstractC0564f.n;
        int applyDimension = (int) TypedValue.applyDimension(1, 10.0f, h1());
        ((ViewGroup.MarginLayoutParams) bVar).leftMargin = applyDimension;
        ((ViewGroup.MarginLayoutParams) bVar).rightMargin = applyDimension;
        findViewById.addView(mediaController2, bVar);
        videoView.setMediaController(mediaController2);
        return mediaController2;
    }

    public final void a2() {
        int i;
        this.o.startPreview();
        this.s.setOnClickListener(this.A);
        if (s1()) {
            i = AbstractC0563e.Q;
            this.p.setVisibility(8);
            this.p.setImageBitmap((Bitmap) null);
            d2(a.PhotoCapture);
        } else {
            if (!u1()) {
                throw new IllegalStateException("Unknown mode");
            }
            i = AbstractC0563e.L;
            this.q.setVisibility(8);
            this.x.setVisibility(8);
            this.q.setVideoURI(null);
            d2(a.VideoCapture);
        }
        this.s.setBackgroundResource(i);
        this.t.setBackgroundResource(AbstractC0563e.P);
        this.o.setVisibility(0);
        this.u.setVisibility(0);
        this.v.setVisibility(0);
        this.w.setVisibility(0);
    }

    @Override
    public void b(final java.lang.Throwable r11) {
        throw new UnsupportedOperationException("Method not decompiled: com.xone.android.framework.activities.CameraActivity.b(java.lang.Throwable):void");
    }

    public final void b1(Uri uri) {
        if (uri == null) {
            return;
        }
        d1(uri);
        c1(uri);
    }

    public final void b2(final Uri uri) {
        if (Utils.s3()) {
            F1(uri);
        } else {
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    CameraActivity.this.F1(uri);
                }
            });
        }
    }

    @Override
    public boolean c() {
        return isDestroyed();
    }

    public final void c1(Uri uri) {
        if (uri == null) {
            return;
        }
        try {
            getContentResolver().delete(uri, null, null);
        } catch (Exception unused) {
        }
    }

    public final void F1(final Uri uri) {
        d2(a.FilePreview);
        this.o.stopPreview();
        this.t.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CameraActivity.this.G1(uri, view);
            }
        });
        this.s.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CameraActivity.this.H1(uri, view);
            }
        });
        this.s.setBackgroundResource(AbstractC0563e.r);
        this.t.setBackgroundResource(AbstractC0563e.O);
        this.o.setVisibility(8);
        this.u.setVisibility(8);
        this.v.setVisibility(8);
        this.w.setVisibility(8);
        if (s1()) {
            this.p.setVisibility(0);
            try {
                this.p.setImageURI(uri);
                return;
            } catch (OutOfMemoryError unused) {
                System.gc();
                this.p.post(new Runnable() {
                    @Override
                    public final void run() {
                        CameraActivity.this.I1(uri);
                    }
                });
                return;
            }
        }
        if (u1()) {
            this.q.setVisibility(0);
            this.x.setVisibility(0);
            this.q.setVideoPath(l1(uri));
        }
    }

    public final void d1(Uri uri) {
        if (uri == null) {
            return;
        }
        try {
            String path = uri.getPath();
            if (TextUtils.isEmpty(path)) {
                Utils.l("XOneAndroidFramework", "Cannot obtain file path from uri " + uri);
                return;
            }
            File file = new File(path);
            if (!file.exists()) {
                Utils.l("XOneAndroidFramework", "File " + file.getAbsolutePath() + " does not exist");
                return;
            }
            if (!file.isFile()) {
                Utils.l("XOneAndroidFramework", "Path " + file.getAbsolutePath() + " is not a file");
                return;
            }
            if (file.delete()) {
                return;
            }
            Utils.l("XOneAndroidFramework", "Cannot delete file " + file.getAbsolutePath());
        } catch (Exception unused) {
        }
    }

    public final void d2(a aVar) {
        this.C = aVar;
    }

    public final void e1() {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CameraActivity.this.w1();
            }
        });
    }

    public final void e2() {
        if (Utils.s3()) {
            f2();
        } else {
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    CameraActivity.this.f2();
                }
            });
        }
    }

    @Override
    public boolean f() {
        return this.B;
    }

    public final void f1() {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CameraActivity.this.x1();
            }
        });
    }

    public final void f2() {
        Chronometer chronometer = this.r;
        if (chronometer == null) {
            return;
        }
        chronometer.setVisibility(0);
        this.r.setBase(SystemClock.elapsedRealtime());
        this.r.start();
    }

    public final DisplayMetrics h1() {
        return getResources().getDisplayMetrics();
    }

    public final void h2() {
        Chronometer chronometer = this.r;
        if (chronometer == null) {
            return;
        }
        chronometer.stop();
        this.r.setVisibility(8);
    }

    public final AlertDialog j1(Throwable th, String str) {
        AlertDialog create = k1(th, str, null).create();
        create.setOwnerActivity(this);
        return create;
    }

    public final AlertDialog.Builder k1(Throwable th, final String str, DialogInterface.OnClickListener onClickListener) {
        AlertDialog.Builder g = AbstractC0665a.g(this);
        boolean z = false;
        final String str2 = null;
        if ((th instanceof JavaScriptException) || (th instanceof ra.c) || (th instanceof e) || (th instanceof D) || (th instanceof q)) {
            if (TextUtils.isEmpty(str)) {
                str = th.getMessage();
            }
            g.setIcon(R.drawable.ic_dialog_alert);
            g.setTitle(AbstractC0568j.q);
            if (th instanceof q) {
                g.setCancelable(false);
            }
        } else {
            if (th instanceof U0) {
                str = q1((U0) th);
                str2 = Utils.N2(th);
                g.setIcon(R.drawable.ic_dialog_alert);
                g.setTitle(AbstractC0568j.q);
            } else if (th instanceof f) {
                if (AbstractC0515a.c(((f) th).a())) {
                    if (TextUtils.isEmpty(str)) {
                        str = th.getMessage();
                    }
                    if (TextUtils.isEmpty(str)) {
                        str = Utils.M2(th);
                    }
                } else {
                    if (!Utils.d3(xoneApp.Z0())) {
                        str = getString(w7.h.f);
                    } else if (TextUtils.isEmpty(str)) {
                        str = Utils.M2(th);
                    }
                    str2 = Utils.N2(th);
                    g.setIcon(R.drawable.ic_dialog_alert);
                    g.setTitle(AbstractC0568j.q);
                }
            } else if (th instanceof InterfaceC1049s0) {
                InterfaceC1049s0 interfaceC1049s0 = (InterfaceC1049s0) th;
                if (interfaceC1049s0.a()) {
                    str = th.getMessage();
                } else if (TextUtils.isEmpty(str)) {
                    if (th instanceof C0738c) {
                        str = th.getMessage();
                        if (TextUtils.isEmpty(str)) {
                            str = "No details available";
                        }
                    } else {
                        str = Utils.M2(th);
                    }
                }
                str2 = Utils.N2(th);
                z = interfaceC1049s0.b();
                g.setIcon(R.drawable.ic_dialog_alert);
                g.setTitle(AbstractC0568j.q);
            } else if (th instanceof C0738c) {
                Throwable cause = th.getCause();
                boolean z2 = cause instanceof InterfaceC1049s0;
                if (z2 && ((InterfaceC1049s0) cause).a()) {
                    str = cause.getMessage();
                } else if (!Utils.d3(xoneApp.Z0())) {
                    str = getString(w7.h.f);
                } else if (TextUtils.isEmpty(str)) {
                    str = th.getMessage();
                    if (TextUtils.isEmpty(str)) {
                        str = "No details available";
                    }
                }
                String N2 = Utils.N2(th);
                z = z2 ? ((InterfaceC1049s0) cause).b() : true;
                g.setIcon(R.drawable.ic_dialog_alert);
                g.setTitle(AbstractC0568j.q);
                str2 = N2;
            } else if (th != 0) {
                if (!Utils.d3(xoneApp.Z0())) {
                    str = getString(w7.h.f);
                } else if (TextUtils.isEmpty(str)) {
                    str = Utils.M2(th);
                }
                str2 = Utils.N2(th);
                g.setIcon(R.drawable.ic_dialog_alert);
                g.setTitle(AbstractC0568j.q);
            } else {
                g.setIcon(R.drawable.ic_dialog_alert);
                g.setTitle(AbstractC0568j.q);
            }
            z = true;
        }
        if (TextUtils.isEmpty(str)) {
            str = getString(w7.h.f);
        }
        g.setMessage(str);
        if (onClickListener == null) {
            onClickListener = new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    dialogInterface.dismiss();
                }
            };
        }
        g.setPositiveButton(AbstractC0568j.a, onClickListener);
        if (z) {
            final Context applicationContext = getApplicationContext();
            final WeakReference weakReference = new WeakReference(findViewById(R.id.content));
            g.setNeutralButton(w7.h.g, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    w7.s.r(applicationContext, weakReference, str, str2);
                }
            });
        }
        return g;
    }

    public final AppCompatImageView m1() {
        return this.p;
    }

    public final String n1() {
        return AbstractC0698k.a(getIntent());
    }

    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        try {
            this.o.stopPreview();
            this.o.startPreview();
        } catch (Exception e) {
            b(e);
        }
    }

    public void onCreate(Bundle bundle) {
        int i;
        super/*androidx.fragment.app.j*/.onCreate(bundle);
        setContentView(AbstractC0565g.b);
        try {
            EditViewHyper editViewHyper = (EditViewHyper) xoneApp.Z0().g();
            if (editViewHyper == null) {
                throw new IllegalStateException("Last edit view not found");
            }
            IXoneObject dataObject = editViewHyper.getDataObject();
            if (dataObject == null) {
                throw new IllegalStateException("No data object found from activity");
            }
            Intent intent = getIntent();
            final int i2 = AbstractC0698k.i(intent, "android.intent.extra.durationLimit", -1);
            final int i3 = AbstractC0698k.i(intent, "android.intent.extra.sizeLimit", -1);
            this.y = editViewHyper.n3();
            if (s1()) {
                d2(a.PhotoCapture);
                i = AbstractC0563e.Q;
                this.A = new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        CameraActivity.this.A1(view);
                    }
                };
            } else {
                if (!u1()) {
                    throw new IllegalArgumentException("Unknown intent action: " + n1());
                }
                d2(a.VideoCapture);
                i = AbstractC0563e.L;
                this.A = new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        CameraActivity.this.B1(i2, i3, view);
                    }
                };
            }
            this.o = (XOneCameraView) findViewById(AbstractC0564f.r);
            this.p = findViewById(AbstractC0564f.j);
            this.q = (VideoView) findViewById(AbstractC0564f.q);
            if (i2 > 0) {
                Chronometer chronometer = (Chronometer) findViewById(AbstractC0564f.l);
                this.r = chronometer;
                chronometer.setBase(SystemClock.elapsedRealtime());
                this.r.setFormat("%s/" + o1(i2));
            }
            String p3 = editViewHyper.p3();
            C1066a r3 = editViewHyper.r3();
            if (r3 == null) {
                throw new IllegalStateException("No root layout found in activity");
            }
            C1066a g = r3.g(p3);
            dataObject.SetFieldPropertyValue(p3, "camera-api", "camerax");
            dataObject.SetFieldPropertyValue(p3, "pinch-to-zoom", "true");
            dataObject.SetFieldPropertyValue(p3, "max-duration", String.valueOf(i2));
            dataObject.SetFieldPropertyValue(p3, "max-filesize", String.valueOf(i3));
            this.o.setDefaultCameraApi("camerax");
            XOneCameraView xOneCameraView = this.o;
            xoneApp Z0 = xoneApp.Z0();
            int i4 = i;
            Boolean bool = Boolean.FALSE;
            xOneCameraView.createView(this, Z0, null, dataObject, g, bool, bool, bool, bool, null, -1, -1, -1, -1, 1, null, 100, 100);
            final LinearLayout linearLayout = (LinearLayout) findViewById(AbstractC0564f.g);
            AppCompatButton findViewById = findViewById(AbstractC0564f.d);
            this.s = findViewById;
            findViewById.setBackgroundResource(i4);
            this.s.setOnClickListener(this.A);
            this.s.setTypeface(g1());
            this.s.setTextSize(2, 24.0f);
            AppCompatButton findViewById2 = findViewById(AbstractC0564f.o);
            this.t = findViewById2;
            findViewById2.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    CameraActivity.this.U1(view);
                }
            });
            AppCompatButton findViewById3 = findViewById(AbstractC0564f.i);
            this.u = findViewById3;
            findViewById3.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    CameraActivity.this.N1(view);
                }
            });
            AppCompatButton findViewById4 = findViewById(AbstractC0564f.p);
            this.v = findViewById4;
            findViewById4.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    CameraActivity.this.O1(view);
                }
            });
            AppCompatButton findViewById5 = findViewById(AbstractC0564f.e);
            this.w = findViewById5;
            findViewById5.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    CameraActivity.this.C1(linearLayout, view);
                }
            });
            findViewById(AbstractC0564f.f).setOnSeekBarChangeListener(new k() {
                @Override
                public final void onProgressChanged(SeekBar seekBar, int i5, boolean z) {
                    CameraActivity.this.M1(seekBar, i5, z);
                }

                @Override
                public void onStartTrackingTouch(SeekBar seekBar) {
                    n8.j.a(this, seekBar);
                }

                @Override
                public void onStopTrackingTouch(SeekBar seekBar) {
                    n8.j.b(this, seekBar);
                }
            });
            findViewById(AbstractC0564f.h).setOnSeekBarChangeListener(new k() {
                @Override
                public final void onProgressChanged(SeekBar seekBar, int i5, boolean z) {
                    CameraActivity.this.Y1(seekBar, i5, z);
                }

                @Override
                public void onStartTrackingTouch(SeekBar seekBar) {
                    n8.j.a(this, seekBar);
                }

                @Override
                public void onStopTrackingTouch(SeekBar seekBar) {
                    n8.j.b(this, seekBar);
                }
            });
            this.x = a1(this.q);
            this.B = false;
            getOnBackPressedDispatcher().h(new L0(new K0() {
                @Override
                public final void a() {
                    CameraActivity.this.L1();
                }
            }));
            if (Build.VERSION.SDK_INT >= 35) {
                Z.F0(findViewById(R.id.content), new I() {
                    public final N0.B0 a(View view, N0.B0 b0) {
                        return CameraActivity.K0(view, b0);
                    }
                });
            }
        } catch (Exception e) {
            J(e, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i5) {
                    CameraActivity.this.D1(dialogInterface, i5);
                }
            });
        }
    }

    public void onPause() {
        super/*androidx.fragment.app.j*/.onPause();
        this.B = true;
    }

    public void onResume() {
        super/*androidx.fragment.app.j*/.onResume();
        this.B = false;
        if (this.o == null) {
            return;
        }
        if (t1() || v1()) {
            final XOneCameraView xOneCameraView = this.o;
            Objects.requireNonNull(xOneCameraView);
            xOneCameraView.post(new Runnable() {
                @Override
                public final void run() {
                    XOneCameraView.this.startPreview();
                }
            });
        }
    }

    public void onStop() {
        super.onStop();
        final XOneCameraView xOneCameraView = this.o;
        if (xOneCameraView == null) {
            return;
        }
        Objects.requireNonNull(xOneCameraView);
        xOneCameraView.post(new Runnable() {
            @Override
            public final void run() {
                XOneCameraView.this.stopPreview();
            }
        });
    }

    @Override
    public void p(C9.h hVar) {
        List<C9.f> j = C9.e.j(this, hVar);
        if (j.isEmpty()) {
            hVar.h(hVar.d());
            return;
        }
        HashSet hashSet = new HashSet();
        for (C9.f fVar : j) {
            String a2 = fVar.a();
            if (TextUtils.isEmpty(a2)) {
                a2 = "";
            }
            Utils.l("XOneAndroidFramework", "Permission denied: " + a2);
            if (fVar.b()) {
                hashSet.add(fVar.a());
            }
        }
        if (hashSet.isEmpty()) {
            a(hVar);
            C9.e.h(this, hVar);
        } else {
            J(new q(new StringBuilder(hVar.c())), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    CameraActivity.this.E1(dialogInterface, i);
                }
            });
            hVar.g(hashSet);
        }
    }

    public final a p1() {
        return this.C;
    }

    public final boolean r1() {
        return p1() == a.FilePreview;
    }

    public final boolean s1() {
        String n1 = n1();
        return "android.media.action.IMAGE_CAPTURE".equals(n1) || "android.media.action.STILL_IMAGE_CAMERA".equals(n1) || "android.media.action.IMAGE_CAPTURE_SECURE".equals(n1);
    }

    public final boolean t1() {
        return p1() == a.PhotoCapture;
    }

    public final boolean u1() {
        return "android.media.action.VIDEO_CAPTURE".equals(n1());
    }

    public final boolean v1() {
        return p1() == a.VideoCapture;
    }

    public final void w1() {
        this.s.setEnabled(false);
    }

    @Override
    public boolean x() {
        Configuration configuration = getResources().getConfiguration();
        return configuration != null && configuration.orientation == 1;
    }

    public final void x1() {
        this.s.setEnabled(true);
    }

    public final void y1(Throwable th) {
        try {
            if (c()) {
                Utils.l("XOneAndroidFramework", "An exception has happened while CameraActivity was being destroyed");
                return;
            }
            AlertDialog i1 = i1(th);
            this.n = i1;
            i1.show();
            TextView textView = (TextView) this.n.findViewById(R.id.message);
            if (textView != null) {
                textView.setTypeface(g1());
            }
        } catch (Exception e) {
            e.printStackTrace();
            new s(getApplicationContext(), th).t();
        }
    }

    public final void z1(Throwable th, DialogInterface.OnClickListener onClickListener) {
        AlertDialog create = k1(th, null, onClickListener).create();
        this.n = create;
        create.show();
        TextView textView = (TextView) this.n.findViewById(R.id.message);
        if (textView != null) {
            textView.setTypeface(g1());
        }
    }
}