正在查看: Hyouka private v5.8.9 应用的 HomeActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Hyouka private v5.8.9 应用的 HomeActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.beint.project.screens;
import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.text.Spannable;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Pair;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.animation.AnimationUtils;
import android.view.animation.ScaleAnimation;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import com.beint.project.AbstractZangiActivity;
import com.beint.project.Engine;
import com.beint.project.MainApplication;
import com.beint.project.adapter.HomeActivityPagerAdapter;
import com.beint.project.billing.utils.IabHelper;
import com.beint.project.billing.utils.IabResult;
import com.beint.project.billing.utils.Inventory;
import com.beint.project.billing.utils.Purchase;
import com.beint.project.billing.utils.SkuDetails;
import com.beint.project.call.CallHelper;
import com.beint.project.core.dataaccess.DBLoader;
import com.beint.project.core.dataaccess.dao.ContactNumberDao;
import com.beint.project.core.endtoend.services.CryptManager;
import com.beint.project.core.events.RegistrationEventArgs;
import com.beint.project.core.events.RegistrationEventTypes;
import com.beint.project.core.events.ZangiUIEventArgs;
import com.beint.project.core.events.ZangiUIEventTypes;
import com.beint.project.core.model.block.number.ZangiBlockNumber;
import com.beint.project.core.model.contact.Contact;
import com.beint.project.core.model.contact.ContactNumber;
import com.beint.project.core.model.contact.Profile;
import com.beint.project.core.model.http.ServiceResult;
import com.beint.project.core.model.recent.ZangiRecent;
import com.beint.project.core.model.sms.Conversation;
import com.beint.project.core.services.BadgeManager;
import com.beint.project.core.services.impl.BlockContactServiceImpl;
import com.beint.project.core.services.impl.ContactsManager;
import com.beint.project.core.services.impl.RegistrationService;
import com.beint.project.core.services.impl.SignalingService;
import com.beint.project.core.services.impl.StorageService;
import com.beint.project.core.services.impl.ZangiConfigurationService;
import com.beint.project.core.services.impl.ZangiHTTPServices;
import com.beint.project.core.services.impl.ZangiProfileServiceImpl;
import com.beint.project.core.signal.AVSession;
import com.beint.project.core.signal.SignallingSession;
import com.beint.project.core.utils.AppUserManager;
import com.beint.project.core.utils.Constants;
import com.beint.project.core.utils.Log;
import com.beint.project.core.utils.NotificationCenter;
import com.beint.project.core.utils.ZangiEngineUtils;
import com.beint.project.core.utils.ZangiPermissionUtils;
import com.beint.project.core.utils.ZangiTimer;
import com.beint.project.enums.ActivityAction;
import com.beint.project.enums.ActivityNavigation;
import com.beint.project.extended.BadgeView;
import com.beint.project.extended.ScrollingFABBehavior;
import com.beint.project.interfaces.SetVisibilityListener;
import com.beint.project.items.BlockListItem;
import com.beint.project.managers.ContactsManagerHelper;
import com.beint.project.managers.LoginManager;
import com.beint.project.push.NotificationController;
import com.beint.project.screens.HomeActivity;
import com.beint.project.screens.contacts.ContactInfoFragmentView;
import com.beint.project.screens.contacts.ScreenTabContacts;
import com.beint.project.screens.phone.ScreenDialerActivity;
import com.beint.project.screens.recent.ScreenTabRecent;
import com.beint.project.screens.settings.more.settings.ChooseLanguageFragment;
import com.beint.project.screens.sms.AppModeNotifierActivity;
import com.beint.project.screens.sms.ConversationView;
import com.beint.project.screens.sms.ScreenTabSMS;
import com.beint.project.screens.sms.ScreenTabSMSDelegate;
import com.beint.project.services.PassCodeController;
import com.beint.project.utils.AlertDialogUtils;
import com.beint.project.utils.DateTimeUtils;
import com.beint.project.utils.FastDataTimeUtils;
import com.beint.project.utils.ProjectUtils;
import com.beint.project.utils.ProtectedAppHandler;
import com.beint.project.utils.ProtectedAppHandlerKt;
import com.beint.project.utils.color.ColorsManger;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.tabs.TabLayout;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Observable;
import java.util.Observer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;
public class HomeActivity extends AppModeNotifierActivity implements SetVisibilityListener, ScreenTabSMSDelegate {
private static final String TAG = "com.beint.project.screens.HomeActivity";
public static TabLayout tabLayout;
private androidx.appcompat.app.a actionBar;
private AppBarLayout appbarLayout;
private AVSession avSession;
private AppBarLayout.Behavior behavior;
private Bundle bundle;
private View enabletNotification;
private RelativeLayout extendBarContainer;
private FrameLayout hideContentView;
private IabHelper iabHelper;
private BroadcastReceiver loginSuccess;
private FloatingActionButton mFABButton;
private FloatingActionButton mFABButtonGroupCall;
private BroadcastReceiver mMissedCallReceiver;
private HomeActivityPagerAdapter mTabsAdapter;
private BroadcastReceiver mTimeAndTimeZoneChangedReceiver;
ZangiTimer mTimerInCall;
TimerTask mTimerTaskInCall;
private BadgeView recentBadge;
private View returnToCall;
private View returnToCallContainer;
private TextView returnToCallTimerTextView;
private CoordinatorLayout rootLayout;
private BadgeView settingsBadge;
private BadgeView smsBadge;
private String title;
private Toolbar toolbar;
private ViewPager viewPager;
private static WeakReference<HomeActivity> thisWeak = new WeakReference<>(null);
public static long startedTime = -1;
public static int currentTabId = 0;
private Button updateButton = null;
private boolean isUpdateNeeded = false;
private Handler handler = new Handler();
private boolean showFloatingBtn = true;
private boolean isLoaded = false;
boolean fromChooseLanguage = false;
private Observer avSessionObserver = new Observer() {
@Override
public final void update(Observable observable, Object obj) {
HomeActivity.this.lambda$new$2(observable, obj);
}
};
private Runnable runnable = null;
View.OnClickListener fabClickLisnener = new View.OnClickListener() {
@Override
public void onClick(View view) {
if (SystemClock.elapsedRealtime() - Constants.lastTime < 1000) {
return;
}
Constants.lastTime = SystemClock.elapsedRealtime();
int currentItem = HomeActivity.this.viewPager.getCurrentItem();
if (currentItem != 0) {
if (currentItem == 1) {
HomeActivity.this.startActivity(new Intent((Context) HomeActivity.this, (Class<?>) ScreenDialerActivity.class));
return;
} else {
if (currentItem != 2) {
return;
}
AbstractZangiActivity.startAddContactActivity(HomeActivity.this, "", "", "", 2);
return;
}
}
Conversation conversation = new Conversation();
conversation.setNew(true);
conversation.setGroup(false);
conversation.setGroupCall(false);
Constants.IS_FAB_BUTTON_SELECTED = true;
ConversationManager.INSTANCE.openConversation(conversation, HomeActivity.getInstance(), 2131362423, null, false, false);
ScreenTabSMS screenTabSMS = (ScreenTabSMS) HomeActivity.this.mTabsAdapter.getFragmentByTabPosition(0);
if (screenTabSMS == null || !screenTabSMS.isAnySelectedItems()) {
return;
}
HomeActivity.this.setVisibilityToolbar();
}
};
View.OnClickListener fabGroupCallClickLisnener = new View.OnClickListener() {
@Override
public void onClick(View view) {
Conversation conversation = new Conversation();
conversation.setNew(true);
conversation.setGroup(false);
conversation.setGroupCall(true);
ConversationManager.INSTANCE.openConversation(conversation, HomeActivity.getInstance(), 2131362423, null, false, false);
}
};
private Boolean iabStarted = Boolean.FALSE;
List skus = new ArrayList();
List<SkuDetails> skudLst = new ArrayList();
private Boolean isNetwork = Boolean.TRUE;
static class AnonymousClass21 {
static final int[] $SwitchMap$com$beint$project$core$events$RegistrationEventTypes;
static final int[] $SwitchMap$com$beint$project$core$events$ZangiUIEventTypes;
static final int[] $SwitchMap$com$beint$project$enums$ActivityNavigation;
static {
int[] iArr = new int[ZangiUIEventTypes.values().length];
$SwitchMap$com$beint$project$core$events$ZangiUIEventTypes = iArr;
try {
iArr[ZangiUIEventTypes.BUSY.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$beint$project$core$events$ZangiUIEventTypes[ZangiUIEventTypes.TERMWAIT.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$beint$project$core$events$ZangiUIEventTypes[ZangiUIEventTypes.TERMINATED.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
int[] iArr2 = new int[RegistrationEventTypes.values().length];
$SwitchMap$com$beint$project$core$events$RegistrationEventTypes = iArr2;
try {
iArr2[RegistrationEventTypes.UNREGISTRATION_OK.ordinal()] = 1;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$beint$project$core$events$RegistrationEventTypes[RegistrationEventTypes.REGISTRATION_INPROGRESS.ordinal()] = 2;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$com$beint$project$core$events$RegistrationEventTypes[RegistrationEventTypes.UNREGISTRATION_INPROGRESS.ordinal()] = 3;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$com$beint$project$core$events$RegistrationEventTypes[RegistrationEventTypes.UNREGISTRATION_NOK.ordinal()] = 4;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$com$beint$project$core$events$RegistrationEventTypes[RegistrationEventTypes.CONNECTION_NOK.ordinal()] = 5;
} catch (NoSuchFieldError unused8) {
}
try {
$SwitchMap$com$beint$project$core$events$RegistrationEventTypes[RegistrationEventTypes.REGISTRATION_NOK.ordinal()] = 6;
} catch (NoSuchFieldError unused9) {
}
try {
$SwitchMap$com$beint$project$core$events$RegistrationEventTypes[RegistrationEventTypes.REGISTRATION_OK.ordinal()] = 7;
} catch (NoSuchFieldError unused10) {
}
int[] iArr3 = new int[ActivityNavigation.values().length];
$SwitchMap$com$beint$project$enums$ActivityNavigation = iArr3;
try {
iArr3[ActivityNavigation.SHOW_CHAT.ordinal()] = 1;
} catch (NoSuchFieldError unused11) {
}
try {
$SwitchMap$com$beint$project$enums$ActivityNavigation[ActivityNavigation.SHOW_CONTACT.ordinal()] = 2;
} catch (NoSuchFieldError unused12) {
}
try {
$SwitchMap$com$beint$project$enums$ActivityNavigation[ActivityNavigation.VIRTUAL_NETWORK_SIGN_IN.ordinal()] = 3;
} catch (NoSuchFieldError unused13) {
}
try {
$SwitchMap$com$beint$project$enums$ActivityNavigation[ActivityNavigation.SHOW_SERVICES_FRAGMENT.ordinal()] = 4;
} catch (NoSuchFieldError unused14) {
}
}
}
class AnonymousClass9 extends TimerTask {
AnonymousClass9() {
}
public void lambda$run$0(String str) {
if (HomeActivity.startedTime != -1) {
HomeActivity.this.returnToCallTimerTextView.setText(str);
} else {
HomeActivity.this.returnToCallTimerTextView.setText(2131887545);
}
}
public void lambda$run$1(final String str) {
if (HomeActivity.this.returnToCallTimerTextView != null) {
HomeActivity.this.runOnUiThread(new Runnable() {
@Override
public final void run() {
HomeActivity.AnonymousClass9.this.lambda$run$0(str);
}
});
}
}
@Override
public void run() {
long elapsedRealtime = SystemClock.elapsedRealtime() - HomeActivity.startedTime;
TimeUnit timeUnit = TimeUnit.MILLISECONDS;
final String format = String.format("%02d:%02d", Long.valueOf(timeUnit.toMinutes(elapsedRealtime)), Long.valueOf(timeUnit.toSeconds(elapsedRealtime) - TimeUnit.MINUTES.toSeconds(timeUnit.toMinutes(elapsedRealtime))));
HomeActivity.this.runOnUiThread(new Runnable() {
@Override
public final void run() {
HomeActivity.AnonymousClass9.this.lambda$run$1(format);
}
});
}
}
private void SwitchScreenIfNeeded(android.content.Intent r8) {
throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.HomeActivity.SwitchScreenIfNeeded(android.content.Intent):void");
}
private void audioVideoCall(String str, String str2, boolean z) {
if (!z) {
CallHelper.callVideo(false);
} else if (!CallHelper.callVideo(true)) {
return;
}
if (BlockContactServiceImpl.getInstance().getZangiBlockNumber(ZangiEngineUtils.getE164WithoutPlus(str, ZangiEngineUtils.getZipCode(), true)) == null) {
CallHelper._makeCall(this, str, str2);
if (TextUtils.isEmpty(str2)) {
ZangiConfigurationService.INSTANCE.putString("IDENTITI_CALL_NUMBER.com.beint.zangi.core.c.b", str, true);
} else {
ZangiConfigurationService.INSTANCE.putString("IDENTITI_CALL_NUMBER.com.beint.zangi.core.c.b", "", true);
}
}
}
private boolean canReplaceFromScreenTabContactsContactsList() {
if (!ConversationManager.INSTANCE.getIcShowContactListOnBackWithGroup()) {
return false;
}
if (this.viewPager.getCurrentItem() != 0 && this.viewPager.getCurrentItem() != 3) {
return false;
}
List<Fragment> v0 = getSupportFragmentManager().v0();
Fragment currentConversationViewFragmentIfExists = getCurrentConversationViewFragmentIfExists(v0);
Fragment fragment = v0.size() > 0 ? v0.get(v0.size() - 1) : null;
if (!(currentConversationViewFragmentIfExists instanceof ConversationView) || !(fragment instanceof ScreenTabContacts)) {
return false;
}
ScreenTabContacts screenTabContacts = (ScreenTabContacts) fragment;
if (screenTabContacts.getForWhichScreen() != ScreenTabContacts.ForWhichScreen.CREATE_GROUP && screenTabContacts.getForWhichScreen() != ScreenTabContacts.ForWhichScreen.GROUP_CALL) {
return false;
}
screenTabContacts.changeForWithScreen(ScreenTabContacts.ForWhichScreen.CONTACTS_TAB_With_BUTTONS, true);
((ConversationView) currentConversationViewFragmentIfExists).showContactList();
return true;
}
private void checkBundle(android.os.Bundle r11) {
throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.HomeActivity.checkBundle(android.os.Bundle):void");
}
private void checkCalling(Intent intent) {
if (intent == null || intent.getExtras() == null) {
return;
}
int intExtra = intent.getIntExtra(Constants.ZANGI_ACTION, -1);
if (CallingFragmentActivity.getInstance() != null && intExtra != -1 && intExtra != 4 && intExtra != ActivityAction.ACTION_SHOW_MISSED_CALL.ordinal() && intExtra != ActivityAction.ACTION_SHOW_CONTSHARE_SCREEN.ordinal()) {
finish();
getScreenService().showCallScreen();
return;
}
if (ActivityAction.ACTION_SHOW_MISSED_CALL.ordinal() == intExtra) {
Log.i(TAG, "!!!!!Missed notification");
Engine.getInstance().getScreenService().getArguments().putInt("com.beint.project.CURRENT_TAB_POSITION", 1);
backConversationView();
MainApplication.Companion.getMainContext().sendBroadcast(new Intent("com.beint.project.ScreenRecent.badge"));
return;
}
if (ActivityAction.ACTION_SHOW_CONTSHARE_SCREEN.ordinal() == intExtra) {
Engine.getInstance().getScreenService().getArguments().putInt("com.beint.project.CURRENT_TAB_POSITION", 2);
return;
}
if (intent.getAction() == null || !intent.getAction().equals("android.intent.action.VIEW")) {
return;
}
Bundle extras = intent.getExtras();
this.bundle = extras;
if (!extras.getBoolean("contactsPermissinon", false)) {
androidx.core.app.b.v(this, new String[]{"android.permission.READ_CONTACTS", "android.permission.WRITE_CONTACTS"}, 145);
return;
}
final String stringExtra = intent.getStringExtra("callNumber");
final String stringExtra2 = intent.getStringExtra("email");
if (intent.getType() != null && intent.getType().equals("vnd.android.cursor.item/vnd.com.zangi.audio")) {
if (ZangiPermissionUtils.hasPermissionForRegistration(this, 1001, new ZangiPermissionUtils.OnPermissionResult() {
public final void onResult(ArrayList arrayList, boolean z) {
HomeActivity.this.lambda$checkCalling$21(stringExtra, stringExtra2, arrayList, z);
}
})) {
audioVideoCall(stringExtra, stringExtra2, false);
}
} else if (intent.getType() != null && intent.getType().equals("vnd.android.cursor.item/vnd.com.zangi.video")) {
if (ZangiPermissionUtils.hasPermissionForRegistration(this, 1009, new ZangiPermissionUtils.OnPermissionResult() {
public final void onResult(ArrayList arrayList, boolean z) {
HomeActivity.this.lambda$checkCalling$22(stringExtra, stringExtra2, arrayList, z);
}
})) {
audioVideoCall(stringExtra, stringExtra2, true);
}
} else if (intent.getType() != null && intent.getType().equals("vnd.android.cursor.item/vnd.com.zangi.out") && ZangiPermissionUtils.hasPermissionForRegistration(this, 1001, new ZangiPermissionUtils.OnPermissionResult() {
public final void onResult(ArrayList arrayList, boolean z) {
HomeActivity.this.lambda$checkCalling$23(stringExtra, arrayList, z);
}
})) {
CallHelper.zangiOut(this, stringExtra, "", new ConversationView.blockNumberCallback() {
@Override
public void callback(boolean z) {
}
});
}
}
private void checkMyProfile() {
String userNumber = AppUserManager.INSTANCE.getUserNumber();
ZangiProfileServiceImpl zangiProfileServiceImpl = ZangiProfileServiceImpl.getInstance();
Profile userProfile = zangiProfileServiceImpl.getUserProfile(userNumber);
if (userProfile == null) {
zangiProfileServiceImpl.getUserProfileFromServer(userNumber);
return;
}
if (userProfile.getState() == 1 || isProfileStateOkButFileNotExist(userProfile)) {
zangiProfileServiceImpl.downloadProfilesBucketFromAmazon(userProfile, userNumber, "avatar");
} else if (userProfile.getState() == 8) {
zangiProfileServiceImpl.uploadProfileImage(userProfile, zangiProfileServiceImpl.getProfileAvatarTempDir(), userProfile.getKey(), "avatar");
} else if (userProfile.getState() == 4) {
zangiProfileServiceImpl.editOrAddProfile(userProfile.getFirstName(), userProfile.getLastName(), userProfile.getImg(), false);
}
}
public void checkOpenExtendBarInSmsScreenOrNo() {
ScreenTabSMS screenTabSMS = (ScreenTabSMS) this.mTabsAdapter.getFragmentByTabPosition(0);
if (screenTabSMS == null || screenTabSMS.getSelectedItems().size() <= 0) {
return;
}
screenTabSMS.onItemLongClicked(null);
}
private void checkScreenWithIntent(Intent intent) {
int intExtra;
if (intent == null || (intExtra = intent.getIntExtra("com.beint.project.TAB_POSITION_WITH_NOTIFICATION", -10)) != 0) {
return;
}
Engine.getInstance().getScreenService().getArguments().putInt("com.beint.project.CURRENT_TAB_POSITION", intExtra);
}
private void clearTimer() {
ZangiTimer zangiTimer = this.mTimerInCall;
if (zangiTimer != null) {
zangiTimer.purge();
this.mTimerInCall.cancel();
}
TimerTask timerTask = this.mTimerTaskInCall;
if (timerTask != null) {
timerTask.cancel();
}
ZangiConfigurationService.INSTANCE.putLong("TIMER_VALUE", -1L, true);
}
private boolean createBadgeAndUpdateButtonIfHasNewVersion() {
com.google.android.play.core.appupdate.c.a(this).a().d(new k6.c() {
@Override
public final void a(Object obj) {
HomeActivity.this.lambda$createBadgeAndUpdateButtonIfHasNewVersion$4((com.google.android.play.core.appupdate.a) obj);
}
});
return this.isUpdateNeeded;
}
private void createNewContact() {
Intent intent = new Intent("android.intent.action.INSERT");
intent.setType("vnd.android.cursor.dir/contact");
intent.putExtra("finishActivityOnSaveCompleted", true);
startActivity(intent);
}
private void createUpdateButton(ViewGroup viewGroup) {
Button button = new Button(this);
this.updateButton = button;
button.setTextColor(androidx.core.content.a.c(this, 2131099817));
this.updateButton.setBackgroundResource(2131231929);
this.updateButton.setText(getResources().getString(2131887616).toUpperCase());
this.updateButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
HomeActivity.this.lambda$createUpdateButton$5(view);
}
});
CoordinatorLayout.f fVar = new CoordinatorLayout.f(ProjectUtils.dpToPx(188), ProjectUtils.dpToPx(48));
fVar.c = 81;
((ViewGroup.MarginLayoutParams) fVar).bottomMargin = ProjectUtils.dpToPx(32);
this.updateButton.setLayoutParams(fVar);
if (currentTabId == 3) {
this.updateButton.setVisibility(0);
} else {
this.updateButton.setVisibility(8);
}
viewGroup.addView(this.updateButton);
}
private void destroyIab() throws IabHelper.IabAsyncInProgressException {
if (Constants.IS_GOOG_PLAY_PURCHASE_ENABLED) {
if (this.iabHelper != null && this.iabStarted.booleanValue()) {
this.iabHelper.dispose();
this.iabStarted = Boolean.FALSE;
}
this.iabHelper = null;
}
}
@SuppressLint({"StaticFieldLeak"})
private void downloadBlockedContactsList() {
new AsyncTask<Void, Void, List<BlockListItem>>() {
@Override
public List<BlockListItem> doInBackground(Void... voidArr) {
ArrayList arrayList;
IOException e;
ServiceResult blockContactsList;
try {
ArrayList arrayList2 = new ArrayList();
arrayList2.add("66666666");
blockContactsList = ZangiHTTPServices.getInstance().getBlockContactsList(arrayList2, "get", true);
} catch (IOException e7) {
arrayList = null;
e = e7;
}
if (blockContactsList == null || blockContactsList.getBody() == null) {
return null;
}
BlockContactServiceImpl.getInstance().deletAllBlockedNumbers();
arrayList = new ArrayList();
for (int i = 0; i < ((List) blockContactsList.getBody()).size(); i++) {
try {
BlockListItem blockListItem = new BlockListItem();
ZangiBlockNumber zangiBlockNumber = new ZangiBlockNumber();
ContactNumber contactNumber = ContactNumberDao.INSTANCE.getContactNumber((String) ((List) blockContactsList.getBody()).get(i), (String) null);
Contact firstContact = contactNumber != null ? contactNumber.getFirstContact() : null;
blockListItem.setContactNumber((String) ((List) blockContactsList.getBody()).get(i));
BlockListItem blockedItem = HomeActivity.this.getBlockedItem(firstContact, (String) ((List) blockContactsList.getBody()).get(i));
if (firstContact == null || firstContact.getIdentifire().equals("")) {
zangiBlockNumber.setBlockedExField("");
} else {
zangiBlockNumber.setBlockedExField(firstContact.getIdentifire());
}
if (blockedItem != null) {
blockListItem.setDisplayNumber(blockedItem.getDisplayNumber());
if (firstContact != null) {
StorageService.INSTANCE.addOrUpdateContact(firstContact);
}
blockListItem.setContactName(blockedItem.getContactName());
zangiBlockNumber.setBlockedNumber((String) ((List) blockContactsList.getBody()).get(i));
blockListItem.setNumberType(blockedItem.getNumberType());
} else {
blockListItem.setContactNumber((String) ((List) blockContactsList.getBody()).get(i));
if (!HomeActivity.this.isDestroyed()) {
blockListItem.setNumberType(HomeActivity.this.getString(2131887567));
}
}
BlockContactServiceImpl.getInstance().addNewBlockNumber(zangiBlockNumber);
arrayList.add(blockListItem);
} catch (IOException e8) {
e = e8;
e.printStackTrace();
return arrayList;
}
}
return arrayList;
}
}.executeOnExecutor(MainApplication.Companion.getRequestServiceExecutor(), new Void[0]);
}
private DialogInterface.OnClickListener getContactPermissionDialogAcceptClick(final String str) {
return new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
HomeActivity.this.lambda$getContactPermissionDialogAcceptClick$16(str, dialogInterface, i);
}
};
}
private Fragment getCurrentConversationViewFragmentIfExists(List<Fragment> list) {
Fragment fragment = null;
for (int size = list.size() - 1; size >= 0; size--) {
fragment = list.get(size);
if (fragment instanceof ConversationView) {
break;
}
}
return fragment;
}
@SuppressLint({"ClickableViewAccessibility"})
private FrameLayout getHideContentView() {
if (this.hideContentView == null) {
FrameLayout frameLayout = new FrameLayout(this);
this.hideContentView = frameLayout;
frameLayout.setBackgroundResource(ColorsManger.background_color);
this.hideContentView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
this.hideContentView.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
boolean lambda$getHideContentView$0;
lambda$getHideContentView$0 = HomeActivity.lambda$getHideContentView$0(view, motionEvent);
return lambda$getHideContentView$0;
}
});
this.hideContentView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
HomeActivity.lambda$getHideContentView$1(view);
}
});
}
return this.hideContentView;
}
public static synchronized HomeActivity getInstance() {
HomeActivity homeActivity;
synchronized (HomeActivity.class) {
homeActivity = thisWeak.get();
}
return homeActivity;
}
private String getNumber(String str, String str2) {
if (str == null || !str.contains(str2)) {
return null;
}
return str.replace(str2, "");
}
private void initBroadcastRecvs() {
this.mMissedCallReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
HomeActivity.this.setMissedBadge();
}
};
this.loginSuccess = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if ((!LoginManager.INSTANCE.getAutoLogin() || ZangiConfigurationService.INSTANCE.getBoolean("IS_FROM_FIRST_LOGIN", false)) && Engine.getInstance().getScreenService().getArguments().getBoolean("com.beint.project.fromLogin", false)) {
ZangiConfigurationService.INSTANCE.putBoolean("IS_FROM_FIRST_LOGIN", false, true);
}
}
};
}
private void initIab() {
if (Constants.IS_GOOG_PLAY_PURCHASE_ENABLED) {
this.skus.clear();
this.skudLst.clear();
this.skus.add("zangi.inapp.consumable_0");
this.skus.add("zangi.inapp.consumable_1");
this.skus.add("zangi.inapp.consumable_2");
this.skus.add("zangi.inapp.consumable_3");
IabHelper iabHelper = new IabHelper(this, Constants.G_A_K);
this.iabHelper = iabHelper;
iabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult iabResult) {
if (iabResult.isSuccess()) {
HomeActivity.this.iabStarted = Boolean.TRUE;
return;
}
Log.e(HomeActivity.TAG, "Problem setting up In-app Billing: " + iabResult);
HomeActivity.this.iabStarted = Boolean.FALSE;
}
});
}
}
private boolean isProfileStateOkButFileNotExist(Profile profile) {
String userNumber = AppUserManager.INSTANCE.getUserNumber();
if (profile == null) {
profile = ZangiProfileServiceImpl.getInstance().getUserProfile(userNumber);
}
if (profile.getImg() == null || profile.getImg().equals("") || ZangiProfileServiceImpl.getInstance().isFileExist(userNumber, true)) {
return false;
}
return profile.getState() == 5 || profile.getState() == 2;
}
public void lambda$actionRegisterEvent$17() {
connectionStatusChanged(Boolean.TRUE);
}
public static fb.r lambda$backConversationView$3(ConversationView conversationView) {
conversationView.onBack();
return null;
}
public void lambda$checkBundle$24(String str, String str2, ArrayList arrayList, boolean z) {
if (z) {
audioVideoCall(str, str2, false);
}
}
public void lambda$checkBundle$25(String str, String str2, ArrayList arrayList, boolean z) {
if (z) {
audioVideoCall(str, str2, false);
}
}
public void lambda$checkBundle$26(String str, ArrayList arrayList, boolean z) {
if (z) {
CallHelper.zangiOut(this, str, "", new ConversationView.blockNumberCallback() {
@Override
public void callback(boolean z6) {
}
});
}
}
public void lambda$checkCalling$21(String str, String str2, ArrayList arrayList, boolean z) {
if (z) {
audioVideoCall(str, str2, false);
}
}
public void lambda$checkCalling$22(String str, String str2, ArrayList arrayList, boolean z) {
if (z) {
audioVideoCall(str, str2, true);
}
}
public void lambda$checkCalling$23(String str, ArrayList arrayList, boolean z) {
if (z) {
CallHelper.zangiOut(this, str, "", new ConversationView.blockNumberCallback() {
@Override
public void callback(boolean z6) {
}
});
}
}
public void lambda$connectionStatusChanged$28() {
if (this.isNetwork.booleanValue() || this.actionBar == null) {
return;
}
if (!SignalingService.INSTANCE.isRegistered()) {
this.actionBar.w(2131887666);
} else {
this.isNetwork = Boolean.TRUE;
this.actionBar.x(this.title);
}
}
public void lambda$createBadgeAndUpdateButtonIfHasNewVersion$4(com.google.android.play.core.appupdate.a aVar) {
CoordinatorLayout coordinatorLayout;
try {
if (aVar.b() == 2 && aVar.a(1) && (coordinatorLayout = this.rootLayout) != null) {
createUpdateButton(coordinatorLayout);
this.settingsBadge = new BadgeView(this, tabLayout, 3);
setSettingsBadge();
this.isUpdateNeeded = true;
}
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
}
public void lambda$createUpdateButton$5(View view) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse("market://details?id=com.beint.zangi"));
startActivity(intent);
}
public void lambda$getContactPermissionDialogAcceptClick$16(final String str, DialogInterface dialogInterface, int i) {
if (!isFinishing() && ZangiPermissionUtils.hasPermissionForRegistration(this, 1016, new ZangiPermissionUtils.OnPermissionResult() {
public void onResult(ArrayList<Pair<String, Boolean>> arrayList, boolean z) {
ZangiConfigurationService.INSTANCE.putBoolean(str, true);
ContactsManager.INSTANCE.loadOrInportContacts();
}
})) {
ContactsManager.INSTANCE.loadOrInportContacts();
}
}
public static boolean lambda$getHideContentView$0(View view, MotionEvent motionEvent) {
return true;
}
public static void lambda$getHideContentView$1(View view) {
}
public void lambda$new$2(Observable observable, Object obj) {
if (((AVSession) obj).getConnectionState() == SignallingSession.ConnectionState.TERMINATED) {
runOnUiThread(new Runnable() {
@Override
public final void run() {
HomeActivity.this.hideReturnToCall();
}
});
}
}
public fb.r lambda$onCreate$10(Object obj) {
Integer num = (Integer) obj;
if (num == null) {
if (ZangiConfigurationService.INSTANCE.getBoolean("DARK_MODE_ENABLE", false)) {
getDelegate().N(2);
} else {
getDelegate().N(1);
}
} else if (num.intValue() == 32) {
getDelegate().N(2);
} else {
getDelegate().N(1);
}
ZangiConfigurationService.INSTANCE.putBoolean("ACTIVITY_RECREATED", true, false);
recreate();
return fb.r.a;
}
public fb.r lambda$onCreate$11(Object obj) {
setMessagesBadge();
return fb.r.a;
}
public fb.r lambda$onCreate$12(Object obj) {
if (ProtectedAppHandler.Companion.getInstance().isDataSaverModeTurnOn()) {
ProtectedAppHandlerKt.showDataSaverDialog(this);
}
return fb.r.a;
}
public fb.r lambda$onCreate$13(Object obj) {
((RelativeLayout) findViewById(2131362423)).removeView(this.hideContentView);
return fb.r.a;
}
public fb.r lambda$onCreate$14(Object obj) {
ZangiUIEventArgs parcelableExtra = ((Intent) obj).getParcelableExtra(ZangiUIEventArgs.EXTRA_EMBEDDED);
if (parcelableExtra == null) {
return fb.r.a;
}
int i = AnonymousClass21.$SwitchMap$com$beint$project$core$events$ZangiUIEventTypes[parcelableExtra.getEventType().ordinal()];
if (i == 1 || i == 2 || i == 3) {
hideReturnToCall();
}
return fb.r.a;
}
public static void lambda$onCreate$6() {
DBLoader.INSTANCE.loadDb();
}
public void lambda$onCreate$7(View view) {
ProtectedAppHandler.Companion companion = ProtectedAppHandler.Companion;
companion.getInstance().showAutostartOption(this);
ProtectedAppHandlerKt.showXiaomiPermissionDialog(this);
if (companion.getInstance().getIsPopupRequired()) {
return;
}
this.enabletNotification.setVisibility(8);
}
public void lambda$onCreate$8(ArrayList arrayList, boolean z) {
if (z) {
this.enabletNotification.setVisibility(8);
}
}
public void lambda$onCreate$9(View view) {
if (ZangiPermissionUtils.hasPermission(this, 1017, true, new ZangiPermissionUtils.OnPermissionResult() {
public final void onResult(ArrayList arrayList, boolean z) {
HomeActivity.this.lambda$onCreate$8(arrayList, z);
}
})) {
this.enabletNotification.setVisibility(8);
}
}
public void lambda$onResume$27(ArrayList arrayList, boolean z) {
if (z) {
this.enabletNotification.setVisibility(8);
}
}
public fb.r lambda$registerBroadcastRecvs$18(Object obj) {
connectionStatusChanged((Boolean) obj);
return fb.r.a;
}
public static fb.r lambda$registerBroadcastRecvs$19(Object obj) {
if (getInstance() != null) {
getInstance().finish();
}
return fb.r.a;
}
public fb.r lambda$registerBroadcastRecvs$20(Object obj) {
final RegistrationEventArgs registrationEventArgs = (RegistrationEventArgs) obj;
MainApplication.Companion.getMainExecutor2().execute(new Runnable() {
@Override
public void run() {
HomeActivity.this.actionRegisterEvent(registrationEventArgs);
}
});
return fb.r.a;
}
public static void lambda$showContactPermissionDialog$15(String str, DialogInterface dialogInterface, int i) {
ZangiConfigurationService.INSTANCE.putBoolean(str, true);
}
private int loadTabPosition() {
this.isLoaded = true;
return ZangiConfigurationService.INSTANCE.getInt("currentTabId", 0);
}
private void notifyUnreadMessages() {
BadgeManager.INSTANCE.calculateMessageBadges();
}
private void queryIab() throws IabHelper.IabAsyncInProgressException {
if (this.iabHelper == null || !this.iabStarted.booleanValue()) {
return;
}
Log.i(TAG, "Iab setup successful");
this.iabHelper.queryInventoryAsync(true, this.skus, (List) null, new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult iabResult, Inventory inventory) {
if (iabResult.isFailure()) {
Log.e(HomeActivity.TAG, "Query inventory error: " + iabResult);
return;
}
for (int i = 0; i < HomeActivity.this.skus.size(); i++) {
SkuDetails skuDetails = inventory.getSkuDetails((String) HomeActivity.this.skus.get(i));
if (skuDetails != null) {
HomeActivity.this.skudLst.add(skuDetails);
}
if (inventory.hasPurchase((String) HomeActivity.this.skus.get(i))) {
try {
HomeActivity.this.validatePurchase(inventory.getPurchase((String) HomeActivity.this.skus.get(i)), false);
} catch (IabHelper.IabAsyncInProgressException e) {
e.printStackTrace();
}
Log.i(HomeActivity.TAG, "has not consumed prods");
}
}
}
});
}
private void registerBroadcastRecvs() {
NotificationCenter notificationCenter = NotificationCenter.INSTANCE;
notificationCenter.addObserver(this, NotificationCenter.NotificationType.CONNECTION_STATUS_CHANGED, new qb.l() {
public final Object invoke(Object obj) {
fb.r lambda$registerBroadcastRecvs$18;
lambda$registerBroadcastRecvs$18 = HomeActivity.this.lambda$registerBroadcastRecvs$18(obj);
return lambda$registerBroadcastRecvs$18;
}
});
notificationCenter.addObserver(this, NotificationCenter.NotificationType.CRASH, new qb.l() {
public final Object invoke(Object obj) {
fb.r lambda$registerBroadcastRecvs$19;
lambda$registerBroadcastRecvs$19 = HomeActivity.lambda$registerBroadcastRecvs$19(obj);
return lambda$registerBroadcastRecvs$19;
}
});
notificationCenter.addObserver(this, NotificationCenter.NotificationType.REGISTRATION_EVENT, new qb.l() {
public final Object invoke(Object obj) {
fb.r lambda$registerBroadcastRecvs$20;
lambda$registerBroadcastRecvs$20 = HomeActivity.this.lambda$registerBroadcastRecvs$20(obj);
return lambda$registerBroadcastRecvs$20;
}
});
registerReceiver(this.mMissedCallReceiver, new IntentFilter("com.beint.project.ScreenRecent.badge"));
registerReceiver(this.loginSuccess, new IntentFilter("com.beint.project.LOGIN_SUCCESS"));
}
private void saveTabPosition(int i) {
ZangiConfigurationService.INSTANCE.putInt("currentTabId", i, true);
}
public static synchronized void setInstance(HomeActivity homeActivity) {
synchronized (HomeActivity.class) {
thisWeak = new WeakReference<>(homeActivity);
}
}
private void setMessagesBadge() {
if (this.smsBadge == null) {
return;
}
int totalUnreadMessages = BadgeManager.INSTANCE.getTotalUnreadMessages();
if (totalUnreadMessages <= 0) {
this.smsBadge.hide();
return;
}
this.smsBadge.setText(Integer.toString(totalUnreadMessages));
ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.2f, 0.0f, 1.2f, 1, 0.5f, 1, 0.5f);
ScaleAnimation scaleAnimation2 = new ScaleAnimation(1.2f, 1.0f, 1.2f, 1.0f, 1, 0.5f, 1, 0.5f);
scaleAnimation.setFillAfter(false);
scaleAnimation.setDuration(300L);
scaleAnimation2.setDuration(150L);
this.smsBadge.show(scaleAnimation, scaleAnimation2);
}
public void setMissedBadge() {
if (this.recentBadge == null) {
return;
}
int missedCallsCount = BadgeManager.INSTANCE.getMissedCallsCount();
if (this.viewPager == null) {
return;
}
if (missedCallsCount > 0) {
this.recentBadge.setText(Integer.toString(missedCallsCount));
ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.2f, 0.0f, 1.2f, 1, 0.5f, 1, 0.5f);
ScaleAnimation scaleAnimation2 = new ScaleAnimation(1.2f, 1.0f, 1.2f, 1.0f, 1, 0.5f, 1, 0.5f);
scaleAnimation.setFillAfter(false);
scaleAnimation.setDuration(300L);
scaleAnimation2.setDuration(150L);
this.recentBadge.show(scaleAnimation, scaleAnimation2);
}
if (missedCallsCount == 0) {
this.recentBadge.hide();
int i = Engine.getInstance().getScreenService().getArguments().getInt("com.beint.project.CURRENT_TAB_POSITION", 0);
this.viewPager.setCurrentItem(i);
setBarTitleByTab(i);
NotificationController.INSTANCE.removeMissedNotifications();
}
}
private void setSettingsBadge() {
BadgeView badgeView = this.settingsBadge;
if (badgeView == null) {
return;
}
badgeView.setText("1");
ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.2f, 0.0f, 1.2f, 1, 0.5f, 1, 0.5f);
ScaleAnimation scaleAnimation2 = new ScaleAnimation(1.2f, 1.0f, 1.2f, 1.0f, 1, 0.5f, 1, 0.5f);
scaleAnimation.setFillAfter(false);
scaleAnimation.setDuration(300L);
scaleAnimation2.setDuration(150L);
this.settingsBadge.show(scaleAnimation, scaleAnimation2);
}
private void setStatusBarColor(int i) {
Window window = getWindow();
window.addFlags(Integer.MIN_VALUE);
window.setStatusBarColor(androidx.core.content.a.c(this, i));
}
private void setupTabsWithBadge() {
TabLayout tabLayout2 = (TabLayout) findViewById(2131363761);
tabLayout = tabLayout2;
tabLayout2.setSelectedTabIndicatorHeight(0);
TabLayout tabLayout3 = tabLayout;
tabLayout3.addTab(tabLayout3.newTab().n(2131558778).p(2131231884));
TabLayout tabLayout4 = tabLayout;
tabLayout4.addTab(tabLayout4.newTab().n(2131558780).p(2131231886));
TabLayout tabLayout5 = tabLayout;
tabLayout5.addTab(tabLayout5.newTab().n(2131558777).p(2131231883));
TabLayout tabLayout6 = tabLayout;
tabLayout6.addTab(tabLayout6.newTab().n(2131558779).p(2131231885));
tabLayout.setTabGravity(0);
ViewPager findViewById = findViewById(2131363280);
this.viewPager = findViewById;
findViewById.addOnPageChangeListener(new ViewPager.j() {
public void onPageScrollStateChanged(int i) {
}
public void onPageScrolled(int i, float f, int i7) {
ScreenTabSMS screenTabSMS = (ScreenTabSMS) HomeActivity.this.mTabsAdapter.getFragmentByTabPosition(0);
if (f == 0.0d && i7 == 0 && screenTabSMS != null && (screenTabSMS.getSelectedItems() == null || screenTabSMS.getSelectedItems().size() < 1)) {
HomeActivity.this.setVisibilityToolbar();
}
if (screenTabSMS != null) {
screenTabSMS.setDelegate(HomeActivity.this);
}
}
public void onPageSelected(int i) {
if (i == 0) {
HomeActivity.this.checkOpenExtendBarInSmsScreenOrNo();
}
if (HomeActivity.this.updateButton != null) {
if (i == 3) {
HomeActivity.this.updateButton.setVisibility(0);
} else {
HomeActivity.this.updateButton.setVisibility(8);
}
}
}
});
HomeActivityPagerAdapter homeActivityPagerAdapter = new HomeActivityPagerAdapter(getSupportFragmentManager(), tabLayout.getTabCount());
this.mTabsAdapter = homeActivityPagerAdapter;
this.viewPager.setAdapter(homeActivityPagerAdapter);
this.viewPager.setOffscreenPageLimit(4);
this.viewPager.addOnPageChangeListener(new TabLayout.h(tabLayout));
int i = Engine.getInstance().getScreenService().getArguments().getInt("com.beint.project.CURRENT_TAB_POSITION", 0);
if (i == 1 && this.mFABButtonGroupCall.getVisibility() == 8) {
this.mFABButtonGroupCall.setVisibility(0);
}
this.viewPager.setCurrentItem(i);
tabLayout.addOnTabSelectedListener(new TabLayout.d() {
@Override
public void onTabReselected(TabLayout.g gVar) {
}
@Override
public void onTabSelected(TabLayout.g gVar) {
ScreenTabContacts screenTabContacts;
HomeActivity.this.expandToolbar();
ScrollingFABBehavior.hideShow(HomeActivity.this.mFABButton, -1);
ScrollingFABBehavior.hideShow(HomeActivity.this.mFABButtonGroupCall, -1);
int g = gVar.g();
if (g == 3) {
ScreenTabContacts screenTabContacts2 = (ScreenTabContacts) HomeActivity.this.mTabsAdapter.getFragmentByTabPosition(2);
if (screenTabContacts2 != null) {
screenTabContacts2.setPremiumItemInGroupCallVisibility(screenTabContacts2.isShowNeedPremiumItem());
}
try {
screenTabContacts2.clearMenu();
} catch (Exception unused) {
}
}
if (g == 2 && (screenTabContacts = (ScreenTabContacts) HomeActivity.this.mTabsAdapter.getFragmentByTabPosition(2)) != null) {
screenTabContacts.sendContactsOnlineStatusRequestIfNedded();
}
HomeActivity.this.setBarTitleByTab(g);
HomeActivity.this.setFABButtonByTab(g);
HomeActivity.this.viewPager.setCurrentItem(gVar.g());
HomeActivity.currentTabId = g;
Engine.getInstance().getScreenService().getArguments().putInt("com.beint.project.CURRENT_TAB_POSITION", g);
boolean z = true;
if (g == 1) {
BadgeManager.INSTANCE.setMissedCallsCount(0);
HomeActivity.this.setMissedBadge();
}
ZangiConfigurationService zangiConfigurationService = ZangiConfigurationService.INSTANCE;
if (!zangiConfigurationService.getBoolean("Contacts_Asked_Permission", false) && !zangiConfigurationService.getBoolean("SHOW_PRIVACY_POLICY_DIALOG", false)) {
z = false;
}
if (g == 2) {
if (Constants.IS_CONTACTS_SCREEN_ON_REGISTRATION || z) {
ContactsManager.INSTANCE.loadOrInportContacts();
} else if (ZangiPermissionUtils.hasPermission(HomeActivity.this, 1016, false, (ZangiPermissionUtils.OnPermissionResult) null)) {
ContactsManager.INSTANCE.loadOrInportContacts();
} else {
HomeActivity.this.showContactPermissionDialog("Contacts_Asked_Permission");
}
}
}
@Override
public void onTabUnselected(TabLayout.g gVar) {
ScreenTabContacts screenTabContacts;
int g = gVar.g();
if (g == 0) {
ScreenTabSMS screenTabSMS = (ScreenTabSMS) HomeActivity.this.mTabsAdapter.getFragmentByTabPosition(0);
if (screenTabSMS != null && screenTabSMS.isAnySelectedItems()) {
HomeActivity.this.setVisibilityToolbar();
}
} else if (g == 3 && (screenTabContacts = (ScreenTabContacts) HomeActivity.this.mTabsAdapter.getFragmentByTabPosition(2)) != null) {
screenTabContacts.setPremiumItemInGroupCallVisibility(screenTabContacts.isShowNeedPremiumItem());
screenTabContacts.prepareMenu();
}
if (g == 1) {
BadgeManager badgeManager = BadgeManager.INSTANCE;
if (badgeManager.getMissedCallsCount() > 0) {
badgeManager.setMissedCallsCount(0);
HomeActivity.this.setMissedBadge();
}
}
}
});
try {
this.recentBadge = new BadgeView(this, tabLayout, 1);
} catch (Exception e) {
e.printStackTrace();
}
try {
this.smsBadge = new BadgeView(this, tabLayout, 0);
} catch (Exception e7) {
e7.printStackTrace();
}
}
public void showContactPermissionDialog(final String str) {
if (isFinishing()) {
return;
}
AlertDialogUtils.showAlertWithMessage((Context) this, 2131886181, (Spannable) SpannableBuilderManager.INSTANCE.getPrivacyPolicySpannableBuilder(this, getResources().getString(2131887129)), 2131886369, 2131886439, getContactPermissionDialogAcceptClick(str), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
HomeActivity.lambda$showContactPermissionDialog$15(str, dialogInterface, i);
}
}, true);
}
private void startTimer() {
this.mTimerInCall = new ZangiTimer("Timer In Call");
this.mTimerTaskInCall = new AnonymousClass9();
this.mTimerInCall.purge();
this.mTimerInCall.schedule(this.mTimerTaskInCall, 0L, 1000L);
}
private void unRegisterBroadcastRecvs() {
NotificationCenter.INSTANCE.removeObserver(this, NotificationCenter.NotificationType.CONNECTION_STATUS_CHANGED);
unregisterReceiver(this.mMissedCallReceiver);
unregisterReceiver(this.loginSuccess);
}
public void validatePurchase(Purchase purchase, boolean z) throws IabHelper.IabAsyncInProgressException {
ServiceResult serviceResult;
SkuDetails skuDetails;
String str;
String str2;
if (purchase != null) {
int i = 0;
while (true) {
serviceResult = null;
if (i >= this.skudLst.size()) {
skuDetails = null;
break;
} else {
if (purchase.getSku().equals(this.skudLst.get(i).getSku())) {
skuDetails = this.skudLst.get(i);
break;
}
i++;
}
}
if (skuDetails != null) {
String valueOf = String.valueOf(skuDetails.getPriceAmountMicros());
str2 = skuDetails.getPriceCurrencyCode();
str = valueOf;
} else {
str = null;
str2 = null;
}
try {
serviceResult = ZangiHTTPServices.getInstance().validatePurchase(getPackageName(), purchase.getSku(), purchase.getToken(), str, str2);
} catch (Exception e) {
Log.e(TAG, "Error" + e.getMessage());
}
if (serviceResult == null) {
Log.i(TAG, "no connection");
return;
}
if (!serviceResult.isOk()) {
Log.i(TAG, "!!!! purchase NOT validated successfully");
return;
}
BaseScreen.showCustomToast((Context) this, 2131886696);
sendBroadcast(new Intent("com.beint.project.GET_BALANCE_REQUEST"));
this.iabHelper.consumeAsync(purchase, new IabHelper.OnConsumeFinishedListener() {
public void onConsumeFinished(Purchase purchase2, IabResult iabResult) {
}
});
Log.i(TAG, "purchase validated successfully");
}
}
public void actionRegisterEvent(RegistrationEventArgs registrationEventArgs) {
if (AnonymousClass21.$SwitchMap$com$beint$project$core$events$RegistrationEventTypes[registrationEventArgs.getEventType().ordinal()] != 7) {
return;
}
runOnUiThread(new Runnable() {
@Override
public final void run() {
HomeActivity.this.lambda$actionRegisterEvent$17();
}
});
checkMyProfile();
try {
queryIab();
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
ContactsManagerHelper contactsManagerHelper = ContactsManagerHelper.INSTANCE;
if (contactsManagerHelper.getDownloadBlockedContacts()) {
downloadBlockedContactsList();
contactsManagerHelper.setDownloadBlockedContacts(false);
}
if ((!LoginManager.INSTANCE.getAutoLogin() || ZangiConfigurationService.INSTANCE.getBoolean("IS_FROM_FIRST_LOGIN", false)) && Engine.getInstance().getScreenService().getArguments().getBoolean("com.beint.project.fromLogin", false)) {
ZangiConfigurationService.INSTANCE.putBoolean("IS_FROM_FIRST_LOGIN", false, true);
}
}
public boolean backConversationView() {
final ConversationView conversationView;
ConversationManager conversationManager = ConversationManager.INSTANCE;
if (conversationManager.getConversationScreenRef() == null || (conversationView = conversationManager.getConversationScreenRef().get()) == null || !conversationView.isVisible()) {
return false;
}
conversationManager.navigate(this, new qb.a() {
public final Object invoke() {
fb.r lambda$backConversationView$3;
lambda$backConversationView$3 = HomeActivity.lambda$backConversationView$3(ConversationView.this);
return lambda$backConversationView$3;
}
});
return true;
}
public void collapseToolbar() {
AppBarLayout appBarLayout = this.appbarLayout;
if (appBarLayout != null) {
AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) appBarLayout.getLayoutParams().f();
this.behavior = behavior;
if (behavior != null) {
behavior.onNestedFling(this.rootLayout, this.appbarLayout, (View) null, 0.0f, 10000.0f, true);
}
}
}
void connectionStatusChanged(Boolean bool) {
if (!bool.booleanValue()) {
this.isNetwork = Boolean.FALSE;
MainApplication.Companion.getMainHandler().postDelayed(new Runnable() {
@Override
public final void run() {
HomeActivity.this.lambda$connectionStatusChanged$28();
}
}, CallingFragmentActivity.CALL_RESULT_WAITING_TIMEOUT);
return;
}
this.isNetwork = Boolean.TRUE;
androidx.appcompat.app.a aVar = this.actionBar;
if (aVar != null) {
aVar.x(this.title);
}
}
public void expandToolbar() {
AppBarLayout appBarLayout = this.appbarLayout;
if (appBarLayout != null) {
AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) appBarLayout.getLayoutParams().f();
this.behavior = behavior;
if (behavior != null) {
behavior.onNestedFling(this.rootLayout, this.appbarLayout, (View) null, 0.0f, -10000.0f, false);
}
}
}
public BlockListItem getBlockedItem(Contact contact, String str) {
BlockListItem blockListItem = new BlockListItem();
if (contact == null) {
StorageService storageService = StorageService.INSTANCE;
Profile userProfile = storageService.getUserProfile(str);
Conversation conversationItemByChat = storageService.getConversationItemByChat(str);
if (conversationItemByChat != null) {
String name = conversationItemByChat.getName();
return (conversationItemByChat.getDisplayEmail() == null || conversationItemByChat.getDisplayEmail().isEmpty()) ? new BlockListItem(name, conversationItemByChat.getDisplayNumber(), ProjectUtils.localisationLabels("", this), conversationItemByChat.getDisplayNumber()) : new BlockListItem(name, conversationItemByChat.getDisplayNumber(), ProjectUtils.localisationLabels("", this), conversationItemByChat.getDisplayEmail());
}
ZangiRecent recentInfo = storageService.getRecentInfo(str);
if (recentInfo == null) {
return new BlockListItem((userProfile == null || userProfile.getDisplayName() == null || userProfile.getDisplayName().isEmpty()) ? str : userProfile.getDisplayName(), str, ProjectUtils.localisationLabels("", this), str);
}
String displayNumber = userProfile != null ? (userProfile.getDisplayName() == null || userProfile.getDisplayName().isEmpty()) ? (recentInfo.getEmail() == null || recentInfo.getEmail().isEmpty()) ? recentInfo.getDisplayNumber() : recentInfo.getEmail() : userProfile.getDisplayName() : "";
return (recentInfo.getEmail() == null || recentInfo.getEmail().isEmpty()) ? new BlockListItem(displayNumber, recentInfo.getDisplayNumber(), ProjectUtils.localisationLabels("", this), recentInfo.getDisplayNumber()) : new BlockListItem(displayNumber, recentInfo.getDisplayNumber(), ProjectUtils.localisationLabels("", this), recentInfo.getEmail());
}
LinkedList contactNumbers = contact.getContactNumbers();
for (int i = 0; i < contactNumbers.size(); i++) {
if (contactNumbers.get(i) != null) {
if (((ContactNumber) contactNumbers.get(i)).isHaveEmail() && !TextUtils.isEmpty(((ContactNumber) contactNumbers.get(i)).getFullNumber()) && ((ContactNumber) contactNumbers.get(i)).getFullNumber().equals(str)) {
blockListItem = new BlockListItem(contact.getName(), ((ContactNumber) contactNumbers.get(i)).getFullNumber(), ProjectUtils.localisationLabels(((ContactNumber) contactNumbers.get(i)).getLabel(), this), ((ContactNumber) contactNumbers.get(i)).getEmail());
} else if (!TextUtils.isEmpty(((ContactNumber) contactNumbers.get(i)).getFullNumber()) && ((ContactNumber) contactNumbers.get(i)).getFullNumber().equals(str) && !((ContactNumber) contactNumbers.get(i)).isHaveEmail()) {
blockListItem = new BlockListItem(contact.getName(), ((ContactNumber) contactNumbers.get(i)).getFullNumber(), ProjectUtils.localisationLabels(((ContactNumber) contactNumbers.get(i)).getLabel(), this), ((ContactNumber) contactNumbers.get(i)).getFullNumber());
}
}
}
return blockListItem;
}
public int getItemPosition() {
return this.viewPager.getCurrentItem();
}
public Toolbar getToolbar() {
return this.toolbar;
}
public boolean hasAllPermissionsGranted(int[] iArr) {
for (int i : iArr) {
if (i == -1) {
return false;
}
}
return true;
}
public void hideEnabletNotification() {
ProtectedAppHandler.Companion companion = ProtectedAppHandler.Companion;
if (!companion.getInstance().getIsPopupRequired() || this.returnToCall.getVisibility() == 0) {
this.enabletNotification.setVisibility(8);
} else {
this.enabletNotification.setVisibility(0);
}
if (Build.VERSION.SDK_INT >= 33 && companion.getInstance().getIsPushNotificationEnabledRequeired() && this.returnToCall.getVisibility() == 8) {
this.enabletNotification.setVisibility(0);
}
}
public void hideFABButton() {
this.mFABButton.setVisibility(8);
}
public void hideReturnToCall() {
if (this.returnToCall.getVisibility() == 0) {
this.returnToCall.setVisibility(8);
this.returnToCallTimerTextView.setVisibility(8);
clearTimer();
}
hideEnabletNotification();
}
public void hideShowFABButton(boolean z) {
FloatingActionButton floatingActionButton = this.mFABButton;
if (floatingActionButton != null) {
floatingActionButton.setVisibility(z ? 0 : 8);
}
}
public void hideShowGroupFABButton(boolean z) {
int i = Engine.getInstance().getScreenService().getArguments().getInt("com.beint.project.CURRENT_TAB_POSITION", 1);
FloatingActionButton floatingActionButton = this.mFABButtonGroupCall;
if (floatingActionButton == null || i != 1) {
return;
}
floatingActionButton.setVisibility(z ? 0 : 8);
}
public boolean isContactTabVisible() {
return ((ScreenTabContacts) this.mTabsAdapter.getFragmentByTabPosition(2)) != null;
}
public void missedCallChecker(final Intent intent) {
if (intent.getIntExtra("com.beint.project.CURRENT_TAB_POSITION", 0) == 2) {
this.viewPager.setCurrentItem(1);
this.mTabsAdapter.notifyDataSetChanged();
setFABButtonByTab(1);
getIntent().removeExtra("com.beint.project.CURRENT_TAB_POSITION");
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
NotificationCenter.INSTANCE.postNotificationName(NotificationCenter.NotificationType.MISSED_NOTIFICATION, intent);
ZangiConfigurationService.INSTANCE.putBoolean("MISSED_NOTIF_OPENED_FROM_SPLASH_SCREEN", false, true);
}
}, ZangiConfigurationService.INSTANCE.getBoolean("MISSED_NOTIF_OPENED_FROM_SPLASH_SCREEN", false) ? 2000L : 0L);
}
}
protected void onActivityResult(int i, int i7, Intent intent) {
super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i7, intent);
}
public void onBackPressed() {
ConversationView conversationView;
Fragment j0;
ConversationView conversationView2;
Fragment j02;
if (canReplaceFromScreenTabContactsContactsList()) {
return;
}
ConversationManager conversationManager = ConversationManager.INSTANCE;
if (conversationManager.getConversationScreenRef() != null && (conversationView2 = conversationManager.getConversationScreenRef().get()) != null && conversationView2.isVisible() && conversationView2.getYoutubeVideoPlayingMode() && (j02 = getSupportFragmentManager().j0(YoutubePlayerFragment.Tag)) != null) {
getSupportFragmentManager().n().p(j02).j();
return;
}
if (conversationManager.getConversationScreenRef() != null && (conversationView = conversationManager.getConversationScreenRef().get()) != null && conversationView.isVisible() && (j0 = getSupportFragmentManager().j0("ForwardMessageFragment")) != null) {
getSupportFragmentManager().n().p(j0).j();
return;
}
setSupportActionBar(this.toolbar);
if (this.viewPager.getCurrentItem() == 0 || this.viewPager.getCurrentItem() == 3) {
checkOpenExtendBarInSmsScreenOrNo();
ScreenTabSMS screenTabSMS = (ScreenTabSMS) this.mTabsAdapter.getFragmentByTabPosition(0);
if (screenTabSMS != null) {
screenTabSMS.updateConversationAllListIfNeeded();
}
}
setSupportActionBar(this.toolbar);
super.onBackPressed();
}
public void onConfigurationChanged(Configuration configuration) {
ScreenTabSMS screenTabSMS;
boolean z;
ZangiConfigurationService zangiConfigurationService = ZangiConfigurationService.INSTANCE;
String string = zangiConfigurationService.getString(Constants.LANGUAGE_CODE, "default");
if (string.equals("default")) {
string = Resources.getSystem().getConfiguration().locale.getLanguage();
}
if (configuration.locale.getLanguage().equals(string)) {
if (Build.VERSION.SDK_INT < 28 || !zangiConfigurationService.getBoolean("CHANGE_APP_COLOR", false)) {
z = false;
} else {
zangiConfigurationService.putBoolean("CHANGE_APP_COLOR", false, true);
configuration.uiMode = (configuration.uiMode & (-49)) | (zangiConfigurationService.getInt("SYSTEM_COLOR_MODE", -1) != 32 ? 16 : 32);
createConfigurationContext(configuration);
z = true;
}
super/*androidx.appcompat.app.AppCompatActivity*/.onConfigurationChanged(configuration);
if (z) {
zangiConfigurationService.putBoolean("ACTIVITY_RECREATED", true, false);
recreate();
}
} else {
Locale locale = new Locale(string);
Resources resources = getResources();
DisplayMetrics displayMetrics = resources.getDisplayMetrics();
Configuration configuration2 = resources.getConfiguration();
configuration2.locale = locale;
configuration2.setLayoutDirection(locale);
resources.updateConfiguration(configuration2, displayMetrics);
super/*androidx.appcompat.app.AppCompatActivity*/.onConfigurationChanged(configuration2);
}
if (this.viewPager.getCurrentItem() != 0 || (screenTabSMS = (ScreenTabSMS) this.mTabsAdapter.getFragmentByTabPosition(0)) == null) {
return;
}
screenTabSMS.updateItems();
}
@Override
@SuppressLint({"RestrictedApi"})
protected void onCreate(Bundle bundle) {
int isGooglePlayServicesAvailable;
Locale locale;
ZangiConfigurationService zangiConfigurationService = ZangiConfigurationService.INSTANCE;
if (zangiConfigurationService.getBoolean(Constants.IS_LANGUAGE_CHANGE, false)) {
zangiConfigurationService.putBoolean(Constants.IS_LANGUAGE_CHANGE, false, true);
getScreenService().showFragment(ChooseLanguageFragment.class);
String string = zangiConfigurationService.getString(Constants.LANGUAGE_CODE, "default");
if (string.equals("default")) {
string = Resources.getSystem().getConfiguration().locale.getLanguage();
}
if (string.equals("br")) {
locale = new Locale("pt", "BR");
} else {
locale = string.equals("pt") ? new Locale(string, "PT") : new Locale(string);
}
Resources resources = getResources();
DisplayMetrics displayMetrics = resources.getDisplayMetrics();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
configuration.setLayoutDirection(locale);
resources.updateConfiguration(configuration, displayMetrics);
this.showFloatingBtn = false;
this.fromChooseLanguage = true;
} else {
this.fromChooseLanguage = false;
if (zangiConfigurationService.getBoolean("ACTIVITY_RECREATED", false)) {
zangiConfigurationService.putBoolean("ACTIVITY_RECREATED", false, false);
} else {
PassCodeController.INSTANCE.toWorkPassCode();
}
}
super.onCreate(bundle);
LoginManager loginManager = LoginManager.INSTANCE;
if (loginManager.getAutoLogin()) {
MainApplication.Companion.getGlobalExecutor().execute(new Runnable() {
@Override
public final void run() {
HomeActivity.lambda$onCreate$6();
}
});
}
int i = Build.VERSION.SDK_INT;
setContentView(2131558550);
this.appbarLayout = (AppBarLayout) findViewById(2131362883);
this.rootLayout = findViewById(l5.g.coordinator);
if (i >= 23) {
getWindow().setStatusBarColor(getColor(ColorsManger.status_bar_color));
} else {
getWindow().setStatusBarColor(getResources().getColor(ColorsManger.status_bar_color));
}
this.toolbar = findViewById(2131363848);
this.extendBarContainer = (RelativeLayout) findViewById(2131362268);
this.mFABButton = (FloatingActionButton) findViewById(2131362477);
FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(2131362603);
this.mFABButtonGroupCall = floatingActionButton;
floatingActionButton.setOnClickListener(this.fabGroupCallClickLisnener);
this.mFABButton.setOnClickListener(this.fabClickLisnener);
boolean z = this.showFloatingBtn && currentTabId != 3;
this.showFloatingBtn = z;
if (z) {
this.mFABButton.setVisibility(0);
}
this.returnToCall = findViewById(2131363456);
this.returnToCallContainer = findViewById(2131363457);
this.returnToCallTimerTextView = (TextView) findViewById(2131363455);
this.enabletNotification = findViewById(2131362459);
ProtectedAppHandler.Companion companion = ProtectedAppHandler.Companion;
if (companion.getInstance().getIsPopupRequired()) {
this.enabletNotification.setVisibility(0);
this.enabletNotification.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
HomeActivity.this.lambda$onCreate$7(view);
}
});
} else if (companion.getInstance().getIsPushNotificationEnabledRequeired()) {
this.enabletNotification.setVisibility(0);
this.enabletNotification.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
HomeActivity.this.lambda$onCreate$9(view);
}
});
}
this.returnToCallContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
HomeActivity.this.getScreenService().showCallScreen();
HomeActivity.this.returnToCall.setVisibility(8);
HomeActivity.this.returnToCallTimerTextView.setVisibility(8);
}
});
setSupportActionBar(this.toolbar);
getSupportActionBar().v(false);
getSupportActionBar().q(false);
getSupportActionBar().r(true);
setBarTitleByTab(0);
checkScreenWithIntent(getIntent());
checkCalling(getIntent());
setupTabsWithBadge();
notifyUnreadMessages();
showFreeMinutes();
if ((!loginManager.getAutoLogin() || zangiConfigurationService.getBoolean("IS_FROM_FIRST_LOGIN", false)) && Engine.getInstance().getScreenService().getArguments().getBoolean("com.beint.project.fromLogin", false)) {
this.viewPager.setCurrentItem(2);
if (i < 23 && (isGooglePlayServicesAvailable = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this)) != 0) {
GooglePlayServicesUtil.getErrorDialog(isGooglePlayServicesAvailable, this, 69).show();
}
}
if (getIntent() != null) {
SwitchScreenIfNeeded(getIntent());
}
if (getIntent() != null) {
missedCallChecker(getIntent());
}
setInstance(this);
companion.getInstance().showAutostartOption(this);
ProtectedAppHandlerKt.showXiaomiPermissionDialog(this);
Constants.KEYBOARD_HEIGHT_INT = zangiConfigurationService.getInt(Constants.KEYBOARD_HEIGHT, 0);
NotificationCenter notificationCenter = NotificationCenter.INSTANCE;
notificationCenter.addObserver(this, NotificationCenter.NotificationType.RECREATE_HOME_BY_DARK_LIGHT_MODE_CHANGE, new qb.l() {
public final Object invoke(Object obj) {
fb.r lambda$onCreate$10;
lambda$onCreate$10 = HomeActivity.this.lambda$onCreate$10(obj);
return lambda$onCreate$10;
}
});
notificationCenter.addObserver(this, NotificationCenter.NotificationType.CONVERSATION_BADGES_CHANGED, new qb.l() {
public final Object invoke(Object obj) {
fb.r lambda$onCreate$11;
lambda$onCreate$11 = HomeActivity.this.lambda$onCreate$11(obj);
return lambda$onCreate$11;
}
});
notificationCenter.addObserver(this, NotificationCenter.NotificationType.BECOME_FOREGROUND, new qb.l() {
public final Object invoke(Object obj) {
fb.r lambda$onCreate$12;
lambda$onCreate$12 = HomeActivity.this.lambda$onCreate$12(obj);
return lambda$onCreate$12;
}
});
notificationCenter.addObserver(this, NotificationCenter.NotificationType.UN_HIDE_CONTENT_HIDED_VIEW, new qb.l() {
public final Object invoke(Object obj) {
fb.r lambda$onCreate$13;
lambda$onCreate$13 = HomeActivity.this.lambda$onCreate$13(obj);
return lambda$onCreate$13;
}
});
notificationCenter.addObserver(this, NotificationCenter.NotificationType.ACTION_UI_EVENT, new qb.l() {
public final Object invoke(Object obj) {
fb.r lambda$onCreate$14;
lambda$onCreate$14 = HomeActivity.this.lambda$onCreate$14(obj);
return lambda$onCreate$14;
}
});
this.mTimeAndTimeZoneChangedReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action == null) {
return;
}
if (action.equals("android.intent.action.DATE_CHANGED")) {
DateTimeUtils.updateCalendars();
NotificationCenter.INSTANCE.postNotificationName(NotificationCenter.NotificationType.UPDATE_DATE_IN_CONVERSATION, (Object) null);
}
if (action.equals("android.intent.action.TIME_SET")) {
DateTimeUtils.updateCalendars();
String string2 = ZangiConfigurationService.INSTANCE.getString(Constants.LANGUAGE_CODE, "default");
if (string2.equals("default")) {
string2 = Resources.getSystem().getConfiguration().locale.getLanguage();
}
FastDataTimeUtils.INSTANCE.resetFastDate(new Locale(string2));
NotificationCenter.INSTANCE.postNotificationName(NotificationCenter.NotificationType.UPDATE_TIME_IN_CONVERSATION, (Object) null);
}
if (action.equals("android.intent.action.TIMEZONE_CHANGED")) {
DateTimeUtils.updateCalendars();
NotificationCenter.INSTANCE.postNotificationName(NotificationCenter.NotificationType.UPDATE_TME_ZONE, (Object) null);
}
}
};
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.TIME_SET");
intentFilter.addAction("android.intent.action.DATE_CHANGED");
intentFilter.addAction("android.intent.action.TIMEZONE_CHANGED");
registerReceiver(this.mTimeAndTimeZoneChangedReceiver, intentFilter);
createBadgeAndUpdateButtonIfHasNewVersion();
if (!PassCodeController.INSTANCE.checkNeedToAddHideContentView() || this.fromChooseLanguage) {
return;
}
((RelativeLayout) findViewById(2131362423)).addView(getHideContentView());
}
public boolean onCreateOptionsMenu(Menu menu) {
return super/*android.app.Activity*/.onCreateOptionsMenu(menu);
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.i(ConversationManager.INSTANCE.getTAG(), "onDestroy HomeActivity");
clearTimer();
ZangiConfigurationService.INSTANCE.putLong("TIMER_VALUE", startedTime, true);
unregisterReceiver(this.mTimeAndTimeZoneChangedReceiver);
NotificationCenter.INSTANCE.removeObserver(this);
setInstance(null);
}
@Override
public void onItemLongClicked(ExtendedBar extendedBar) {
if (extendedBar != null) {
this.extendBarContainer.setVisibility(0);
this.extendBarContainer.addView(extendedBar);
}
}
protected void onNewIntent(Intent intent) {
super/*androidx.fragment.app.FragmentActivity*/.onNewIntent(intent);
if (intent == null) {
return;
}
missedCallChecker(intent);
Log.i(TAG, "!!!!!onNewIntent=" + intent);
checkCalling(intent);
SwitchScreenIfNeeded(intent);
if (intent.getIntExtra("com.beint.project.TAB_POSITION_WITH_NOTIFICATION", -10) == 0) {
checkScreenWithIntent(intent);
scrollToChatScreen();
}
}
@Override
protected void onPause() {
super.onPause();
Engine.getInstance().getScreenService().getArguments().putInt("com.beint.project.CURRENT_TAB_POSITION", this.viewPager.getCurrentItem());
unRegisterBroadcastRecvs();
AVSession aVSession = this.avSession;
if (aVSession != null) {
aVSession.deleteObservers();
}
if (this.viewPager.getCurrentItem() == 1) {
BadgeManager.INSTANCE.setMissedCallsCount(0);
setMissedBadge();
}
}
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
super.onRequestPermissionsResult(i, strArr, iArr);
if (i == 145) {
boolean hasAllPermissionsGranted = hasAllPermissionsGranted(iArr);
if (this.bundle == null || !hasAllPermissionsGranted) {
return;
}
NotificationCenter.INSTANCE.postNotificationName(NotificationCenter.NotificationType.CONTACT_LIST_CHANGED, new Intent());
sendBroadcast(new Intent("com.beint.project.updateImageCache"));
checkBundle(this.bundle);
return;
}
if (i == 1006) {
NotificationCenter.INSTANCE.postNotificationName(NotificationCenter.NotificationType.CONTACT_LIST_CHANGED, new Intent());
sendBroadcast(new Intent("com.beint.project.updateImageCache"));
} else if (i == 1007 && iArr != null) {
CryptManager.INSTANCE.ressetIsStoragePermission();
}
}
@Override
protected void onResume() {
View view;
super.onResume();
setFABButtonByTab(currentTabId);
RegistrationService.INSTANCE.setOnBackground(false);
ZangiConfigurationService zangiConfigurationService = ZangiConfigurationService.INSTANCE;
long j = zangiConfigurationService.getLong("TIMER_VALUE", -1L);
startedTime = j;
if (j == -1) {
AVSession.Companion companion = AVSession.Companion;
if (companion.hasActiveSession() && companion.getActiveSession() != null) {
startedTime = companion.getActiveSession().getStartRelativeTime();
}
}
if (startedTime != -1) {
startTimer();
} else {
this.returnToCallTimerTextView.setText(2131887545);
}
AVSession.Companion companion2 = AVSession.Companion;
if (companion2.hasActiveSession() && (view = this.returnToCall) != null) {
view.setVisibility(0);
this.returnToCallTimerTextView.setVisibility(0);
AVSession activeSession = companion2.getActiveSession();
this.avSession = activeSession;
if (activeSession != null) {
activeSession.addObserver(this.avSessionObserver);
}
hideEnabletNotification();
return;
}
View view2 = this.returnToCall;
if (view2 != null && view2.getVisibility() == 0) {
this.returnToCall.setVisibility(8);
this.returnToCallTimerTextView.setVisibility(8);
clearTimer();
}
setMessagesBadge();
setMissedBadge();
int i = Engine.getInstance().getScreenService().getArguments().getInt("com.beint.project.CURRENT_TAB_POSITION", 0);
if (Constants.IS_CONTACTS_SEND_TO_SERVER) {
this.viewPager.setCurrentItem(i);
setBarTitleByTab(i);
} else if (!this.isLoaded) {
int loadTabPosition = loadTabPosition();
this.viewPager.setCurrentItem(loadTabPosition);
setBarTitleByTab(loadTabPosition);
}
initBroadcastRecvs();
registerBroadcastRecvs();
Log.i("TAG", "Screen Home Resume!!!!!");
if (zangiConfigurationService.getBoolean("FROM_CALL_ACTIVITY", false)) {
startActivity(new Intent((Context) this, (Class<?>) ScreenDialerActivity.class));
}
connectionStatusChanged(Boolean.valueOf(SignalingService.INSTANCE.isRegistered()));
if (ZangiPermissionUtils.hasPermission(this, 1017, true, new ZangiPermissionUtils.OnPermissionResult() {
public final void onResult(ArrayList arrayList, boolean z) {
HomeActivity.this.lambda$onResume$27(arrayList, z);
}
})) {
this.enabletNotification.setVisibility(8);
}
}
@Override
protected void onStart() {
initIab();
ConversationManager.INSTANCE.setHomeActivityIsStoped(false);
super.onStart();
}
@Override
protected void onStop() {
ConversationManager.INSTANCE.setHomeActivityIsStoped(true);
try {
if (!Constants.IS_CONTACTS_SEND_TO_SERVER) {
saveTabPosition(currentTabId);
}
destroyIab();
} catch (IabHelper.IabAsyncInProgressException e) {
e.printStackTrace();
}
super.onStop();
}
public boolean processKeyDown(int i, KeyEvent keyEvent) {
if (i == 4) {
if (backConversationView()) {
return true;
}
int currentItem = this.viewPager.getCurrentItem();
if (currentItem == 0) {
ScreenTabSMS screenTabSMS = (ScreenTabSMS) this.mTabsAdapter.getFragmentByTabPosition(0);
if (screenTabSMS.isAnySelectedItems()) {
screenTabSMS.clearSelects();
screenTabSMS.updateAdapter();
setVisibilityToolbar();
return true;
}
if (screenTabSMS.isSearchViewExpanded() && screenTabSMS.collapseSearchView()) {
return true;
}
} else if (currentItem == 1) {
ScreenTabRecent screenTabRecent = (ScreenTabRecent) this.mTabsAdapter.getFragmentByTabPosition(1);
if (screenTabRecent != null && screenTabRecent.isSearchViewExpanded() && screenTabRecent.collapseSearchView()) {
return true;
}
} else if (currentItem == 2) {
ScreenTabContacts screenTabContacts = (ScreenTabContacts) this.mTabsAdapter.getFragmentByTabPosition(2);
if (screenTabContacts != null) {
screenTabContacts.setPremiumItemInGroupCallVisibility(screenTabContacts.isShowNeedPremiumItem());
if (screenTabContacts.collapseSearchView() && screenTabContacts.isSearchViewExpanded()) {
return true;
}
}
} else if (currentItem == 3) {
}
}
return super.processKeyDown(i, keyEvent);
}
public void returnToCallSetVisibility() {
if (AVSession.Companion.getSize() <= 0) {
this.returnToCall.setVisibility(8);
this.returnToCallTimerTextView.setVisibility(8);
clearTimer();
} else {
if (this.enabletNotification.getVisibility() == 0) {
this.enabletNotification.setVisibility(8);
}
this.returnToCall.setVisibility(0);
this.returnToCallTimerTextView.setVisibility(0);
}
hideEnabletNotification();
}
public void scrollToChatScreen() {
expandToolbar();
ScrollingFABBehavior.hideShow(this.mFABButton, -1);
setBarTitleByTab(0);
setFABButtonByTab(0);
this.viewPager.setCurrentItem(0);
Engine.getInstance().getScreenService().getArguments().putInt("com.beint.project.CURRENT_TAB_POSITION", 0);
this.mFABButton.setImageResource(2131231423);
this.mFABButton.setVisibility(0);
ScreenTabSMS screenTabSMS = (ScreenTabSMS) this.mTabsAdapter.getFragmentByTabPosition(0);
if (screenTabSMS == null || !screenTabSMS.isAnySelectedItems()) {
return;
}
screenTabSMS.clearSelects();
setVisibilityToolbar();
}
public void scrollToContactScreen() {
setBarTitleByTab(2);
setFABButtonByTab(2);
this.viewPager.setCurrentItem(2);
Engine.getInstance().getScreenService().getArguments().putInt("com.beint.project.CURRENT_TAB_POSITION", 2);
}
public void setBarTitleByTab(int i) {
androidx.appcompat.app.a supportActionBar = getSupportActionBar();
this.actionBar = supportActionBar;
if (supportActionBar == null) {
return;
}
if (i == 0) {
this.title = getResources().getString(2131886717);
} else if (i == 1) {
this.title = getResources().getString(2131886718);
} else if (i == 2) {
this.title = getResources().getString(2131886716);
} else if (i != 3) {
this.title = getResources().getString(2131887550);
} else {
this.title = getResources().getString(2131886719);
}
ContactInfoFragmentView contactInfoFragmentView = (ContactInfoFragmentView) getSupportFragmentManager().j0(ContactInfoFragmentView.class.getCanonicalName());
if ((contactInfoFragmentView == null || !contactInfoFragmentView.isVisible()) && this.actionBar.f() != getResources().getString(2131887666)) {
this.toolbar.setTitle(this.title);
}
}
public void setFABButtonByTab(int i) {
if (i == 0) {
this.mFABButton.setImageResource(2131231423);
this.mFABButton.setVisibility(0);
this.mFABButtonGroupCall.setVisibility(8);
return;
}
if (i == 1) {
this.mFABButton.setImageResource(2131231399);
this.mFABButton.setVisibility(0);
this.mFABButtonGroupCall.setVisibility(0);
} else if (i == 2) {
this.mFABButton.setImageResource(2131231241);
this.mFABButton.setVisibility(0);
this.mFABButtonGroupCall.setVisibility(8);
} else if (i == 3) {
this.mFABButton.setVisibility(8);
this.mFABButtonGroupCall.setVisibility(8);
} else {
this.mFABButton.setImageResource(2131231423);
this.mFABButton.setVisibility(0);
this.mFABButtonGroupCall.setVisibility(8);
}
}
public void setVisibilityMenu(boolean z) {
this.extendBarContainer.setVisibility(0);
if (z) {
this.extendBarContainer.startAnimation(AnimationUtils.loadAnimation(this, 2130771983));
}
setStatusBarColor(ColorsManger.status_bar_gray_color);
}
public void setVisibilityToolbar() {
this.extendBarContainer.setVisibility(8);
this.toolbar.setVisibility(0);
AppBarLayout appBarLayout = this.appbarLayout;
if (appBarLayout != null) {
appBarLayout.setBackgroundColor(getResources().getColor(ColorsManger.app_main_color));
}
setStatusBarColor(ColorsManger.status_bar_color);
}
public void showFABButton() {
if (Engine.getInstance().getScreenService().getArguments().getInt("com.beint.project.CURRENT_TAB_POSITION", 0) == 3) {
this.mFABButton.setVisibility(8);
} else {
this.mFABButton.setVisibility(0);
}
}
public void showFreeMinutes() {
if (!LoginManager.INSTANCE.getAutoLogin() || ZangiConfigurationService.INSTANCE.getBoolean("IS_FROM_FIRST_LOGIN", false)) {
ZangiConfigurationService.INSTANCE.putBoolean("IS_FROM_FIRST_LOGIN", false, true);
}
}
}