导航菜单

页面标题

页面副标题

95爱播免登录版 v3.1.9 - EasyPhotosActivity.java 源代码

正在查看: 95爱播免登录版 v3.1.9 应用的 EasyPhotosActivity.java JAVA 源代码文件

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


package easyphotos.ui;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Fragment;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.mobile.auth.gatewayauth.Constant;
import com.sssp.sjchat.R;
import d.i.j;
import e.e.b.a;
import e.h.d.a;
import easyphotos.models.album.entity.Photo;
import easyphotos.ui.a.a;
import easyphotos.ui.a.b;
import easyphotos.ui.widget.PressedTextView;
import easyphotos.utils.system.SJImmersiveStatusBar;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;

public class EasyPhotosActivity extends androidx.fragment.app.b implements a.c, b.e, e.e.a.a, View.OnClickListener {
    private SJImmersiveStatusBar B;
    easyphotos.ui.b.a C;
    String H;
    String I;
    private File a;
    private e.e.b.a b;

    private RecyclerView f4748f;

    private easyphotos.ui.a.b f4749g;

    private GridLayoutManager f4750h;

    private RecyclerView f4751i;

    private easyphotos.ui.a.e f4752j;

    private LinearLayoutManager f4753k;
    private RecyclerView l;
    private easyphotos.ui.a.a m;
    private RelativeLayout n;
    private PressedTextView o;
    private PressedTextView p;
    private PressedTextView q;
    private AnimatorSet r;
    private AnimatorSet s;
    private LinearLayout t;
    private ImageView u;
    private TextView w;
    private RelativeLayout x;
    private TextView y;
    private View z;
    private ArrayList<Object> c = new ArrayList<>();
    private ArrayList<Object> d = new ArrayList<>();

    private ArrayList<Photo> f4747e = new ArrayList<>();
    private int v = 0;
    private boolean A = false;
    private Uri G = null;
    private boolean J = false;

    class a implements a.b {

        class RunnableC0137a implements Runnable {
            RunnableC0137a() {
            }

            @Override
            public void run() {
                EasyPhotosActivity.this.C.dismiss();
                EasyPhotosActivity.this.f0();
            }
        }

        a() {
        }

        @Override
        public void a() {
            EasyPhotosActivity.this.runOnUiThread(new RunnableC0137a());
        }
    }

    class b extends AnimatorListenerAdapter {
        b() {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            super.onAnimationEnd(animator);
            EasyPhotosActivity.this.n.setVisibility(8);
            EasyPhotosActivity easyPhotosActivity = EasyPhotosActivity.this;
            easyPhotosActivity.n0(easyPhotosActivity.u, true);
        }
    }

    class c implements a.InterfaceC0136a {
        c() {
        }

        @Override
        public void a() {
            EasyPhotosActivity.this.finish();
        }

        @Override
        public void b() {
            EasyPhotosActivity.this.finish();
        }

        @Override
        public void onSuccess() {
            EasyPhotosActivity.this.V();
        }
    }

    class d implements View.OnClickListener {
        d() {
        }

        @Override
        public void onClick(View view) {
            androidx.fragment.app.b bVar = EasyPhotosActivity.this;
            e.h.e.a.a(bVar, bVar.getPackageName());
        }
    }

    class e implements Runnable {
        final int a;

        e(int i2) {
            this.a = i2;
        }

        @Override
        public void run() {
            EasyPhotosActivity.this.r0(this.a);
        }
    }

    class f implements Runnable {

        class a implements Runnable {
            final Photo a;

            a(Photo photo) {
                this.a = photo;
            }

            @Override
            public void run() {
                EasyPhotosActivity.this.C.dismiss();
                if (!e.g.a.r && !EasyPhotosActivity.this.b.b().isEmpty()) {
                    EasyPhotosActivity.this.O(this.a);
                    return;
                }
                Intent intent = new Intent();
                this.a.l = e.g.a.n;
                EasyPhotosActivity.this.f4747e.add(this.a);
                intent.putParcelableArrayListExtra("keyOfEasyPhotosResult", EasyPhotosActivity.this.f4747e);
                intent.putExtra("keyOfEasyPhotosResultSelectedOriginal", e.g.a.n);
                EasyPhotosActivity.this.setResult(-1, intent);
                EasyPhotosActivity.this.finish();
            }
        }

