导航菜单

页面标题

页面副标题

万能钥匙 v1.1.23 - ImagePreviewActivity.java 源代码

正在查看: 万能钥匙 v1.1.23 应用的 ImagePreviewActivity.java JAVA 源代码文件

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


package com.wifitutu.widget.imagepicker.ui;

import android.content.Intent;
import android.os.Bundle;
import android.text.format.Formatter;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.CompoundButton;
import androidx.viewpager.widget.ViewPager;
import c70.c;
import c70.e;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.wifitutu.widget.imagepicker.bean.ImageItem;
import com.wifitutu.widget.imagepicker.view.SuperCheckBox;
import java.util.Iterator;
import x60.c;
import x60.f;
import x60.h;

public class ImagePreviewActivity extends ImagePreviewBaseActivity implements c.a, View.OnClickListener, CompoundButton.OnCheckedChangeListener {
    public static ChangeQuickRedirect changeQuickRedirect;
    public boolean Z;
    public SuperCheckBox a0;
    public SuperCheckBox b0;
    public Button c0;
    public View d0;
    public View e0;

    public class a extends ViewPager.l {
        public static ChangeQuickRedirect changeQuickRedirect;

        public a() {
        }

        public void onPageSelected(int i) {
            if (PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 37126, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
                return;
            }
            ImagePreviewActivity imagePreviewActivity = ImagePreviewActivity.this;
            imagePreviewActivity.R = i;
            ImagePreviewActivity.this.a0.setChecked(ImagePreviewActivity.this.P.w(imagePreviewActivity.Q.get(i)));
            ?? r11 = ImagePreviewActivity.this;
            r11.S.setText(r11.getString(h.ip_preview_image_count, Integer.valueOf(r11.R + 1), Integer.valueOf(ImagePreviewActivity.this.Q.size())));
        }
    }

    public class b implements View.OnClickListener {
        public static ChangeQuickRedirect changeQuickRedirect;

        public b() {
        }

        @Override
        public void onClick(View view) {
            if (PatchProxy.proxy(new Object[]{view}, this, changeQuickRedirect, false, 37127, new Class[]{View.class}, Void.TYPE).isSupported) {
                return;
            }
            ImagePreviewActivity imagePreviewActivity = ImagePreviewActivity.this;
            ImageItem imageItem = imagePreviewActivity.Q.get(imagePreviewActivity.R);
            int p = ImagePreviewActivity.this.P.p();
            if (!ImagePreviewActivity.this.a0.isChecked() || ImagePreviewActivity.this.T.size() < p) {
                ImagePreviewActivity imagePreviewActivity2 = ImagePreviewActivity.this;
                imagePreviewActivity2.P.b(imagePreviewActivity2.R, imageItem, imagePreviewActivity2.a0.isChecked());
            } else {
                c70.b.a(ImagePreviewActivity.this).c(ImagePreviewActivity.this.getString(h.ip_select_limit, Integer.valueOf(p)));
                ImagePreviewActivity.this.a0.setChecked(false);
            }
        }
    }

    public class c implements c.a {
        public static ChangeQuickRedirect changeQuickRedirect;

        public c() {
        }

        @Override
        public void a(int i, int i2) {
            Object[] objArr = {new Integer(i), new Integer(i2)};
            ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
            Class cls = Integer.TYPE;
            if (PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 37128, new Class[]{cls, cls}, Void.TYPE).isSupported) {
                return;
            }
            ImagePreviewActivity.this.e0.setVisibility(0);
            ViewGroup.LayoutParams layoutParams = ImagePreviewActivity.this.e0.getLayoutParams();
            if (layoutParams.height == 0) {
                layoutParams.height = e.d(ImagePreviewActivity.this);
                ImagePreviewActivity.this.e0.requestLayout();
            }
        }

