导航菜单

页面标题

页面副标题

零界绘 v1.0.2 - BookDownloadMangerActivity.java 源代码

正在查看: 零界绘 v1.0.2 应用的 BookDownloadMangerActivity.java JAVA 源代码文件

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


package com.junyue.novel.modules.bookshelf.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.junyue.basic.activity.BaseActivity;
import com.junyue.basic.util.ViewUtils;
import com.junyue.basic.widget.SimpleTextView;
import com.junyue.basic.widget.StatusLayout;
import com.junyue.novel.modules.bookshelf.adapter.DownloadBookRvAdapter;
import com.junyue.novel.modules_bookshelf.R;
import com.junyue.novel.sharebean.BookDownload;
import com.junyue.novel.sharebean.reader.BookChapterBean;
import f.p.c.z.m;
import f.p.f.a.c;
import i.b0.c.u;
import i.d;
import i.t;
import kotlin.jvm.functions.Function1;

public final class BookDownloadMangerActivity extends BaseActivity implements c.b, View.OnClickListener {
    public StatusLayout L;
    public boolean M;
    public boolean N;
    public final d E = f.n.a.a.a.a(this, R.id.rv_download);
    public final d F = f.n.a.a.a.a(this, R.id.tv_edit);
    public final d G = f.n.a.a.a.a(this, R.id.view_line);
    public final d H = f.n.a.a.a.a(this, R.id.ll_ctrl);
    public final d I = f.n.a.a.a.a(this, R.id.tv_delete);
    public final d J = f.n.a.a.a.a(this, R.id.tv_selected_all);
    public final DownloadBookRvAdapter K = new DownloadBookRvAdapter(new b());
    public Runnable O = new c();

    public static final class a implements StatusLayout.e {
        public a() {
        }

        @Override
        public final void a(int i) {
            if (i == 2) {
                BookDownloadMangerActivity.this.n1().setVisibility(8);
                BookDownloadMangerActivity.this.i1().setVisibility(8);
                BookDownloadMangerActivity.this.l1().setVisibility(8);
            } else if (i == 0) {
                if (BookDownloadMangerActivity.this.K.J()) {
                    BookDownloadMangerActivity.this.n1().setVisibility(0);
                    BookDownloadMangerActivity.this.i1().setVisibility(0);
                }
                BookDownloadMangerActivity.this.l1().setVisibility(0);
            }
        }
    }

    public static final class b extends u implements Function1<DownloadBookRvAdapter, t> {
        public b() {
            super(1);
        }

        public final void b(DownloadBookRvAdapter downloadBookRvAdapter) {
            i.b0.c.t.e(downloadBookRvAdapter, "$receiver");
            BookDownloadMangerActivity.this.o1(downloadBookRvAdapter.I(), downloadBookRvAdapter.getItemCount());
        }

        public Object invoke(Object obj) {
            b((DownloadBookRvAdapter) obj);
            return t.a;
        }
    }

    public static final class c implements Runnable {
        public c() {
        }

        @Override
        public final void run() {
            BookDownloadMangerActivity.this.H0();
            BookDownloadMangerActivity.this.N = false;
        }
    }

    @Override
    public void E() {
        this.K.D(f.p.g.g.a.c.a.i.h());
        if (this.K.getItemCount() == 0) {
            StatusLayout statusLayout = this.L;
            if (statusLayout == null) {
                i.b0.c.t.t("mStatusLayout");
                throw null;
            }
            statusLayout.s();
        } else {
            StatusLayout statusLayout2 = this.L;
            if (statusLayout2 == null) {
                i.b0.c.t.t("mStatusLayout");
                throw null;
            }
            statusLayout2.B();
        }
        o1(this.K.I(), this.K.getItemCount());
    }

    @Override
    public void H0() {
        this.K.D(f.p.g.g.a.c.a.i.h());
    }

    @Override
    public int I0() {
        return R.layout.activity_download_book_manager;
    }

