导航菜单

页面标题

页面副标题

TezFinance v1.1.1 - LivenessActivity.java 源代码

正在查看: TezFinance v1.1.1 应用的 LivenessActivity.java JAVA 源代码文件

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


package com.izilab.liveness.api;

import android.media.SoundPool;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.Toolbar;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import b.f;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.izilab.liveness.R;
import com.izilab.liveness.api.Detector;
import com.izilab.widget.LivenessPreview;
import java.util.ArrayList;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.Intrinsics;

@Metadata(d1 = {"\u0000Z\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0007\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\t\u0018\u00002\u00020\u00012\u00020\u0002B\u0007¢\u0006\u0004\b:\u0010;J\u0010\u0010\u0006\u001a\u00020\u00052\u0006\u0010\u0004\u001a\u00020\u0003H\u0002J\u0010\u0010\b\u001a\u00020\u00052\u0006\u0010\u0007\u001a\u00020\u0003H\u0002J\u0012\u0010\u000b\u001a\u00020\u00052\b\u0010\n\u001a\u0004\u0018\u00010\tH\u0014J\u0010\u0010\u000e\u001a\u00020\u00052\u0006\u0010\r\u001a\u00020\fH\u0016J\u0010\u0010\u0011\u001a\u00020\u00052\u0006\u0010\u0010\u001a\u00020\u000fH\u0016J\b\u0010\u0012\u001a\u00020\u0005H\u0016J\b\u0010\u0013\u001a\u00020\u0005H\u0014R\"\u0010\u0015\u001a\u00020\u00148\u0006@\u0006X\u0086.¢\u0006\u0012\n\u0004\b\u0015\u0010\u0016\u001a\u0004\b\u0017\u0010\u0018\"\u0004\b\u0019\u0010\u001aR\"\u0010\u001c\u001a\u00020\u001b8\u0006@\u0006X\u0086.¢\u0006\u0012\n\u0004\b\u001c\u0010\u001d\u001a\u0004\b\u001e\u0010\u001f\"\u0004\b \u0010!R\"\u0010#\u001a\u00020\"8\u0006@\u0006X\u0086.¢\u0006\u0012\n\u0004\b#\u0010$\u001a\u0004\b%\u0010&\"\u0004\b'\u0010(R\"\u0010*\u001a\u00020)8\u0006@\u0006X\u0086.¢\u0006\u0012\n\u0004\b*\u0010+\u001a\u0004\b,\u0010-\"\u0004\b.\u0010/R\"\u00100\u001a\u00020\u00148\u0006@\u0006X\u0086.¢\u0006\u0012\n\u0004\b0\u0010\u0016\u001a\u0004\b1\u0010\u0018\"\u0004\b2\u0010\u001aR\"\u00104\u001a\u0002038\u0006@\u0006X\u0086.¢\u0006\u0012\n\u0004\b4\u00105\u001a\u0004\b6\u00107\"\u0004\b8\u00109¨\u0006<"}, d2 = {"Lcom/izilab/liveness/api/LivenessActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "Lb/f;", "", "percentWidth", "", "initPreview", "f", "setBrightness", "Landroid/os/Bundle;", "savedInstanceState", "onCreate", "", "code", "onLivenessAction", "", FirebaseAnalytics.Param.SUCCESS, "onLivenessResult", "onBackPressed", "onDestroy", "Landroid/widget/TextView;", "mGuideText", "Landroid/widget/TextView;", "getMGuideText", "()Landroid/widget/TextView;", "setMGuideText", "(Landroid/widget/TextView;)V", "Landroidx/appcompat/widget/Toolbar;", "mToolBar", "Landroidx/appcompat/widget/Toolbar;", "getMToolBar", "()Landroidx/appcompat/widget/Toolbar;", "setMToolBar", "(Landroidx/appcompat/widget/Toolbar;)V", "Landroid/view/View;", "mMainContainer", "Landroid/view/View;", "getMMainContainer", "()Landroid/view/View;", "setMMainContainer", "(Landroid/view/View;)V", "Lcom/izilab/widget/LivenessPreview;", "mLivenessPreview", "Lcom/izilab/widget/LivenessPreview;", "getMLivenessPreview", "()Lcom/izilab/widget/LivenessPreview;", "setMLivenessPreview", "(Lcom/izilab/widget/LivenessPreview;)V", "mGuideTextView", "getMGuideTextView", "setMGuideTextView", "Landroidx/appcompat/widget/AppCompatImageView;", "mUserGuideIconView", "Landroidx/appcompat/widget/AppCompatImageView;", "getMUserGuideIconView", "()Landroidx/appcompat/widget/AppCompatImageView;", "setMUserGuideIconView", "(Landroidx/appcompat/widget/AppCompatImageView;)V", "<init>", "()V", "app_release"}, k = 1, mv = {1, 7, 1})
public final class LivenessActivity extends AppCompatActivity implements f {
    public TextView mGuideText;
    public TextView mGuideTextView;
    public LivenessPreview mLivenessPreview;
    public View mMainContainer;
    public Toolbar mToolBar;
    public AppCompatImageView mUserGuideIconView;

    private final void initPreview(float percentWidth) {
        ConstraintLayout.LayoutParams layoutParams = getMLivenessPreview().getLayoutParams();
        Intrinsics.checkNotNull(layoutParams, "null cannot be cast to non-null type androidx.constraintlayout.widget.ConstraintLayout.LayoutParams");
        ConstraintLayout.LayoutParams layoutParams2 = layoutParams;
        layoutParams2.matchConstraintPercentWidth = percentWidth;
        getMLivenessPreview().setLayoutParams(layoutParams2);
    }

    public static final void m113onCreate$lambda0(LivenessActivity this$0, View view) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        LivenessResult.setSuccess(false);
        LivenessResult.setErrorMsg(SDKConstant.ERROR_USER_GIVE_UP);
        this$0.setResult(0);
        this$0.finish();
    }

    private final void setBrightness(float f) {
        try {
            WindowManager.LayoutParams attributes = getWindow().getAttributes();
            attributes.screenBrightness = f;
            getWindow().setAttributes(attributes);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public final TextView getMGuideText() {
        TextView textView = this.mGuideText;
        if (textView != null) {
            return textView;
        }
        Intrinsics.throwUninitializedPropertyAccessException("mGuideText");
        return null;
    }

    public final TextView getMGuideTextView() {
        TextView textView = this.mGuideTextView;
        if (textView != null) {
            return textView;
        }
        Intrinsics.throwUninitializedPropertyAccessException("mGuideTextView");
        return null;
    }

    public final LivenessPreview getMLivenessPreview() {
        LivenessPreview livenessPreview = this.mLivenessPreview;
        if (livenessPreview != null) {
            return livenessPreview;
        }
        Intrinsics.throwUninitializedPropertyAccessException("mLivenessPreview");
        return null;
    }

    public final View getMMainContainer() {
        View view = this.mMainContainer;
        if (view != null) {
            return view;
        }
        Intrinsics.throwUninitializedPropertyAccessException("mMainContainer");
        return null;
    }

    public final Toolbar getMToolBar() {
        Toolbar toolbar = this.mToolBar;
        if (toolbar != null) {
            return toolbar;
        }
        Intrinsics.throwUninitializedPropertyAccessException("mToolBar");
        return null;
    }

    public final AppCompatImageView getMUserGuideIconView() {
        AppCompatImageView appCompatImageView = this.mUserGuideIconView;
        if (appCompatImageView != null) {
            return appCompatImageView;
        }
        Intrinsics.throwUninitializedPropertyAccessException("mUserGuideIconView");
        return null;
    }

    public void onBackPressed() {
        LivenessResult.setSuccess(false);
        LivenessResult.setErrorMsg(SDKConstant.ERROR_USER_GIVE_UP);
        setResult(0);
        finish();
    }

    public void onCreate(Bundle savedInstanceState) {
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(savedInstanceState);
        setBrightness(1.0f);
        setContentView(R.layout.izilab_activity_liveness);
        View findViewById = findViewById(R.id.guide);
        Intrinsics.checkNotNullExpressionValue(findViewById, "findViewById(R.id.guide)");
        setMGuideTextView((TextView) findViewById);
        Toolbar findViewById2 = findViewById(R.id.toolbar);
        Intrinsics.checkNotNullExpressionValue(findViewById2, "findViewById(R.id.toolbar)");
        setMToolBar(findViewById2);
        View findViewById3 = findViewById(R.id.camera_preview);
        Intrinsics.checkNotNullExpressionValue(findViewById3, "findViewById(R.id.camera_preview)");
        setMLivenessPreview((LivenessPreview) findViewById3);
        View findViewById4 = findViewById(R.id.guide);
        Intrinsics.checkNotNullExpressionValue(findViewById4, "findViewById(R.id.guide)");
        setMGuideText((TextView) findViewById4);
        View findViewById5 = findViewById(R.id.main);
        Intrinsics.checkNotNullExpressionValue(findViewById5, "findViewById(R.id.main)");
        setMMainContainer(findViewById5);
        AppCompatImageView findViewById6 = findViewById(R.id.user_guide_icon);
        Intrinsics.checkNotNullExpressionValue(findViewById6, "findViewById(R.id.user_guide_icon)");
        setMUserGuideIconView(findViewById6);
        int intExtra = getIntent().getIntExtra(SDKConstant.KEY_TITLE_COLOR, ContextCompat.getColor(this, android.R.color.black));
        getMToolBar().setTitleTextColor(intExtra);
        getMToolBar().setNavigationIcon(SDKHelper.getColoredDrawableWithColor$default(SDKHelper.INSTANCE, this, R.drawable.izilab_ic_back, intExtra, 0, 8, null));
        getMMainContainer().setBackgroundColor(getIntent().getIntExtra(SDKConstant.KEY_BG_COLOR, ContextCompat.getColor(this, android.R.color.white)));
        getMGuideText().setTextColor(getIntent().getIntExtra(SDKConstant.KEY_GUIDE_COLOR, ContextCompat.getColor(this, R.color.colorPrimary)));
        getMToolBar().setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                LivenessActivity.m113onCreate$lambda0(LivenessActivity.this, view);
            }
        });
        initPreview(getIntent().getFloatExtra(SDKConstant.KEY_WIDTH_PERCENT, 0.7f));
        int intExtra2 = getIntent().getIntExtra(SDKConstant.KEY_PROGRESS_COLOR, ContextCompat.getColor(this, R.color.colorPrimary));
        ArrayList<String> stringArrayListExtra = getIntent().getStringArrayListExtra(SDKConstant.KEY_ACTION_LIST);
        boolean booleanExtra = getIntent().getBooleanExtra(SDKConstant.KEY_AUDIO, true);
        getMLivenessPreview().setProgressBarColor(intExtra2);
        if (!booleanExtra) {
            getMLivenessPreview().x = false;
        }
        if (stringArrayListExtra != null) {
            ArrayList arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(stringArrayListExtra, 10));
            for (String it : stringArrayListExtra) {
                Intrinsics.checkNotNullExpressionValue(it, "it");
                arrayList.add(Detector.DetectionType.valueOf(it));
            }
            getMLivenessPreview().setActionList(new ArrayList<>(arrayList));
        }
        getMLivenessPreview().setUserGuideView(getMUserGuideIconView());
        getMLivenessPreview().setLivenessPreviewCallback(this);
        getMLivenessPreview().g();
    }

    public void onDestroy() {
        super.onDestroy();
        LivenessPreview mLivenessPreview = getMLivenessPreview();
        mLivenessPreview.i.shutdown();
        SoundPool soundPool = mLivenessPreview.g;
        if (soundPool == null) {
            Intrinsics.throwUninitializedPropertyAccessException("mSoundPool");
            soundPool = null;
        }
        soundPool.release();
    }

    public void onLivenessAction(int code) {
        if (code == 1) {
            getMGuideTextView().setText(R.string.izilab_facing_camera);
            return;
        }
        if (code == 2) {
            getMGuideTextView().setText(R.string.izilab_open_mouth);
            return;
        }
        if (code == 3) {
            getMGuideTextView().setText(R.string.izilab_shake_your_head);
        } else if (code == 4) {
            getMGuideTextView().setText(R.string.izilab_blink);
        } else {
            if (code != 5) {
                return;
            }
            getMGuideTextView().setText(R.string.izilab_only_one_face);
        }
    }

    public void onLivenessResult(boolean success) {
        setResult(-1);
        finish();
    }

    public final void setMGuideText(TextView textView) {
        Intrinsics.checkNotNullParameter(textView, "<set-?>");
        this.mGuideText = textView;
    }

    public final void setMGuideTextView(TextView textView) {
        Intrinsics.checkNotNullParameter(textView, "<set-?>");
        this.mGuideTextView = textView;
    }

    public final void setMLivenessPreview(LivenessPreview livenessPreview) {
        Intrinsics.checkNotNullParameter(livenessPreview, "<set-?>");
        this.mLivenessPreview = livenessPreview;
    }

    public final void setMMainContainer(View view) {
        Intrinsics.checkNotNullParameter(view, "<set-?>");
        this.mMainContainer = view;
    }

    public final void setMToolBar(Toolbar toolbar) {
        Intrinsics.checkNotNullParameter(toolbar, "<set-?>");
        this.mToolBar = toolbar;
    }

    public final void setMUserGuideIconView(AppCompatImageView appCompatImageView) {
        Intrinsics.checkNotNullParameter(appCompatImageView, "<set-?>");
        this.mUserGuideIconView = appCompatImageView;
    }
}