导航菜单

页面标题

页面副标题

Rilo v2.0.21 - StreamerAgentReferralActivity.java 源代码

正在查看: Rilo v2.0.21 应用的 StreamerAgentReferralActivity.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 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.swiperefreshlayout.widget.SwipeRefreshLayout;
import app.callpe.adapters.MyUserReferAdapter;
import app.callpe.common.utils.custom.CustomLinearLayoutManager;
import app.callpe.data.model.User;
import app.callpe.databinding.ActivityStreamerAgentReferralBinding;
import app.callpe.ui.user.UserViewModel;
import dagger.hilt.android.AndroidEntryPoint;
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 kotlin.text.StringsKt;
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\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001:\u0001-B\u0005¢\u0006\u0002\u0010\u0003J\u0010\u0010\u0018\u001a\u00020\u00022\u0006\u0010\u0019\u001a\u00020\u001aH\u0016J\b\u0010\u001b\u001a\u00020\u001cH\u0002J\b\u0010\u001d\u001a\u00020\u001cH\u0002J\b\u0010\u001e\u001a\u00020\u001fH\u0002J\b\u0010 \u001a\u00020\u001cH\u0002J\u0012\u0010!\u001a\u00020\u001c2\b\u0010\"\u001a\u0004\u0018\u00010#H\u0014J\u0010\u0010$\u001a\u00020%2\u0006\u0010&\u001a\u00020'H\u0016J\b\u0010(\u001a\u00020\u001cH\u0002J\b\u0010)\u001a\u00020\u001cH\u0002J\b\u0010*\u001a\u00020\u001cH\u0002J\b\u0010+\u001a\u00020\u001cH\u0002J\b\u0010,\u001a\u00020\u001cH\u0002R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0006\u001a\u0004\u0018\u00010\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\t\u001a\u00020\nX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000b\u0010\f\"\u0004\b\r\u0010\u000eR\u000e\u0010\u000f\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0011X\u0082.¢\u0006\u0002\n\u0000R\u001b\u0010\u0012\u001a\u00020\u00138BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0016\u0010\u0017\u001a\u0004\b\u0014\u0010\u0015¨\u0006."}, d2 = {"Lapp/callpe/ui/home/StreamerAgentReferralActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityStreamerAgentReferralBinding;", "()V", "adapterReferredAgents", "Lapp/callpe/adapters/MyUserReferAdapter;", "adapterReferredStreamers", "appLink", "", "currentTab", "Lapp/callpe/ui/home/StreamerAgentReferralActivity$CurrentTab;", "getCurrentTab", "()Lapp/callpe/ui/home/StreamerAgentReferralActivity$CurrentTab;", "setCurrentTab", "(Lapp/callpe/ui/home/StreamerAgentReferralActivity$CurrentTab;)V", "refCode", "toolbar", "Landroidx/appcompat/widget/Toolbar;", "viewModel", "Lapp/callpe/ui/user/UserViewModel;", "getViewModel", "()Lapp/callpe/ui/user/UserViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "initViews", "", "inviteFriendsIntent", "observeEvent", "Lkotlinx/coroutines/Job;", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onOptionsItemSelected", "", "item", "Landroid/view/MenuItem;", "refresh", "setUpToolbar", "setupRvForAgentList", "setupRvForStreamerList", "swipeRefresh", "CurrentTab", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class StreamerAgentReferralActivity extends BaseActivity<ActivityStreamerAgentReferralBinding> {
    private MyUserReferAdapter adapterReferredAgents;
    private MyUserReferAdapter adapterReferredStreamers;
    private Toolbar toolbar;

    private final Lazy viewModel;
    private CurrentTab currentTab = CurrentTab.REFERRED_STREAMERS;
    private String refCode = "";
    private String appLink = "";

    @Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0004\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004¨\u0006\u0005"}, d2 = {"Lapp/callpe/ui/home/StreamerAgentReferralActivity$CurrentTab;", "", "(Ljava/lang/String;I)V", "REFERRED_STREAMERS", "REFERRED_AGENTS", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public enum CurrentTab {
        REFERRED_STREAMERS,
        REFERRED_AGENTS
    }

    public StreamerAgentReferralActivity() {
        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 m1429invoke() {
                return componentActivity.getViewModelStore();
            }
        }, new Function0<ViewModelProvider.Factory>() {
            {
                super(0);
            }

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

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

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

    public final CurrentTab getCurrentTab() {
        return this.currentTab;
    }

    public final void setCurrentTab(CurrentTab currentTab) {
        Intrinsics.checkNotNullParameter(currentTab, "<set-?>");
        this.currentTab = currentTab;
    }

    public final UserViewModel getViewModel() {
        return (UserViewModel) 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();
        setUpToolbar();
        setupRvForStreamerList();
        setupRvForAgentList();
        swipeRefresh();
        observeEvent();
        onClicks();
        refresh();
    }

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

    private final void onClicks() {
        getBinding().myStreamersBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                StreamerAgentReferralActivity.onClicks$lambda$0(StreamerAgentReferralActivity.this, view);
            }
        });
        getBinding().myAgentsBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                StreamerAgentReferralActivity.onClicks$lambda$1(StreamerAgentReferralActivity.this, view);
            }
        });
        getBinding().referBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                StreamerAgentReferralActivity.onClicks$lambda$2(StreamerAgentReferralActivity.this, view);
            }
        });
    }

    public static final void onClicks$lambda$0(StreamerAgentReferralActivity streamerAgentReferralActivity, View view) {
        Intrinsics.checkNotNullParameter(streamerAgentReferralActivity, "this$0");
        streamerAgentReferralActivity.getBinding().myStreamersBtn.setChecked(true);
        streamerAgentReferralActivity.getBinding().myAgentsBtn.setChecked(false);
        if (streamerAgentReferralActivity.currentTab == CurrentTab.REFERRED_STREAMERS) {
            return;
        }
        View view2 = streamerAgentReferralActivity.getBinding().rvStreamerReferrals;
        Intrinsics.checkNotNullExpressionValue(view2, "binding.rvStreamerReferrals");
        view2.setVisibility(0);
        View view3 = streamerAgentReferralActivity.getBinding().rvAgentReferrals;
        Intrinsics.checkNotNullExpressionValue(view3, "binding.rvAgentReferrals");
        view3.setVisibility(8);
        streamerAgentReferralActivity.currentTab = CurrentTab.REFERRED_STREAMERS;
        streamerAgentReferralActivity.refresh();
    }

    public static final void onClicks$lambda$1(StreamerAgentReferralActivity streamerAgentReferralActivity, View view) {
        Intrinsics.checkNotNullParameter(streamerAgentReferralActivity, "this$0");
        streamerAgentReferralActivity.getBinding().myStreamersBtn.setChecked(false);
        streamerAgentReferralActivity.getBinding().myAgentsBtn.setChecked(true);
        if (streamerAgentReferralActivity.currentTab == CurrentTab.REFERRED_AGENTS) {
            return;
        }
        View view2 = streamerAgentReferralActivity.getBinding().rvAgentReferrals;
        Intrinsics.checkNotNullExpressionValue(view2, "binding.rvAgentReferrals");
        view2.setVisibility(0);
        View view3 = streamerAgentReferralActivity.getBinding().rvStreamerReferrals;
        Intrinsics.checkNotNullExpressionValue(view3, "binding.rvStreamerReferrals");
        view3.setVisibility(8);
        streamerAgentReferralActivity.currentTab = CurrentTab.REFERRED_AGENTS;
        streamerAgentReferralActivity.refresh();
    }

    public static final void onClicks$lambda$2(StreamerAgentReferralActivity streamerAgentReferralActivity, View view) {
        Intrinsics.checkNotNullParameter(streamerAgentReferralActivity, "this$0");
        streamerAgentReferralActivity.inviteFriendsIntent();
    }

    private final void inviteFriendsIntent() {
        try {
            String string = getString(2131951675);
            Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.app_name)");
            String trimIndent = StringsKt.trimIndent("\n        Take agency or become host on " + string + " .\n        " + string + " पर होस्ट बनें या एजेंसी लें |\n        \n        Download app: " + this.appLink + "\n        \n        Use my referral code : *" + this.refCode + "*\n    ");
            Intent intent = new Intent("android.intent.action.SEND");
            intent.setType("text/plain");
            intent.putExtra("android.intent.extra.TEXT", trimIndent);
            startActivity(Intent.createChooser(intent, "Share via"));
        } catch (Exception e) {
            Timber.e("Error: " + e, new Object[0]);
        }
    }

    private final void initViews() {
        Toolbar toolbar = getBinding().toolbar;
        Intrinsics.checkNotNullExpressionValue(toolbar, "binding.toolbar");
        this.toolbar = toolbar;
        if (this.currentTab == CurrentTab.REFERRED_STREAMERS) {
            View view = getBinding().rvStreamerReferrals;
            Intrinsics.checkNotNullExpressionValue(view, "binding.rvStreamerReferrals");
            view.setVisibility(0);
            View view2 = getBinding().rvAgentReferrals;
            Intrinsics.checkNotNullExpressionValue(view2, "binding.rvAgentReferrals");
            view2.setVisibility(8);
            return;
        }
        View view3 = getBinding().rvStreamerReferrals;
        Intrinsics.checkNotNullExpressionValue(view3, "binding.rvStreamerReferrals");
        view3.setVisibility(8);
        View view4 = getBinding().rvAgentReferrals;
        Intrinsics.checkNotNullExpressionValue(view4, "binding.rvAgentReferrals");
        view4.setVisibility(0);
    }

    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 setupRvForStreamerList() {
        ((ActivityStreamerAgentReferralBinding) getBinding()).rvStreamerReferrals.setLayoutManager(new CustomLinearLayoutManager((Context) this));
        this.adapterReferredStreamers = new MyUserReferAdapter(null, new MyUserReferAdapter.ItemClickListener() {
            @Override
            public void onItemClick(User user) {
                Intrinsics.checkNotNullParameter(user, "user");
            }
        }, 1, null);
        ((ActivityStreamerAgentReferralBinding) getBinding()).rvStreamerReferrals.setAdapter(this.adapterReferredStreamers);
    }

    private final void setupRvForAgentList() {
        ((ActivityStreamerAgentReferralBinding) getBinding()).rvAgentReferrals.setLayoutManager(new CustomLinearLayoutManager((Context) this));
        this.adapterReferredAgents = new MyUserReferAdapter(null, new MyUserReferAdapter.ItemClickListener() {
            @Override
            public void onItemClick(User user) {
                Intrinsics.checkNotNullParameter(user, "user");
            }
        }, 1, null);
        ((ActivityStreamerAgentReferralBinding) getBinding()).rvAgentReferrals.setAdapter(this.adapterReferredAgents);
    }

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

    public static final void swipeRefresh$lambda$4(StreamerAgentReferralActivity streamerAgentReferralActivity) {
        Intrinsics.checkNotNullParameter(streamerAgentReferralActivity, "this$0");
        streamerAgentReferralActivity.getBinding().swipeRefresh.setRefreshing(false);
        streamerAgentReferralActivity.refresh();
    }

    private final void refresh() {
        if (this.currentTab == CurrentTab.REFERRED_STREAMERS) {
            MyUserReferAdapter myUserReferAdapter = this.adapterReferredStreamers;
            if (myUserReferAdapter != null) {
                myUserReferAdapter.clear();
            }
            getViewModel().getStreamerReferralListOfStreamers();
        } else {
            MyUserReferAdapter myUserReferAdapter2 = this.adapterReferredAgents;
            if (myUserReferAdapter2 != null) {
                myUserReferAdapter2.clear();
            }
            getViewModel().getStreamerReferralListOfAgents();
        }
        UserViewModel.getUserDetails$default(getViewModel(), false, 1, null);
    }

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