导航菜单

页面标题

页面副标题

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

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

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


package easyphotos.ui;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.ScaleAnimation;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.k;
import com.sssp.sjchat.R;
import d.i.j;
import easyphotos.models.album.entity.Photo;
import easyphotos.ui.PreviewFragment;
import easyphotos.ui.a.c;
import easyphotos.ui.widget.PressedTextView;
import java.util.ArrayList;

public class PreviewActivity extends androidx.appcompat.app.b implements c.f, View.OnClickListener, PreviewFragment.a {
    private PreviewFragment A;
    private int B;
    private long c;
    private long d;

    private RelativeLayout f4757g;

    private FrameLayout f4758h;

    private boolean f4760j;

    View f4761k;
    private TextView l;
    private TextView m;
    private PressedTextView n;
    private TextView o;
    private RecyclerView p;
    private easyphotos.ui.a.c q;
    private k r;
    private LinearLayoutManager s;
    private int t;
    private boolean x;
    private boolean y;
    private FrameLayout z;

    private final Handler f4755e = new Handler();

    private final Runnable f4756f = new a();

    private final Runnable f4759i = new b();
    private ArrayList<Photo> u = new ArrayList<>();
    private int v = 0;
    private int w = 0;

    class a implements Runnable {
        a() {
        }

        @Override
        public void run() {
            easyphotos.utils.system.c a = easyphotos.utils.system.c.a();
            ?? r1 = PreviewActivity.this;
            a.l(r1, r1.f4761k);
        }
    }

    class b implements Runnable {
        b() {
        }

        @Override
        public void run() {
            PreviewActivity.this.f4757g.setVisibility(0);
            PreviewActivity.this.f4758h.setVisibility(0);
        }
    }

    class c implements Animation.AnimationListener {
        c() {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            PreviewActivity.this.f4757g.setVisibility(8);
            PreviewActivity.this.f4758h.setVisibility(8);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationStart(Animation animation) {
        }
    }

    class d extends RecyclerView.s {
        d() {
        }

        public void onScrollStateChanged(RecyclerView recyclerView, int i2) {
            int position;
            super.onScrollStateChanged(recyclerView, i2);
            View g2 = PreviewActivity.this.r.g(PreviewActivity.this.s);
            if (g2 == null || PreviewActivity.this.w == (position = PreviewActivity.this.s.getPosition(g2))) {
                return;
            }
            PreviewActivity.this.w = position;
            PreviewActivity.this.A.f(-1);
            TextView textView = PreviewActivity.this.m;
            ?? r7 = PreviewActivity.this;
            textView.setText(r7.getString(R.string.preview_current_number_easy_photos, new Object[]{Integer.valueOf(((PreviewActivity) r7).w + 1), Integer.valueOf(PreviewActivity.this.u.size())}));
            PreviewActivity.this.i0();
        }
    }

    public PreviewActivity() {
        this.x = e.g.a.d == 1;
        this.y = e.f.a.c() == e.g.a.d;
    }

    private void T() {
        if (Build.VERSION.SDK_INT >= 23) {
            int b2 = androidx.core.a.a.b(this, R.color.easy_photos_status_bar);
            this.B = b2;
            if (e.h.a.a.a(b2)) {
                getWindow().addFlags(67108864);
            }
        }
    }

    private void U() {
        Intent intent = new Intent();
        intent.putExtra("keyOfPreviewClickDone", false);
        setResult(this.v, intent);
        finish();
    }

    private void V() {
        AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
        alphaAnimation.setAnimationListener(new c());
        alphaAnimation.setDuration(300L);
        this.f4757g.startAnimation(alphaAnimation);
        this.f4758h.startAnimation(alphaAnimation);
        this.f4760j = false;
        this.f4755e.removeCallbacks(this.f4759i);
        this.f4755e.postDelayed(this.f4756f, 300L);
    }

    private void W() {
        ActionBar A = A();
        if (A != null) {
            A.l();
        }
    }

