正在查看: Rilo v2.0.21 应用的 AgentHomeActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Rilo v2.0.21 应用的 AgentHomeActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package app.callpe.ui.home;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import androidx.activity.ComponentActivity;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
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.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;
import app.callpe.App;
import app.callpe.common.utils.badgeMenu.BadgeDrawerToggle;
import app.callpe.data.model.VideoDetailModel;
import app.callpe.databinding.ActivityAgentHomeBinding;
import app.callpe.service.jobs.JobPriority;
import app.callpe.ui.call.ZegoVideoCallActivity;
import app.callpe.ui.home.agent.fragments.EarningFragment;
import app.callpe.ui.home.fragments.VitokChatFragment;
import com.birjuvachhani.locus.Constants;
import com.facebook.internal.NativeProtocol;
import com.google.android.material.badge.BadgeDrawable;
import com.google.android.material.navigation.NavigationBarView;
import com.google.android.material.navigation.NavigationView;
import com.google.android.material.snackbar.Snackbar;
import com.google.gson.Gson;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.Iterator;
import java.util.Objects;
import kotlin.Deprecated;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.ArrayIteratorKt;
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¢\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0015\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0010\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001:\u0001QB\u0005¢\u0006\u0002\u0010\u0003J\b\u0010%\u001a\u00020&H\u0002J\b\u0010'\u001a\u00020(H\u0002J\u0010\u0010)\u001a\u00020\u00022\u0006\u0010*\u001a\u00020+H\u0016J\b\u0010,\u001a\u00020&H\u0002J\b\u0010-\u001a\u00020.H\u0002J\"\u0010/\u001a\u00020&2\u0006\u00100\u001a\u00020\t2\u0006\u00101\u001a\u00020\t2\b\u00102\u001a\u0004\u0018\u000103H\u0015J\b\u00104\u001a\u00020&H\u0017J\b\u00105\u001a\u00020&H\u0002J\u0012\u00106\u001a\u00020&2\b\u00107\u001a\u0004\u0018\u000108H\u0014J\b\u00109\u001a\u00020&H\u0014J+\u0010:\u001a\u00020&2\u0006\u00100\u001a\u00020\t2\f\u0010;\u001a\b\u0012\u0004\u0012\u00020\u00060\u00052\u0006\u0010<\u001a\u00020=H\u0016¢\u0006\u0002\u0010>J\b\u0010?\u001a\u00020&H\u0014J\b\u0010@\u001a\u00020&H\u0014J\u001d\u0010A\u001a\u00020B2\u000e\u0010;\u001a\n\u0012\u0004\u0012\u00020\u0006\u0018\u00010\u0005H\u0002¢\u0006\u0002\u0010CJ\u0010\u0010D\u001a\u00020B2\u0006\u0010E\u001a\u00020\u0006H\u0002J\b\u0010F\u001a\u00020&H\u0002J\u0010\u0010G\u001a\u00020&2\u0006\u0010H\u001a\u00020\tH\u0002J\u0012\u0010I\u001a\u00020&2\b\b\u0001\u0010J\u001a\u00020\tH\u0002J\b\u0010K\u001a\u00020&H\u0002J\b\u0010L\u001a\u00020&H\u0002J\u000e\u0010M\u001a\u00020&2\u0006\u0010N\u001a\u00020BJ\b\u0010O\u001a\u00020&H\u0002J\b\u0010P\u001a\u00020&H\u0002R\u0016\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005X\u0082\u000e¢\u0006\u0004\n\u0002\u0010\u0007R\u000e\u0010\b\u001a\u00020\tX\u0082D¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\tX\u0082D¢\u0006\u0002\n\u0000R\u0010\u0010\u000b\u001a\u0004\u0018\u00010\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000eX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0010X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0012X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0014X\u0082.¢\u0006\u0002\n\u0000R\u001c\u0010\u0015\u001a\u0010\u0012\f\u0012\n \u0017*\u0004\u0018\u00010\u00060\u00060\u0016X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0018\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0019\u001a\u00020\u001aX\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u001b\u001a\u00020\u001cX\u0082.¢\u0006\u0002\n\u0000R\u001b\u0010\u001d\u001a\u00020\u001e8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b!\u0010\"\u001a\u0004\b\u001f\u0010 R\u0010\u0010#\u001a\u0004\u0018\u00010$X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006R"}, d2 = {"Lapp/callpe/ui/home/AgentHomeActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityAgentHomeBinding;", "()V", "PERMISSIONS", "", "", "[Ljava/lang/String;", "PERMISSION_REQ_FORWARD", "", "PERMISSION_REQ_STAY", "alertDialog", "Landroidx/appcompat/app/AlertDialog;", "broadcastReceiver", "Landroid/content/BroadcastReceiver;", "drawer", "Landroidx/drawerlayout/widget/DrawerLayout;", "mViewPagerAdapter", "Lapp/callpe/ui/home/AgentHomeActivity$ViewPager2Adapter;", "navigationView", "Lcom/google/android/material/navigation/NavigationView;", "requestPermissionLauncher", "Landroidx/activity/result/ActivityResultLauncher;", "kotlin.jvm.PlatformType", "response", "toggle", "Lapp/callpe/common/utils/badgeMenu/BadgeDrawerToggle;", "toolbar", "Landroidx/appcompat/widget/Toolbar;", "viewModel", "Lapp/callpe/ui/home/HomeViewModel;", "getViewModel", "()Lapp/callpe/ui/home/HomeViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "viewPager", "Landroidx/viewpager2/widget/ViewPager2;", "checkPermissions", "", "getContext", "Landroid/content/Context;", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "initViews", "observeEvent", "Lkotlinx/coroutines/Job;", "onActivityResult", "requestCode", "resultCode", "data", "Landroid/content/Intent;", "onBackPressed", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onRequestPermissionsResult", NativeProtocol.RESULT_ARGS_PERMISSIONS, "grantResults", "", "(I[Ljava/lang/String;[I)V", "onStart", "onStop", "permissionArrayGranted", "", "([Ljava/lang/String;)Z", "permissionGranted", "permission", "registerReceiver", "requestPermissions", Constants.INTENT_EXTRA_CONFIGURATION, "setFabText", "text", "setUpNavigation", "setUpToolbar", "showBadgeVitokChats", "isVisible", "toastNeedPermissions", "unRegisterReceiver", "ViewPager2Adapter", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class AgentHomeActivity extends BaseActivity<ActivityAgentHomeBinding> {
private String[] PERMISSIONS;
private final int PERMISSION_REQ_FORWARD;
private final int PERMISSION_REQ_STAY;
private AlertDialog alertDialog;
private final BroadcastReceiver broadcastReceiver;
private DrawerLayout drawer;
private ViewPager2Adapter mViewPagerAdapter;
private NavigationView navigationView;
private final ActivityResultLauncher<String> requestPermissionLauncher;
private String response = "";
private BadgeDrawerToggle toggle;
private Toolbar toolbar;
private final Lazy viewModel;
private ViewPager2 viewPager;
public AgentHomeActivity() {
final ComponentActivity componentActivity = (ComponentActivity) this;
final Function0 function0 = null;
this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(HomeViewModel.class), new Function0<ViewModelStore>() {
{
super(0);
}
public final ViewModelStore m1332invoke() {
return componentActivity.getViewModelStore();
}
}, new Function0<ViewModelProvider.Factory>() {
{
super(0);
}
public final ViewModelProvider.Factory m1331invoke() {
return componentActivity.getDefaultViewModelProviderFactory();
}
}, new Function0<CreationExtras>() {
{
super(0);
}
public final CreationExtras m1333invoke() {
CreationExtras creationExtras;
Function0 function02 = function0;
return (function02 == null || (creationExtras = (CreationExtras) function02.invoke()) == null) ? componentActivity.getDefaultViewModelCreationExtras() : creationExtras;
}
});
ActivityResultLauncher<String> registerForActivityResult = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.RequestPermission(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
AgentHomeActivity.requestPermissionLauncher$lambda$1(AgentHomeActivity.this, ((Boolean) obj).booleanValue());
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResul… }.show()\n }\n }");
this.requestPermissionLauncher = registerForActivityResult;
this.PERMISSION_REQ_FORWARD = 1010;
this.PERMISSION_REQ_STAY = 1011;
this.PERMISSIONS = new String[]{"android.permission.READ_PHONE_STATE", "android.permission.READ_EXTERNAL_STORAGE"};
this.broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(intent, "intent");
Timber.e("Action %s", new Object[]{intent.getAction()});
String action = intent.getAction();
if (action == null || action.hashCode() != 2051162126) {
return;
}
action.equals(app.callpe.common.utils.Constants.GROUP_CHAT_NOTIFICATION_REFRESH);
}
};
}
public final HomeViewModel getViewModel() {
return (HomeViewModel) this.viewModel.getValue();
}
public static final void requestPermissionLauncher$lambda$1(final AgentHomeActivity agentHomeActivity, boolean z) {
Intrinsics.checkNotNullParameter(agentHomeActivity, "this$0");
if (z) {
Timber.d("Permission granted", new Object[0]);
if (agentHomeActivity.permissionArrayGranted(agentHomeActivity.PERMISSIONS)) {
return;
}
agentHomeActivity.requestPermissions(agentHomeActivity.PERMISSION_REQ_FORWARD);
return;
}
Snackbar.make(agentHomeActivity.getBinding().getRoot(), "Notification blocked", -2).setAction(agentHomeActivity.getString(2131952579), new View.OnClickListener() {
@Override
public final void onClick(View view) {
AgentHomeActivity.requestPermissionLauncher$lambda$1$lambda$0(AgentHomeActivity.this, view);
}
}).show();
}
public static final void requestPermissionLauncher$lambda$1$lambda$0(AgentHomeActivity agentHomeActivity, View view) {
Intrinsics.checkNotNullParameter(agentHomeActivity, "this$0");
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.addFlags(268435456);
Uri fromParts = Uri.fromParts("package", agentHomeActivity.getPackageName(), null);
Intrinsics.checkNotNullExpressionValue(fromParts, "fromParts(\"package\", packageName, null)");
intent.setData(fromParts);
agentHomeActivity.startActivity(intent);
agentHomeActivity.finish();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setWindowFlag((Activity) this, 67108864, false);
getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131100053));
if (Build.VERSION.SDK_INT < 30) {
this.PERMISSIONS = new String[]{"android.permission.READ_PHONE_STATE", "android.permission.READ_EXTERNAL_STORAGE"};
} else if (Build.VERSION.SDK_INT >= 33) {
this.PERMISSIONS = new String[]{"android.permission.POST_NOTIFICATIONS"};
}
checkPermissions();
initViews();
setUpToolbar();
observeEvent();
setUpNavigation();
onClicks();
getViewModel().getUserDetails();
getViewModel().observeCallEvents();
getViewModel().getActivePayouts();
}
private final void checkPermissions() {
if (Build.VERSION.SDK_INT >= 33) {
this.requestPermissionLauncher.launch("android.permission.POST_NOTIFICATIONS");
} else {
if (permissionArrayGranted(this.PERMISSIONS)) {
return;
}
requestPermissions(this.PERMISSION_REQ_FORWARD);
}
}
private final boolean permissionArrayGranted(String[] permissions) {
if (permissions == null) {
permissions = this.PERMISSIONS;
}
Iterator it = ArrayIteratorKt.iterator(permissions);
while (it.hasNext()) {
if (!permissionGranted((String) it.next())) {
return false;
}
}
return true;
}
private final boolean permissionGranted(String permission) {
Timber.e("permission name " + permission, new Object[0]);
return ContextCompat.checkSelfPermission((Context) this, permission) == 0;
}
private final void requestPermissions(int request) {
ActivityCompat.requestPermissions((Activity) this, this.PERMISSIONS, request);
}
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
Intrinsics.checkNotNullParameter(permissions, NativeProtocol.RESULT_ARGS_PERMISSIONS);
Intrinsics.checkNotNullParameter(grantResults, "grantResults");
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == this.PERMISSION_REQ_FORWARD || requestCode == this.PERMISSION_REQ_STAY) {
boolean permissionArrayGranted = permissionArrayGranted(permissions);
if ((permissionArrayGranted && requestCode == this.PERMISSION_REQ_FORWARD) || permissionArrayGranted) {
return;
}
toastNeedPermissions();
}
}
private final void toastNeedPermissions() {
Toast.makeText((Context) this, 2131952354, 1).show();
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.setData(Uri.fromParts("package", getPackageName(), null));
startActivityForResult(intent, JobPriority.MID);
}
private final void onClicks() {
getBinding().ongoingCallParent.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
AgentHomeActivity.onClicks$lambda$3(AgentHomeActivity.this, view);
}
});
}
public static final void onClicks$lambda$3(AgentHomeActivity agentHomeActivity, View view) {
Intrinsics.checkNotNullParameter(agentHomeActivity, "this$0");
VideoDetailModel videoDetails = agentHomeActivity.getViewModel().getVideoDetails();
if (videoDetails != null) {
Intent intent = new Intent(agentHomeActivity.getApplicationContext(), (Class<?>) ZegoVideoCallActivity.class);
intent.putExtra(app.callpe.common.utils.Constants.FROM_NOTIFICATION_CLICK, !App.Companion.isVideoCallScreen());
intent.putExtra(app.callpe.common.utils.Constants.KEY_CALLING_CHANNEL, videoDetails.getAgoraChannelName());
intent.putExtra(app.callpe.common.utils.Constants.KEY_CALLING_VIDEO_ID, videoDetails.getId());
intent.putExtra(app.callpe.common.utils.Constants.KEY_AGORA_ACCESS_TOKEN, videoDetails.getAgoraUserToken());
intent.putExtra(app.callpe.common.utils.Constants.KEY_CALLER, agentHomeActivity.getViewModel().getCaller());
intent.putExtra(app.callpe.common.utils.Constants.FCM_DATA, new Gson().toJson(videoDetails));
agentHomeActivity.startActivity(intent);
}
}
private final void initViews() {
DrawerLayout drawerLayout = getBinding().newHomeDrawerLayout;
Intrinsics.checkNotNullExpressionValue(drawerLayout, "binding.newHomeDrawerLayout");
this.drawer = drawerLayout;
NavigationView navigationView = getBinding().newHomeNavView;
Intrinsics.checkNotNullExpressionValue(navigationView, "binding.newHomeNavView");
this.navigationView = navigationView;
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 AgentHomeActivity$observeEvent$1(this, null), 3, (Object) null);
}
private final void setUpNavigation() {
this.viewPager = getBinding().viewPager;
FragmentManager supportFragmentManager = getSupportFragmentManager();
Intrinsics.checkNotNullExpressionValue(supportFragmentManager, "supportFragmentManager");
Lifecycle lifecycle = getLifecycle();
Intrinsics.checkNotNullExpressionValue(lifecycle, "lifecycle");
RecyclerView.Adapter viewPager2Adapter = new ViewPager2Adapter(supportFragmentManager, lifecycle);
this.mViewPagerAdapter = viewPager2Adapter;
ViewPager2 viewPager2 = this.viewPager;
if (viewPager2 != null) {
viewPager2.setAdapter(viewPager2Adapter);
}
ViewPager2 viewPager22 = this.viewPager;
if (viewPager22 != null) {
viewPager22.setUserInputEnabled(false);
}
ViewPager2 viewPager23 = this.viewPager;
if (viewPager23 != null) {
viewPager23.setOffscreenPageLimit(3);
}
getBinding().bottomNavigation.setOnItemSelectedListener(new NavigationBarView.OnItemSelectedListener() {
public final boolean onNavigationItemSelected(MenuItem menuItem) {
boolean upNavigation$lambda$4;
upNavigation$lambda$4 = AgentHomeActivity.setUpNavigation$lambda$4(AgentHomeActivity.this, menuItem);
return upNavigation$lambda$4;
}
});
ViewPager2 viewPager24 = this.viewPager;
if (viewPager24 != null) {
viewPager24.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
if (position == 0) {
AgentHomeActivity.this.getBinding().homeTitle.setText(AgentHomeActivity.this.getString(2131952128));
} else if (position == 1) {
AgentHomeActivity.this.getBinding().homeTitle.setText(AgentHomeActivity.this.getString(2131951840));
} else {
if (position != 2) {
return;
}
AgentHomeActivity.this.getBinding().homeTitle.setText(AgentHomeActivity.this.getString(2131951654));
}
}
public void onPageSelected(int position) {
if (position == 0) {
AgentHomeActivity.this.getBinding().bottomNavigation.setSelectedItemId(2131362954);
} else if (position == 1) {
AgentHomeActivity.this.getBinding().bottomNavigation.setSelectedItemId(2131362950);
} else {
if (position != 2) {
return;
}
AgentHomeActivity.this.getBinding().bottomNavigation.setSelectedItemId(2131362948);
}
}
});
}
getBinding().fab.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
AgentHomeActivity.setUpNavigation$lambda$5(AgentHomeActivity.this, view);
}
});
}
public static final boolean setUpNavigation$lambda$4(AgentHomeActivity agentHomeActivity, MenuItem menuItem) {
ViewPager2 viewPager2;
Intrinsics.checkNotNullParameter(agentHomeActivity, "this$0");
Intrinsics.checkNotNullParameter(menuItem, "item");
if (menuItem.getItemId() == 2131362954) {
ViewPager2 viewPager22 = agentHomeActivity.viewPager;
if (viewPager22 != null) {
viewPager22.setCurrentItem(0);
}
} else if (menuItem.getItemId() == 2131362950) {
ViewPager2 viewPager23 = agentHomeActivity.viewPager;
if (viewPager23 != null) {
viewPager23.setCurrentItem(1);
}
} else if (menuItem.getItemId() == 2131362948 && (viewPager2 = agentHomeActivity.viewPager) != null) {
viewPager2.setCurrentItem(2);
}
return true;
}
public static final void setUpNavigation$lambda$5(AgentHomeActivity agentHomeActivity, View view) {
ViewPager2 viewPager2;
Intrinsics.checkNotNullParameter(agentHomeActivity, "this$0");
ViewPager2 viewPager22 = agentHomeActivity.viewPager;
if (viewPager22 != null) {
if ((viewPager22 != null ? viewPager22.getAdapter() : null) == null || (viewPager2 = agentHomeActivity.viewPager) == null) {
return;
}
viewPager2.getCurrentItem();
}
}
private final void setUpToolbar() {
try {
Toolbar toolbar = this.toolbar;
Toolbar toolbar2 = null;
if (toolbar == null) {
Intrinsics.throwUninitializedPropertyAccessException("toolbar");
toolbar = null;
}
toolbar.setOverflowIcon(ContextCompat.getDrawable((Context) this, 2131231656));
Toolbar toolbar3 = this.toolbar;
if (toolbar3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("toolbar");
} else {
toolbar2 = toolbar3;
}
setSupportActionBar(toolbar2);
ActionBar actionBar = (ActionBar) Objects.requireNonNull(getSupportActionBar());
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(false);
}
} catch (Exception e) {
Timber.e(e, "setUpToolbar: Error ", new Object[0]);
}
}
private final Context getContext() {
return (Context) this;
}
private final void setFabText(int text) {
getBinding().fab.setText(text);
if (getBinding().fab.isExtended()) {
return;
}
getBinding().fab.extend();
}
protected void onDestroy() {
AlertDialog alertDialog = this.alertDialog;
if (alertDialog != null) {
alertDialog.dismiss();
}
super.onDestroy();
}
@Deprecated(message = "Deprecated in Java")
public void onBackPressed() {
ViewPager2 viewPager2 = this.viewPager;
if (viewPager2 != null) {
if ((viewPager2 != null ? viewPager2.getAdapter() : null) != null) {
ViewPager2 viewPager22 = this.viewPager;
Integer valueOf = viewPager22 != null ? Integer.valueOf(viewPager22.getCurrentItem()) : null;
if (valueOf != null && valueOf.intValue() == 0) {
super.onBackPressed();
finish();
return;
} else {
ViewPager2 viewPager23 = this.viewPager;
if (viewPager23 == null) {
return;
}
viewPager23.setCurrentItem(0);
return;
}
}
}
super.onBackPressed();
}
@Deprecated(message = "Deprecated in Java")
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 500) {
checkPermissions();
}
}
@Metadata(d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u0010\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\nH\u0016J\u000e\u0010\u000b\u001a\u00020\b2\u0006\u0010\f\u001a\u00020\nJ\b\u0010\r\u001a\u00020\nH\u0016R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000e"}, d2 = {"Lapp/callpe/ui/home/AgentHomeActivity$ViewPager2Adapter;", "Landroidx/viewpager2/adapter/FragmentStateAdapter;", "fm", "Landroidx/fragment/app/FragmentManager;", "lifecycle", "Landroidx/lifecycle/Lifecycle;", "(Landroidx/fragment/app/FragmentManager;Landroidx/lifecycle/Lifecycle;)V", "createFragment", "Landroidx/fragment/app/Fragment;", "position", "", "getItem", "currentItem", "getItemCount", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static final class ViewPager2Adapter extends FragmentStateAdapter {
private final FragmentManager fm;
public int getItemCount() {
return 3;
}
public ViewPager2Adapter(FragmentManager fragmentManager, Lifecycle lifecycle) {
super(fragmentManager, lifecycle);
Intrinsics.checkNotNullParameter(fragmentManager, "fm");
Intrinsics.checkNotNullParameter(lifecycle, "lifecycle");
this.fm = fragmentManager;
}
public Fragment createFragment(int position) {
if (position == 0) {
return new EarningFragment();
}
if (position == 1) {
return new VitokChatFragment();
}
if (position == 2) {
return new AgentAccountFragment();
}
return new AgentAccountFragment();
}
public final Fragment getItem(int currentItem) {
Object obj = this.fm.getFragments().get(currentItem);
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type androidx.fragment.app.Fragment");
return (Fragment) obj;
}
}
@Override
public ActivityAgentHomeBinding inflateLayout(LayoutInflater layoutInflater) {
Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
ActivityAgentHomeBinding inflate = ActivityAgentHomeBinding.inflate(layoutInflater);
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
return inflate;
}
@Override
protected void onStart() {
super.onStart();
registerReceiver();
}
protected void onStop() {
super.onStop();
unRegisterReceiver();
}
private final void registerReceiver() {
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance((Context) this);
Intrinsics.checkNotNullExpressionValue(localBroadcastManager, "getInstance(this)");
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(app.callpe.common.utils.Constants.GROUP_CHAT_NOTIFICATION_REFRESH);
localBroadcastManager.registerReceiver(this.broadcastReceiver, intentFilter);
}
private final void unRegisterReceiver() {
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance((Context) this);
Intrinsics.checkNotNullExpressionValue(localBroadcastManager, "getInstance(this)");
localBroadcastManager.unregisterReceiver(this.broadcastReceiver);
}
public final void showBadgeVitokChats(boolean isVisible) {
BadgeDrawable orCreateBadge = getBinding().bottomNavigation.getOrCreateBadge(2131362950);
Intrinsics.checkNotNullExpressionValue(orCreateBadge, "binding.bottomNavigation…Badge(R.id.fragment_chat)");
orCreateBadge.setVisible(isVisible);
}
}