导航菜单

页面标题

页面副标题

Biko v2.0.23 - AgentLevelDetailsActivity.java 源代码

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

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


package app.callpe.ui.user;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import androidx.activity.ComponentActivity;
import androidx.appcompat.app.ActionBar;
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.swiperefreshlayout.widget.SwipeRefreshLayout;
import app.callpe.adapters.AgentLevelDetailsAdapter;
import app.callpe.common.utils.custom.CustomLinearLayoutManager;
import app.callpe.databinding.ActivityAgentLevelDetailsBinding;
import app.callpe.ui.home.BaseActivity;
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 = {"\u0000L\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\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003J\u0010\u0010\f\u001a\u00020\u00022\u0006\u0010\r\u001a\u00020\u000eH\u0016J\b\u0010\u000f\u001a\u00020\u0010H\u0003J\u0012\u0010\u0011\u001a\u00020\u00122\b\u0010\u0013\u001a\u0004\u0018\u00010\u0014H\u0014J\u0010\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u0018H\u0016J\b\u0010\u0019\u001a\u00020\u0012H\u0002J\b\u0010\u001a\u001a\u00020\u0012H\u0002J\u0010\u0010\u001b\u001a\u00020\u00122\u0006\u0010\u001c\u001a\u00020\u001dH\u0002J\b\u0010\u001e\u001a\u00020\u0012H\u0002R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u000e¢\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\t¨\u0006\u001f"}, d2 = {"Lapp/callpe/ui/user/AgentLevelDetailsActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityAgentLevelDetailsBinding;", "()V", "adapter", "Lapp/callpe/adapters/AgentLevelDetailsAdapter;", "viewModel", "Lapp/callpe/ui/user/UserViewModel;", "getViewModel", "()Lapp/callpe/ui/user/UserViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "observeEvent", "Lkotlinx/coroutines/Job;", "onCreate", "", "savedInstanceState", "Landroid/os/Bundle;", "onOptionsItemSelected", "", "item", "Landroid/view/MenuItem;", "setRv", "setUpToolbar", "setValues", "metadata", "Lapp/callpe/data/model/Metadata;", "swipeRefresh", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class AgentLevelDetailsActivity extends BaseActivity<ActivityAgentLevelDetailsBinding> {
    private AgentLevelDetailsAdapter adapter;

    private final Lazy viewModel;

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

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

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

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

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

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

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView((View) getBinding().getRoot());
        setUpToolbar();
        UserViewModel.getUserDetails$default(getViewModel(), false, 1, null);
        observeEvent();
        setRv();
        swipeRefresh();
    }

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

    public static final void swipeRefresh$lambda$0(AgentLevelDetailsActivity agentLevelDetailsActivity) {
        Intrinsics.checkNotNullParameter(agentLevelDetailsActivity, "this$0");
        agentLevelDetailsActivity.getBinding().swipeRefresh.setRefreshing(false);
        UserViewModel.getUserDetails$default(agentLevelDetailsActivity.getViewModel(), false, 1, null);
    }

    private final void setRv() {
        ((ActivityAgentLevelDetailsBinding) getBinding()).rv.setLayoutManager(new CustomLinearLayoutManager((Context) this));
        this.adapter = new AgentLevelDetailsAdapter(new ArrayList());
        ((ActivityAgentLevelDetailsBinding) getBinding()).rv.setAdapter(this.adapter);
    }

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

    public final void setValues(app.callpe.data.model.Metadata metadata) {
        StringBuilder sb = new StringBuilder();
        sb.append(metadata.getAgencyCurrentCommission());
        sb.append('%');
        getBinding().commission.setText(sb.toString());
    }

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

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