    private void X() {
        Intent intent = getIntent();
        int intExtra = intent.getIntExtra("keyOfPreviewAlbumItemIndex", 0);
        this.u.clear();
        if (intExtra == -1) {
            this.u.addAll(e.f.a.a);
        } else {
            this.u.addAll(e.e.b.a.d.d(intExtra));
        }
        int intExtra2 = intent.getIntExtra("keyOfPreviewPhotoIndex", 0);
        this.t = intExtra2;
        this.w = intExtra2;
        this.f4760j = true;
    }

    private void Y() {
        this.p = findViewById(R.id.rv_photos);
        this.q = new easyphotos.ui.a.c(this, this.u, this);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, 0, false);
        this.s = linearLayoutManager;
        this.p.setLayoutManager(linearLayoutManager);
        this.p.setAdapter(this.q);
        this.p.scrollToPosition(this.t);
        i0();
        k kVar = new k();
        this.r = kVar;
        kVar.b(this.p);
        this.p.addOnScrollListener(new d());
        this.m.setText(getString(R.string.preview_current_number_easy_photos, new Object[]{Integer.valueOf(this.t + 1), Integer.valueOf(this.u.size())}));
    }

    private void Z() {
        b0(R.id.iv_back, R.id.tv_edit, R.id.tv_selector);
        this.f4758h = (FrameLayout) findViewById(R.id.m_top_bar_layout);
        if (!easyphotos.utils.system.c.a().d(this)) {
            ((FrameLayout) findViewById(R.id.m_root_view)).setFitsSystemWindows(true);
            this.f4758h.setPadding(0, easyphotos.utils.system.c.a().b(this), 0, 0);
            if (e.h.a.a.a(this.B)) {
                easyphotos.utils.system.c.a().h(this, true);
            }
        }
        this.f4757g = (RelativeLayout) findViewById(R.id.m_bottom_bar);
        this.o = (TextView) findViewById(R.id.tv_selector_num);
        this.m = (TextView) findViewById(R.id.tv_number);
        this.n = (PressedTextView) findViewById(R.id.tv_done);
        this.l = (TextView) findViewById(R.id.tv_original);
        this.z = (FrameLayout) findViewById(R.id.fl_fragment);
        this.A = (PreviewFragment) getSupportFragmentManager().d(R.id.fragment_preview);
        if (e.g.a.f4739k) {
            a0();
        } else {
            this.l.setVisibility(8);
        }
        c0(this.l, this.n, this.o);
        Y();
        d0();
    }

    private void a0() {
        if (e.g.a.n) {
            this.l.setTextColor(androidx.core.a.a.b(this, R.color.easy_photos_fg_accent));
        } else if (e.g.a.l) {
            this.l.setTextColor(androidx.core.a.a.b(this, R.color.easy_photos_fg_primary));
        } else {
            this.l.setTextColor(androidx.core.a.a.b(this, R.color.easy_photos_fg_primary_dark));
        }
    }

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

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