    @Override
    public void O0() {
        BaseActivity.A0(this, null, 1, null);
        Y0(R.id.ib_back);
        this.K.D(f.p.g.g.a.c.a.i.h());
        j1().setAdapter(this.K);
        StatusLayout q = StatusLayout.q(j1());
        i.b0.c.t.d(q, "sl");
        ViewGroup.LayoutParams layoutParams = q.getLayoutParams();
        if (layoutParams == null) {
            throw new NullPointerException("null cannot be cast to non-null type android.widget.LinearLayout.LayoutParams");
        }
        ((LinearLayout.LayoutParams) layoutParams).weight = 1.0f;
        q.setOnStatusChangedListener(new a());
        this.L = q;
        if (this.K.getItemCount() == 0) {
            q.s();
        } else {
            q.B();
        }
        m1().setOnClickListener(this);
        l1().setOnClickListener(this);
        k1().setOnClickListener(this);
    }

    public final LinearLayout i1() {
        return (LinearLayout) this.H.getValue();
    }

    @Override
    public void j(BookDownload bookDownload, BookChapterBean bookChapterBean, int i, int i2, boolean z) {
        i.b0.c.t.e(bookDownload, "bookDownload");
        i.b0.c.t.e(bookChapterBean, "currentChapterBean");
        if (bookDownload.h() != bookDownload.k()) {
            this.K.notifyDataSetChanged();
        }
    }

    public final RecyclerView j1() {
        return (RecyclerView) this.E.getValue();
    }

    public final SimpleTextView k1() {
        return (SimpleTextView) this.I.getValue();
    }

    public final SimpleTextView l1() {
        return (SimpleTextView) this.F.getValue();
    }

    public final SimpleTextView m1() {
        return (SimpleTextView) this.J.getValue();
    }

    @Override
    public void n(BookDownload bookDownload) {
        i.b0.c.t.e(bookDownload, "bookDownload");
        if (bookDownload.h() != bookDownload.k()) {
            this.K.notifyDataSetChanged();
        }
        this.K.M();
    }

    public final View n1() {
        return (View) this.G.getValue();
    }

    public final void o1(int i, int i2) {
        if (i == 0) {
            k1().setText(m.r(this, R.string.delete));
        } else {
            k1().setText(getString(R.string.multi_delete_with_num, new Object[]{Integer.valueOf(i)}));
        }
        k1().setEnabled(i > 0);
        boolean z = i == i2;
        ViewUtils.q(m1(), z ? R.string.un_selected_all : R.string.selected_all);
        m1().setSelected(z);
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
        if (i == 100) {
            if (this.M) {
                H0();
            } else {
                this.N = true;
            }
        }
    }

    @Override
    public void onClick(View view) {
        i.b0.c.t.e(view, "v");
        int id = view.getId();
        if (id != R.id.tv_edit) {
            if (id == R.id.tv_delete) {
                f.p.g.g.a.c.a.i.c(this.K.G());
                return;
            } else {
                if (id == R.id.tv_selected_all) {
                    if (view.isSelected()) {
                        this.K.N();
                        return;
                    } else {
                        this.K.K();
                        return;
                    }
                }
                return;
            }
        }
        if (this.K.J()) {
            this.K.L(false);
            ViewUtils.q(l1(), R.string.edit);
            n1().setVisibility(8);
            i1().setVisibility(8);
            return;
        }
        ViewUtils.q(l1(), R.string.complete);
        this.K.L(true);
        n1().setVisibility(0);
        i1().setVisibility(0);
        o1(this.K.I(), this.K.q());
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        f.p.g.g.a.c.a.i.u(this, false);
    }

    public void onDestroy() {
        super.onDestroy();
        f.p.g.g.a.c.a.i.E(this);
    }

    @Override
    public void onPause() {
        super.onPause();
        this.M = false;
        a0(this.O);
    }

    @Override
    public void onResume() {
        super.onResume();
        this.M = true;
        if (this.N) {
            n0(this.O, 400L);
        }
    }
}