正在查看: Biko v2.0.23 应用的 StreamerAgentReferralForAgentsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Biko v2.0.23 应用的 StreamerAgentReferralForAgentsActivity.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.FrameLayout;
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.MyStreamerAdapter;
import app.callpe.adapters.MySubAgentAdapter;
import app.callpe.common.utils.custom.CustomLinearLayoutManager;
import app.callpe.common.utils.extensions.StringExtKt;
import app.callpe.common.utils.helper_functions.DialogHelper;
import app.callpe.data.model.StreamerModel;
import app.callpe.databinding.ActivityStreamerAgentReferralBinding;
import app.callpe.ui.bottomsheet.AgentStreamerFilterBottomSheet;
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 = {"\u0000b\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\u0000\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\u0019\u001a\u00020\u00022\u0006\u0010\u001a\u001a\u00020\u001bH\u0016J\b\u0010\u001c\u001a\u00020\u001dH\u0002J\b\u0010\u001e\u001a\u00020\u001dH\u0002J\b\u0010\u001f\u001a\u00020 H\u0002J\b\u0010!\u001a\u00020\u001dH\u0002J\u0012\u0010\"\u001a\u00020\u001d2\b\u0010#\u001a\u0004\u0018\u00010$H\u0014J\u0010\u0010%\u001a\u00020&2\u0006\u0010'\u001a\u00020(H\u0016J\b\u0010)\u001a\u00020\u001dH\u0002J\b\u0010*\u001a\u00020\u001dH\u0002J\b\u0010+\u001a\u00020\u001dH\u0002J\b\u0010,\u001a\u00020\u001dH\u0002J\b\u0010-\u001a\u00020\u001dH\u0002R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0006\u001a\u0004\u0018\u00010\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\n\u001a\u00020\u000bX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\f\u0010\r\"\u0004\b\u000e\u0010\u000fR\u000e\u0010\u0010\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0012X\u0082.¢\u0006\u0002\n\u0000R\u001b\u0010\u0013\u001a\u00020\u00148BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0017\u0010\u0018\u001a\u0004\b\u0015\u0010\u0016¨\u0006/"}, d2 = {"Lapp/callpe/ui/home/StreamerAgentReferralForAgentsActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityStreamerAgentReferralBinding;", "()V", "adapterReferredAgents", "Lapp/callpe/adapters/MySubAgentAdapter;", "adapterReferredStreamers", "Lapp/callpe/adapters/MyStreamerAdapter;", "appLink", "", "currentTab", "Lapp/callpe/ui/home/StreamerAgentReferralForAgentsActivity$CurrentTab;", "getCurrentTab", "()Lapp/callpe/ui/home/StreamerAgentReferralForAgentsActivity$CurrentTab;", "setCurrentTab", "(Lapp/callpe/ui/home/StreamerAgentReferralForAgentsActivity$CurrentTab;)V", "refCode", "toolbar", "Landroidx/appcompat/widget/Toolbar;", "viewModel", "Lapp/callpe/ui/home/AccountViewModel;", "getViewModel", "()Lapp/callpe/ui/home/AccountViewModel;", "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_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class StreamerAgentReferralForAgentsActivity extends BaseActivity<ActivityStreamerAgentReferralBinding> {
private MySubAgentAdapter adapterReferredAgents;
private MyStreamerAdapter 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/StreamerAgentReferralForAgentsActivity$CurrentTab;", "", "(Ljava/lang/String;I)V", "REFERRED_STREAMERS", "REFERRED_AGENTS", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public enum CurrentTab {
REFERRED_STREAMERS,
REFERRED_AGENTS
}
public StreamerAgentReferralForAgentsActivity() {
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 m1433invoke() {
return componentActivity.getViewModelStore();
}
}, new Function0<ViewModelProvider.Factory>() {
{
super(0);
}
public final ViewModelProvider.Factory m1432invoke() {
return componentActivity.getDefaultViewModelProviderFactory();
}
}, new Function0<CreationExtras>() {
{
super(0);
}
public final CreationExtras m1434invoke() {
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 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();
setUpToolbar();
setupRvForStreamerList();
setupRvForAgentList();
swipeRefresh();
observeEvent();
onClicks();
refresh();
}
private final Job observeEvent() {
return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new StreamerAgentReferralForAgentsActivity$observeEvent$1(this, null), 3, (Object) null);
}
private final void onClicks() {
getBinding().myStreamersBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StreamerAgentReferralForAgentsActivity.onClicks$lambda$0(StreamerAgentReferralForAgentsActivity.this, view);
}
});
getBinding().myAgentsBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StreamerAgentReferralForAgentsActivity.onClicks$lambda$1(StreamerAgentReferralForAgentsActivity.this, view);
}
});
getBinding().referBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StreamerAgentReferralForAgentsActivity.onClicks$lambda$2(StreamerAgentReferralForAgentsActivity.this, view);
}
});
getBinding().icFilter.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StreamerAgentReferralForAgentsActivity.onClicks$lambda$3(StreamerAgentReferralForAgentsActivity.this, view);
}
});
}
public static final void onClicks$lambda$0(StreamerAgentReferralForAgentsActivity streamerAgentReferralForAgentsActivity, View view) {
Intrinsics.checkNotNullParameter(streamerAgentReferralForAgentsActivity, "this$0");
streamerAgentReferralForAgentsActivity.getBinding().myStreamersBtn.setChecked(true);
streamerAgentReferralForAgentsActivity.getBinding().myAgentsBtn.setChecked(false);
if (streamerAgentReferralForAgentsActivity.currentTab == CurrentTab.REFERRED_STREAMERS) {
return;
}
View view2 = streamerAgentReferralForAgentsActivity.getBinding().rvStreamerReferrals;
Intrinsics.checkNotNullExpressionValue(view2, "binding.rvStreamerReferrals");
view2.setVisibility(0);
View view3 = streamerAgentReferralForAgentsActivity.getBinding().rvAgentReferrals;
Intrinsics.checkNotNullExpressionValue(view3, "binding.rvAgentReferrals");
view3.setVisibility(8);
streamerAgentReferralForAgentsActivity.currentTab = CurrentTab.REFERRED_STREAMERS;
streamerAgentReferralForAgentsActivity.refresh();
}
public static final void onClicks$lambda$1(StreamerAgentReferralForAgentsActivity streamerAgentReferralForAgentsActivity, View view) {
Intrinsics.checkNotNullParameter(streamerAgentReferralForAgentsActivity, "this$0");
streamerAgentReferralForAgentsActivity.getBinding().myStreamersBtn.setChecked(false);
streamerAgentReferralForAgentsActivity.getBinding().myAgentsBtn.setChecked(true);
if (streamerAgentReferralForAgentsActivity.currentTab == CurrentTab.REFERRED_AGENTS) {
return;
}
View view2 = streamerAgentReferralForAgentsActivity.getBinding().rvAgentReferrals;
Intrinsics.checkNotNullExpressionValue(view2, "binding.rvAgentReferrals");
view2.setVisibility(0);
View view3 = streamerAgentReferralForAgentsActivity.getBinding().rvStreamerReferrals;
Intrinsics.checkNotNullExpressionValue(view3, "binding.rvStreamerReferrals");
view3.setVisibility(8);
streamerAgentReferralForAgentsActivity.currentTab = CurrentTab.REFERRED_AGENTS;
streamerAgentReferralForAgentsActivity.refresh();
}
public static final void onClicks$lambda$2(StreamerAgentReferralForAgentsActivity streamerAgentReferralForAgentsActivity, View view) {
Intrinsics.checkNotNullParameter(streamerAgentReferralForAgentsActivity, "this$0");
streamerAgentReferralForAgentsActivity.inviteFriendsIntent();
}
public static final void onClicks$lambda$3(final StreamerAgentReferralForAgentsActivity streamerAgentReferralForAgentsActivity, View view) {
Intrinsics.checkNotNullParameter(streamerAgentReferralForAgentsActivity, "this$0");
try {
AgentStreamerFilterBottomSheet newInstance = AgentStreamerFilterBottomSheet.INSTANCE.newInstance(streamerAgentReferralForAgentsActivity.getViewModel().getAgentStreamerFilter());
newInstance.setListener(new AgentStreamerFilterBottomSheet.BottomSheetDialogListener() {
@Override
public void onBottomSheetDismissed(String filter) {
AccountViewModel viewModel;
viewModel = StreamerAgentReferralForAgentsActivity.this.getViewModel();
viewModel.setAgentStreamerFilter(filter);
StreamerAgentReferralForAgentsActivity.this.refresh();
}
});
newInstance.show(streamerAgentReferralForAgentsActivity.getSupportFragmentManager(), "filter_bottom_sheet");
} catch (Exception e) {
Timber.e(e);
}
}
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;
getBinding().title.setText("My Streamers & Sub-Agents");
getBinding().myAgentsBtn.setText("My Sub-Agents");
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);
FrameLayout frameLayout = getBinding().agentFilterParent;
Intrinsics.checkNotNullExpressionValue(frameLayout, "binding.agentFilterParent");
frameLayout.setVisibility(0);
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);
FrameLayout frameLayout2 = getBinding().agentFilterParent;
Intrinsics.checkNotNullExpressionValue(frameLayout2, "binding.agentFilterParent");
frameLayout2.setVisibility(8);
}
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 MyStreamerAdapter(null, new MyStreamerAdapter.ItemClickListener() {
@Override
public void onItemClick(StreamerModel streamer) {
Intrinsics.checkNotNullParameter(streamer, "streamer");
}
@Override
public void onRemoveBtnClick(final StreamerModel streamer) {
Intrinsics.checkNotNullParameter(streamer, "streamer");
StringBuilder sb = new StringBuilder();
sb.append("This will remove ");
String name = streamer.getName();
sb.append(name != null ? StringExtKt.capitalizeFirstLetter(name) : null);
sb.append(" from your agency. Do you want to continue?");
String sb2 = sb.toString();
final StreamerAgentReferralForAgentsActivity streamerAgentReferralForAgentsActivity = StreamerAgentReferralForAgentsActivity.this;
DialogHelper.showReasonDialog((Context) streamerAgentReferralForAgentsActivity, "", sb2, true, new DialogHelper.Listener() {
@Override
public void onNegativeClick() {
}
@Override
public void onPositiveClick() {
AccountViewModel viewModel;
viewModel = StreamerAgentReferralForAgentsActivity.this.getViewModel();
viewModel.removeReferral(streamer.getId());
}
});
}
}, 1, null);
((ActivityStreamerAgentReferralBinding) getBinding()).rvStreamerReferrals.setAdapter(this.adapterReferredStreamers);
}
private final void setupRvForAgentList() {
((ActivityStreamerAgentReferralBinding) getBinding()).rvAgentReferrals.setLayoutManager(new CustomLinearLayoutManager((Context) this));
this.adapterReferredAgents = new MySubAgentAdapter(null, new MySubAgentAdapter.ItemClickListener() {
@Override
public void onItemClick(StreamerModel streamer) {
Intrinsics.checkNotNullParameter(streamer, "streamer");
}
@Override
public void onRemoveBtnClick(final StreamerModel streamer) {
Intrinsics.checkNotNullParameter(streamer, "streamer");
StringBuilder sb = new StringBuilder();
sb.append("This will remove ");
String name = streamer.getName();
sb.append(name != null ? StringExtKt.capitalizeFirstLetter(name) : null);
sb.append(" from your agency. Do you want to continue?");
String sb2 = sb.toString();
final StreamerAgentReferralForAgentsActivity streamerAgentReferralForAgentsActivity = StreamerAgentReferralForAgentsActivity.this;
DialogHelper.showReasonDialog((Context) streamerAgentReferralForAgentsActivity, "", sb2, true, new DialogHelper.Listener() {
@Override
public void onNegativeClick() {
}
@Override
public void onPositiveClick() {
AccountViewModel viewModel;
viewModel = StreamerAgentReferralForAgentsActivity.this.getViewModel();
viewModel.removeReferral(streamer.getId());
}
});
}
}, 1, null);
((ActivityStreamerAgentReferralBinding) getBinding()).rvAgentReferrals.setAdapter(this.adapterReferredAgents);
}
private final void swipeRefresh() {
getBinding().swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
public final void onRefresh() {
StreamerAgentReferralForAgentsActivity.swipeRefresh$lambda$5(StreamerAgentReferralForAgentsActivity.this);
}
});
}
public static final void swipeRefresh$lambda$5(StreamerAgentReferralForAgentsActivity streamerAgentReferralForAgentsActivity) {
Intrinsics.checkNotNullParameter(streamerAgentReferralForAgentsActivity, "this$0");
streamerAgentReferralForAgentsActivity.getBinding().swipeRefresh.setRefreshing(false);
streamerAgentReferralForAgentsActivity.refresh();
}
public final void refresh() {
if (this.currentTab == CurrentTab.REFERRED_STREAMERS) {
MyStreamerAdapter myStreamerAdapter = this.adapterReferredStreamers;
if (myStreamerAdapter != null) {
myStreamerAdapter.clear();
}
getViewModel().getMyStreamersForAgents();
FrameLayout frameLayout = getBinding().agentFilterParent;
Intrinsics.checkNotNullExpressionValue(frameLayout, "binding.agentFilterParent");
frameLayout.setVisibility(0);
} else {
MySubAgentAdapter mySubAgentAdapter = this.adapterReferredAgents;
if (mySubAgentAdapter != null) {
mySubAgentAdapter.clear();
}
getViewModel().getMySubAgentsForAgents();
FrameLayout frameLayout2 = getBinding().agentFilterParent;
Intrinsics.checkNotNullExpressionValue(frameLayout2, "binding.agentFilterParent");
frameLayout2.setVisibility(8);
}
AccountViewModel.getUserDetails$default(getViewModel(), false, false, 3, null);
}
public boolean onOptionsItemSelected(MenuItem item) {
Intrinsics.checkNotNullParameter(item, "item");
if (item.getItemId() != 16908332) {
return true;
}
finish();
return true;
}
}