        f() {
        }

        @Override
        public void run() {
            EasyPhotosActivity easyPhotosActivity = EasyPhotosActivity.this;
            Photo U = easyPhotosActivity.U(easyPhotosActivity.G);
            if (U == null) {
                return;
            }
            EasyPhotosActivity.this.runOnUiThread(new a(U));
        }
    }

    class g implements Runnable {

        class a implements Runnable {
            final Photo a;

            a(Photo photo) {
                this.a = photo;
            }

            @Override
            public void run() {
                if (!e.g.a.r && !EasyPhotosActivity.this.b.b().isEmpty()) {
                    EasyPhotosActivity.this.O(this.a);
                    return;
                }
                Intent intent = new Intent();
                this.a.l = e.g.a.n;
                EasyPhotosActivity.this.f4747e.add(this.a);
                intent.putParcelableArrayListExtra("keyOfEasyPhotosResult", EasyPhotosActivity.this.f4747e);
                intent.putExtra("keyOfEasyPhotosResultSelectedOriginal", e.g.a.n);
                EasyPhotosActivity.this.setResult(-1, intent);
                EasyPhotosActivity.this.finish();
            }
        }

        g() {
        }

        @Override
        public void run() {
            int i2;
            int i3;
            int i4;
            File file = new File(EasyPhotosActivity.this.a.getParentFile(), String.format("IMG_%s.jpg", new SimpleDateFormat("yyyyMMdd_HH_mm_ss", Locale.getDefault()).format(new Date())));
            if (!file.exists() && EasyPhotosActivity.this.a.renameTo(file)) {
                EasyPhotosActivity.this.a = file;
            }
            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inJustDecodeBounds = true;
            BitmapFactory.decodeFile(EasyPhotosActivity.this.a.getAbsolutePath(), options);
            ?? r0 = EasyPhotosActivity.this;
            e.h.c.b.a(r0, ((EasyPhotosActivity) r0).a);
            ?? r02 = EasyPhotosActivity.this;
            Uri c = e.h.f.a.c(r02, ((EasyPhotosActivity) r02).a);
            if (e.g.a.f4737i) {
                int i5 = options.outWidth;
                int i6 = options.outHeight;
                androidx.exifinterface.a.a aVar = null;
                try {
                    aVar = new androidx.exifinterface.a.a(EasyPhotosActivity.this.a);
                } catch (IOException e2) {
                    e2.printStackTrace();
                }
                if (aVar != null) {
                    int e3 = aVar.e("Orientation", -1);
                    if (e3 == 6 || e3 == 8) {
                        i2 = options.outHeight;
                        i3 = options.outWidth;
                        i4 = e3;
                    } else {
                        i2 = i5;
                        i4 = e3;
                        i3 = i6;
                    }
                    EasyPhotosActivity.this.runOnUiThread(new a(new Photo(EasyPhotosActivity.this.a.getName(), c, EasyPhotosActivity.this.a.getAbsolutePath(), EasyPhotosActivity.this.a.lastModified() / 1000, i2, i3, i4, EasyPhotosActivity.this.a.length(), e.h.c.a.b(EasyPhotosActivity.this.a.getAbsolutePath()), options.outMimeType)));
                }
                i2 = i5;
                i3 = i6;
            } else {
                i2 = 0;
                i3 = 0;
            }
            i4 = 0;
            EasyPhotosActivity.this.runOnUiThread(new a(new Photo(EasyPhotosActivity.this.a.getName(), c, EasyPhotosActivity.this.a.getAbsolutePath(), EasyPhotosActivity.this.a.lastModified() / 1000, i2, i3, i4, EasyPhotosActivity.this.a.length(), e.h.c.a.b(EasyPhotosActivity.this.a.getAbsolutePath()), options.outMimeType)));
        }
    }

    class h extends GridLayoutManager.b {
        h() {
        }

        public int f(int i2) {
            if (i2 == 0) {
                return EasyPhotosActivity.this.f4750h.k();
            }
            return 1;
        }
    }

