导航菜单

页面标题

页面副标题

Biko v2.0.23 - EarningDetailActivity.java 源代码

正在查看: Biko v2.0.23 应用的 EarningDetailActivity.java JAVA 源代码文件

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


package app.callpe.ui.home;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.RelativeLayout;
import androidx.activity.ComponentActivity;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import app.callpe.adapters.WalletLogAdapter;
import app.callpe.common.utils.custom.CustomLinearLayoutManager;
import app.callpe.common.utils.extensions.StringExtKt;
import app.callpe.data.model.EarningModel;
import app.callpe.data.model.WalletLogModel;
import app.callpe.databinding.ActivityEarningDetailBinding;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.ArrayList;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Job;
import timber.log.Timber;

@Metadata(d1 = {"\u0000`\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003J\b\u0010\u000e\u001a\u00020\u000fH\u0002J\b\u0010\u0010\u001a\u00020\u0011H\u0002J\u0010\u0010\u0012\u001a\u00020\u00022\u0006\u0010\u0013\u001a\u00020\u0014H\u0016J\b\u0010\u0015\u001a\u00020\u0011H\u0002J\b\u0010\u0016\u001a\u00020\u0017H\u0002J\b\u0010\u0018\u001a\u00020\u0011H\u0002J\u0012\u0010\u0019\u001a\u00020\u00112\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bH\u0014J\b\u0010\u001c\u001a\u00020\u0011H\u0014J\u0010\u0010\u001d\u001a\u00020\u001e2\u0006\u0010\u001f\u001a\u00020 H\u0016J\b\u0010!\u001a\u00020\u0011H\u0002J\b\u0010\"\u001a\u00020\u0011H\u0002J\u0010\u0010#\u001a\u00020\u00112\u0006\u0010$\u001a\u00020%H\u0002J\b\u0010&\u001a\u00020\u0011H\u0002J\b\u0010'\u001a\u00020\u0011H\u0002R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082.¢\u0006\u0002\n\u0000R\u001b\u0010\u0006\u001a\u00020\u00078BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\n\u0010\u000b\u001a\u0004\b\b\u0010\tR\u000e\u0010\f\u001a\u00020\rX\u0082.¢\u0006\u0002\n\u0000¨\u0006("}, d2 = {"Lapp/callpe/ui/home/EarningDetailActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityEarningDetailBinding;", "()V", "toolbar", "Landroidx/appcompat/widget/Toolbar;", "viewModel", "Lapp/callpe/ui/home/AccountViewModel;", "getViewModel", "()Lapp/callpe/ui/home/AccountViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "walletLogAdapter", "Lapp/callpe/adapters/WalletLogAdapter;", "getContext", "Landroid/content/Context;", "getDate", "", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "initViews", "observeEvent", "Lkotlinx/coroutines/Job;", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onOptionsItemSelected", "", "item", "Landroid/view/MenuItem;", "refresh", "setUpToolbar", "setValues", "model", "Lapp/callpe/data/model/EarningModel;", "setupRv", "swipeRefresh", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class EarningDetailActivity extends BaseActivity<ActivityEarningDetailBinding> {
    private Toolbar toolbar;

    private final Lazy viewModel;
    private WalletLogAdapter walletLogAdapter;

    private final void onClicks() {
    }

    public EarningDetailActivity() {
        final ComponentActivity componentActivity = (ComponentActivity) this;
        final Function0 function0 = null;
        this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(AccountViewModel.class), new Function0<ViewModelStore>() {
            {
                super(0);
            }

            public final ViewModelStore m1336invoke() {
                return componentActivity.getViewModelStore();
            }
        }, new Function0<ViewModelProvider.Factory>() {
            {
                super(0);
            }

            public final ViewModelProvider.Factory m1335invoke() {
                return componentActivity.getDefaultViewModelProviderFactory();
            }
        }, new Function0<CreationExtras>() {
            {
                super(0);
            }

            public final CreationExtras m1337invoke() {
                CreationExtras creationExtras;
                Function0 function02 = function0;
                return (function02 == null || (creationExtras = (CreationExtras) function02.invoke()) == null) ? componentActivity.getDefaultViewModelCreationExtras() : creationExtras;
            }
        });
    }

    public final AccountViewModel getViewModel() {
        return (AccountViewModel) this.viewModel.getValue();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setWindowFlag((Activity) this, 67108864, false);
        getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131100053));
        initViews();
        getDate();
        setUpToolbar();
        setupRv();
        swipeRefresh();
        observeEvent();
        onClicks();
        refresh();
    }

    private final void getDate() {
        String stringExtra;
        Intent intent = getIntent();
        if (intent == null || (stringExtra = intent.getStringExtra("date")) == null) {
            return;
        }
        getViewModel().setCurrentDate(stringExtra);
        getBinding().title.setText(StringExtKt.formatDateByPattern(stringExtra, "yyyy-MM-dd", "dd MMM"));
    }

    private final void setupRv() {
        ((ActivityEarningDetailBinding) getBinding()).rv.setLayoutManager(new CustomLinearLayoutManager((Context) this));
        RecyclerView.Adapter adapter = null;
        this.walletLogAdapter = new WalletLogAdapter(adapter, new WalletLogAdapter.ItemClickListener() {
            @Override
            public void onItemClick(WalletLogModel host) {
                Intrinsics.checkNotNullParameter(host, "host");
            }
        }, 1, adapter);
        RecyclerView recyclerView = ((ActivityEarningDetailBinding) getBinding()).rv;
        RecyclerView.Adapter adapter2 = this.walletLogAdapter;
        if (adapter2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("walletLogAdapter");
        } else {
            adapter = adapter2;
        }
        recyclerView.setAdapter(adapter);
    }

    private final void setUpToolbar() {
        try {
            Toolbar toolbar = this.toolbar;
            if (toolbar == null) {
                Intrinsics.throwUninitializedPropertyAccessException("toolbar");
                toolbar = null;
            }
            setSupportActionBar(toolbar);
            ActionBar supportActionBar = getSupportActionBar();
            if (supportActionBar != null) {
                supportActionBar.setDisplayHomeAsUpEnabled(true);
            }
        } catch (Exception e) {
            Timber.e(e, "setUpToolbar: Error ", new Object[0]);
        }
    }

    private final void swipeRefresh() {
        getBinding().swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            public final void onRefresh() {
                EarningDetailActivity.swipeRefresh$lambda$1(EarningDetailActivity.this);
            }
        });
    }

    public static final void swipeRefresh$lambda$1(EarningDetailActivity earningDetailActivity) {
        Intrinsics.checkNotNullParameter(earningDetailActivity, "this$0");
        earningDetailActivity.getBinding().swipeRefresh.setRefreshing(false);
        earningDetailActivity.refresh();
    }

    private final void refresh() {
        WalletLogAdapter walletLogAdapter = this.walletLogAdapter;
        if (walletLogAdapter == null) {
            Intrinsics.throwUninitializedPropertyAccessException("walletLogAdapter");
            walletLogAdapter = null;
        }
        walletLogAdapter.clear();
        AccountViewModel.getEarningDetail$default(getViewModel(), null, 1, null);
    }

    private final void initViews() {
        Toolbar toolbar = getBinding().toolbar;
        Intrinsics.checkNotNullExpressionValue(toolbar, "binding.toolbar");
        this.toolbar = toolbar;
    }

    private final Job observeEvent() {
        return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new EarningDetailActivity$observeEvent$1(this, null), 3, (Object) null);
    }

    public final void setValues(EarningModel model) {
        ArrayList<WalletLogModel> txns = model.getTxns();
        boolean z = txns == null || txns.isEmpty();
        View view = getBinding().rv;
        Intrinsics.checkNotNullExpressionValue(view, "binding.rv");
        view.setVisibility(z ^ true ? 0 : 8);
        RelativeLayout relativeLayout = getBinding().noDataFound;
        Intrinsics.checkNotNullExpressionValue(relativeLayout, "binding.noDataFound");
        relativeLayout.setVisibility(z ? 0 : 8);
        WalletLogAdapter walletLogAdapter = this.walletLogAdapter;
        if (walletLogAdapter == null) {
            Intrinsics.throwUninitializedPropertyAccessException("walletLogAdapter");
            walletLogAdapter = null;
        }
        ArrayList<WalletLogModel> txns2 = model.getTxns();
        if (txns2 == null) {
            txns2 = new ArrayList<>();
        }
        walletLogAdapter.addItems(txns2);
        String valueOf = String.valueOf(model.getVideoBeans());
        String valueOf2 = String.valueOf(model.getGiftBeans());
        String valueOf3 = String.valueOf(model.getOtherBeans());
        getBinding().earning.setText(String.valueOf(model.getTotalBeans()));
        getBinding().videoCallEarning.setText(valueOf);
        getBinding().giftEarning.setText(valueOf2);
        getBinding().otherBonus.setText(valueOf3);
    }

    private final Context getContext() {
        return (Context) this;
    }

    protected void onDestroy() {
        super.onDestroy();
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        Intrinsics.checkNotNullParameter(item, "item");
        if (item.getItemId() != 16908332) {
            return true;
        }
        finish();
        return true;
    }

    @Override
    public ActivityEarningDetailBinding inflateLayout(LayoutInflater layoutInflater) {
        Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
        ActivityEarningDetailBinding inflate = ActivityEarningDetailBinding.inflate(layoutInflater);
        Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
        return inflate;
    }
}