package androidx.biometric;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.e;
import androidx.lifecycle.at;
import com.strmr.ps.R;
import defpackage.h15;
import defpackage.l18;
import defpackage.m38;
import defpackage.re6;
import defpackage.vo6;

/* JADX INFO: loaded from: classes.dex */
@m38
public class y extends androidx.fragment.app.l {
    public final Handler a = new Handler(Looper.getMainLooper());
    public final Runnable b = new a();
    public BiometricViewModel c;
    public int d;
    public int e;
    public ImageView f;
    public TextView i;

    public class a implements Runnable {
        public a() {
        }

        @Override // java.lang.Runnable
        public final void run() {
            y yVar = y.this;
            Context context = yVar.getContext();
            if (context == null) {
                Log.w("FingerprintFragment", "Not resetting the dialog. Context is null.");
            } else {
                yVar.c.d(1);
                yVar.c.c(context.getString(R.string.fingerprint_dialog_touch_sensor));
            }
        }
    }

    @l18
    public static class b {
        public static void a(@vo6 Drawable drawable) {
            if (drawable instanceof AnimatedVectorDrawable) {
                ((AnimatedVectorDrawable) drawable).start();
            }
        }
    }

    @l18
    public static class c {
        public static int a() {
            return R.attr.colorError;
        }
    }

    public final int k(int i) {
        Context context = getContext();
        androidx.fragment.app.t activity = getActivity();
        if (context == null || activity == null) {
            Log.w("FingerprintFragment", "Unable to get themed color. Context or activity is null.");
            return 0;
        }
        TypedValue typedValue = new TypedValue();
        context.getTheme().resolveAttribute(i, typedValue, true);
        TypedArray typedArrayObtainStyledAttributes = activity.obtainStyledAttributes(typedValue.data, new int[]{i});
        int color = typedArrayObtainStyledAttributes.getColor(0, 0);
        typedArrayObtainStyledAttributes.recycle();
        return color;
    }

    @Override // androidx.fragment.app.l, android.content.DialogInterface.OnCancelListener
    public final void onCancel(DialogInterface dialogInterface) {
        super.onCancel(dialogInterface);
        BiometricViewModel biometricViewModel = this.c;
        if (biometricViewModel.m == null) {
            biometricViewModel.m = new re6();
        }
        BiometricViewModel.f(biometricViewModel.m, Boolean.TRUE);
    }

    @Override // androidx.fragment.app.l, androidx.fragment.app.o
    public final void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        androidx.fragment.app.t activity = getActivity();
        if (activity != null) {
            BiometricViewModel biometricViewModel = (BiometricViewModel) new at(activity).a(h15.e(BiometricViewModel.class));
            this.c = biometricViewModel;
            if (biometricViewModel.o == null) {
                biometricViewModel.o = new re6();
            }
            biometricViewModel.o.f(this, new aa(this));
            BiometricViewModel biometricViewModel2 = this.c;
            if (biometricViewModel2.p == null) {
                biometricViewModel2.p = new re6();
            }
            biometricViewModel2.p.f(this, new ab(this));
        }
        this.d = k(c.a());
        this.e = k(android.R.attr.textColorSecondary);
    }

    @Override // androidx.fragment.app.l
    public final Dialog onCreateDialog(Bundle bundle) {
        e.a aVar = new e.a(requireContext());
        this.c.getClass();
        aVar.setTitle((CharSequence) null);
        View viewInflate = LayoutInflater.from(aVar.getContext()).inflate(R.layout.fingerprint_dialog_layout, (ViewGroup) null);
        TextView textView = (TextView) viewInflate.findViewById(R.id.fingerprint_subtitle);
        if (textView != null) {
            this.c.getClass();
            if (TextUtils.isEmpty(null)) {
                textView.setVisibility(8);
            } else {
                textView.setVisibility(0);
                textView.setText((CharSequence) null);
            }
        }
        TextView textView2 = (TextView) viewInflate.findViewById(R.id.fingerprint_description);
        if (textView2 != null) {
            this.c.getClass();
            if (TextUtils.isEmpty(null)) {
                textView2.setVisibility(8);
            } else {
                textView2.setVisibility(0);
                textView2.setText((CharSequence) null);
            }
        }
        this.f = (ImageView) viewInflate.findViewById(R.id.fingerprint_icon);
        this.i = (TextView) viewInflate.findViewById(R.id.fingerprint_error);
        this.c.getClass();
        this.c.getClass();
        aVar.setNegativeButton((CharSequence) null, new z(this));
        aVar.setView(viewInflate);
        androidx.appcompat.app.e eVarCreate = aVar.create();
        eVarCreate.setCanceledOnTouchOutside(false);
        return eVarCreate;
    }

    @Override // androidx.fragment.app.o
    public final void onPause() {
        super.onPause();
        this.a.removeCallbacksAndMessages(null);
    }

    @Override // androidx.fragment.app.o
    public final void onResume() {
        super.onResume();
        BiometricViewModel biometricViewModel = this.c;
        biometricViewModel.n = 0;
        biometricViewModel.d(1);
        this.c.c(getString(R.string.fingerprint_dialog_touch_sensor));
    }
}