    class i implements Runnable {
        i() {
        }

        @Override
        public void run() {
            EasyPhotosActivity.this.f4752j.notifyDataSetChanged();
            EasyPhotosActivity.this.f4752j.i(true);
        }
    }

    public void O(Photo photo) {
        photo.l = e.g.a.n;
        if (!this.A) {
            e.h.c.b.b(this, photo.c);
            String absolutePath = new File(photo.c).getParentFile().getAbsolutePath();
            this.H = absolutePath;
            this.I = e.h.b.a.a(absolutePath);
        }
        this.b.a.e(this.b.c(this)).a(0, photo);
        this.b.a.b(this.I, this.H, photo.c, photo.a);
        this.b.a.e(this.I).a(0, photo);
        this.d.clear();
        this.d.addAll(this.b.b());
        if (e.g.a.b()) {
            this.d.add(this.d.size() < 3 ? this.d.size() - 1 : 2, e.g.a.f4734f);
        }
        this.m.notifyDataSetChanged();
        if (e.g.a.d == 1) {
            e.f.a.b();
            e(Integer.valueOf(e.f.a.a(photo)));
        } else if (e.f.a.c() >= e.g.a.d) {
            e(null);
        } else {
            e(Integer.valueOf(e.f.a.a(photo)));
        }
        this.l.scrollToPosition(0);
        this.m.h(0);
        l0();
    }

    private void Q() {
        File externalStoragePublicDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
        if (externalStoragePublicDirectory == null) {
            File externalStorageDirectory = Environment.getExternalStorageDirectory();
            StringBuilder sb = new StringBuilder();
            String str = File.separator;
            sb.append(str);
            sb.append("temp");
            sb.append(str);
            sb.append("Camera");
            sb.append(str);
            externalStoragePublicDirectory = new File(externalStorageDirectory, sb.toString());
        }
        if (!externalStoragePublicDirectory.isDirectory() && !externalStoragePublicDirectory.mkdirs() && (((externalStoragePublicDirectory = getExternalFilesDir(null)) == null || !externalStoragePublicDirectory.exists()) && (((externalStoragePublicDirectory = getFilesDir()) == null || !externalStoragePublicDirectory.exists()) && ((externalStoragePublicDirectory = getFilesDir()) == null || !externalStoragePublicDirectory.exists())))) {
            StringBuilder sb2 = new StringBuilder();
            String str2 = File.separator;
            sb2.append(str2);
            sb2.append("data");
            sb2.append(str2);
            sb2.append("data");
            sb2.append(str2);
            sb2.append(getPackageName());
            sb2.append(str2);
            sb2.append("cache");
            sb2.append(str2);
            File file = new File(sb2.toString());
            if (!file.exists()) {
                file.mkdirs();
            }
            externalStoragePublicDirectory = file;
        }
        try {
            this.a = File.createTempFile("IMG", ".jpg", externalStoragePublicDirectory);
        } catch (IOException e2) {
            e2.printStackTrace();
            this.a = null;
        }
    }

    private Uri R() {
        ContentValues contentValues = new ContentValues();
        contentValues.put("_display_name", String.valueOf(System.currentTimeMillis()));
        if (Build.VERSION.SDK_INT >= 29) {
            contentValues.put("relative_path", "Pictures");
        }
        contentValues.put("mime_type", "image/JPEG");
        return getContentResolver().insert(MediaStore.Images.Media.getContentUri("external"), contentValues);
    }

    private void S() {
        if (e.f.a.c() == 0) {
            j.s(R.string.tex_select_video_photo);
        } else {
            if (this.J) {
                return;
            }
            this.J = true;
            i0();
        }
    }

