导航菜单

页面标题

页面副标题

Easycash v3.75.13 - EasyCashSubHomeContainerActivity.java 源代码

正在查看: Easycash v3.75.13 应用的 EasyCashSubHomeContainerActivity.java JAVA 源代码文件

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


package com.lingyue.easycash.business.subhome;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import butterknife.BindView;
import com.lingyue.easycash.R;
import com.lingyue.easycash.account.u;
import com.lingyue.easycash.business.home.IHomeContract;
import com.lingyue.easycash.business.subhome.SubHomeContainerType;
import com.lingyue.easycash.commom.EasyCashCommonActivity;
import com.lingyue.easycash.models.home.HomeBody;
import com.lingyue.easycash.models.response.HomeResponse;
import com.lingyue.easycash.widght.home.HomeErrorCard;
import com.lingyue.idnbaselib.dialogmanager.DialogManager;
import com.lingyue.idnbaselib.framework.lifecycle.LifecycleEvent;
import com.lingyue.idnbaselib.framework.lifecycle.m;
import com.lingyue.idnbaselib.model.IdnObserver;
import com.lingyue.supertoolkit.screen.IScreenShotProtectPage;
import com.lingyue.supertoolkit.widgets.BaseUtils;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Predicate;

public class EasyCashSubHomeContainerActivity extends EasyCashCommonActivity implements IHomeContract, IScreenShotProtectPage {

    @Nullable
    private HomeBody B;
    private SubHomeContainerType.SubHomeContract C;
    private DialogManager D;
    private boolean E;
    boolean F;

    @BindView(R.id.error_content)
    HomeErrorCard errorCard;

    @BindView(R.id.pull_refresh)
    SwipeRefreshLayout swipeRefreshLayout;

    private void W() {
        this.swipeRefreshLayout.setRefreshing(true);
        if (this.F) {
            return;
        }
        this.F = true;
        this.apiHelper.a().n1().a(new IdnObserver<HomeResponse>(this) {
            @Override
            public void onError(Throwable th, HomeResponse homeResponse) {
                super.onError(th, (Throwable) homeResponse);
                EasyCashSubHomeContainerActivity easyCashSubHomeContainerActivity = EasyCashSubHomeContainerActivity.this;
                easyCashSubHomeContainerActivity.F = false;
                easyCashSubHomeContainerActivity.swipeRefreshLayout.setRefreshing(false);
                EasyCashSubHomeContainerActivity.this.h0();
            }

            @Override
            public void onSuccess(HomeResponse homeResponse) {
                HomeBody homeBody;
                EasyCashSubHomeContainerActivity.this.swipeRefreshLayout.setRefreshing(false);
                EasyCashSubHomeContainerActivity easyCashSubHomeContainerActivity = EasyCashSubHomeContainerActivity.this;
                easyCashSubHomeContainerActivity.F = false;
                if (homeResponse == null || (homeBody = homeResponse.body) == null) {
                    easyCashSubHomeContainerActivity.h0();
                } else {
                    easyCashSubHomeContainerActivity.f0(homeBody);
                }
            }
        });
    }

    private void X() {
        Fragment findFragmentByTag = getSupportFragmentManager().findFragmentByTag(this.C.V());
        if (findFragmentByTag == null || findFragmentByTag.getView() == null) {
            return;
        }
        findFragmentByTag.getView().setVisibility(8);
    }

    private void Y() {
        this.errorCard.setVisibility(8);
        g0();
    }

    private boolean Z(@NonNull HomeBody homeBody) {
        SubHomeContainerType.SubHomeContract subHomeContract = this.C;
        if (subHomeContract == null) {
            return true;
        }
        return subHomeContract.Y(homeBody);
    }

    public void a0(View view) {
        if (BaseUtils.l()) {
            return;
        }
        this.E = true;
        W();
    }

    public static Intent args(Context context, HomeBody homeBody, @NonNull SubHomeContainerType.SubHomeContract subHomeContract) {
        Intent intent = new Intent(context, (Class<?>) EasyCashSubHomeContainerActivity.class);
        intent.putExtra("homeBody", homeBody);
        intent.putExtra("fragmentType", subHomeContract);
        return intent;
    }

    public void b0() {
        this.E = true;
        W();
    }

    public static boolean c0(LifecycleEvent lifecycleEvent) throws Exception {
        return lifecycleEvent == LifecycleEvent.RESUMED;
    }

    public void d0(LifecycleEvent lifecycleEvent) throws Exception {
        this.E = false;
        W();
    }

    @SuppressLint({"CheckResult"})
    private void e0() {
        lifecycleObs().C(new Predicate() {
            public final boolean test(Object obj) {
                boolean c02;
                c02 = EasyCashSubHomeContainerActivity.c0((LifecycleEvent) obj);
                return c02;
            }
        }).e0(1L).g0(new Consumer() {
            public final void accept(Object obj) {
                EasyCashSubHomeContainerActivity.this.d0((LifecycleEvent) obj);
            }
        }, new u());
    }

