导航菜单

页面标题

页面副标题

饼干视频 v4.1.0 - CaptureActivity.java 源代码

正在查看: 饼干视频 v4.1.0 应用的 CaptureActivity.java JAVA 源代码文件

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


package com.yzq.zxinglibrary.android;

import amc.cd.p101.C0571;
import amc.cd.p179.C1145;
import amc.cd.p179.C1148;
import amc.cd.p179.InterfaceC1143;
import amc.cd.p248.C1405;
import amc.cd.p248.C1407;
import amc.cd.p248.DialogInterfaceOnClickListenerC1406;
import amc.cd.p384.C2209;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.FeatureInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Handler;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.LinearLayoutCompat;
import com.bytedance.sdk.openadsdk.downloadnew.core.TTDownloadField;
import com.yzq.zxinglibrary.R$drawable;
import com.yzq.zxinglibrary.R$id;
import com.yzq.zxinglibrary.R$layout;
import com.yzq.zxinglibrary.R$string;
import com.yzq.zxinglibrary.bean.ZxingConfig;
import com.yzq.zxinglibrary.view.ViewfinderView;
import java.io.IOException;

public class CaptureActivity extends AppCompatActivity implements SurfaceHolder.Callback, View.OnClickListener {

    public static final String f10081 = CaptureActivity.class.getSimpleName();

    public ViewfinderView f10082;

    public SurfaceView f10083;

    public C0571 f10084;

    public C1405 f10085;

    public LinearLayoutCompat f10086;

    public CaptureActivityHandler f10087;

    public TextView f10088;

    public SurfaceHolder f10089;

    public C1407 f10090;

    public LinearLayoutCompat f10091;

    public ZxingConfig f10092;

    public boolean f10093;

    public AppCompatImageView f10094;

    public LinearLayoutCompat f10095;

    public AppCompatImageView f10096;

    public class C4108 implements InterfaceC1143 {
        public C4108() {
        }

        @Override
        public void mo2373() {
            Toast.makeText((Context) CaptureActivity.this, R$string.scan_failed_tip, 0).show();
        }

        @Override
        public void mo2374(C2209 c2209) {
            CaptureActivity.this.m10556(c2209);
        }
    }

    static {
        AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    }