    public Photo U(Uri uri) {
        int i2;
        int i3;
        int i4;
        String[] f2 = e.e.b.a.e().f();
        boolean z = f2.length > 8;
        Cursor query = getContentResolver().query(uri, f2, null, null, null);
        Photo photo = null;
        if (query == null) {
            return null;
        }
        int columnIndex = query.getColumnIndex("bucket_display_name");
        if (query.moveToFirst()) {
            String string = query.getString(1);
            String string2 = query.getString(2);
            long j2 = query.getLong(3);
            String string3 = query.getString(4);
            long j3 = query.getLong(5);
            if (z) {
                int i5 = query.getInt(query.getColumnIndex("width"));
                int i6 = query.getInt(query.getColumnIndex("height"));
                int i7 = query.getInt(query.getColumnIndex(Constant.PROTOCOL_WEBVIEW_ORIENTATION));
                if (90 == i7 || 270 == i7) {
                    i2 = i6;
                    i4 = i7;
                    i3 = i5;
                } else {
                    i3 = i6;
                    i4 = i7;
                    i2 = i5;
                }
            } else {
                i2 = 0;
                i3 = 0;
                i4 = 0;
            }
            if (columnIndex > 0) {
                String string4 = query.getString(columnIndex);
                this.I = string4;
                this.H = string4;
            }
            photo = new Photo(string2, uri, string, j2, i2, i3, i4, j3, 0L, string3);
        }
        query.close();
        return photo;
    }

    public void V() {
        this.x.setVisibility(8);
        if (e.g.a.r) {
            b0(11);
            findViewById(R.id.container).setVisibility(8);
        } else {
            this.C.show();
        }
        a aVar = new a();
        e.e.b.a e2 = e.e.b.a.e();
        this.b = e2;
        e2.h(this, aVar);
    }

    private void W() {
        this.l = findViewById(R.id.rv_album_items);
        this.d.clear();
        this.d.addAll(this.b.b());
        if (e.g.a.b()) {
            this.d.add(this.d.size() < 3 ? this.d.size() - 1 : 2, e.g.a.f4734f);
        }
        this.m = new easyphotos.ui.a.a(this, this.d, 0, this);
        this.l.setLayoutManager(new LinearLayoutManager(this));
        this.l.setAdapter(this.m);
    }

    private void X() {
        if (this.f4751i == null) {
            this.f4751i = findViewById(R.id.rv_selected_photos);
            this.f4752j = new easyphotos.ui.a.e(e.f.a.a, this);
            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
            this.f4753k = linearLayoutManager;
            linearLayoutManager.setOrientation(0);
            this.f4751i.setLayoutManager(this.f4753k);
            this.f4751i.setAdapter(this.f4752j);
            androidx.recyclerview.widget.c cVar = new androidx.recyclerview.widget.c();
            cVar.w(500L);
            this.f4751i.setItemAnimator(cVar);
        } else {
            if (e.f.a.b) {
                this.f4752j.notifyDataSetChanged();
            } else {
                this.f4752j.notifyItemRemoved(e.f.a.n());
                this.f4752j.i(false);
                this.f4751i.postDelayed(new i(), 500L);
            }
            this.f4751i.smoothScrollToPosition(this.f4752j.f());
            if (this.f4752j.f() != e.f.a.c()) {
                this.f4752j.j(e.f.a.c());
            }
        }
        if (e.f.a.c() == 0) {
            if (this.f4751i.getVisibility() != 8) {
                this.f4751i.setVisibility(8);
            }
        } else if (this.f4751i.getVisibility() != 0) {
            this.f4751i.setVisibility(0);
        }
    }

    private void Y() {
        this.z = findViewById(R.id.m_bottom_bar);
        this.x = (RelativeLayout) findViewById(R.id.rl_permissions_view);
        this.y = (TextView) findViewById(R.id.tv_permission);
        this.n = (RelativeLayout) findViewById(R.id.root_view_album_items);
        this.w = (TextView) findViewById(R.id.tv_title);
        if (e.g.a.f()) {
            this.w.setText(R.string.video_selection_easy_photos);
        }
        j0(R.id.iv_back);
        Z();
    }

    private void Z() {
        easyphotos.utils.system.b.k(this, null);
        SJImmersiveStatusBar sJImmersiveStatusBar = (SJImmersiveStatusBar) findViewById(R.id.status_bar);
        this.B = sJImmersiveStatusBar;
        if (sJImmersiveStatusBar != null) {
            easyphotos.utils.system.b.f(this, sJImmersiveStatusBar, R.color.white_easy_photos, true);
        }
    }

