CAG v5.7.4版本的 MD5 值为:bc57ead76a7a30559f0708e9d60d749f

以下内容为反编译后的 NewsListActivity.java 源代码,内容仅作参考


package org.godfootsteps.home;

import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import carbon.custom.LoadingLayout;
import com.blankj.utilcode.util.NetworkUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import d.c.a.j.v;
import d.c.a.j.z;
import e.c0.a;
import h.a.a.g.b;
import i.c.a.c.n0;
import i.c.a.c.y;
import i.j.a.e.t.d;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import kotlin.Metadata;
import kotlin.coroutines.intrinsics.CoroutineSingletons;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import n.e;
import n.g.f.a.c;
import n.i.a.l;
import n.i.a.p;
import n.i.b.h;
import n.i.b.o;
import org.commons.screenadapt.recyclerview.FastScreenListAdapter;
import org.commons.screenadapt.recyclerview.ScreenViewHolder;
import org.godfootsteps.arch.api.AppClient;
import org.godfootsteps.arch.api.model.BaseModel;
import org.godfootsteps.arch.api.model.HomeNormalModel;
import org.godfootsteps.arch.api.model.NewsListData;
import org.godfootsteps.arch.api.util.Request;
import org.godfootsteps.arch.base.BaseActivity;
import org.godfootsteps.arch.customSystemViews.CustomThumbnailView;
import org.godfootsteps.arch.util.GAEventSendUtil;
import org.godfootsteps.arch.videoApi.VideoClient;
import org.godfootsteps.home.NewsListActivity;
import org.godfootsteps.home.R$id;
@b
@Metadata(d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0007\u0018\u0000 \u001b2\u00020\u0001:\u0001\u001bB\u0005¢\u0006\u0002\u0010\u0002J\u0012\u0010\u0011\u001a\u00020\u000e2\b\u0010\u0012\u001a\u0004\u0018\u00010\u000bH\u0002J\b\u0010\u0013\u001a\u00020\u0007H\u0014J\b\u0010\u0014\u001a\u00020\u000eH\u0014J\b\u0010\u0015\u001a\u00020\u000eH\u0014J\u0010\u0010\u0016\u001a\u00020\u000e2\u0006\u0010\u0017\u001a\u00020\u0018H\u0016J\b\u0010\u0019\u001a\u00020\u000eH\u0002J\b\u0010\u001a\u001a\u00020\u000eH\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\n\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\f\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\r\u001a\u00020\u000e8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u0010¨\u0006\u001c"}, d2 = {"Lorg/godfootsteps/home/NewsListActivity;", "Lorg/godfootsteps/arch/base/BaseActivity;", "()V", "isUnCover", "", "mIsHaveData", "mLastOffset", "", "mLastPosition", "mPage", "mTitle", "", "mType", "positionAndOffset", "", "getPositionAndOffset", "()Lkotlin/Unit;", "getData", "type", "getLayoutId", "initData", "initView", "onConfigurationChanged", "newConfig", "Landroid/content/res/Configuration;", "setOrientationView", "showError", "Companion", "home_release"}, k = 1, mv = {1, 5, 1}, xi = 48)
public final class NewsListActivity extends BaseActivity {
    public static final int f15854r = 0;
    public int f15855k = 1;
    public String f15856l;
    public String f15857m;
    public int f15858n;
    public int f15859o;
    public boolean f15860p;
    public boolean f15861q;

    public static final void Z(NewsListActivity newsListActivity) {
        int i2 = R$id.loading_layout;
        ((LoadingLayout) newsListActivity.findViewById(i2)).i();
        SmartRefreshLayout smartRefreshLayout = (SmartRefreshLayout) newsListActivity.findViewById(R$id.refresh_layout);
        h.c(smartRefreshLayout);
        smartRefreshLayout.i();
        if (!NetworkUtils.c()) {
            if (newsListActivity.f15860p) {
                ToastUtils.b(R$string.app_no_internet);
            } else {
                ((LoadingLayout) newsListActivity.findViewById(i2)).l();
            }
        } else if (newsListActivity.f15860p) {
            ToastUtils.b(R$string.app_wrong_internet);
        } else {
            ((LoadingLayout) newsListActivity.findViewById(i2)).j();
        }
    }

    public static final void c0(String str, String str2) {
        h.e(str, "title");
        h.e(str2, "type");
        Bundle bundle = new Bundle();
        bundle.putString("title", str);
        bundle.putString("type", str2);
        a.j0(bundle, NewsListActivity.class);
    }

    @Override
    public int Q() {
        return R$layout.activity_aticle_list;
    }

    @Override
    public void R() {
    }

    @Override
    public void W() {
        this.f15857m = getIntent().getStringExtra("title");
        String stringExtra = getIntent().getStringExtra("type");
        this.f15856l = stringExtra;
        this.f15861q = stringExtra != null ? n.o.a.c(stringExtra, "Uncover", false, 2) : false;
        ((Toolbar) findViewById(R$id.toolbar)).setTitle(this.f15857m);
        int i2 = R$id.loading_layout;
        ((LoadingLayout) findViewById(i2)).setButtonRetryClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NewsListActivity newsListActivity = NewsListActivity.this;
                int i3 = NewsListActivity.f15854r;
                n.i.b.h.e(newsListActivity, "this$0");
                if (newsListActivity.f15860p) {
                    return;
                }
                if (NetworkUtils.c()) {
                    ((LoadingLayout) newsListActivity.findViewById(R$id.loading_layout)).k();
                    newsListActivity.a0(newsListActivity.f15856l);
                    return;
                }
                ((LoadingLayout) newsListActivity.findViewById(R$id.loading_layout)).l();
            }
        });
        ((RecyclerView) findViewById(R$id.rv_list)).addOnScrollListener(new RecyclerView.s() {
            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int i3) {
                h.e(recyclerView, "recyclerView");
                super.onScrollStateChanged(recyclerView, i3);
                if (recyclerView.getLayoutManager() != null) {
                    NewsListActivity newsListActivity = NewsListActivity.this;
                    int i4 = NewsListActivity.f15854r;
                    RecyclerView recyclerView2 = (RecyclerView) newsListActivity.findViewById(R$id.rv_list);
                    h.c(recyclerView2);
                    LinearLayoutManager linearLayoutManager = (LinearLayoutManager) recyclerView2.getLayoutManager();
                    h.c(linearLayoutManager);
                    View childAt = linearLayoutManager.getChildAt(0);
                    if (childAt != null) {
                        newsListActivity.f15858n = childAt.getTop();
                        newsListActivity.f15859o = linearLayoutManager.getPosition(childAt);
                    }
                }
            }
        });
        b0();
        ((LoadingLayout) findViewById(i2)).k();
        a0(this.f15856l);
    }

    public final void a0(final String str) {
        n.m.t.a.p.m.e1.a.f2(new l<Request<NewsListData, BaseModel<NewsListData>>, e>() {

            @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\b\u0012\u0004\u0012\u00020\u00020\u0001H\u008a@"}, d2 = {"<anonymous>", "Lorg/godfootsteps/arch/api/model/BaseModel;", "Lorg/godfootsteps/arch/api/model/NewsListData;"}, k = 3, mv = {1, 5, 1}, xi = 48)
            @c(c = "org.godfootsteps.home.NewsListActivity$getData$1$1", f = "NewsListActivity.kt", l = {126}, m = "invokeSuspend")
            public static final class AnonymousClass1 extends SuspendLambda implements l<n.g.c<? super BaseModel<NewsListData>>, Object> {
                public final String $type;
                public int label;
                public final NewsListActivity this$0;

                public AnonymousClass1(String str, NewsListActivity newsListActivity, n.g.c<? super AnonymousClass1> cVar) {
                    super(1, cVar);
                    this.$type = str;
                    this.this$0 = newsListActivity;
                }

                @Override
                public final n.g.c<e> create(n.g.c<?> cVar) {
                    return new AnonymousClass1(this.$type, this.this$0, cVar);
                }

                @Override
                public final Object invoke(n.g.c<? super BaseModel<NewsListData>> cVar) {
                    return ((AnonymousClass1) create(cVar)).invokeSuspend(e.a);
                }

                @Override
                public final Object invokeSuspend(Object obj) {
                    CoroutineSingletons coroutineSingletons = CoroutineSingletons.COROUTINE_SUSPENDED;
                    int i2 = this.label;
                    if (i2 == 0) {
                        d.Q4(obj);
                        Objects.requireNonNull(AppClient.a);
                        AppClient appClient = AppClient.Companion.f15176d;
                        String str = this.$type;
                        if (str == null) {
                            str = "";
                        }
                        String valueOf = String.valueOf(this.this$0.f15855k);
                        this.label = 1;
                        obj = appClient.M(str, valueOf, this);
                        if (obj == coroutineSingletons) {
                            return coroutineSingletons;
                        }
                    } else if (i2 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    } else {
                        d.Q4(obj);
                    }
                    return obj;
                }
            }

            {
                super(1);
            }

            @Override
            public e invoke(Request<NewsListData, BaseModel<NewsListData>> request) {
                invoke2(request);
                return e.a;
            }

            public final void invoke2(Request<NewsListData, BaseModel<NewsListData>> request) {
                h.e(request, "$this$request");
                request.f(new AnonymousClass1(str, this, null));
                final NewsListActivity newsListActivity = this;
                request.f15180l = new l<NewsListData, e>() {
                    {
                        super(1);
                    }

                    @Override
                    public e invoke(NewsListData newsListData) {
                        invoke2(newsListData);
                        return e.a;
                    }

                    public final void invoke2(final NewsListData newsListData) {
                        h.e(newsListData, "it");
                        try {
                            NewsListActivity newsListActivity2 = NewsListActivity.this;
                            newsListActivity2.f15860p = true;
                            int i2 = R$id.rv_list;
                            RecyclerView.Adapter adapter = ((RecyclerView) newsListActivity2.findViewById(i2)).getAdapter();
                            int itemCount = adapter == null ? 0 : adapter.getItemCount();
                            if (((RecyclerView) NewsListActivity.this.findViewById(i2)).getAdapter() == null) {
                                SmartRefreshLayout smartRefreshLayout = (SmartRefreshLayout) NewsListActivity.this.findViewById(R$id.refresh_layout);
                                h.c(smartRefreshLayout);
                                final NewsListActivity newsListActivity3 = NewsListActivity.this;
                                smartRefreshLayout.t(new i.s.a.a.f.b() {
                                    @Override
                                    public final void a(i.s.a.a.b.i iVar) {
                                        NewsListActivity newsListActivity4 = NewsListActivity.this;
                                        n.i.b.h.e(newsListActivity4, "this$0");
                                        n.i.b.h.e(iVar, "it");
                                        newsListActivity4.a0(newsListActivity4.f15856l);
                                    }
                                });
                                List<HomeNormalModel.ListBean> list = newsListData.getList();
                                final NewsListActivity newsListActivity4 = NewsListActivity.this;
                                ((RecyclerView) NewsListActivity.this.findViewById(i2)).setAdapter(new FastScreenListAdapter<HomeNormalModel.ListBean>(list) {
                                    @Override
                                    public int g() {
                                        return NewsListActivity.this.f15861q ? R$layout.item_number_title : R$layout.item_thumbnail_title_date_lr;
                                    }

                                    @Override
                                    public void i(final ScreenViewHolder screenViewHolder, HomeNormalModel.ListBean listBean) {
                                        final HomeNormalModel.ListBean listBean2 = listBean;
                                        h.e(listBean2, "item");
                                        if (screenViewHolder == null) {
                                            return;
                                        }
                                        final NewsListActivity newsListActivity5 = NewsListActivity.this;
                                        NewsListData newsListData2 = newsListData;
                                        View view = screenViewHolder.f15173i;
                                        ((TextView) (view == null ? null : view.findViewById(R$id.tv_title))).setText(listBean2.getTitle());
                                        if (newsListActivity5.f15861q) {
                                            View view2 = screenViewHolder.f15173i;
                                            View findViewById = view2 == null ? null : view2.findViewById(R$id.tv_number);
                                            h.d(findViewById, "tv_number");
                                            n.m.t.a.p.m.e1.a.q2((TextView) findViewById);
                                            View view3 = screenViewHolder.f15173i;
                                            ((carbon.widget.TextView) (view3 != null ? view3.findViewById(R$id.tv_number) : null)).setText(String.valueOf(screenViewHolder.getLayoutPosition() + 1));
                                            if (v.i()) {
                                                View view4 = screenViewHolder.itemView;
                                                h.d(view4, "itemView");
                                                new d.c.a.i.b(view4, 0.0f, 0.0f, 6).a();
                                            }
                                            screenViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
                                                @Override
                                                public final void onClick(View view5) {
                                                    HomeNormalModel.ListBean listBean3 = HomeNormalModel.ListBean.this;
                                                    n.i.b.h.e(listBean3, "$item");
                                                    d.c.i.c cVar = (d.c.i.c) k.a.a.a.a.b(d.c.i.c.class);
                                                    if (cVar == null) {
                                                        return;
                                                    }
                                                    cVar.m(listBean3.getId(), listBean3.getShare());
                                                }
                                            });
                                            return;
                                        }
                                        View view5 = screenViewHolder.f15173i;
                                        TextView textView = (TextView) (view5 == null ? null : view5.findViewById(R$id.tv_publish_date));
                                        if (textView != null) {
                                            textView.setText(z.b(listBean2.getDate()));
                                        }
                                        if (h.a(listBean2.getType(), "video")) {
                                            VideoClient.a.a(listBean2.getVideoId(), new l<String, e>() {
                                                {
                                                    super(1);
                                                }

                                                @Override
                                                public e invoke(String str2) {
                                                    invoke2(str2);
                                                    return e.a;
                                                }

                                                public final void invoke2(String str2) {
                                                    h.e(str2, "url");
                                                    View view6 = ScreenViewHolder.this.f15173i;
                                                    View findViewById2 = view6 == null ? null : view6.findViewById(R$id.iv_thumbnail);
                                                    h.d(findViewById2, "iv_thumbnail");
                                                    ((CustomThumbnailView) findViewById2).e(str2, R$drawable.ic_video_default, (r14 & 4) != 0 ? -1 : 0, (r14 & 8) != 0 ? -1 : 0, (r14 & 16) != 0 ? false : true);
                                                }
                                            }, false);
                                            View view6 = screenViewHolder.f15173i;
                                            ((CustomThumbnailView) (view6 != null ? view6.findViewById(R$id.iv_thumbnail) : null)).setDuration(z.c(listBean2.getDuration()));
                                            screenViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
                                                @Override
                                                public final void onClick(View view7) {
                                                    HomeNormalModel.ListBean listBean3 = HomeNormalModel.ListBean.this;
                                                    NewsListActivity newsListActivity6 = newsListActivity5;
                                                    n.i.b.h.e(listBean3, "$item");
                                                    n.i.b.h.e(newsListActivity6, "this$0");
                                                    d.c.i.f fVar = (d.c.i.f) k.a.a.a.a.b(d.c.i.f.class);
                                                    if (fVar != null) {
                                                        String valueOf = String.valueOf(listBean3.getId());
                                                        String videoId = listBean3.getVideoId();
                                                        if (videoId == null) {
                                                            videoId = "";
                                                        }
                                                        fVar.b(valueOf, videoId);
                                                    }
                                                    GAEventSendUtil.Companion companion = GAEventSendUtil.a;
                                                    String str2 = newsListActivity6.f15857m;
                                                    companion.o(str2 != null ? str2 : "", listBean3.getTitle());
                                                }
                                            });
                                            return;
                                        }
                                        View view7 = screenViewHolder.f15173i;
                                        View findViewById2 = view7 == null ? null : view7.findViewById(R$id.iv_thumbnail);
                                        h.d(findViewById2, "iv_thumbnail");
                                        StringBuilder sb = new StringBuilder();
                                        Objects.requireNonNull(AppClient.a);
                                        sb.append("https://appservercn.kingdomsalvation.org");
                                        sb.append((Object) newsListData2.getImageBaseUrl());
                                        sb.append("/ld/");
                                        sb.append(listBean2.getImage());
                                        ((CustomThumbnailView) findViewById2).e(sb.toString(), R$drawable.ic_placeholder_16_9, (r14 & 4) != 0 ? -1 : 0, (r14 & 8) != 0 ? -1 : 0, (r14 & 16) != 0 ? false : true);
                                        View view8 = screenViewHolder.f15173i;
                                        ((CustomThumbnailView) (view8 != null ? view8.findViewById(R$id.iv_thumbnail) : null)).setDuration("");
                                        screenViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
                                            @Override
                                            public final void onClick(View view9) {
                                                HomeNormalModel.ListBean listBean3 = HomeNormalModel.ListBean.this;
                                                NewsListActivity newsListActivity6 = newsListActivity5;
                                                n.i.b.h.e(listBean3, "$item");
                                                n.i.b.h.e(newsListActivity6, "this$0");
                                                d.c.i.c cVar = (d.c.i.c) k.a.a.a.a.b(d.c.i.c.class);
                                                if (cVar != null) {
                                                    cVar.m(listBean3.getId(), listBean3.getShare());
                                                }
                                                GAEventSendUtil.Companion companion = GAEventSendUtil.a;
                                                String str2 = newsListActivity6.f15857m;
                                                if (str2 == null) {
                                                    str2 = "";
                                                }
                                                companion.l(str2, listBean3.getTitle());
                                            }
                                        });
                                    }
                                });
                            } else {
                                RecyclerView.Adapter adapter2 = ((RecyclerView) NewsListActivity.this.findViewById(i2)).getAdapter();
                                if (adapter2 != null) {
                                    FastScreenListAdapter fastScreenListAdapter = (FastScreenListAdapter) adapter2;
                                    Collection collection = fastScreenListAdapter.a;
                                    if (collection != null) {
                                        List c = o.c(collection);
                                        List<HomeNormalModel.ListBean> list2 = newsListData.getList();
                                        h.d(list2, "it.list");
                                        c.addAll(list2);
                                        fastScreenListAdapter.notifyItemInserted(itemCount);
                                    } else {
                                        throw new NullPointerException("null cannot be cast to non-null type kotlin.collections.MutableList<org.godfootsteps.arch.api.model.HomeNormalModel.ListBean>");
                                    }
                                } else {
                                    throw new NullPointerException("null cannot be cast to non-null type org.commons.screenadapt.recyclerview.FastScreenListAdapter<org.godfootsteps.arch.api.model.HomeNormalModel.ListBean>");
                                }
                            }
                            ((LoadingLayout) NewsListActivity.this.findViewById(R$id.loading_layout)).i();
                            if (NewsListActivity.this.f15855k < newsListData.getTotal()) {
                                SmartRefreshLayout smartRefreshLayout2 = (SmartRefreshLayout) NewsListActivity.this.findViewById(R$id.refresh_layout);
                                h.c(smartRefreshLayout2);
                                smartRefreshLayout2.i();
                                NewsListActivity.this.f15855k++;
                                return;
                            }
                            SmartRefreshLayout smartRefreshLayout3 = (SmartRefreshLayout) NewsListActivity.this.findViewById(R$id.refresh_layout);
                            h.c(smartRefreshLayout3);
                            smartRefreshLayout3.k();
                        } catch (Exception e2) {
                            e2.printStackTrace();
                            NewsListActivity.Z(NewsListActivity.this);
                        }
                    }
                };
                final NewsListActivity newsListActivity2 = this;
                request.f15181m = new p<Integer, String, e>() {
                    {
                        super(2);
                    }

                    @Override
                    public e invoke(Integer num, String str2) {
                        invoke(num.intValue(), str2);
                        return e.a;
                    }

                    public final void invoke(int i2, String str2) {
                        h.e(str2, "$noName_1");
                        NewsListActivity.Z(NewsListActivity.this);
                    }
                };
            }
        });
    }

    public final void b0() {
        int i2 = R$id.rv_list;
        RecyclerView recyclerView = (RecyclerView) findViewById(i2);
        h.c(recyclerView);
        n0.r(recyclerView, (int) getResources().getDimension(R$dimen.dp6_16_x));
        if (!this.f15861q && v.i()) {
            RecyclerView recyclerView2 = (RecyclerView) findViewById(i2);
            h.c(recyclerView2);
            RecyclerView.n layoutManager = recyclerView2.getLayoutManager();
            Objects.requireNonNull(layoutManager, "null cannot be cast to non-null type androidx.recyclerview.widget.GridLayoutManager");
            ((GridLayoutManager) layoutManager).s(getResources().getInteger(R$integer.integer1_2_x));
            RecyclerView recyclerView3 = (RecyclerView) findViewById(i2);
            h.d(recyclerView3, "rv_list");
            n0.q(recyclerView3, y.E(36.0f));
        }
        RecyclerView.Adapter adapter = ((RecyclerView) findViewById(i2)).getAdapter();
        if (adapter == null) {
            return;
        }
        adapter.notifyDataSetChanged();
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        h.e(configuration, "newConfig");
        super.onConfigurationChanged(configuration);
        b0();
        int i2 = R$id.rv_list;
        RecyclerView recyclerView = (RecyclerView) findViewById(i2);
        h.c(recyclerView);
        if (recyclerView.getLayoutManager() == null || this.f15859o <= 0) {
            return;
        }
        RecyclerView recyclerView2 = (RecyclerView) findViewById(i2);
        h.c(recyclerView2);
        LinearLayoutManager linearLayoutManager = (LinearLayoutManager) recyclerView2.getLayoutManager();
        h.c(linearLayoutManager);
        linearLayoutManager.scrollToPositionWithOffset(this.f15859o, this.f15858n);
    }
}