    public void f0(@NonNull HomeBody homeBody) {
        if (Z(homeBody)) {
            finish();
            return;
        }
        this.B = homeBody;
        i0(homeBody);
        Y();
    }

    private void g0() {
        Fragment findFragmentByTag = getSupportFragmentManager().findFragmentByTag(this.C.V());
        if (findFragmentByTag == null || findFragmentByTag.getView() == null) {
            return;
        }
        findFragmentByTag.getView().setVisibility(0);
    }

    public void h0() {
        this.errorCard.setVisibility(0);
        X();
    }

    private void i0(@NonNull HomeBody homeBody) {
        Fragment findFragmentByTag = getSupportFragmentManager().findFragmentByTag(this.C.V());
        if (!this.C.G(findFragmentByTag)) {
            getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, this.C.A(homeBody), this.C.V()).commitNowAllowingStateLoss();
        } else {
            if (findFragmentByTag == null || findFragmentByTag.getView() == null) {
                return;
            }
            this.C.g(findFragmentByTag, homeBody);
        }
    }

    @Override
    protected void B(@NonNull Bundle bundle) {
        super.B(bundle);
        this.B = (HomeBody) bundle.get("homeBody");
        SubHomeContainerType.SubHomeContract subHomeContract = (SubHomeContainerType.SubHomeContract) bundle.get("fragmentType");
        this.C = subHomeContract;
        if (subHomeContract == null) {
            finish();
        }
    }

    @Override
    protected void D() {
        super.D();
        setTitle("");
        this.errorCard.setOnClickRetryListener(new HomeErrorCard.OnClickRetryListener() {
            @Override
            public final void a(View view) {
                EasyCashSubHomeContainerActivity.this.a0(view);
            }
        });
        this.swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            public final void onRefresh() {
                EasyCashSubHomeContainerActivity.this.b0();
            }
        });
    }

    @Override
    protected void N(@NonNull Bundle bundle) {
        super.N(bundle);
        bundle.putSerializable("fragmentType", this.C);
        Fragment findFragmentByTag = getSupportFragmentManager().findFragmentByTag(this.C.V());
        if (findFragmentByTag != null) {
            getSupportFragmentManager().putFragment(bundle, this.C.V(), findFragmentByTag);
        }
    }

    @Override
    public IHomeContract.PageType getContainerType() {
        return IHomeContract.PageType.NEW_HOME;
    }

    @Override
    public DialogManager getDialogManager() {
        return this.D;
    }

    @Override
    public int getLayoutID() {
        return R.layout.easycash_activity_sub_home_container_layout;
    }

    @Override
    public String getTrackUrl() {
        return j0.b.a(this);
    }

    @Override
    protected void init() {
        super.init();
        this.D = new DialogManager();
    }

    @Override
    public void initDefaultToolBarBackground(int i) {
        this.f.setBackgroundColor(i);
    }

    @Override
    public boolean isCreatingOrder() {
        return a0.a.a(this);
    }

    @Override
    public boolean isNeedProcessScreenShot() {
        return j0.a.a(this);
    }

    @Override
    public boolean isPullRefresh() {
        return this.E;
    }

    @Override
    public void refreshHomeView() {
        this.E = false;
        W();
    }

    @Override
    public Disposable runOnActiveEvent(Runnable runnable) {
        return m.a(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnCreated(@NonNull Runnable runnable) {
        return m.b(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnDestroy(@NonNull Runnable runnable) {
        return m.c(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnEvent(@NonNull LifecycleEvent lifecycleEvent, @Nullable Runnable runnable) {
        return m.d(this, lifecycleEvent, runnable);
    }

    @Override
    public Disposable runOnEvents(@NonNull LifecycleEvent[] lifecycleEventArr, @Nullable Runnable runnable) {
        return m.e(this, lifecycleEventArr, runnable);
    }

    @Override
    public void setPulRefreshEnable(boolean z2) {
        this.swipeRefreshLayout.setEnabled(z2);
    }

    @Override
    public void setToolBarVisibility(int i) {
        Toolbar toolbar = this.f;
        if (toolbar == null) {
            return;
        }
        toolbar.setVisibility(i);
    }

    @Override
    public void switchToHomeFragment(HomeBody homeBody, int i) {
        a0.a.c(this, homeBody, i);
    }

    @Override
    protected void z() {
        super.z();
        HomeBody homeBody = this.B;
        if (homeBody == null) {
            this.E = false;
            W();
        } else if (Z(homeBody)) {
            h0();
        } else {
            f0(this.B);
        }
        e0();
    }

    @Override
    public EasyCashCommonActivity getActivity() {
        return this;
    }

    @Override
    public void onJoinActivity() {
    }

    @Override
    public void refreshToolBarView() {
    }
}