        @Override
        public void b(int i) {
            if (PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 37129, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
                return;
            }
            ImagePreviewActivity.this.e0.setVisibility(8);
        }
    }

    public class d implements c.a {
        public static ChangeQuickRedirect changeQuickRedirect;

        public d() {
        }

        @Override
        public void a(int i, int i2) {
            Object[] objArr = {new Integer(i), new Integer(i2)};
            ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
            Class cls = Integer.TYPE;
            if (PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 37130, new Class[]{cls, cls}, Void.TYPE).isSupported) {
                return;
            }
            ImagePreviewActivity.this.V.setPadding(0, 0, i2, 0);
            ImagePreviewActivity.this.d0.setPadding(0, 0, i2, 0);
        }

        @Override
        public void b(int i) {
            if (PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 37131, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
                return;
            }
            ImagePreviewActivity.this.V.setPadding(0, 0, 0, 0);
            ImagePreviewActivity.this.d0.setPadding(0, 0, 0, 0);
        }
    }

    @Override
    public void M() {
        if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 37125, new Class[0], Void.TYPE).isSupported) {
            return;
        }
        if (this.V.getVisibility() == 0) {
            this.V.setAnimation(AnimationUtils.loadAnimation(this, x60.d.top_out));
            this.d0.setAnimation(AnimationUtils.loadAnimation(this, x60.d.fade_out));
            this.V.setVisibility(8);
            this.d0.setVisibility(8);
            this.O.c(0);
            return;
        }
        this.V.setAnimation(AnimationUtils.loadAnimation(this, x60.d.top_in));
        this.d0.setAnimation(AnimationUtils.loadAnimation(this, x60.d.fade_in));
        this.V.setVisibility(0);
        this.d0.setVisibility(0);
        this.O.c(x60.e.ip_color_primary_dark);
    }

    public void onBackPressed() {
        if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 37122, new Class[0], Void.TYPE).isSupported) {
            return;
        }
        Intent intent = new Intent();
        intent.putExtra("isOrigin", this.Z);
        setResult(1005, intent);
        finish();
        super/*androidx.activity.ComponentActivity*/.onBackPressed();
    }

    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
        if (!PatchProxy.proxy(new Object[]{compoundButton, new Byte(z ? (byte) 1 : (byte) 0)}, this, changeQuickRedirect, false, 37123, new Class[]{CompoundButton.class, Boolean.TYPE}, Void.TYPE).isSupported && compoundButton.getId() == f.cb_origin) {
            if (!z) {
                this.Z = false;
                this.b0.setText(getString(h.ip_origin));
                return;
            }
            Iterator<ImageItem> it = this.T.iterator();
            long j = 0;
            while (it.hasNext()) {
                j += it.next().d;
            }
            String formatFileSize = Formatter.formatFileSize(this, j);
            this.Z = true;
            this.b0.setText(getString(h.ip_origin_size, formatFileSize));
        }
    }

    @Override
    public void onClick(View view) {
        if (PatchProxy.proxy(new Object[]{view}, this, changeQuickRedirect, false, 37121, new Class[]{View.class}, Void.TYPE).isSupported) {
            return;
        }
        int id = view.getId();
        if (id != f.btn_ok) {
            if (id == f.btn_back) {
                Intent intent = new Intent();
                intent.putExtra("isOrigin", this.Z);
                setResult(1005, intent);
                finish();
                return;
            }
            return;
        }
        if (this.P.q().size() == 0) {
            this.a0.setChecked(true);
            this.P.b(this.R, this.Q.get(this.R), this.a0.isChecked());
        }
        Intent intent2 = new Intent();
        intent2.putExtra("extra_result_items", this.P.q());
        setResult(1004, intent2);
        finish();
    }

    @Override
    public void onCreate(Bundle bundle) {
        if (PatchProxy.proxy(new Object[]{bundle}, this, changeQuickRedirect, false, 37119, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            return;
        }
        super.onCreate(bundle);
        this.Z = getIntent().getBooleanExtra("isOrigin", false);
        this.P.a(this);
        Button button = (Button) findViewById(f.btn_ok);
        this.c0 = button;
        button.setVisibility(0);
        this.c0.setOnClickListener(this);
        View findViewById = findViewById(f.bottom_bar);
        this.d0 = findViewById;
        findViewById.setVisibility(0);
        this.a0 = (SuperCheckBox) findViewById(f.cb_check);
        this.b0 = (SuperCheckBox) findViewById(f.cb_origin);
        this.e0 = findViewById(f.margin_bottom);
        this.b0.setText(getString(h.ip_origin));
        this.b0.setOnCheckedChangeListener(this);
        this.b0.setChecked(this.Z);
        w(0, null, false);
        boolean w = this.P.w(this.Q.get(this.R));
        this.S.setText(getString(h.ip_preview_image_count, Integer.valueOf(this.R + 1), Integer.valueOf(this.Q.size())));
        this.a0.setChecked(w);
        this.W.addOnPageChangeListener(new a());
        this.a0.setOnClickListener(new b());
        c70.c.b(this).a(new c());
        c70.c.c(this, 2).a(new d());
    }

    public void onDestroy() {
        if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 37124, new Class[0], Void.TYPE).isSupported) {
            return;
        }
        this.P.z(this);
        super.onDestroy();
    }

    @Override
    public void w(int i, ImageItem imageItem, boolean z) {
        if (PatchProxy.proxy(new Object[]{new Integer(i), imageItem, new Byte(z ? (byte) 1 : (byte) 0)}, this, changeQuickRedirect, false, 37120, new Class[]{Integer.TYPE, ImageItem.class, Boolean.TYPE}, Void.TYPE).isSupported) {
            return;
        }
        if (this.P.o() > 0) {
            this.c0.setText(getString(h.ip_select_complete, Integer.valueOf(this.P.o()), Integer.valueOf(this.P.p())));
        } else {
            this.c0.setText(getString(h.ip_complete));
        }
        if (this.b0.isChecked()) {
            Iterator<ImageItem> it = this.T.iterator();
            long j = 0;
            while (it.hasNext()) {
                j += it.next().d;
            }
            this.b0.setText(getString(h.ip_origin_size, Formatter.formatFileSize(this, j)));
        }
    }
}