    private void a0() {
        if (this.b.b().isEmpty()) {
            if (e.g.a.f()) {
                Toast.makeText((Context) this, R.string.no_videos_easy_photos, 1).show();
                finish();
                return;
            }
            Toast.makeText((Context) this, R.string.no_photos_easy_photos, 1).show();
            if (e.g.a.p) {
                b0(11);
                return;
            } else {
                finish();
                return;
            }
        }
        e.b.b(this);
        if (e.g.a.c()) {
            findViewById(R.id.m_tool_bar_bottom_line).setVisibility(8);
        }
        int integer = getResources().getInteger(R.integer.photos_columns_easy_photos);
        this.t = (LinearLayout) findViewById(R.id.lv_title);
        this.u = (ImageView) findViewById(R.id.iv_title_arrow);
        ?? r2 = (PressedTextView) findViewById(R.id.tv_title);
        this.o = r2;
        r2.setText(this.b.b().get(0).a);
        this.p = (PressedTextView) findViewById(R.id.tv_done);
        RecyclerView findViewById = findViewById(R.id.rv_photos);
        this.f4748f = findViewById;
        findViewById.getItemAnimator().R(false);
        this.c.clear();
        this.c.addAll(this.b.d(0));
        if (e.g.a.c()) {
            this.c.add(0, e.g.a.f4733e);
        }
        if (e.g.a.p && !e.g.a.d()) {
            this.c.add(e.g.a.c() ? 1 : 0, null);
        }
        this.f4749g = new easyphotos.ui.a.b(this, this.c, this);
        this.f4750h = new GridLayoutManager(this, integer);
        if (e.g.a.c()) {
            this.f4750h.s(new h());
        }
        this.f4748f.setLayoutManager(this.f4750h);
        this.f4748f.setAdapter(this.f4749g);
        this.q = (PressedTextView) findViewById(R.id.tv_preview);
        W();
        l0();
        k0(this.t, this.n, this.p, this.q);
    }

    private void b0(int i2) {
        if (TextUtils.isEmpty(e.g.a.o)) {
            throw new RuntimeException("AlbumBuilder : 请执行 setFileProviderAuthority()方法");
        }
        if (P()) {
            this.x.postDelayed(new e(i2), 500L);
            return;
        }
        this.x.setVisibility(0);
        this.y.setText(R.string.permissions_die_easy_photos);
        this.x.setOnClickListener(new d());
    }

    private void c0() {
        d0();
        e0();
    }