    public static boolean m10553(PackageManager packageManager) {
        FeatureInfo[] systemAvailableFeatures;
        if (packageManager != null && (systemAvailableFeatures = packageManager.getSystemAvailableFeatures()) != null) {
            for (FeatureInfo featureInfo : systemAvailableFeatures) {
                if (featureInfo != null && "android.hardware.camera.flash".equals(featureInfo.name)) {
                    return true;
                }
            }
        }
        return false;
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
        if (i == 10 && i2 == -1) {
            new C1148(C1145.m2380(this, intent.getData()), new C4108()).run();
        }
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R$id.flashLightLayout) {
            this.f10084.m1064(this.f10087);
            return;
        }
        if (id != R$id.albumLayout) {
            if (id == R$id.backIv) {
                finish();
            }
        } else {
            Intent intent = new Intent();
            intent.setAction("android.intent.action.PICK");
            intent.setType("image/*");
            startActivityForResult(intent, 10);
        }
    }

    public void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
        Window window = getWindow();
        window.addFlags(TTDownloadField.CALL_DOWNLOAD_MODEL_SET_APP_NAME);
        window.setStatusBarColor(-16777216);
        try {
            this.f10092 = (ZxingConfig) getIntent().getExtras().get("zxingConfig");
        } catch (Exception e) {
            e.toString();
        }
        if (this.f10092 == null) {
            this.f10092 = new ZxingConfig();
        }
        setContentView(R$layout.activity_capture);
        m10559();
        this.f10093 = false;
        this.f10090 = new C1407(this);
        C1405 c1405 = new C1405(this);
        this.f10085 = c1405;
        c1405.m2596(this.f10092.isPlayBeep());
        this.f10085.m2592(this.f10092.isShake());
    }

    public void onDestroy() {
        this.f10090.m2604();
        this.f10082.m10569();
        super.onDestroy();
    }

    public void onPause() {
        CaptureActivityHandler captureActivityHandler = this.f10087;
        if (captureActivityHandler != null) {
            captureActivityHandler.m10564();
            this.f10087 = null;
        }
        this.f10090.m2603();
        this.f10085.close();
        this.f10084.m1062();
        if (!this.f10093) {
            this.f10089.removeCallback(this);
        }
        super/*androidx.fragment.app.FragmentActivity*/.onPause();
    }

    public void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
        C0571 c0571 = new C0571(getApplication(), this.f10092);
        this.f10084 = c0571;
        this.f10082.setCameraManager(c0571);
        this.f10087 = null;
        SurfaceHolder holder = this.f10083.getHolder();
        this.f10089 = holder;
        if (this.f10093) {
            m10563(holder);
        } else {
            holder.addCallback(this);
        }
        this.f10085.m2595();
        this.f10090.m2602();
    }

    @Override
    public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
    }

    @Override
    public void surfaceCreated(SurfaceHolder surfaceHolder) {
        if (this.f10093) {
            return;
        }
        this.f10093 = true;
        m10563(surfaceHolder);
    }

    @Override
    public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
        this.f10093 = false;
    }

    public ViewfinderView m10554() {
        return this.f10082;
    }

    public final void m10555(View view, boolean z) {
        if (z) {
            view.setVisibility(0);
        } else {
            view.setVisibility(8);
        }
    }

    public void m10556(C2209 c2209) {
        this.f10090.m2605();
        this.f10085.m2594();
        Intent intent = getIntent();
        intent.putExtra("codedContent", c2209.m3966());
        setResult(-1, intent);
        finish();
    }

    public void m10557(int i) {
        if (i == 8) {
            this.f10096.setImageResource(R$drawable.ic_open);
            this.f10088.setText(R$string.close_flash);
        } else {
            this.f10096.setImageResource(R$drawable.ic_close);
            this.f10088.setText(R$string.open_flash);
        }
    }

    public C0571 m10558() {
        return this.f10084;
    }

    public final void m10559() {
        SurfaceView surfaceView = (SurfaceView) findViewById(R$id.preview_view);
        this.f10083 = surfaceView;
        surfaceView.setOnClickListener(this);
        ViewfinderView viewfinderView = (ViewfinderView) findViewById(R$id.viewfinder_view);
        this.f10082 = viewfinderView;
        viewfinderView.setZxingConfig(this.f10092);
        AppCompatImageView findViewById = findViewById(R$id.backIv);
        this.f10094 = findViewById;
        findViewById.setOnClickListener(this);
        this.f10096 = findViewById(R$id.flashLightIv);
        this.f10088 = (TextView) findViewById(R$id.flashLightTv);
        LinearLayoutCompat findViewById2 = findViewById(R$id.flashLightLayout);
        this.f10095 = findViewById2;
        findViewById2.setOnClickListener(this);
        LinearLayoutCompat findViewById3 = findViewById(R$id.albumLayout);
        this.f10091 = findViewById3;
        findViewById3.setOnClickListener(this);
        LinearLayoutCompat findViewById4 = findViewById(R$id.bottomLayout);
        this.f10086 = findViewById4;
        m10555(findViewById4, this.f10092.isShowbottomLayout());
        m10555(this.f10095, this.f10092.isShowFlashLight());
        m10555(this.f10091, this.f10092.isShowAlbum());
        if (m10553(getPackageManager())) {
            this.f10095.setVisibility(0);
        } else {
            this.f10095.setVisibility(8);
        }
    }

    public void m10560() {
        this.f10082.m10570();
    }

    public Handler m10561() {
        return this.f10087;
    }

    public final void m10562() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("扫一扫");
        builder.setMessage(getString(R$string.msg_camera_framework_bug));
        builder.setPositiveButton(R$string.button_ok, new DialogInterfaceOnClickListenerC1406(this));
        builder.setOnCancelListener(new DialogInterfaceOnClickListenerC1406(this));
        builder.show();
    }

    public final void m10563(SurfaceHolder surfaceHolder) {
        if (surfaceHolder == null) {
            throw new IllegalStateException("No SurfaceHolder provided");
        }
        if (this.f10084.m1063()) {
            return;
        }
        try {
            this.f10084.m1060(surfaceHolder);
            if (this.f10087 == null) {
                this.f10087 = new CaptureActivityHandler(this, this.f10084);
            }
        } catch (IOException unused) {
            m10562();
        } catch (RuntimeException unused2) {
            m10562();
        }
    }
}