    private void d0() {
        if (e.f.a.j()) {
            if (this.n.getVisibility() == 0) {
                ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f);
                scaleAnimation.setDuration(200L);
                this.n.startAnimation(scaleAnimation);
            }
            this.n.setVisibility(8);
            this.z.setVisibility(8);
            return;
        }
        if (8 == this.n.getVisibility()) {
            ScaleAnimation scaleAnimation2 = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f);
            scaleAnimation2.setDuration(200L);
            this.n.startAnimation(scaleAnimation2);
        }
        this.z.setVisibility(8);
        this.n.setVisibility(8);
    }

    private void e0() {
        if (Build.VERSION.SDK_INT >= 16) {
            easyphotos.utils.system.c.a().n(this, this.f4761k);
        }
        this.f4760j = true;
        this.f4755e.removeCallbacks(this.f4756f);
        this.f4755e.post(this.f4759i);
    }

    private void f0(Photo photo) {
        if (e.f.a.j()) {
            e.f.a.a(photo);
        } else if (e.f.a.e(0).equals(photo.c)) {
            e.f.a.m(photo);
        } else {
            e.f.a.l(0);
            e.f.a.a(photo);
        }
        i0();
    }

    public static void g0(Activity activity, int i2, int i3) {
        Intent intent = new Intent(activity, (Class<?>) PreviewActivity.class);
        intent.putExtra("keyOfPreviewAlbumItemIndex", i2);
        intent.putExtra("keyOfPreviewPhotoIndex", i3);
        activity.startActivityForResult(intent, 13);
    }

    private void h0() {
        if (this.f4760j) {
            V();
        } else {
            e0();
        }
    }

    public void i0() {
        if (this.u.get(this.w).f4746k) {
            this.o.setBackgroundResource(R.drawable.bg_select_true_easy_photos);
            String h2 = e.f.a.h(this.u.get(this.w));
            this.o.setText(h2 + "");
            this.o.startAnimation(AnimationUtils.loadAnimation(this.o.getContext(), R.anim.window_alpha_enter));
            if (!e.f.a.j()) {
                int c2 = e.f.a.c();
                int i2 = 0;
                while (true) {
                    if (i2 >= c2) {
                        break;
                    }
                    if (this.u.get(this.w).c.equals(e.f.a.e(i2))) {
                        this.A.f(i2);
                        break;
                    }
                    i2++;
                }
            }
        } else {
            this.o.setText("");
            this.o.setBackgroundResource(R.drawable.bg_select_false_unable_easy_photos);
        }
        this.A.e();
        d0();
    }

    private void j0() {
        this.v = -1;
        Photo photo = this.u.get(this.w);
        if (this.x) {
            f0(photo);
            return;
        }
        if (this.y) {
            if (photo.f4746k) {
                e.f.a.m(photo);
                if (this.y) {
                    this.y = false;
                }
                i0();
                return;
            }
            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), 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;
            }
        }
        boolean z = !photo.f4746k;
        photo.f4746k = z;
        if (!z) {
            e.f.a.m(photo);
            this.A.f(-1);
            if (this.y) {
                this.y = false;
            }
        } else {
            if (photo.f4744i > this.c) {
                j.u(String.format(getString(R.string.video_exceed_limit), Long.valueOf(this.d)));
                return;
            }
            int a2 = e.f.a.a(photo);
            if (a2 != 0) {
                photo.f4746k = false;
                if (a2 == -3) {
                    Toast.makeText((Context) this, (CharSequence) getString(R.string.selector_single_type_hint_easy_photos), 0).show();
                    return;
                } else if (a2 == -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();
                    return;
                } else {
                    if (a2 != -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();
                    return;
                }
            }
            if (e.f.a.c() == e.g.a.d) {
                this.y = true;
            }
        }
        i0();
    }

    @Override
    public void d() {
        h0();
    }

    @Override
    public void k(int i2) {
        String e2 = e.f.a.e(i2);
        int size = this.u.size();
        for (int i3 = 0; i3 < size; i3++) {
            if (TextUtils.equals(e2, this.u.get(i3).c)) {
                this.p.scrollToPosition(i3);
                this.w = i3;
                this.m.setText(getString(R.string.preview_current_number_easy_photos, new Object[]{Integer.valueOf(i3 + 1), Integer.valueOf(this.u.size())}));
                this.A.f(i2);
                i0();
                return;
            }
        }
    }

    @Override
    public void n() {
        if (this.f4760j) {
            V();
        }
    }

    public void onBackPressed() {
        U();
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (R.id.iv_back == id) {
            U();
            return;
        }
        if (R.id.tv_selector == id) {
            j0();
            return;
        }
        if (R.id.tv_selector_num == id) {
            j0();
            return;
        }
        if (R.id.tv_original == id) {
            if (!e.g.a.l) {
                Toast.makeText((Context) this, (CharSequence) e.g.a.m, 0).show();
            } else {
                e.g.a.n = !e.g.a.n;
                a0();
            }
        }
    }

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.f4761k = getWindow().getDecorView();
        easyphotos.utils.system.c.a().m(this, this.f4761k);
        setContentView(R.layout.activity_preview_easy_photos);
        long t = d.c.a.n().t();
        this.c = t;
        this.d = j.q(t);
        W();
        T();
        if (e.e.b.a.d == null) {
            finish();
        } else {
            X();
            Z();
        }
    }
}