    private void d0() {
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.l, "translationY", 0.0f, this.z.getTop());
        ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this.n, "alpha", 1.0f, 0.0f);
        ofFloat.setDuration(200L);
        AnimatorSet animatorSet = new AnimatorSet();
        this.r = animatorSet;
        animatorSet.addListener(new b());
        this.r.setInterpolator(new AccelerateInterpolator());
        this.r.play(ofFloat).with(ofFloat2);
    }

    private void e0() {
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.l, "translationY", this.z.getTop(), 0.0f);
        ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this.n, "alpha", 0.0f, 1.0f);
        ofFloat.setDuration(300L);
        AnimatorSet animatorSet = new AnimatorSet();
        this.s = animatorSet;
        animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
        this.s.play(ofFloat).with(ofFloat2);
    }

    public void f0() {
        a0();
    }

    private void g0() {
        new Thread(new g()).start();
    }

    private void h0() {
        this.C.show();
        new Thread(new f()).start();
    }

    private void i0() {
        Intent intent = new Intent();
        e.f.a.k();
        this.f4747e.addAll(e.f.a.a);
        intent.putParcelableArrayListExtra("keyOfEasyPhotosResult", this.f4747e);
        intent.putExtra("keyOfEasyPhotosResultSelectedOriginal", e.g.a.n);
        setResult(-1, intent);
        finish();
    }

    private void j0(int... iArr) {
        for (int i2 : iArr) {
            findViewById(i2).setOnClickListener(this);
        }
    }

    private void k0(View... viewArr) {
        for (View view : viewArr) {
            view.setOnClickListener(this);
        }
    }

    private void l0() {
        if (e.f.a.j()) {
            this.q.setVisibility(4);
            this.p.setBackgroundResource(R.drawable.circle_purple_unable_easy);
            this.p.setText(R.string.tex_send_easy_photos);
        } else {
            this.p.setBackgroundResource(R.drawable.circle_purple_able_easy);
            this.p.setText(getString(R.string.selector_action_done_easy_photos, new Object[]{Integer.valueOf(e.f.a.c())}));
        }
        X();
    }

    private void m0(boolean z) {
        if (this.s == null) {
            c0();
        }
        if (!z) {
            this.r.start();
            return;
        }
        this.n.setVisibility(0);
        n0(this.u, false);
        this.s.start();
    }

    public void n0(View view, boolean z) {
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(view, "rotation", z ? 180.0f : 0.0f, z ? 0.0f : 180.0f);
        ofFloat.setDuration(500L);
        ofFloat.start();
    }

    public static void o0(Activity activity, int i2) {
        activity.startActivityForResult(new Intent(activity, (Class<?>) EasyPhotosActivity.class), i2);
    }

    public static void p0(Fragment fragment, int i2) {
        fragment.startActivityForResult(new Intent(fragment.getActivity(), (Class<?>) EasyPhotosActivity.class), i2);
    }

    public static void q0(androidx.fragment.app.Fragment fragment, int i2) {
        fragment.startActivityForResult(new Intent(fragment.getContext(), (Class<?>) EasyPhotosActivity.class), i2);
    }

    public void r0(int i2) {
        Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
        if (intent.resolveActivity(getPackageManager()) == null && !getPackageManager().hasSystemFeature("android.hardware.camera.any")) {
            Toast.makeText((Context) this, R.string.msg_no_camera_easy_photos, 0).show();
            return;
        }
        if (this.A) {
            Uri R = R();
            this.G = R;
            intent.putExtra("output", R);
            intent.addFlags(1);
            intent.addFlags(2);
            startActivityForResult(intent, i2);
            return;
        }
        Q();
        File file = this.a;
        if (file == null || !file.isFile()) {
            Toast.makeText((Context) this, R.string.camera_temp_file_error_easy_photos, 0).show();
            return;
        }
        Uri c2 = e.h.f.a.c(this, this.a);
        intent.addFlags(1);
        intent.addFlags(2);
        intent.putExtra("output", c2);
        startActivityForResult(intent, i2);
    }

    private void s0(int i2) {
        this.v = i2;
        this.c.clear();
        this.c.addAll(this.b.d(i2));
        if (e.g.a.c()) {
            this.c.add(0, e.g.a.f4733e);
        }
        if (e.g.a.p && !e.g.a.d()) {
            this.c.add(e.g.a.c() ? 1 : 0, null);
        }
        this.f4749g.j();
        this.f4748f.scrollToPosition(0);
    }

    public boolean P() {
        throw new UnsupportedOperationException("Method not decompiled: easyphotos.ui.EasyPhotosActivity.P():boolean");
    }

    protected String[] T() {
        return e.g.a.p ? Build.VERSION.SDK_INT >= 16 ? new String[]{"android.permission.CAMERA", "android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_EXTERNAL_STORAGE"} : new String[]{"android.permission.CAMERA", "android.permission.WRITE_EXTERNAL_STORAGE"} : Build.VERSION.SDK_INT >= 16 ? new String[]{"android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_EXTERNAL_STORAGE"} : new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"};
    }

    @Override
    public void c() {
        this.f4749g.j();
        l0();
    }

    @Override
    @SuppressLint({"StringFormatInvalid"})
    public void e(Integer num) {
        if (num == null) {
            if (e.g.a.f()) {
                Toast.makeText((Context) this, (CharSequence) getString(R.string.selector_reach_max_video_hint_easy_photos, new Object[]{Integer.valueOf(e.g.a.d)}), 0).show();
                return;
            } else if (e.g.a.v) {
                Toast.makeText((Context) this, (CharSequence) getString(R.string.selector_reach_max_hint_easy_photos, new Object[]{Integer.valueOf(e.g.a.d)}), 0).show();
                return;
            } else {
                Toast.makeText((Context) this, (CharSequence) getString(R.string.selector_reach_max_image_hint_easy_photos, new Object[]{Integer.valueOf(e.g.a.d)}), 0).show();
                return;
            }
        }
        int intValue = num.intValue();
        if (intValue == -3) {
            Toast.makeText((Context) this, (CharSequence) getString(R.string.selector_single_type_hint_easy_photos), 0).show();
        } else if (intValue == -2) {
            Toast.makeText((Context) this, (CharSequence) getString(R.string.selector_reach_max_video_hint_easy_photos, new Object[]{Integer.valueOf(e.g.a.B)}), 0).show();
        } else {
            if (intValue != -1) {
                return;
            }
            Toast.makeText((Context) this, (CharSequence) getString(R.string.selector_reach_max_image_hint_easy_photos, new Object[]{Integer.valueOf(e.g.a.C)}), 0).show();
        }
    }

    @SuppressLint({"MissingSuperCall"})
    protected void onActivityResult(int i2, int i3, Intent intent) {
        if (i2 == 14) {
            if (e.h.d.a.a(this, T())) {
                V();
                return;
            } else {
                this.x.setVisibility(0);
                return;
            }
        }
        if (i3 != -1) {
            if (i3 == 0 && 11 == i2) {
                File file = this.a;
                if (file != null && file.exists()) {
                    this.a.delete();
                    this.a = null;
                }
                if (e.g.a.r) {
                    finish();
                    return;
                }
                return;
            }
            return;
        }
        if (11 == i2) {
            if (this.A) {
                h0();
                return;
            }
            File file2 = this.a;
            if (file2 == null || !file2.isFile()) {
                throw new RuntimeException("EasyPhotos拍照保存的图片不存在");
            }
            g0();
            return;
        }
        if (13 != i2) {
            if (16 == i2) {
                O((Photo) intent.getParcelableExtra("keyOfEasyPhotosResult"));
            }
        } else if (intent.getBooleanExtra("keyOfPreviewClickDone", false)) {
            S();
        } else {
            this.f4749g.j();
            l0();
        }
    }

    public void onBackPressed() {
        RelativeLayout relativeLayout = this.n;
        if (relativeLayout != null && relativeLayout.getVisibility() == 0) {
            m0(false);
            return;
        }
        e.e.b.a aVar = this.b;
        if (aVar != null) {
            aVar.i();
        }
        if (e.g.a.c()) {
            this.f4749g.k();
        }
        if (e.g.a.b()) {
            this.m.g();
        }
        setResult(0);
        finish();
    }

    @Override
    public void onClick(View view) {
        if (j.m()) {
            return;
        }
        int id = view.getId();
        if (R.id.lv_title == id) {
            m0(8 == this.n.getVisibility());
            return;
        }
        if (R.id.root_view_album_items == id) {
            m0(false);
            return;
        }
        if (R.id.iv_back == id) {
            onBackPressed();
        } else if (R.id.tv_done == id) {
            S();
        } else if (R.id.tv_preview == id) {
            PreviewActivity.g0(this, -1, 0);
        }
    }

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_easy_photos);
        if (e.g.a.r) {
            findViewById(R.id.rlv_bg).setVisibility(8);
        }
        this.C = easyphotos.ui.b.a.a(this);
        this.A = Build.VERSION.SDK_INT == 29;
        if (!e.g.a.r && e.g.a.y == null) {
            finish();
            return;
        }
        Y();
        if (e.h.d.a.a(this, T())) {
            V();
        } else {
            this.x.setVisibility(0);
        }
    }

    protected void onDestroy() {
        e.e.b.a aVar = this.b;
        if (aVar != null) {
            aVar.i();
        }
        super.onDestroy();
    }

    public void onRequestPermissionsResult(int i2, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i2, strArr, iArr);
        e.h.d.a.b(this, strArr, iArr, new c());
    }

    @Override
    public void r() {
        l0();
    }

    @Override
    public void s() {
        b0(11);
    }

    @Override
    public void t(int i2, int i3) {
        s0(i3);
        m0(false);
        this.o.setText(this.b.b().get(i3).a);
    }

    @Override
    public void w(int i2, int i3) {
        if (i2 == -1) {
            PreviewActivity.g0(this, i2, i3);
        } else {
            PreviewActivity.g0(this, this.v, i3);
        }
    }
}