CarrotChat v2.8.60.240131版本的 MD5 值为:2baf8b9f31830b86b5c5a85ae6b47e05
以下内容为反编译后的 MainActivity.java 源代码,内容仅作参考
package ak.im.ui.activity;
import ak.application.AKApplication;
import ak.event.FindBoxFailedEvent;
import ak.im.module.AKCDiscoverInstance;
import ak.im.module.AKSessionBean;
import ak.im.module.AKey;
import ak.im.module.AppAction;
import ak.im.module.ChatMessage;
import ak.im.module.EnterpriseInfo;
import ak.im.module.IMMessage;
import ak.im.module.OnlineSession;
import ak.im.module.Role;
import ak.im.module.ThirdAppInfo;
import ak.im.module.UpdateBean;
import ak.im.module.User;
import ak.im.modules.dlp.DLPManger;
import ak.im.sdk.manager.AKCDiscoverManager;
import ak.im.sdk.manager.AKeyManager;
import ak.im.sdk.manager.BadgeManager;
import ak.im.sdk.manager.DailyReportManager;
import ak.im.sdk.manager.IntentManager;
import ak.im.sdk.manager.MessageManager;
import ak.im.sdk.manager.SessionManager;
import ak.im.sdk.manager.SyncManager;
import ak.im.sdk.manager.UpdateManager;
import ak.im.sdk.manager.XMPPConnectionManager;
import ak.im.ui.activity.MainActivity;
import ak.im.ui.activity.settings.MessageNoticeSettingActivity;
import ak.im.ui.view.BadgeRadioButton.BadgeRadioButton;
import ak.im.ui.view.FloatActionButton;
import ak.im.ui.view.NonSwipeableViewPager;
import ak.im.ui.view.SlidingMenu;
import ak.im.ui.view.UpdateDialog;
import ak.im.uitls.AKCAppConfiguration;
import ak.im.utils.AkeyChatUtils;
import ak.im.utils.Log;
import ak.push.AKPushManager;
import ak.smack.AKLoginException;
import ak.view.AKeyDialog;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Process;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.viewpager.widget.ViewPager;
import cn.tee3.avd.RolePrivilege;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.asim.protobuf.Akeychat;
import com.github.ybq.android.spinkit.SpinKitView;
import com.kinggrid.iapppdf.droids.mupdf.codec.cosobject.PdfBoolean;
import com.meizu.cloud.pushsdk.notification.model.AdvanceSetting;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import kotlin.Pair;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.jivesoftware.smackx.xdatalayout.packet.DataLayout;
import org.pjsip.pjsua2.app.CallActivity;
import org.pjsip.pjsua2.app.VoIpManager;
@SuppressLint({"HandlerLeak"})
public class MainActivity extends OldActivity implements View.OnClickListener, ak.im.ui.view.m4.t {
public static WeakReference<MainActivity> g;
public static long h;
private TextView A;
private SpinKitView A0;
private TextView B;
private LinearLayout B0;
private TextView C;
private ImageView D;
private Context D0;
private View E;
private boolean E0;
private SlidingMenu F;
private View F0;
View G;
private TextView H;
private BadgeRadioButton H0;
private BadgeRadioButton I0;
private BadgeRadioButton J0;
private BadgeRadioButton K0;
private BadgeRadioButton L0;
private boolean O;
private ak.j.a<String> P;
private Intent Q;
private Intent R;
@Nullable
private ImageView j0;
private NonSwipeableViewPager k;
private ak.g.u k0;
private FloatActionButton l;
private AKeyDialog l0;
private TextView m;
private ImageView n;
private View o;
private View p;
private View p0;
private View q;
private TextView q0;
private View r;
private View r0;
private View s;
private View s0;
private View t;
private TextView t0;
private View u;
private TextView u0;
private TextView v;
private TextView w;
private LinearLayout w0;
private TextView x;
private boolean x0;
private TextView y;
private boolean y0;
private TextView z;
private TextView z0;
final String i = "reason";
final String j = "globalactions";
private ImageView I = null;
private PopupWindow J = null;
private View K = null;
private Handler L = new Handler();
private ListView M = null;
private List<OnlineSession> N = new ArrayList();
private LinearLayout S = null;
private LinearLayout T = null;
private ImageView U = null;
private ImageView V = null;
private TextView W = null;
private TextView X = null;
private TextView Y = null;
private TextView Z = null;
private LinearLayout f0 = null;
private TextView g0 = null;
private User h0 = null;
private String i0 = null;
private int m0 = 0;
private BroadcastReceiver n0 = new e();
private boolean o0 = false;
private UpdateDialog v0 = new UpdateDialog(getIBaseActivity());
private boolean C0 = false;
boolean G0 = true;
boolean M0 = true;
private int N0 = -1;
ak.im.listener.g O0 = new ak.im.listener.g() {
@Override
public final void onResult(int i2) {
MainActivity.this.M0(i2);
}
};
View.OnClickListener P0 = new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.O0(view);
}
};
public class a implements kotlin.jvm.b.l<String, String> {
final AKeyDialog a;
public class RunnableC0018a implements Runnable {
RunnableC0018a() {
}
@Override
public void run() {
a.this.a.show();
}
}
a(AKeyDialog aKeyDialog) {
this.a = aKeyDialog;
}
@Override
public String invoke(String str) {
if (!MainActivity.this.x0) {
MainActivity.this.w0.setVisibility(0);
}
if (!ak.im.sdk.manager.ye.getInstance().getMMKV().getBoolean("had_close_fcm_dialog_four", false)) {
ak.im.sdk.manager.ye.getInstance().getMMKV().putBoolean("had_close_fcm_dialog_four", true);
ak.im.sdk.manager.ye.getInstance().A1 = true;
this.a.setTip(MainActivity.this.getString(ak.im.b2.tips_for_fcm));
MainActivity.this.runOnUiThread(new RunnableC0018a());
}
return str;
}
}
public class b implements push.f {
final kotlin.jvm.b.l a;
final kotlin.jvm.b.l f1705b;
b(kotlin.jvm.b.l lVar, kotlin.jvm.b.l lVar2) {
this.a = lVar;
this.f1705b = lVar2;
}
@Override
public void onComplete(boolean z, String str) {
this.a.invoke(new Pair(Boolean.valueOf(z), str));
}
@Override
public void onFailed() {
this.f1705b.invoke("");
}
}
public class c extends ak.j.a<Pair<Boolean, JSONObject>> {
c() {
}
public void b(JSONObject jSONObject, View view) {
MainActivity.this.getIBaseActivity().dismissAlertDialog();
MainActivity.this.v(jSONObject, new ArrayList(jSONObject.keySet()), jSONObject.keySet().size() - 1);
}
public void d(View view) {
ak.im.sdk.manager.ye.getInstance().getMMKV().putString(ak.im.sdk.manager.ye.getInstance().transFormTableKey(), "");
MainActivity.this.getIBaseActivity().dismissAlertDialog();
}
@Override
public void onError(Throwable th) {
super.onError(th);
Log.e("MainActivity", "checkTransFormDialog failed ,e is " + th.getMessage());
AkeyChatUtils.logException(th);
ak.im.sdk.manager.ye.getInstance().getMMKV().putString(ak.im.sdk.manager.ye.getInstance().transFormTableKey(), "");
}
@Override
public void onNext(Pair<Boolean, JSONObject> pair) {
if (pair.getFirst().booleanValue()) {
final JSONObject second = pair.getSecond();
MainActivity.this.getIBaseActivity().showAlertDialog(MainActivity.this.getString(ak.im.b2.recovery_transform_hint), MainActivity.this.getString(ak.im.b2.continue_btn), MainActivity.this.getString(ak.im.b2.cancel), new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.c.this.b(second, view);
}
}, new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.c.this.d(view);
}
}, false);
return;
}
Log.i("MainActivity", "max transForm msgs is zero");
ak.im.sdk.manager.ye.getInstance().getMMKV().putString(ak.im.sdk.manager.ye.getInstance().transFormTableKey(), "");
}
}
public class d extends ak.j.a<Object[]> {
final int a;
final JSONObject f1707b;
final ArrayList f1708c;
public class a implements ak.im.uitls.newtransform.p {
a() {
}
public void b() {
MainActivity.this.getIBaseActivity().showToast(MainActivity.this.getString(ak.im.b2.transform_failed));
}
public void d() {
MainActivity.this.T1("transform-check");
MainActivity.this.getIBaseActivity().showToast(MainActivity.this.getString(ak.im.b2.new_transform_8));
}
@Override
public void onFailed() {
Log.debug("MainActivity", "lwxt onFailed");
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public final void run() {
MainActivity.d.a.this.b();
}
});
}
@Override
public void onSuccess() {
Log.debug("MainActivity", "lwxt onSuccess");
d dVar = d.this;
int i = dVar.a;
if (i > 0) {
MainActivity.this.v(dVar.f1707b, dVar.f1708c, i - 1);
} else {
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public final void run() {
MainActivity.d.a.this.d();
}
});
}
}
}
d(int i, JSONObject jSONObject, ArrayList arrayList) {
this.a = i;
this.f1707b = jSONObject;
this.f1708c = arrayList;
}
@Override
public void onError(Throwable th) {
Log.debug("MainActivity", "lwxt e is " + th.getMessage());
th.printStackTrace();
}
@Override
public void onNext(Object[] objArr) {
if (objArr == null || objArr.length <= 1) {
return;
}
List<ChatMessage> list = (List) objArr[0];
StringBuilder sb = new StringBuilder();
for (ChatMessage chatMessage : list) {
sb.append(chatMessage.getUniqueId() + "***" + chatMessage.getmSeqNO() + ",");
}
ArrayList<Object> arrayList = (ArrayList) objArr[1];
Log.debug("MainActivity", "lwxt oldtransForm msgs is " + sb.toString() + "***" + arrayList.size());
StringBuilder sb2 = new StringBuilder();
Iterator<ChatMessage> it = MessageManager.getInstance().getOldTransFormMsgs().iterator();
while (it.hasNext()) {
ChatMessage next = it.next();
sb2.append(next.getUniqueId() + "***" + next.getmSeqNO() + ",");
}
Log.debug("MainActivity", "lwxt newTransFormMsg msgs is " + sb2.toString());
try {
String str = (String) objArr[2];
if (str == null) {
str = "";
}
String str2 = str;
String[] split = str2.split("-");
MessageManager.getInstance().newTransform(MainActivity.this.getIBaseActivity(), list, new Object[]{MainActivity.this.getIntent().getType(), (Uri) MainActivity.this.getIntent().getParcelableExtra("android.intent.extra.STREAM"), MainActivity.this.getIntent()}, new a(), arrayList, split.length > 1 ? Boolean.parseBoolean(split[1]) : true, false, true, str2);
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
public class e extends BroadcastReceiver {
e() {
}
public void b(boolean z) {
if (z) {
MainActivity.this.getIBaseActivity().showToast(ak.im.b2.sec_mode_stop);
}
}
@Override
public void onReceive(Context context, Intent intent) {
String action = intent != null ? intent.getAction() : null;
Log.i("MainActivity", "BroadcastReceiver rcv :" + action);
if (!"android.intent.action.CLOSE_SYSTEM_DIALOGS".equals(action) && !"android.intent.action.SCREEN_OFF".equals(action)) {
if (!ak.im.p1.U.equals(action) && !ak.im.p1.A.equals(action)) {
if ("android.intent.action.SCREEN_ON".equals(action)) {
Log.i("MainActivity", "ACTION_SCREEN_ON");
return;
} else if (ak.im.g2.a.a.f399d.equals(action)) {
MainActivity.this.g2();
return;
} else if (ak.im.g2.a.a.f397b.equals(action)) {
MainActivity.this.f2(intent);
return;
} else {
return;
}
}
Log.i("MainActivity", "AKEY_STATUS_UPDATE:" + action);
MainActivity.this.U1();
MainActivity mainActivity = MainActivity.this;
if (mainActivity.G != null) {
if (mainActivity.K1()) {
MainActivity.this.R1();
return;
} else {
MainActivity.this.refreshMyInfoView();
return;
}
}
return;
}
String stringExtra = intent.getStringExtra("reason");
Log.i("MainActivity", "run in bg! " + stringExtra);
if (VoIpManager.getInstance().getmCurrentCall() == null && VoIpManager.getInstance().getCurrentThreeTeeCall() == null) {
if (ak.im.sdk.manager.nf.getInstance().getCurrentUserMeObject() != null && AKeyManager.getInstance().isBindABKey()) {
Log.i("MainActivity", "run in background,akey the type is abkey");
return;
} else if ("globalactions".equals(stringExtra)) {
Log.w("MainActivity", "SYSTEM_DIALOG_REASON_LONG_POWER_KEY");
return;
} else if (ak.im.sdk.manager.ye.getInstance().isSecurityAutoClose() && AKeyManager.isSecurity()) {
if (!ak.im.sdk.manager.ye.getInstance().isSupportPlainMode()) {
Log.w("MainActivity", "this ver do not support plain mode");
return;
} else {
new ak.im.task.f(context, new ak.worker.d0() {
@Override
public final void onResult(boolean z) {
MainActivity.e.this.b(z);
}
}, false).exec(new Void[0]);
return;
}
} else {
return;
}
}
Log.w("MainActivity", "there is a user is callling.");
}
}
public class f extends ak.j.a<ThirdAppInfo> {
boolean a;
f() {
}
@Override
public void onNext(ThirdAppInfo thirdAppInfo) {
Log.i("MainActivity", "check app info:" + thirdAppInfo);
if (!this.a) {
AkeyChatUtils.handleAKShareIntent(MainActivity.this.Q, MainActivity.this);
this.a = true;
return;
}
Log.w("MainActivity", "ignore this");
}
}
public class g extends ak.j.a<ArrayList<String>> {
final String a;
final String f1711b;
final String f1712c;
final int f1713d;
g(String str, String str2, String str3, int i) {
this.a = str;
this.f1711b = str2;
this.f1712c = str3;
this.f1713d = i;
}
@Override
public void onError(Throwable th) {
th.printStackTrace();
Log.i("MainActivity", "queryMCUMember failed,e is " + th.getMessage());
}
@Override
public void onNext(ArrayList<String> arrayList) {
if (arrayList.size() > 0) {
Log.i("MainActivity", "queryMCUMember is " + arrayList);
VoIpManager.getInstance().startCallActivity(this.a, this.f1711b, this.f1712c, this.f1713d);
return;
}
MainActivity mainActivity = MainActivity.this;
mainActivity.showToast(mainActivity.getString(ak.im.b2.voip_conf_gone));
Log.i("MainActivity", "queryMCUMember is empty");
}
}
class h extends ak.j.a<Long> {
h() {
}
@Override
public void onError(Throwable th) {
super.onError(th);
}
@Override
public void onNext(Long l) {
Log.d("lwx", "restart");
Intent launchIntentForPackage = MainActivity.this.D0.getPackageManager().getLaunchIntentForPackage(MainActivity.this.D0.getPackageName());
if (launchIntentForPackage != null) {
launchIntentForPackage.addFlags(RolePrivilege.privilege_room_updateroomstatus);
MainActivity.this.D0.startActivity(launchIntentForPackage);
} else {
Log.e("MainActivity", "restart failed");
}
BadgeManager.getSingleton().clearBadge(MainActivity.this.D0);
Process.killProcess(Process.myPid());
}
}
class i extends ak.j.a<String> {
i() {
}
@Override
public void onComplete() {
Log.i("MainActivity", "onCompleted");
MainActivity.this.O = false;
}
@Override
public void onError(Throwable th) {
th.printStackTrace();
MainActivity.this.O = false;
}
@Override
public void onNext(String str) {
Log.i("MainActivity", "onNext");
MainActivity.this.O = false;
if ("success".equals(str)) {
ak.im.utils.j4.sendEvent(ak.event.k7.newToastEvent(ak.im.b2.delete_success));
MainActivity.this.queryOnlineDesktopSessions();
return;
}
ak.im.utils.j4.sendEvent(ak.event.k7.newToastEvent(ak.im.b2.delete_failed));
}
}
public class j implements ViewPager.OnPageChangeListener {
final ArrayList a;
j(ArrayList arrayList) {
this.a = arrayList;
}
@Override
public void onPageScrollStateChanged(int i) {
}
@Override
public void onPageScrolled(int i, float f, int i2) {
}
@Override
public void onPageSelected(int i) {
if (this.a.size() <= i) {
Log.e("MainActivity", "out of bounds,index is " + i + ",size is " + this.a.size());
MainActivity.this.q0.setVisibility(8);
} else if ((this.a.get(i) instanceof kh0) || (this.a.get(i) instanceof eh0)) {
MainActivity.this.q0.setVisibility(0);
} else {
MainActivity.this.q0.setVisibility(8);
}
MainActivity.this.Z0(i);
}
}
public class k implements kotlin.jvm.b.l<Pair<Boolean, String>, String> {
final AKeyDialog a;
public class a implements Runnable {
a() {
}
@Override
public void run() {
k.this.a.show();
}
}
public class b implements Runnable {
b() {
}
@Override
public void run() {
k.this.a.show();
}
}
public class c implements Runnable {
c() {
}
@Override
public void run() {
k.this.a.show();
}
}
k(AKeyDialog aKeyDialog) {
this.a = aKeyDialog;
}
@Override
public String invoke(Pair<Boolean, String> pair) {
if (!pair.getFirst().booleanValue()) {
Log.i("MainActivity", "registerForGooglePush failed,reason is " + pair.getSecond());
if (!MainActivity.this.x0) {
MainActivity.this.w0.setVisibility(0);
}
if (!ak.im.sdk.manager.ye.getInstance().getMMKV().getBoolean("had_close_fcm_dialog_two", false)) {
ak.im.sdk.manager.ye.getInstance().A1 = true;
ak.im.sdk.manager.ye.getInstance().getMMKV().putBoolean("had_close_fcm_dialog_two", true);
this.a.setTip(MainActivity.this.getString(ak.im.b2.tips_for_fcm));
MainActivity.this.runOnUiThread(new a());
}
return "";
}
String second = pair.getSecond();
Log.i("MainActivity", "google register success ,token is " + second);
if (TextUtils.isEmpty(second)) {
if (!MainActivity.this.x0) {
MainActivity.this.w0.setVisibility(0);
}
if (!ak.im.sdk.manager.ye.getInstance().getMMKV().getBoolean("had_close_fcm_dialog_three", false)) {
ak.im.sdk.manager.ye.getInstance().getMMKV().putBoolean("had_close_fcm_dialog_three", true);
ak.im.sdk.manager.ye.getInstance().A1 = true;
this.a.setTip(MainActivity.this.getString(ak.im.b2.tips_for_fcm));
MainActivity.this.runOnUiThread(new c());
}
} else {
if (ak.im.sdk.manager.ye.getInstance().B1) {
MainActivity.this.z0.setText(MainActivity.this.getString(ak.im.b2.fire_base_tip_one));
if (!MainActivity.this.y0) {
ak.im.sdk.manager.ye.getInstance().A1 = true;
MainActivity.this.w0.setVisibility(0);
}
if (!ak.im.sdk.manager.ye.getInstance().getMMKV().getBoolean("had_close_fcm_dialog_one", false)) {
ak.im.sdk.manager.ye.getInstance().getMMKV().putBoolean("had_close_fcm_dialog_one", true);
ak.im.sdk.manager.ye.getInstance().A1 = true;
this.a.setTip(MainActivity.this.getString(ak.im.b2.tips_for_auto));
MainActivity.this.runOnUiThread(new b());
}
}
ak.im.sdk.manager.ye.getInstance().D1 = true;
ak.im.sdk.manager.ye.getInstance().getMMKV().putBoolean("is_fcm_push", true);
AKPushManager.a.getInstance().registerSuccess(second, "fcm");
if (Build.VERSION.SDK_INT >= 26) {
((NotificationManager) MainActivity.this.getSystemService(NotificationManager.class)).createNotificationChannel(new NotificationChannel(MainActivity.this.getString(ak.im.b2.fire_base_channel_id), "Google push", 4));
}
}
return "";
}
}
private void A() {
I1();
ViewGroup.LayoutParams layoutParams = this.F0.getLayoutParams();
int i2 = Build.VERSION.SDK_INT;
if (i2 >= 21) {
View decorView = getWindow().getDecorView();
int i3 = 1280;
if (i2 >= 23 && AKeyManager.isSecurity()) {
i3 = 9472;
}
decorView.setSystemUiVisibility(i3);
getWindow().setStatusBarColor(getResources().getColor(ak.im.t1.transparent_absolute));
layoutParams.height = ak.im.utils.p5.getStatusBarHeight(this);
} else {
layoutParams.height = 0;
}
this.F0.setLayoutParams(layoutParams);
}
private void B() {
this.n.setVisibility(4);
}
public void C0(View view) {
boolean handlePermissionDenied = AkeyChatUtils.handlePermissionDenied(getIBaseActivity(), getString(ak.im.b2.boxtalk_request_camera, new Object[]{AKApplication.getAppName()}), "android.permission.CAMERA", true);
if (AkeyChatUtils.judgeThePermission("android.permission.CAMERA")) {
AkeyChatUtils.startQRCodeScanActivity(getIBaseActivity(), "scan_from_main_activity");
w();
} else if (handlePermissionDenied) {
((com.uber.autodispose.v) getIBaseActivity().getRxPermissions().request("android.permission.CAMERA").as(bindAutoDispose())).subscribe(new io.reactivex.s0.g() {
@Override
public final void accept(Object obj) {
MainActivity.this.A0((Boolean) obj);
}
});
}
}
public void C1(int i2, View view) {
if (i2 == 28) {
ak.im.sdk.manager.ye.getInstance().deleteAccount(ak.im.sdk.manager.ye.getInstance().U0);
}
ak.worker.q1 q1Var = new ak.worker.q1((Activity) this, 8, false, true, true);
q1Var.setNeedRestart(true);
q1Var.start();
}
private void C() {
this.E.setVisibility(8);
}
private void D() {
if (ak.im.g2.c.a.isFlavor("jwmx")) {
F();
E();
}
}
public void E0(View view) {
this.D0.startActivity(new Intent(this, AddUserActivity.class));
w();
}
public void E1(DialogInterface dialogInterface) {
new ak.worker.q1((Activity) this, 8, false, true, true).start();
}
private void E() {
Intent intent = this.R;
if (intent != null) {
Z0(intent.getIntExtra("start_index_extra", 0));
int intExtra = this.R.getIntExtra(DataLayout.ELEMENT, 1);
if (intExtra == 2) {
Z0(0);
this.I0.setChecked(true);
} else if (intExtra == 3) {
Z0(2);
this.J0.setChecked(true);
}
this.K0.setBadgeNumber(this.R.getIntExtra("unreadmsg", 0));
}
}
private void F() {
findViewById(ak.im.w1.tab_layout_normal).setVisibility(8);
findViewById(ak.im.w1.layout_tab_jwmx).setVisibility(0);
BadgeRadioButton badgeRadioButton = (BadgeRadioButton) findViewById(ak.im.w1.top_rg_a);
this.H0 = badgeRadioButton;
badgeRadioButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.U(view);
}
});
BadgeRadioButton badgeRadioButton2 = (BadgeRadioButton) findViewById(ak.im.w1.xinyuan_tab_msg);
this.I0 = badgeRadioButton2;
badgeRadioButton2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.W(view);
}
});
BadgeRadioButton badgeRadioButton3 = (BadgeRadioButton) findViewById(ak.im.w1.xinyuan_tab_ct);
this.J0 = badgeRadioButton3;
badgeRadioButton3.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.Y(view);
}
});
BadgeRadioButton badgeRadioButton4 = (BadgeRadioButton) findViewById(ak.im.w1.top_rg_e);
this.K0 = badgeRadioButton4;
badgeRadioButton4.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.a0(view);
}
});
BadgeRadioButton badgeRadioButton5 = (BadgeRadioButton) findViewById(ak.im.w1.top_rg_f);
this.L0 = badgeRadioButton5;
badgeRadioButton5.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.c0(view);
}
});
}
public void G0(View view) {
AkeyChatUtils.prepareAVCall(this, null, true, false);
w();
}
public void G1(View view) {
ak.worker.q1 q1Var = new ak.worker.q1((Activity) this, 8, false, true, true);
q1Var.setNeedRestart(true);
q1Var.start();
}
private void G() {
View inflate = getLayoutInflater().inflate(ak.im.x1.more_popup_win_layout, (ViewGroup) null, false);
this.K = inflate;
ViewCompat.setElevation(inflate, 20.0f);
this.K.findViewById(ak.im.w1.group_chat).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.y0(view);
}
});
this.K.findViewById(ak.im.w1.scan).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.C0(view);
}
});
this.K.findViewById(ak.im.w1.add_friend).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.E0(view);
}
});
View findViewById = this.K.findViewById(ak.im.w1.video_call);
if (!VoIpManager.getInstance().isSupportVideoMcu()) {
findViewById.setVisibility(8);
}
findViewById.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.G0(view);
}
});
this.K.findViewById(ak.im.w1.akey_team).setVisibility(8);
this.K.findViewById(ak.im.w1.popu_line1).setVisibility(8);
this.K.findViewById(ak.im.w1.view_line_fourth);
Y1((LinearLayout) this.K.findViewById(ak.im.w1.ll_buy_enterprise), "https://buy.akey.me/app/top");
this.K.findViewById(ak.im.w1.root_view).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.I0(view);
}
});
}
private void H() {
getSharedPreferences("FlutterSharedPreferences", 0).edit().putString("flutter.axt_calculator_name", ak.im.sdk.manager.nf.getMyStrJid()).apply();
}
public void I0(View view) {
w();
}
public static int H1(Long l, Long l2) {
return (int) (l.longValue() - l2.longValue());
}
private boolean I() {
return ak.im.sdk.manager.ye.getInstance().isSupportDLP();
}
private void I1() {
if (this.F0 == null) {
this.F0 = findViewById(ak.im.w1.v_fake_status_bar);
}
}
public void K(View view) {
getIBaseActivity().dismissAlertDialog();
startActivity(new Intent(this, MessageNoticeSettingActivity.class));
}
public void K0(Long l) throws Exception {
User userMe;
if (AKeyManager.isSecurity() || (userMe = ak.im.sdk.manager.nf.getInstance().getUserMe()) == null || userMe.getPasscodeSwitch()) {
return;
}
this.l.setTag("auto");
this.l.performClick();
}
private void J1() {
if (getTabAdapter() != null && getTabAdapter().getFragmentList() != null) {
getTabAdapter().getFragmentList().clear();
}
NonSwipeableViewPager nonSwipeableViewPager = this.k;
if (nonSwipeableViewPager != null) {
nonSwipeableViewPager.clearOnPageChangeListeners();
}
List<Fragment> fragments = getSupportFragmentManager().getFragments();
if (fragments != null) {
for (Fragment fragment : fragments) {
Log.w("MainActivity", "we will remove old fragment:" + fragment);
getSupportFragmentManager().beginTransaction().remove(fragment);
}
Log.i("MainActivity", "this for check whether fragment count is 0");
return;
}
Log.w("MainActivity", "there is nothing old fragment");
}
public boolean K1() {
return true;
}
public void M(View view) {
getIBaseActivity().dismissAlertDialog();
}
public void M0(int i2) {
if (ak.im.sdk.manager.ye.getInstance().isSupportPlainMode()) {
if (i2 != 3) {
getIBaseActivity().showToast(getString(ak.im.b2.security_switch_fail_for_net_err));
} else {
handleIntentAction();
}
}
}
private void L1() {
PopupWindow popupWindow = this.J;
if (popupWindow == null) {
G();
PopupWindow popupWindow2 = new PopupWindow(this.K, -2, -2, true);
this.J = popupWindow2;
popupWindow2.setTouchable(true);
this.J.setOutsideTouchable(true);
this.J.setBackgroundDrawable(new BitmapDrawable(getResources()));
if (Build.VERSION.SDK_INT >= 21) {
this.J.setElevation(20.0f);
}
this.J.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public final void onDismiss() {
MainActivity.d1();
}
});
} else if (popupWindow.isShowing()) {
this.J.dismiss();
return;
}
Role roleByIdFromDam = ak.im.sdk.manager.jf.getInstance().getRoleByIdFromDam(ak.im.sdk.manager.nf.getInstance().getUserMe().getUser_role_id());
if (roleByIdFromDam == null) {
this.J.getContentView().findViewById(ak.im.w1.group_chat).setVisibility(0);
} else if (roleByIdFromDam.isAllow_create_group()) {
this.J.getContentView().findViewById(ak.im.w1.group_chat).setVisibility(0);
} else {
this.J.getContentView().findViewById(ak.im.w1.group_chat).setVisibility(8);
LinearLayout linearLayout = (LinearLayout) this.J.getContentView().findViewById(ak.im.w1.add_friend);
ViewGroup.LayoutParams layoutParams = linearLayout.getLayoutParams();
layoutParams.width = -2;
linearLayout.setLayoutParams(layoutParams);
}
this.J.showAtLocation(getWindow().getDecorView(), 8388661, 20, this.q0.getTop());
this.J.setAnimationStyle(0);
}
private void M1() {
User user = this.h0;
if (user != null) {
String akeyId = user.getAkeyId();
this.i0 = akeyId;
if (!TextUtils.isEmpty(akeyId)) {
if (this.i0.length() > 0) {
this.X.setText(this.i0);
return;
}
return;
}
this.X.setText(getString(ak.im.b2.asimid_not_set));
}
}
public static Pair N(String str) throws Exception {
JSONObject jSONObject;
Iterator<String> it;
JSONObject jSONObject2;
Iterator<String> it2;
int i2;
ChatMessage oneMessageByUniqueId;
JSONObject parseObject = JSON.parseObject(str);
ArrayList<String[]> arrayList = new ArrayList();
ArrayList<String[]> arrayList2 = new ArrayList();
Set<String> keySet = parseObject.keySet();
Iterator<String> it3 = keySet.iterator();
while (true) {
int i3 = 0;
if (!it3.hasNext()) {
break;
}
String next = it3.next();
JSONObject jSONObject3 = (JSONObject) parseObject.get(next);
Iterator<String> it4 = jSONObject3.keySet().iterator();
while (true) {
if (!it4.hasNext()) {
jSONObject = null;
break;
}
jSONObject = (JSONObject) jSONObject3.get(it4.next());
if (Integer.parseInt(((JSONArray) jSONObject.get("index")).getString(0)) == 0) {
break;
}
}
if (jSONObject != null) {
for (String str2 : jSONObject.keySet()) {
String string = ((JSONArray) jSONObject.get(str2)).getString(i3);
if (!TextUtils.isEmpty(string)) {
for (String str3 : jSONObject3.keySet()) {
JSONObject jSONObject4 = (JSONObject) jSONObject3.get(str3);
Iterator<String> it5 = jSONObject4.keySet().iterator();
while (it5.hasNext()) {
String next2 = it5.next();
if (!next2.equals("index")) {
if (next2.equals(string)) {
it = it3;
JSONArray jSONArray = (JSONArray) jSONObject4.get(next2);
jSONObject2 = jSONObject4;
boolean parseBoolean = Boolean.parseBoolean(jSONArray.getString(1));
boolean z = parseBoolean;
if (parseBoolean || (oneMessageByUniqueId = MessageManager.getInstance().getOneMessageByUniqueId(string)) == null || oneMessageByUniqueId.getmSeqNO() > 0) {
it2 = it5;
i2 = 3;
} else {
it2 = it5;
i2 = 3;
z = true;
}
String[] strArr = new String[i2];
strArr[0] = next;
strArr[1] = str3;
strArr[2] = next2;
arrayList.add(strArr);
if (z) {
arrayList2.add(new String[]{next, str3, str2, jSONArray.getString(0)});
}
} else {
it = it3;
jSONObject2 = jSONObject4;
it2 = it5;
}
jSONObject4 = jSONObject2;
it3 = it;
it5 = it2;
}
}
}
}
it3 = it3;
i3 = 0;
}
}
it3 = it3;
}
for (String[] strArr2 : arrayList) {
((JSONObject) ((JSONObject) parseObject.get(strArr2[0])).get(strArr2[1])).remove(strArr2[2]);
}
for (String[] strArr3 : arrayList2) {
((JSONArray) ((JSONObject) ((JSONObject) parseObject.get(strArr3[0])).get(strArr3[1])).get(strArr3[2])).set(0, strArr3[3]);
((JSONArray) ((JSONObject) ((JSONObject) parseObject.get(strArr3[0])).get(strArr3[1])).get(strArr3[2])).set(1, PdfBoolean.TRUE);
}
String jSONString = JSON.toJSONString(parseObject);
Log.i("MainActivity", "lwxt after all is " + jSONString);
MessageManager.getInstance().saveTransformTable(jSONString);
MessageManager.getInstance().setTransFormTable(parseObject);
boolean z2 = false;
for (String str4 : keySet) {
JSONObject jSONObject5 = (JSONObject) parseObject.get(str4);
for (String str5 : jSONObject5.keySet()) {
JSONObject jSONObject6 = (JSONObject) jSONObject5.get(str5);
for (String str6 : jSONObject6.keySet()) {
if (!str6.equals("index")) {
JSONArray jSONArray2 = (JSONArray) jSONObject6.get(str6);
String string2 = jSONArray2.getString(0);
if (!Boolean.parseBoolean(jSONArray2.getString(1))) {
ChatMessage oneMessageByUniqueId2 = MessageManager.getInstance().getOneMessageByUniqueId(string2);
if (!TextUtils.isEmpty(string2) && oneMessageByUniqueId2 != null) {
if (oneMessageByUniqueId2.getmSeqNO() <= 0) {
}
}
z2 = true;
break;
}
continue;
}
}
}
if (z2) {
break;
}
}
return new Pair(Boolean.valueOf(z2), parseObject);
}
public void O0(View view) {
String str;
User userMe = ak.im.sdk.manager.nf.getInstance().getUserMe();
if (userMe != null) {
str = userMe.getAkeyId();
} else {
Log.e("MainActivity", "click my AK id but me is null");
str = null;
}
if (str == null || str.length() <= 0) {
Intent intent = new Intent(this.D0, ModifyAsimIdActivity.class);
intent.putExtra("user_jid", ak.im.sdk.manager.nf.getInstance().getUserMe().getJID());
startActivityForResult(intent, 52);
}
}
private void N1() {
this.p0.setVisibility(8);
}
public Object[] P(int i2, Pair pair) throws Exception {
Iterator<String> it;
boolean z;
JSONObject jSONObject;
String str;
String str2;
String str3 = (String) pair.getFirst();
JSONObject jSONObject2 = (JSONObject) pair.getSecond();
Log.i("MainActivity", "lwxt index:" + i2 + "," + jSONObject2.toJSONString() + ",task name is " + str3);
HashMap hashMap = new HashMap();
ArrayList arrayList = new ArrayList();
HashMap<Long, ChatMessage> hashMap2 = new HashMap<>();
ArrayList<ChatMessage> oldTransFormMsgs = MessageManager.getInstance().getOldTransFormMsgs();
ArrayList arrayList2 = new ArrayList();
oldTransFormMsgs.clear();
boolean containsKey = jSONObject2.containsKey(ak.im.sdk.manager.ye.getInstance().getUsername());
Iterator<String> it2 = jSONObject2.keySet().iterator();
while (it2.hasNext()) {
String next = it2.next();
Log.debug("MainActivity", "lwxt for name is " + next);
JSONObject jSONObject3 = (JSONObject) jSONObject2.get(next);
boolean equals = ak.im.sdk.manager.ye.getInstance().getUsername().equals(next);
String str4 = "index";
Integer valueOf = Integer.valueOf(((JSONArray) jSONObject3.get("index")).getString(0));
JSONObject jSONObject4 = jSONObject2;
boolean z2 = valueOf.intValue() == containsKey;
StringBuilder sb = new StringBuilder();
Iterator<String> it3 = it2;
sb.append("lwxt firstOne:");
sb.append(z2);
sb.append(",index:");
sb.append(valueOf);
sb.append(",isMiyun ");
sb.append(equals);
sb.append(",contains miyun:");
sb.append(containsKey);
Log.debug("MainActivity", sb.toString());
Iterator<String> it4 = jSONObject3.keySet().iterator();
boolean z3 = false;
while (it4.hasNext()) {
String next2 = it4.next();
if (next2.equals(str4)) {
str2 = str3;
it = it4;
z = containsKey;
} else {
it = it4;
z = containsKey;
String string = ((JSONArray) jSONObject3.get(next2)).getString(0);
ChatMessage oneMessageByUniqueId = MessageManager.getInstance().getOneMessageByUniqueId(next2);
if (oneMessageByUniqueId == null) {
str2 = str3;
} else {
jSONObject = jSONObject3;
ChatMessage oneMessageByUniqueId2 = MessageManager.getInstance().getOneMessageByUniqueId(string);
str = str4;
StringBuilder sb2 = new StringBuilder();
str2 = str3;
sb2.append("lwxt old ");
sb2.append(next2);
sb2.append(",new ");
sb2.append(string);
sb2.append(",oldmsg ");
sb2.append(Long.valueOf(oneMessageByUniqueId.getmSeqNO()));
sb2.append("new ");
sb2.append(oneMessageByUniqueId2 == null ? "null" : Long.valueOf(oneMessageByUniqueId2.getmSeqNO()));
Log.debug("MainActivity", sb2.toString());
if (valueOf.intValue() == 0) {
arrayList2.add(oneMessageByUniqueId);
}
if (oneMessageByUniqueId2 == null || oneMessageByUniqueId2.getmSeqNO() <= 0) {
if (oneMessageByUniqueId2 != null) {
MessageManager.getInstance().delMessageByUniqueId(string);
z3 = true;
}
if (oneMessageByUniqueId2 == null) {
z3 = true;
}
if (z2) {
hashMap2.put(Long.valueOf(oneMessageByUniqueId.getmSeqNO()), oneMessageByUniqueId);
}
} else if (z2) {
hashMap2.put(Long.valueOf(oneMessageByUniqueId.getmSeqNO()), oneMessageByUniqueId2);
}
containsKey = z;
it4 = it;
jSONObject3 = jSONObject;
str4 = str;
str3 = str2;
}
}
jSONObject = jSONObject3;
str = str4;
containsKey = z;
it4 = it;
jSONObject3 = jSONObject;
str4 = str;
str3 = str2;
}
String str5 = str3;
boolean z4 = containsKey;
Log.i("MainActivity", "lwxt needTransform " + z3);
User userMe = ak.im.sdk.manager.nf.getInstance().getUserMe();
if (userMe.getName().equals(next)) {
hashMap.put(valueOf, userMe);
} else if (ak.im.sdk.manager.nf.getInstance().getContacterByUserName(next) != null) {
hashMap.put(valueOf, ak.im.sdk.manager.nf.getInstance().getContacterByUserName(next));
} else if (ak.im.sdk.manager.df.getInstance().getGroupBySimpleName(next) != null) {
hashMap.put(valueOf, ak.im.sdk.manager.df.getInstance().getGroupBySimpleName(next));
} else {
Log.i("MainActivity", "cant find the name " + next);
}
jSONObject2 = jSONObject4;
it2 = it3;
containsKey = z4;
str3 = str5;
}
String str6 = str3;
d2(hashMap2, oldTransFormMsgs);
for (int i3 = 0; i3 < hashMap.keySet().size(); i3++) {
arrayList.add(hashMap.get(Integer.valueOf(i3)));
}
if (arrayList2.size() <= 0 || arrayList.size() <= 0) {
Log.debug("MainActivity", "lwxt some error " + arrayList2.size() + ",peers size :" + arrayList.size());
return new Object[1];
}
return new Object[]{arrayList2, arrayList, str6};
}
private void O1() {
I1();
if (AKeyManager.isSecurity()) {
this.F0.setBackgroundColor(getResources().getColor(ak.im.t1.sec_title_unpress));
} else {
this.F0.setBackgroundColor(getResources().getColor(ak.im.t1.unsec_title_unpress));
}
A();
}
public void Q0(int i2) {
if (i2 == 1) {
getIBaseActivity().showToast(getString(ak.im.b2.setup_passcode_failed));
} else if (i2 == 2) {
getIBaseActivity().showToast(getString(ak.im.b2.security_switch_fail_for_net_err));
} else if (i2 != 3) {
} else {
handleIntentAction();
getIBaseActivity().showToast(getString(ak.im.b2.sec_mode_running));
}
}
private void P1(Role role) {
if (role != null) {
if (role.isAllow_group_send()) {
this.r0.setVisibility(0);
} else {
this.r0.setVisibility(8);
}
}
}
public static void Q(String str, io.reactivex.b0 b0Var) throws Exception {
b0Var.onNext(ak.im.sdk.manager.hf.getInstance().deleteDesktopSessions(str));
b0Var.onComplete();
}
private void Q1() {
if (!ak.im.sdk.manager.ye.getInstance().isMasterDevice()) {
this.T.setVisibility(8);
AKApplication.finishDeviceActivity();
return;
}
this.T.setVisibility(0);
}
public void S() {
PopupWindow popupWindow = this.J;
if (popupWindow != null) {
popupWindow.dismiss();
}
}
public void S0(View view) {
AkeyChatUtils.startSearchActivity(this, "global_search", false);
}
public void R1() {
if (!K1()) {
refreshMyInfoView();
return;
}
ih0 mineFragment = getMineFragment();
if (mineFragment != null) {
mineFragment.refreshMyInfoView();
}
}
private void S1() {
Object tag = this.u0.getTag(ak.im.w1.mine_pop_one);
Object tag2 = this.u0.getTag(ak.im.w1.mine_pop_two);
Object tag3 = this.u0.getTag(ak.im.w1.mine_pop_three);
this.u0.setVisibility((tag != null && ((Boolean) tag).booleanValue()) || ((tag2 != null && ((Boolean) tag2).booleanValue()) || (tag3 != null && ((Boolean) tag3).booleanValue())) ? 0 : 8);
this.u0.setText("");
}
public void U(View view) {
if (!ak.im.g2.a.b.hiBoardInstalled()) {
showToast(getString(ak.im.b2.jwmx_not_installed));
return;
}
Intent intent = new Intent(ak.im.g2.a.a.g);
intent.putExtra("jumpType", "home");
intent.putExtra("unreadmsg", this.m0);
startActivity(intent);
}
public void U0(ak.im.sdk.manager.ye yeVar, Long l) throws Exception {
if (!BadgeManager.MANUFACTURER_OF_HARDWARE_HUAWEI.equals(AKApplication.getPushType())) {
Log.i("MainActivity", "start get fcm token");
registerForGooglePush();
}
try {
yeVar.downLoadSeaweedLogin();
} catch (Exception e2) {
Log.i("MainActivity", "downLoadSeaweedLogin failed ,reason is " + e2.getMessage());
e2.printStackTrace();
}
}
public void T1(String str) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.prepareSessionData(str);
return;
}
Log.w("MainActivity", "sf is null:" + str);
}
public void W(View view) {
Z0(0);
}
public void W0(UpdateBean updateBean) {
if (updateBean != null && updateBean.getUpgrade() != 0) {
this.C0 = true;
this.u0.setTag(ak.im.w1.mine_pop_one, Boolean.TRUE);
UpdateManager.a aVar = UpdateManager.a;
if (!aVar.getInstance().getHasShownAuto()) {
this.v0.init();
aVar.getInstance().setHasShownAuto(true);
}
} else {
this.u0.setTag(ak.im.w1.mine_pop_one, Boolean.FALSE);
}
S1();
}
private void V1() {
this.B.setText(ak.im.sdk.manager.ye.getInstance().getWorkspaceName(this));
}
private void W1() {
if (this.o0) {
return;
}
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.CLOSE_SYSTEM_DIALOGS");
intentFilter.addAction("android.intent.action.SCREEN_OFF");
intentFilter.addAction(ak.im.p1.U);
intentFilter.addAction(ak.im.p1.A);
intentFilter.addAction("android.intent.action.SCREEN_ON");
intentFilter.addAction(ak.im.g2.a.a.f399d);
intentFilter.addAction(ak.im.g2.a.a.f397b);
intentFilter.setPriority(Integer.MAX_VALUE);
registerReceiver(this.n0, intentFilter);
this.o0 = true;
}
public void Y(View view) {
Z0(2);
}
public void Y0(ak.event.l1 l1Var, View view) {
ak.im.sdk.manager.ye.getInstance().setAndSaveServerInfo(l1Var.getS());
new ak.worker.q1((Activity) this, 8, false, true, true).start();
}
public void a1(int i2) {
this.k.setCurrentItem(i2, false);
doChange(this.N0, i2);
this.N0 = i2;
}
private void Y1(View view, final String str) {
((com.uber.autodispose.v) b.g.a.b.e.clicks(view).throttleFirst(2L, TimeUnit.SECONDS).as(bindAutoDispose())).subscribe(new io.reactivex.s0.g() {
@Override
public final void accept(Object obj) {
MainActivity.this.m1(str, obj);
}
});
}
public void a0(View view) {
if (!ak.im.g2.a.b.hiBoardInstalled()) {
showToast(getString(ak.im.b2.jwmx_not_installed));
return;
}
Intent intent = new Intent(ak.im.g2.a.a.g);
intent.putExtra("jumpType", "dynamic");
intent.putExtra("unreadmsg", this.m0);
startActivity(intent);
}
private void Z1(TextView textView) {
for (TextView textView2 : new ArrayList(Arrays.asList(K1() ? new TextView[]{this.v, this.w, this.x, this.z, this.A, this.B, this.C, this.t0} : new TextView[]{this.v, this.w, this.x, this.z, this.A, this.B, this.C}))) {
if (textView2 == textView) {
textView.setSelected(true);
} else {
textView2.setSelected(false);
}
}
}
private void a2(boolean z) {
ImageView imageView = this.j0;
if (imageView != null) {
DLPManger.setUserDLPIcon(imageView, z);
}
}
public void c0(View view) {
if (!ak.im.g2.a.b.hiBoardInstalled()) {
showToast(getString(ak.im.b2.jwmx_not_installed));
return;
}
Intent intent = new Intent(ak.im.g2.a.a.g);
intent.putExtra("jumpType", "mine");
intent.putExtra("unreadmsg", this.m0);
startActivity(intent);
}
public void c1(boolean z) {
if (z) {
getIBaseActivity().showToast(ak.im.b2.sec_mode_stop);
}
}
private void b2() {
this.E.setVisibility(0);
}
private void c2(int i2) {
this.u0.setTag(ak.im.w1.mine_pop_two, Boolean.TRUE);
S1();
this.u0.setText(String.valueOf(i2));
}
public void e0(View view) {
kh0 sessionFragment = getSessionFragment();
int currentItem = this.k.getCurrentItem();
ak.im.ui.view.y3 tabAdapter = getTabAdapter();
if (tabAdapter != null) {
int indexOf = tabAdapter.getFragmentList().indexOf(sessionFragment);
if (sessionFragment == null || indexOf != currentItem) {
return;
}
sessionFragment.scrollToFirstUnRead();
}
}
public static void d1() {
}
private void d2(HashMap<Long, ChatMessage> hashMap, List<ChatMessage> list) {
Log.debug("MainActivity", "lwxt keyset " + hashMap.keySet().size());
ArrayList arrayList = new ArrayList(hashMap.keySet());
Log.debug("MainActivity", "lwxt longs " + arrayList.size());
Collections.sort(arrayList, new Comparator() {
@Override
public final int compare(Object obj, Object obj2) {
return MainActivity.H1((Long) obj, (Long) obj2);
}
});
for (int i2 = 0; i2 < arrayList.size(); i2++) {
Log.debug("MainActivity", "lwxt old seq " + arrayList.get(i2) + ",uniq:" + hashMap.get(arrayList.get(i2)).getUniqueId() + ",seq " + hashMap.get(arrayList.get(i2)).getmSeqNO());
list.add(hashMap.get(arrayList.get(i2)));
}
}
public void f1(EnterpriseInfo enterpriseInfo, View view) {
String str;
if (ak.im.g2.c.a.isFlavor("boxtalk")) {
str = ak.im.sdk.manager.ye.getInstance().getDiscoveryId();
} else {
str = enterpriseInfo.discoverServerIP;
}
Log.i("testname", "name is " + str);
AkeyChatUtils.startQRCodeActivity(this, "server", str, null);
}
private void e2() {
if (this.o0) {
unregisterReceiver(this.n0);
this.o0 = false;
}
}
public void g0(View view) {
L1();
}
public void f2(Intent intent) {
int intExtra = intent.getIntExtra("fc_unreadmsg", 0);
Log.i("MainActivity", "jwmx updateJWMXTimeLine unRead " + intExtra);
this.K0.setBadgeNumber(intExtra);
}
public void h1(View view) {
Intent intent = new Intent();
intent.setClass(this.D0, InviteCodeActivity.class);
startActivity(intent);
}
public void g2() {
BadgeRadioButton badgeRadioButton = this.I0;
if (badgeRadioButton != null) {
badgeRadioButton.setBadgeNumber(this.m0);
}
Intent intent = new Intent(ak.im.g2.a.a.f398c);
intent.putExtra("unreadmsg", this.m0);
sendBroadcast(intent);
Log.i("MainActivity", "jwmx updateJWMXUnReadMessages unreadMsgNum " + this.m0);
}
public void i0(View view) {
AkeyChatUtils.startSearchActivity(this, "global_search", false);
}
@SuppressLint({"CheckResult"})
private void initView() {
if (!AKApplication.isAppHadLogin()) {
Log.w("MainActivity", "is not login do not here");
return;
}
long currentTimeMillis = System.currentTimeMillis();
this.k0 = new ak.presenter.impl.a7(this);
initLoginSuccessView();
AKeyManager.showSecModeSwitch(this.l);
AKeyManager.getInstance().noWorkAKeySendScanMessage();
boolean isSecurityAutoClose = ak.im.sdk.manager.ye.getInstance().isSecurityAutoClose();
boolean isSecurity = AKeyManager.isSecurity();
boolean isAppHadLogin = AKApplication.isAppHadLogin();
Log.i("MainActivity", "check flag value,is-auto-close:" + isSecurityAutoClose + ",is-security-mode:" + isSecurity + ",is login :" + isAppHadLogin);
if (this.l != null && !isSecurity && !isSecurityAutoClose && isAppHadLogin && AKApplication.isFirstLogin()) {
io.reactivex.z.timer(300L, TimeUnit.MILLISECONDS, io.reactivex.w0.a.io()).observeOn(io.reactivex.q0.c.a.mainThread()).subscribe(new io.reactivex.s0.g() {
@Override
public final void accept(Object obj) {
MainActivity.this.K0((Long) obj);
}
});
}
Log.i("MainActivity", "enter main inter face,time diff:" + (System.currentTimeMillis() - h));
User userMe = ak.im.sdk.manager.nf.getInstance().getUserMe();
if (userMe != null && userMe.getPasscodeSwitch()) {
AKeyManager.getInstance().startNowLock();
}
D();
Log.i("MainActivity", "check init view time diff:" + (System.currentTimeMillis() - currentTimeMillis));
}
public void k0(View view) {
SlidingMenu slidingMenu = this.F;
if (slidingMenu != null) {
slidingMenu.toggle(true);
} else {
Log.w("MainActivity", "menu is null");
}
}
public void k1(AKeyDialog aKeyDialog, View view) {
y();
aKeyDialog.dismiss();
}
public boolean m0(View view) {
int i2;
ak.im.ui.view.y3 tabAdapter = getTabAdapter();
if (tabAdapter == null || (i2 = this.N0) < 0 || i2 >= tabAdapter.getCount()) {
return true;
}
Fragment item = tabAdapter.getItem(this.N0);
if (item instanceof kh0) {
((kh0) item).scrollToHead();
return true;
} else if (item instanceof ak.im.i2.a.u0) {
((ak.im.i2.a.u0) item).scrollToHead();
return true;
} else if (item instanceof eh0) {
((eh0) item).scrollToHead();
return true;
} else {
return true;
}
}
public void m1(String str, Object obj) throws Exception {
AkeyChatUtils.startWebActivity(str, this);
}
public boolean o0(View view) {
AkeyChatUtils.logNormalAppAction(AKeyManager.isSecurity(), "", AppAction.APP_ACTION_62, "long", 0L);
getIBaseActivity().openOrCloseSecMode(this.O0);
return true;
}
public void o1(View view) {
AkeyChatUtils.gotoPhoneSetting();
getIBaseActivity().dismissAlertDialog();
}
public void q0(View view) {
Object tag = this.l.getTag();
if (!(tag != null && "auto".equals((String) tag))) {
AkeyChatUtils.logNormalAppAction(AKeyManager.isSecurity(), "", AppAction.APP_ACTION_62, TypedValues.Custom.S_FLOAT, 0L);
} else {
this.l.setTag("");
}
getIBaseActivity().openOrCloseSecMode(this.O0);
}
public void q1(View view) {
getIBaseActivity().dismissAlertDialog();
}
@SuppressLint({"ClickableViewAccessibility"})
private void r() {
J1();
ArrayList arrayList = new ArrayList();
Log.debug("MainActivity", "new list " + arrayList.hashCode());
arrayList.add(ch0.newInstance(kh0.class.getSimpleName()));
arrayList.add(new eh0());
if (ak.im.sdk.manager.ye.getInstance().isSupportNews()) {
arrayList.add(new ak.im.i2.a.u0());
this.s.setVisibility(0);
} else {
this.s.setVisibility(8);
}
if (K1()) {
arrayList.add(new ih0());
}
if (ak.im.sdk.manager.ye.getInstance().isWorkspaceOpen()) {
arrayList.add(2, new ak.im.i2.a.z0());
V1();
ViewGroup viewGroup = (ViewGroup) findViewById(ak.im.w1.main_navigator_bottom_bar);
this.u.setVisibility(0);
} else {
this.u.setVisibility(8);
}
NonSwipeableViewPager nonSwipeableViewPager = (NonSwipeableViewPager) findViewById(ak.im.w1.fragment_container);
this.k = nonSwipeableViewPager;
nonSwipeableViewPager.setOffscreenPageLimit(10);
this.k.setSwipe(false);
ak.im.ui.view.y3 y3Var = new ak.im.ui.view.y3(getSupportFragmentManager(), arrayList);
this.k.setAdapter(y3Var);
this.k.addOnPageChangeListener(new j(arrayList));
if (y3Var.getCount() > 0) {
Z0(0);
}
}
public void s0(View view) {
if (getString(ak.im.b2.fire_base_tips).equals(this.z0.getText().toString())) {
ak.im.sdk.manager.ye.getInstance().getMMKV().putBoolean("had_close_fcm_tips", true);
} else {
ak.im.sdk.manager.ye.getInstance().getMMKV().putBoolean("had_close_auto_tips", true);
}
this.w0.setVisibility(8);
}
public void s1(View view) {
ak.im.utils.j4.sendEvent(new ak.event.f0("restart-check-login-for-XMPP_CERTIFY_ERROR"));
getIBaseActivity().dismissAlertDialog();
}
private void s() {
}
public static void startFragment(Activity activity, int i2) {
Intent intent = new Intent(activity, MainActivity.class);
intent.putExtra("start_index_extra", i2);
activity.startActivity(intent);
}
private void t() {
if (ak.im.sdk.manager.ye.getInstance().supportNormalFeedback()) {
AKSessionBean aKSessionBean = SessionManager.getInstance().getFeedbackSessionMap().get(ak.im.sdk.manager.nf.getInstance().loadFeedBackUser().getJID());
if (aKSessionBean != null && aKSessionBean.getUnread() > 0) {
this.u0.setTag(ak.im.w1.mine_pop_three, Boolean.TRUE);
} else {
this.u0.setTag(ak.im.w1.mine_pop_three, Boolean.FALSE);
}
S1();
if (getMineFragment() != null) {
getMineFragment().refreshFeedbackUi();
}
}
}
public void u0(View view) {
y();
}
public void u1(View view) {
getIBaseActivity().dismissAlertDialog();
}
private void u() {
if (getIBaseActivity().isAllowSendNotification()) {
return;
}
long rightTime = ak.im.utils.f4.getRightTime();
if (ak.im.utils.f4.isTheSameDay(rightTime, ak.im.sdk.manager.ye.getInstance().getMMKV().getLong("checkNotificationPermission_time", 0L))) {
return;
}
ak.im.sdk.manager.ye.getInstance().getMMKV().putLong("checkNotificationPermission_time", rightTime);
getIBaseActivity().showAlertDialog(getString(ak.im.b2.check_notify_hint), getString(ak.im.b2.go_setting), getString(ak.im.b2.cancel), new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.K(view);
}
}, new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.M(view);
}
});
}
public void v(JSONObject jSONObject, ArrayList<String> arrayList, final int i2) {
String str;
Exception e2;
JSONObject jSONObject2;
String str2 = "";
try {
str = arrayList.get(i2);
} catch (Exception e3) {
str = "";
e2 = e3;
}
try {
jSONObject2 = (JSONObject) jSONObject.get(arrayList.get(i2));
} catch (Exception e4) {
e2 = e4;
e2.printStackTrace();
jSONObject2 = null;
str2 = ",error is " + e2.getMessage();
Log.i("MainActivity", "lwxt dealSingleRecoveryTransformTask start" + str2);
if (jSONObject2 == null) {
}
}
Log.i("MainActivity", "lwxt dealSingleRecoveryTransformTask start" + str2);
if (jSONObject2 == null) {
io.reactivex.z.just(new Pair(str, jSONObject2)).map(new io.reactivex.s0.o() {
@Override
public final Object apply(Object obj) {
return MainActivity.this.P(i2, (Pair) obj);
}
}).subscribeOn(io.reactivex.w0.a.io()).observeOn(io.reactivex.q0.c.a.mainThread()).subscribe(new d(i2, jSONObject, arrayList));
}
}
public void w0(View view) {
startActivity(new Intent(this, FortuneDetailActivity.class));
}
public void w1(View view) {
ak.im.sdk.manager.ye.getInstance().j2 = true;
ak.im.utils.j4.sendEvent(new ak.event.f0("restart-check-login-for-log-out"));
getIBaseActivity().dismissAlertDialog();
}
private void w() {
this.L.postDelayed(new Runnable() {
@Override
public final void run() {
MainActivity.this.S();
}
}, 200L);
}
private void x() {
this.u0.setTag(ak.im.w1.mine_pop_two, Boolean.FALSE);
S1();
}
public void y0(View view) {
Intent intent = new Intent();
intent.setClass(this.D0, UserListActivity.class);
intent.putExtra("purpose", "create_group");
intent.putExtra("select_a_group_from_more", true);
startActivity(intent);
w();
}
public void y1(View view) {
getIBaseActivity().dismissAlertDialog();
ak.worker.q1 q1Var = new ak.worker.q1((Activity) this, 8, false, false, true);
q1Var.setNeedRestart(true);
q1Var.start();
}
private void y() {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse("zh-CN".equals(ak.im.sdk.manager.ye.getInstance().getLanguage()) ? "https://pub.akeydown.com/fcm-guide/cn/fcm-guide-cn.html" : "https://pub.akeydown.com/fcm-guide/en/fcm-guide-en.html"));
startActivity(intent);
}
private void z(Intent intent) {
if (intent != null) {
Log.i("MainActivity", "handle other intent:" + intent);
AkeyChatUtils.handleOutsideIntent(intent, this);
return;
}
Log.i("MainActivity", "outside action is null");
}
public void A0(Boolean bool) throws Exception {
if (bool.booleanValue()) {
AkeyChatUtils.startQRCodeScanActivity(getIBaseActivity(), "scan_from_main_activity");
w();
return;
}
ak.im.sdk.manager.ye.getInstance().getMMKV().putBoolean("android.permission.CAMERA", false);
}
public void A1(DialogInterface dialogInterface) {
new ak.worker.q1((Activity) this, 8, false, true, true).start();
}
protected void U1() {
if (this.m == null) {
Log.w("MainActivity", "view is empty--search");
return;
}
boolean isSecurity = AKeyManager.isSecurity();
if (AKey.STATUS_DETACHED.equals(AKeyManager.getInstance().getAKeyStatus())) {
this.l.setVisibility(8);
} else {
if (AKeyManager.getInstance().getWorkingAKey() == null) {
Log.w("MainActivity", "working key is null");
this.l.setVisibility(8);
} else if (isSecurity) {
this.l.setBackgroundResource(ak.im.v1.main_akey_security);
} else {
this.l.setBackgroundResource(ak.im.v1.main_akey);
}
AKeyManager.showSecModeSwitch(this.l);
}
if (isSecurity) {
ImageView imageView = this.I;
int i2 = ak.im.v1.sec_title_selector;
imageView.setBackgroundResource(i2);
this.D.setBackgroundResource(i2);
TextView textView = this.m;
int i3 = ak.im.v1.sec_title_unpress;
textView.setBackgroundResource(i3);
this.B0.setBackgroundResource(i3);
TextView textView2 = this.m;
int i4 = ak.im.t1.sec_title_txt_color;
textView2.setTextColor(ContextCompat.getColor(this, i4));
this.n.setBackgroundResource(i2);
this.y.setTextColor(ContextCompat.getColor(this, i4));
this.y.setBackgroundResource(i2);
this.n.setImageResource(ak.im.v1.ic_search);
this.D.setImageResource(ak.im.v1.ic_menu);
this.I.setImageResource(ak.im.v1.ic_main_plus);
} else {
ImageView imageView2 = this.D;
int i5 = ak.im.v1.unsec_title_selector;
imageView2.setBackgroundResource(i5);
this.I.setBackgroundResource(i5);
TextView textView3 = this.m;
int i6 = ak.im.t1.unsec_title_txt_color;
textView3.setTextColor(ContextCompat.getColor(this, i6));
this.y.setBackgroundResource(i5);
this.y.setTextColor(ContextCompat.getColor(this, i6));
TextView textView4 = this.m;
int i7 = ak.im.v1.unsec_title_unpress;
textView4.setBackgroundResource(i7);
this.B0.setBackgroundResource(i7);
this.n.setBackgroundResource(i5);
this.n.setImageResource(ak.im.v1.ic_search_unse);
this.D.setImageResource(ak.im.v1.ic_menu_unse);
this.I.setImageResource(ak.im.v1.ic_main_plus_unse);
}
O1();
}
public void checkTransFormDialog() {
if (AKCAppConfiguration.a.forwardResume()) {
String string = ak.im.sdk.manager.ye.getInstance().getMMKV().getString(ak.im.sdk.manager.ye.getInstance().transFormTableKey(), "");
Log.i("MainActivity", "lwxt all is " + string);
io.reactivex.z.just(string).map(new io.reactivex.s0.o() {
@Override
public final Object apply(Object obj) {
return MainActivity.N((String) obj);
}
}).subscribeOn(io.reactivex.w0.a.io()).observeOn(io.reactivex.q0.c.a.mainThread()).subscribe(new c());
}
}
public void deleteDesktopSessions(final String str) {
if (this.O) {
Log.w("MainActivity", "is loading.");
return;
}
this.O = true;
ak.j.a<String> aVar = this.P;
if (aVar != null) {
aVar.dispose();
}
this.P = new i();
io.reactivex.z.create(new io.reactivex.c0() {
@Override
public final void subscribe(io.reactivex.b0 b0Var) {
MainActivity.Q(str, b0Var);
}
}).subscribeOn(io.reactivex.w0.a.io()).observeOn(io.reactivex.q0.c.a.mainThread()).subscribe(this.P);
}
@Override
public void dismissLoginResultDialog() {
AKeyDialog aKeyDialog = this.l0;
if (aKeyDialog != null) {
aKeyDialog.dismiss();
}
}
public void doChange(int i2, int i3) {
b2();
ak.im.ui.view.y3 tabAdapter = getTabAdapter();
Fragment item = tabAdapter != null ? tabAdapter.getItem(i3) : null;
this.A0.setVisibility(8);
if (item instanceof kh0) {
Z1(this.v);
this.m.setGravity(17);
TextView textView = this.m;
int i4 = ak.im.b2.session_title;
textView.setText(i4);
this.I.setVisibility(0);
this.y.setVisibility(8);
B();
int loginStatus = ak.im.sdk.manager.ye.getInstance().getLoginStatus();
if (loginStatus == 1) {
this.A0.setVisibility(0);
this.m.setText(getString(ak.im.b2.connecting));
} else if (loginStatus == 2) {
this.A0.setVisibility(0);
this.m.setText(getString(ak.im.b2.pulling));
} else {
this.A0.setVisibility(8);
this.m.setText(i4);
}
} else if (item instanceof eh0) {
Z1(this.z);
this.m.setGravity(17);
this.m.setText(ak.im.b2.navi_contacts);
this.I.setVisibility(0);
this.y.setVisibility(8);
B();
if (this.M0) {
((eh0) item).refreshContact(new ak.event.i4(0));
this.M0 = false;
}
} else if (item instanceof ih0) {
Z1(this.t0);
this.m.setGravity(17);
this.m.setText(ak.im.b2.text_slide_menu_my);
this.I.setVisibility(0);
this.y.setVisibility(8);
} else if (item instanceof ak.im.i2.a.u0) {
Z1(this.A);
B();
this.m.setGravity(17);
this.m.setText(ak.im.b2.news);
this.I.setVisibility(0);
this.y.setVisibility(8);
} else if (item instanceof ak.im.i2.a.z0) {
Z1(this.B);
B();
this.m.setGravity(17);
this.m.setText(ak.im.sdk.manager.ye.getInstance().getWorkspaceName(this));
this.I.setVisibility(0);
this.y.setVisibility(8);
} else if (item instanceof ak.im.i2.a.v0) {
Z1(this.w);
B();
this.m.setGravity(17);
this.m.setText(ak.im.b2.my_fortune);
this.I.setVisibility(4);
this.y.setText(ak.im.b2.points_details);
this.y.setVisibility(0);
} else if (item instanceof ak.im.i2.a.y0) {
Z1(this.x);
B();
this.m.setGravity(17);
this.m.setText(ak.im.b2.points_mall);
this.I.setVisibility(0);
this.y.setVisibility(8);
C();
}
}
@Override
public void finish() {
this.E0 = true;
super.finish();
}
public eh0 getContactFragment() {
ak.im.ui.view.y3 tabAdapter = getTabAdapter();
if (tabAdapter != null) {
Iterator<Fragment> it = tabAdapter.getFragmentList().iterator();
while (it.hasNext()) {
Fragment next = it.next();
if (next instanceof eh0) {
return (eh0) next;
}
}
return null;
}
return null;
}
public ih0 getMineFragment() {
ak.im.ui.view.y3 tabAdapter = getTabAdapter();
if (tabAdapter != null) {
Iterator<Fragment> it = tabAdapter.getFragmentList().iterator();
while (it.hasNext()) {
Fragment next = it.next();
if (next instanceof ih0) {
return (ih0) next;
}
}
return null;
}
return null;
}
public kh0 getSessionFragment() {
ak.im.ui.view.y3 tabAdapter = getTabAdapter();
if (tabAdapter != null) {
Iterator<Fragment> it = tabAdapter.getFragmentList().iterator();
while (it.hasNext()) {
Fragment next = it.next();
if (next instanceof kh0) {
return (kh0) next;
}
}
return null;
}
return null;
}
public boolean getSystemProperty() {
String str;
boolean z;
boolean z2;
ak.im.sdk.manager.ye yeVar = ak.im.sdk.manager.ye.getInstance();
String realPushType = AKApplication.getRealPushType();
realPushType.hashCode();
boolean z3 = true;
boolean z4 = false;
char c2 = 65535;
switch (realPushType.hashCode()) {
case -1206476313:
if (realPushType.equals(BadgeManager.MANUFACTURER_OF_HARDWARE_HUAWEI)) {
c2 = 0;
break;
}
break;
case -759499589:
if (realPushType.equals("xiaomi")) {
c2 = 1;
break;
}
break;
case 3418016:
if (realPushType.equals("oppo")) {
c2 = 2;
break;
}
break;
case 3620012:
if (realPushType.equals(BadgeManager.MANUFACTURER_OF_HARDWARE_VIVO)) {
c2 = 3;
break;
}
break;
case 103777484:
if (realPushType.equals("meizu")) {
c2 = 4;
break;
}
break;
}
BufferedReader bufferedReader = null;
String str2 = "";
switch (c2) {
case 0:
str = "hw";
z = false;
break;
case 1:
str2 = "ro.miui.ui.version.name";
str = null;
z = false;
break;
case 2:
str2 = Build.BRAND.toLowerCase().contains("oneplus") ? "ro.build.version.oplusrom" : "ro.build.version.opporom";
str = null;
z = false;
break;
case 3:
str2 = "ro.vivo.os.version";
str = null;
z = false;
break;
case 4:
str = "flyme";
z = false;
break;
default:
str = null;
z = true;
break;
}
Log.i("MainActivity", "KEY_CURRENT_FALG is " + str2);
try {
try {
BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("getprop ro.product.locale").getInputStream()), 1024);
try {
try {
String readLine = bufferedReader2.readLine();
if (str2.length() > 0) {
BufferedReader bufferedReader3 = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("getprop " + str2).getInputStream()), 1024);
try {
str = bufferedReader3.readLine();
bufferedReader2 = bufferedReader3;
} catch (IOException e2) {
e = e2;
bufferedReader = bufferedReader3;
Log.e("MainActivity", "Unable to read sysprop " + str2, e);
if (bufferedReader != null) {
}
return z4;
} catch (Throwable th) {
th = th;
bufferedReader = bufferedReader3;
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException e3) {
Log.e("MainActivity", "Exception while closing InputStream", e3);
}
}
throw th;
}
}
try {
try {
if (readLine != null) {
readLine = readLine.toLowerCase();
Log.i("MainActivity", "rom is " + str + ",location is " + readLine + "," + z);
if (readLine.startsWith("zh") && readLine.endsWith(AdvanceSetting.CLEAR_NOTIFICATION)) {
z2 = true;
if (readLine == null && !z2) {
if (TextUtils.isEmpty(str)) {
yeVar.B1 = false;
} else if (!BadgeManager.MANUFACTURER_OF_HARDWARE_VIVO.equals(AKApplication.getPushType())) {
yeVar.B1 = false;
}
} else {
if (readLine != null && !TextUtils.isEmpty(str) && !z) {
yeVar.C1 = true;
}
if (readLine != null) {
}
}
z3 = false;
bufferedReader2.close();
bufferedReader2.close();
return z3;
}
}
bufferedReader2.close();
return z3;
} catch (IOException e4) {
Log.e("MainActivity", "Exception while closing InputStream", e4);
return z3;
}
bufferedReader2.close();
} catch (IOException e5) {
e = e5;
z4 = z3;
bufferedReader = bufferedReader2;
Log.e("MainActivity", "Unable to read sysprop " + str2, e);
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException e6) {
Log.e("MainActivity", "Exception while closing InputStream", e6);
}
}
return z4;
}
z2 = false;
if (readLine == null) {
}
if (readLine != null) {
yeVar.C1 = true;
}
if (readLine != null) {
}
z3 = false;
} catch (Throwable th2) {
th = th2;
bufferedReader = bufferedReader2;
}
} catch (IOException e7) {
e = e7;
}
} catch (IOException e8) {
e = e8;
}
} catch (Throwable th3) {
th = th3;
}
}
@Nullable
public ak.im.ui.view.y3 getTabAdapter() {
NonSwipeableViewPager nonSwipeableViewPager = this.k;
if (nonSwipeableViewPager == null) {
Log.w("MainActivity", "view pager is null");
return null;
}
return (ak.im.ui.view.y3) nonSwipeableViewPager.getAdapter();
}
public ak.im.i2.a.z0 getWorkspaceFragment() {
ak.im.ui.view.y3 tabAdapter = getTabAdapter();
if (tabAdapter != null) {
Iterator<Fragment> it = tabAdapter.getFragmentList().iterator();
while (it.hasNext()) {
Fragment next = it.next();
if (next instanceof ak.im.i2.a.z0) {
return (ak.im.i2.a.z0) next;
}
}
return null;
}
return null;
}
public void handleIntentAction() {
boolean isAppHadLogin = AKApplication.isAppHadLogin();
Intent intent = this.Q;
if (intent != null) {
String action = intent.getAction();
if (!isAppHadLogin) {
ak.event.c cVar = new ak.event.c();
cVar.a = this.Q;
cVar.f197b = AKeyLauncherActivity.class;
ak.im.utils.j4.sendEvent(cVar);
AkeyChatUtils.startLauncherActivityIntent(this.Q, this);
finish();
return;
}
Log.i("MainActivity", "action is:" + action);
JSONObject jSONObject = null;
if ("android.intent.action.SEND".equals(action)) {
if (!AKeyManager.isSecurity()) {
getIBaseActivity().showToast(getString(ak.im.b2.before_share_you_should_open_sec_mode));
return;
}
z(this.Q);
this.Q = null;
} else if ("android.intent.action.VIEW".equals(action)) {
AkeyChatUtils.handleBrowserOpenEvent(this.Q, ak.im.sdk.manager.ye.getInstance().getLockMode() != 3, this);
this.Q = null;
} else if ("carrot.chat.com.ak_share_action".equals(action)) {
try {
jSONObject = JSON.parseObject(AkeyChatUtils.parseOuterActionData(this.Q));
} catch (Exception e2) {
e2.printStackTrace();
}
if (jSONObject != null) {
MessageManager.getInstance().queryThirdAppInfo(jSONObject.getString(IMMessage.AK_SHARE_APP_ID)).subscribeOn(io.reactivex.w0.a.io()).observeOn(io.reactivex.q0.c.a.mainThread()).subscribe(new f());
}
} else if ("voip_group".equals(this.Q.getStringExtra("purpose"))) {
String stringExtra = this.Q.getStringExtra("caller");
String stringExtra2 = this.Q.getStringExtra("callStr");
VoIpManager.getInstance().queryMCUMember(stringExtra2).subscribeOn(io.reactivex.w0.a.io()).observeOn(io.reactivex.q0.c.a.mainThread()).subscribe(new g(stringExtra, stringExtra2, this.Q.getStringExtra("callPurpose"), this.Q.getIntExtra("type", -1)));
} else {
Log.i("MainActivity", "no voip_group");
IntentManager.getSingleton().checkAVPushIntent();
if (AKApplication.getTopActivity() instanceof CallActivity) {
return;
}
MessageManager.getInstance().chechkCurrentVoipMessage(this);
}
} else if (!isAppHadLogin && XMPPConnectionManager.a.getInstance().getConnection() == null) {
AkeyChatUtils.startLauncherActivityIntent(this.Q, this);
finish();
} else {
Log.w("MainActivity", "main intent is null1");
}
}
public void handleLicenseChangedForSessionFragment(ak.event.z2 z2Var) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.handleLicenseChanged(z2Var);
}
}
public void handleWorkspaceChangedEvent(ak.event.g8 g8Var) {
ak.im.i2.a.z0 workspaceFragment = getWorkspaceFragment();
if (workspaceFragment != null) {
workspaceFragment.handleWorkspaceChangedEvent(g8Var);
}
}
public void initLoginSuccessView() {
if (K1()) {
View findViewById = findViewById(ak.im.w1.tab_mine_layout);
this.s0 = findViewById;
findViewById.setVisibility(0);
this.t0 = (TextView) findViewById(ak.im.w1.tab_mine);
}
this.u0 = (TextView) findViewById(ak.im.w1.update_paopao_txt);
this.o = findViewById(ak.im.w1.tab_message_layout);
this.p = findViewById(ak.im.w1.tab_fortune_layout);
this.q = findViewById(ak.im.w1.tab_mall_layout);
this.u = findViewById(ak.im.w1.tab_app_layout);
this.r = findViewById(ak.im.w1.tab_contacts_layout);
this.s = findViewById(ak.im.w1.tab_news_layout);
this.t = findViewById(ak.im.w1.tab_me_layout);
this.v = (TextView) findViewById(ak.im.w1.tab_message);
this.z = (TextView) findViewById(ak.im.w1.tab_contacts);
this.A = (TextView) findViewById(ak.im.w1.tab_news);
this.w = (TextView) findViewById(ak.im.w1.tab_fortune);
this.x = (TextView) findViewById(ak.im.w1.tab_mall);
this.C = (TextView) findViewById(ak.im.w1.tab_me);
TextView textView = (TextView) findViewById(ak.im.w1.topRightTV);
this.y = textView;
textView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.w0(view);
}
});
this.B = (TextView) findViewById(ak.im.w1.tab_app);
TextView textView2 = (TextView) findViewById(ak.im.w1.message_paopao_txt);
this.H = textView2;
textView2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.e0(view);
}
});
ImageView imageView = (ImageView) findViewById(ak.im.w1.more_btn);
this.I = imageView;
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.g0(view);
}
});
this.D = (ImageView) findViewById(ak.im.w1.ivTitleName);
if (K1()) {
this.D.setVisibility(8);
}
this.m = (TextView) findViewById(ak.im.w1.tv_main_title);
this.B0 = (LinearLayout) findViewById(ak.im.w1.main_title_layout);
SpinKitView spinKitView = (SpinKitView) findViewById(ak.im.w1.circle_progress);
this.A0 = spinKitView;
spinKitView.setVisibility(8);
this.n = (ImageView) findViewById(ak.im.w1.iv_search);
this.l = (FloatActionButton) findViewById(ak.im.w1.aukey_online_img);
this.E = findViewById(ak.im.w1.rl_title_bar);
this.n.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.i0(view);
}
});
this.D.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.k0(view);
}
});
this.D.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view) {
return MainActivity.this.m0(view);
}
});
if (ak.im.sdk.manager.ye.getInstance().isSupportPlainMode()) {
this.B0.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view) {
return MainActivity.this.o0(view);
}
});
}
this.l.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.q0(view);
}
});
r();
this.w0 = (LinearLayout) findViewById(ak.im.w1.fcm_tips);
this.z0 = (TextView) findViewById(ak.im.w1.fcm_tip_text);
this.x0 = ak.im.sdk.manager.ye.getInstance().getMMKV().getBoolean("had_close_fcm_tips", false);
this.y0 = ak.im.sdk.manager.ye.getInstance().getMMKV().getBoolean("had_close_auto_tips", false);
this.w0.setVisibility(8);
findViewById(ak.im.w1.fcm_tip_close_button).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.s0(view);
}
});
findViewById(ak.im.w1.fcm_tips_btn).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.u0(view);
}
});
}
@Override
public boolean isLoginSuccessViewVisible() {
return true;
}
@Override
public void onActivityResult(int i2, int i3, Intent intent) {
super.onActivityResult(i2, i3, intent);
if (i3 == -1) {
User user = null;
User user2 = this.h0;
if (user2 != null) {
user = user2.m16clone();
} else if (ak.im.sdk.manager.nf.getInstance().getUserMe() != null) {
user = ak.im.sdk.manager.nf.getInstance().getUserMe().m16clone();
}
if (user == null) {
return;
}
if (i2 == 40) {
AKeyManager.getInstance().verifySecurityCode(getIBaseActivity(), "akey.passcode.secmode", intent.getStringExtra("passcode"), Akeychat.SecurityOperate.OpenSafeMode, new ak.im.listener.g() {
@Override
public final void onResult(int i4) {
MainActivity.this.Q0(i4);
}
});
} else if (i2 != 52) {
} else {
M1();
if (intent == null || !intent.getExtras().getBoolean("share_asim_id")) {
return;
}
new ak.im.utils.k5(this, this.D0).startShare(true, intent.getExtras().getString("modify_asim_id"));
}
}
}
@Override
public void onClick(View view) {
ak.im.ui.view.y3 tabAdapter = getTabAdapter();
if (tabAdapter == null) {
Log.w("MainActivity", "adapter is null do not response for click");
return;
}
ArrayList<Fragment> fragmentList = tabAdapter.getFragmentList();
int i2 = 0;
if (view != this.o && view.getId() != ak.im.w1.tab_message) {
if (view != this.r && view.getId() != ak.im.w1.tab_contacts) {
if (view != this.s && view.getId() != ak.im.w1.tab_news) {
if (view == this.u) {
Iterator<Fragment> it = fragmentList.iterator();
while (it.hasNext() && !(it.next() instanceof ak.im.i2.a.z0)) {
i2++;
}
Z0(i2);
return;
} else if (view != this.p && view.getId() != ak.im.w1.tab_fortune) {
if (view != this.q && view.getId() != ak.im.w1.tab_mall) {
if (view == this.s0 || view.getId() == ak.im.w1.tab_mine) {
Iterator<Fragment> it2 = fragmentList.iterator();
while (it2.hasNext() && !(it2.next() instanceof ih0)) {
i2++;
}
Z0(i2);
return;
}
return;
}
Iterator<Fragment> it3 = fragmentList.iterator();
while (it3.hasNext() && !(it3.next() instanceof ak.im.i2.a.y0)) {
i2++;
}
Z0(i2);
return;
} else {
Iterator<Fragment> it4 = fragmentList.iterator();
while (it4.hasNext() && !(it4.next() instanceof ak.im.i2.a.v0)) {
i2++;
}
Z0(i2);
return;
}
}
Iterator<Fragment> it5 = fragmentList.iterator();
while (it5.hasNext() && !(it5.next() instanceof ak.im.i2.a.u0)) {
i2++;
}
Z0(i2);
return;
}
Iterator<Fragment> it6 = fragmentList.iterator();
while (it6.hasNext() && !(it6.next() instanceof eh0)) {
i2++;
}
Z0(i2);
return;
}
Iterator<Fragment> it7 = fragmentList.iterator();
while (it7.hasNext() && !(it7.next() instanceof kh0)) {
i2++;
}
Z0(i2);
}
@Override
@SuppressLint({"CheckResult"})
public void onCreate(Bundle bundle) {
this.D0 = this;
this.R = getIntent();
g = new WeakReference<>(this);
Log.i("MainActivity", "before " + ak.im.utils.i4.getScreenInfo(this));
super.onCreate(bundle);
Log.i("MainActivity", "after " + ak.im.utils.i4.getScreenInfo(this));
if (!AKApplication.isAppHadLogin()) {
Intent intent = (Intent) this.R.getParcelableExtra("enter_main_activity_purpose_key");
this.Q = intent;
AkeyChatUtils.startLauncherActivityIntent(intent, this);
finish();
return;
}
if (ak.im.utils.h5.isMeizuFlymeOS()) {
getIBaseActivity().translucentStatusBar();
}
if (!AKApplication.isAppDebug() && !AKCAppConfiguration.a.isSecure(ak.im.sdk.manager.ye.getInstance().getServerId())) {
getWindow().addFlags(8192);
}
setContentView(ak.im.x1.activity_main);
this.q0 = (TextView) findViewById(ak.im.w1.beepSearch);
try {
Drawable drawable = getDrawable(ak.im.v1.ic_gray_search);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
this.q0.setCompoundDrawables(drawable, null, null, null);
} catch (Exception e2) {
e2.printStackTrace();
}
this.q0.setVisibility(0);
this.q0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.S0(view);
}
});
A();
this.Q = (Intent) this.R.getParcelableExtra("enter_main_activity_purpose_key");
Log.i("MainActivity", "check start intent:" + this.R + ",purpose:" + this.Q);
if (this.Q == null) {
this.Q = this.R;
}
handleIntentAction();
if (this.E0) {
Log.i("MainActivity", "we will finish main activity so return");
} else if (!AKApplication.isAppHadLogin()) {
J1();
Log.w("MainActivity", "is not login do not here");
} else {
AkeyChatUtils.checkTimeDiff(System.currentTimeMillis() - AKApplication.n, "from application init and main activity create start");
h = System.currentTimeMillis();
W1();
initView();
EventBus.getDefault().register(this);
IntentManager.getSingleton().handleChatIntent();
AKeyManager.getInstance().startNowLock(this);
final ak.im.sdk.manager.ye yeVar = ak.im.sdk.manager.ye.getInstance();
io.reactivex.z.timer(15L, TimeUnit.MILLISECONDS, io.reactivex.w0.a.io()).subscribe(new io.reactivex.s0.g() {
@Override
public final void accept(Object obj) {
MainActivity.this.U0(yeVar, (Long) obj);
}
});
H();
UpdateManager.a.getInstance().getUpdateBeanLiveData().observe(this, new Observer() {
@Override
public final void onChanged(Object obj) {
MainActivity.this.W0((UpdateBean) obj);
}
});
int i2 = getSharedPreferences("hotFixTime", 0).getInt("hotFixPatch", 0);
Log.i("MainActivity", "current patch is " + i2);
s();
U1();
AKApplication.initRootPath();
AKApplication.setFirstLogin(false);
u();
Log.debug("MainActivity", "supportFeedback " + ak.im.sdk.manager.ye.getInstance().supportNormalFeedback());
Log.debug("MainActivity", "server version is " + ak.im.sdk.manager.ye.getInstance().getServerVersion());
}
}
@Override
public void onDestroy() {
super.onDestroy();
PopupWindow popupWindow = this.J;
if (popupWindow != null) {
popupWindow.dismiss();
}
e2();
ak.g.u uVar = this.k0;
if (uVar != null) {
uVar.destroy();
}
WeakReference<MainActivity> weakReference = g;
if (weakReference != null) {
weakReference.clear();
}
g = null;
ak.im.utils.j4.unregister(this);
}
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onEventAsync(ak.event.w7 w7Var) {
User user = w7Var.a;
User userMe = ak.im.sdk.manager.nf.getInstance().getUserMe();
if (user != null && userMe != null) {
Akeychat.UserPublicSetResponse updateUserPublicInfo = ak.im.sdk.manager.nf.getInstance().updateUserPublicInfo(userMe, w7Var.f273b, (ak.im.listener.z) null);
if (updateUserPublicInfo == null) {
ak.im.sdk.manager.nf.getInstance().setUserMe(user);
ak.im.utils.j4.sendEvent(new ak.event.x7(false, w7Var.f273b, null));
} else {
ak.im.utils.j4.sendEvent(new ak.event.x7(true, w7Var.f273b, updateUserPublicInfo));
}
try {
ak.im.utils.j4.sendEvent(new ak.event.t3(User.UPDATE_INFO));
return;
} catch (Exception e2) {
e2.printStackTrace();
return;
}
}
Log.w("MainActivity", "a user is null,old:" + user + ",new :" + userMe);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.a4 a4Var) {
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.z0 z0Var) {
a2(z0Var.getSupport());
}
@Override
public boolean onKeyDown(int i2, KeyEvent keyEvent) {
SlidingMenu slidingMenu;
if (i2 != 4 || ((slidingMenu = this.F) != null && slidingMenu.isMenuShowing())) {
if (i2 == 4) {
SlidingMenu slidingMenu2 = this.F;
if (slidingMenu2 != null) {
slidingMenu2.toggle();
}
return true;
}
return super.onKeyDown(i2, keyEvent);
}
Log.i("TAG", "key code back");
if (ak.im.sdk.manager.gf.getInstance().getmCurrentCallUser() != null) {
Log.w("MainActivity", "there is a user is callling.");
return true;
}
moveTaskToBack(true);
overridePendingTransition(0, 0);
if (ak.im.sdk.manager.ye.getInstance().isSecurityAutoClose() && AKeyManager.isSecurity()) {
new ak.im.task.f(this.D0, new ak.worker.d0() {
@Override
public final void onResult(boolean z) {
MainActivity.this.c1(z);
}
}, false).exec(new Void[0]);
}
return true;
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onResume() {
super.onResume();
if (!AKApplication.isAppHadLogin()) {
Log.w("MainActivity", "is not login");
} else if (this.E0) {
Log.i("MainActivity", "we will finish main activity so return");
} else {
String language = ak.comm.b.getLanguage();
String language2 = ak.im.sdk.manager.ye.getInstance().getLanguage();
Log.i("MainActivity", "language is " + language + ",current is " + language2);
if (!TextUtils.isEmpty(language2) && !language2.equals(language) && ak.im.sdk.manager.ye.getInstance().getChooseLan() == 0) {
AKeyDialog aKeyDialog = new AKeyDialog(this);
aKeyDialog.setTip(getString(ak.im.b2.quit_hint));
aKeyDialog.setCanceledOnTouchOutside(false);
aKeyDialog.show();
io.reactivex.z.timer(2L, TimeUnit.SECONDS, io.reactivex.w0.a.io()).subscribe(new h());
}
if (this.G0) {
this.G0 = false;
} else {
U1();
}
ak.g.u uVar = this.k0;
if (uVar != null) {
uVar.checkLoginStatusAndHintIfNecessary();
}
long rightTime = ak.im.utils.f4.getRightTime();
DailyReportManager.a aVar = DailyReportManager.a;
if (ak.im.utils.f4.isTheSameDay(rightTime, aVar.getInstance().getReportTime())) {
return;
}
Log.d("MainActivity", "today may not count report, we start report");
aVar.getInstance().setReportTime(ak.im.utils.f4.getRightTime());
aVar.getInstance().postStatistics();
}
}
@Override
public void onStart() {
super.onStart();
}
public void queryOnlineDesktopSessions() {
}
public void refreshMyInfoView() {
if (this.F == null) {
Log.w("MainActivity", "menu is null,give up refresh my info view");
return;
}
this.r0 = this.G.findViewById(ak.im.w1.tv_broadcast_message);
findViewById(ak.im.w1.tvVipSatellite).setVisibility(8);
findViewById(ak.im.w1.tvCheckMyPosition).setVisibility(8);
User userMe = ak.im.sdk.manager.nf.getInstance().getUserMe();
this.h0 = userMe;
if (userMe == null) {
Log.w("MainActivity", "getUserMe is null so need not update my info.");
User localUserMe = ak.im.sdk.manager.nf.getInstance().getLocalUserMe(ak.im.sdk.manager.ye.getInstance().getUsername());
this.h0 = localUserMe;
if (localUserMe == null) {
Log.w("MainActivity", " dbUser is null so need not update my info.");
ak.im.utils.j4.sendEvent(new ak.event.q3());
return;
}
}
Log.i("MainActivity", "check my binding id:" + this.h0.getBindingID());
M1();
if (this.h0.getNickName() == null) {
this.W.setVisibility(8);
} else {
String nickName = this.h0.getNickName();
TextView textView = this.W;
if (textView != null) {
textView.setText(nickName);
} else {
Log.w("MainActivity", "my nick name txt is null ,so pls check your code");
}
this.W.setTextColor(getResources().getColor(ak.im.t1.white));
}
if (this.h0.getGender() != null) {
int i2 = ak.im.v1.ic_male_white;
if (this.h0.getGender().equals(Akeychat.Sex.Female.toString())) {
i2 = ak.im.v1.ic_female_white;
findViewById(ak.im.w1.rl_bg).setBackgroundResource(ak.im.v1.bg_menu_female);
} else {
findViewById(ak.im.w1.rl_bg).setBackgroundResource(ak.im.v1.bg_menu_male);
}
this.V.setImageResource(i2);
}
final EnterpriseInfo currentEnterpriseInfo = ak.im.sdk.manager.af.getInstance().getCurrentEnterpriseInfo();
if (currentEnterpriseInfo != null && !ak.im.utils.n5.isEmptyString(currentEnterpriseInfo.enterpriseName)) {
this.g0.setText(currentEnterpriseInfo.enterpriseName);
this.g0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.f1(currentEnterpriseInfo, view);
}
});
}
Role roleByIdFromDam = ak.im.sdk.manager.jf.getInstance().getRoleByIdFromDam(this.h0.getUser_role_id());
TextView textView2 = (TextView) findViewById(ak.im.w1.tv_share_invite_code);
if (roleByIdFromDam != null) {
if (roleByIdFromDam.isShare_invitation_code()) {
textView2.setEnabled(true);
textView2.setTextColor(getResources().getColor(ak.im.t1.slide_menu_light_txt_color));
} else {
textView2.setEnabled(false);
textView2.setTextColor(getResources().getColor(ak.im.t1.grey));
}
} else {
textView2.setTextColor(getResources().getColor(ak.im.t1.slide_menu_light_txt_color));
textView2.setEnabled(true);
}
if (!K1()) {
textView2.setVisibility(0);
}
textView2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.h1(view);
}
});
P1(roleByIdFromDam);
Q1();
this.f0.setVisibility(8);
ak.im.sdk.manager.cf.getInstance().displayUserAvatar(this.h0, this.U);
a2(I());
}
public void registerForGooglePush() {
if (ak.im.sdk.manager.ye.getInstance().C1 && ak.im.sdk.manager.ye.getInstance().isSuccessForPush()) {
Log.i("MainActivity", "dontUseFcm is true,drop fcm");
return;
}
AKCDiscoverInstance queryDiscoverInstanceBy = AKCDiscoverInstance.Companion.queryDiscoverInstanceBy(AKCDiscoverManager.a.getInstance().getLastServerSearchKey());
if (queryDiscoverInstanceBy != null && !AdvanceSetting.CLEAR_NOTIFICATION.equalsIgnoreCase(queryDiscoverInstanceBy.getLocation())) {
final AKeyDialog aKeyDialog = new AKeyDialog(this);
aKeyDialog.setNegativeButton(getString(ak.im.b2.cancel), new View.OnClickListener() {
@Override
public final void onClick(View view) {
AKeyDialog.this.dismiss();
}
});
aKeyDialog.setPositiveButton(getString(ak.im.b2.know_detail), new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.k1(aKeyDialog, view);
}
});
Log.i("MainActivity", "google " + ak.im.sdk.manager.ye.getInstance().isSuccessForPush());
this.z0.setText(getString(ak.im.b2.fire_base_tips));
push.e.getInstance().registerFcm(new b(new k(aKeyDialog), new a(aKeyDialog)));
return;
}
Log.i("MainActivity", "phone is cn,ip is cn,drop registerForGooglePush");
}
public void setMessagePaoPao(int i2) {
String str;
TextView textView = this.H;
if (textView == null) {
new Exception("check-your-code-pls").printStackTrace();
return;
}
if (i2 > 0) {
Log.d("MainActivity", "total unread message " + i2);
if (i2 > 99) {
str = "99+";
} else {
str = i2 + ak.im.utils.n5.getEmptyStr();
}
this.H.setText(str);
this.H.setVisibility(0);
} else {
textView.setVisibility(8);
}
this.m0 = i2;
g2();
}
@Override
public void showBindDialog(String str) {
}
@Override
public void showLoginResultDialog(String str, final int i2) {
if (i2 == 1001) {
getIBaseActivity().showAlertDialog(str, getString(ak.im.b2.go_setting), getString(ak.im.b2.cancel), new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.o1(view);
}
}, new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.q1(view);
}
});
} else if (1004 == i2) {
getIBaseActivity().showAlertDialog(str, getString(ak.im.b2.search_again), getString(ak.im.b2.cancel), new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.s1(view);
}
}, new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.u1(view);
}
});
} else if (62 == i2) {
getIBaseActivity().showAlertDialog(str, getString(ak.im.b2.recover_account), getString(ak.im.b2.cancel), new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.w1(view);
}
}, new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.y1(view);
}
});
} else {
if (this.l0 == null) {
AKeyDialog aKeyDialog = new AKeyDialog(this);
this.l0 = aKeyDialog;
aKeyDialog.setCanceledOnTouchOutside(false);
this.l0.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
MainActivity.this.A1(dialogInterface);
}
});
this.l0.setPositiveButton(getString(ak.im.b2.ensure), new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.C1(i2, view);
}
});
}
this.l0.setTitle(AKApplication.getAppName());
this.l0.setMessage((CharSequence) str);
this.l0.show();
AKApplication.finishOtherActivityExceptMain();
}
}
@Override
public void showLoginResultDialogHasDetailErrorInfo(AKLoginException aKLoginException, int i2) {
if (this.l0 == null) {
AKeyDialog aKeyDialog = new AKeyDialog(this);
this.l0 = aKeyDialog;
aKeyDialog.setCanceledOnTouchOutside(false);
this.l0.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
MainActivity.this.E1(dialogInterface);
}
});
this.l0.setPositiveButton(getString(ak.im.b2.know), new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.G1(view);
}
});
}
if (TextUtils.isEmpty(AKLoginException.getStr(aKLoginException))) {
this.l0.setTip(aKLoginException.des);
} else {
this.l0.setTitle(aKLoginException.des);
this.l0.setMessage((CharSequence) AKLoginException.getStr(aKLoginException));
}
this.l0.show();
AKApplication.finishOtherActivityExceptMain();
}
@Override
public void showToast(String str) {
getIBaseActivity().showToast(str);
}
@Override
public void showUpgradeHintDialog(String str) {
UpdateBean value = UpdateManager.a.getInstance().getUpdateBeanLiveData().getValue();
if (value == null || value.getUpgrade() == 0) {
return;
}
this.v0.init();
}
@Override
public void showVerifyDialog(String str, boolean z, String str2) {
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.b8 b8Var) {
if (b8Var.a) {
this.F.setSlidingEnabled(false);
} else {
this.F.setSlidingEnabled(true);
}
}
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.i0 i0Var) {
checkTransFormDialog();
EventBus.getDefault().removeStickyEvent(i0Var);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.x7 x7Var) {
if (x7Var == null) {
return;
}
int i2 = x7Var.a;
if (!x7Var.f280c) {
if (i2 == 1) {
ak.im.utils.j4.sendEvent(ak.event.k7.newToastEvent(getString(ak.im.b2.update_avatar_fail)));
return;
} else {
ak.im.utils.j4.sendEvent(ak.event.k7.newToastEvent(getString(ak.im.b2.update_user_me_fail)));
return;
}
}
User userMe = ak.im.sdk.manager.nf.getInstance().getUserMe();
if (userMe == null) {
Log.w("MainActivity", "user is null cancel");
return;
}
userMe.setVersionCode(x7Var.f279b.getVersioncode());
ak.im.sdk.manager.cf.getInstance().addIntoMap(userMe.getHeadImgThumb(), userMe.getHeadImg());
ak.im.sdk.manager.nf.getInstance().setUserMe(userMe);
SyncManager.getSingleton().updateSyncInfo("my_public_info", userMe.getVersionCode());
R1();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.r4 r4Var) {
U1();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.t4 t4Var) {
R1();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.smack.w1 w1Var) {
this.k0.handleLoginResult(w1Var);
}
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.a1 a1Var) {
this.k0.handleLoginResult(new ak.smack.w1(a1Var.getCode(), a1Var.getStr()));
EventBus.getDefault().removeStickyEvent(a1Var);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(final ak.event.l1 l1Var) {
Log.d("MainActivity", "lwx enterprise type is forbidden");
AKeyDialog aKeyDialog = new AKeyDialog(this);
aKeyDialog.setCanceledOnTouchOutside(false);
aKeyDialog.setMessage((CharSequence) getString(ak.im.b2.forbidden_enterprise));
aKeyDialog.setTitle(getString(ak.im.b2.warning));
aKeyDialog.setPositiveButton(getString(ak.im.b2.cfm_btn), new View.OnClickListener() {
@Override
public final void onClick(View view) {
MainActivity.this.Y0(l1Var, view);
}
});
aKeyDialog.show();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.g6 g6Var) {
if (g6Var.f210c == null) {
Log.w("MainActivity", "illegal org bean");
} else if (g6Var.f211d != ak.event.g6.f209b) {
Log.w("MainActivity", "not my event");
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.k3 k3Var) {
queryOnlineDesktopSessions();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.g8 g8Var) {
boolean isWorkspaceOpen = ak.im.sdk.manager.ye.getInstance().isWorkspaceOpen();
ak.im.ui.view.y3 tabAdapter = getTabAdapter();
if (tabAdapter == null) {
Log.i("MainActivity", "WorkspaceChangedEvent failed,adapter is null");
return;
}
ArrayList<Fragment> fragmentList = tabAdapter.getFragmentList();
if (fragmentList == null) {
return;
}
if (isWorkspaceOpen) {
boolean z = false;
Iterator<Fragment> it = fragmentList.iterator();
while (it.hasNext()) {
if (it.next() instanceof ak.im.i2.a.z0) {
z = true;
}
}
if (!z) {
r();
}
} else {
Iterator<Fragment> it2 = fragmentList.iterator();
while (it2.hasNext()) {
boolean z2 = it2.next() instanceof ak.im.i2.a.z0;
}
int i2 = this.N0;
r();
this.u.setVisibility(8);
if (i2 >= 1) {
Z0(i2 - 1);
}
}
handleWorkspaceChangedEvent(g8Var);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.x1 x1Var) {
R1();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.a7 a7Var) {
if (this.p0 == null) {
Log.w("MainActivity", "Slide Menu CA Item mMenuCA is null");
} else {
N1();
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.z2 z2Var) {
onEventMainThread(new ak.event.g8());
onEventMainThread(new ak.event.d7());
handleLicenseChangedForSessionFragment(z2Var);
eh0 contactFragment = getContactFragment();
if (contactFragment != null) {
contactFragment.refreshHead();
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.j jVar) {
eh0 contactFragment = getContactFragment();
if (contactFragment != null) {
contactFragment.showContactsView();
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.d7 d7Var) {
boolean isSupportNews = ak.im.sdk.manager.ye.getInstance().isSupportNews();
ak.im.ui.view.y3 tabAdapter = getTabAdapter();
if (tabAdapter == null) {
Log.w("MainActivity", "adapter is null in support news event");
return;
}
ArrayList<Fragment> fragmentList = tabAdapter.getFragmentList();
if (fragmentList == null) {
Log.w("MainActivity", "adapter is null in support news event");
} else if (isSupportNews) {
boolean z = false;
Iterator<Fragment> it = fragmentList.iterator();
while (it.hasNext()) {
if (it.next() instanceof ak.im.i2.a.u0) {
z = true;
}
}
if (z) {
return;
}
int i2 = this.N0;
r();
if (i2 >= 1) {
Z0(i2);
}
} else {
int i3 = this.N0;
r();
ak.im.ui.view.y3 tabAdapter2 = getTabAdapter();
if (tabAdapter2 == null) {
Log.w("MainActivity", "adapter is null in support news event");
return;
}
ArrayList<Fragment> fragmentList2 = tabAdapter2.getFragmentList();
if (fragmentList2 == null) {
Log.w("MainActivity", "adapter is null in support news event");
} else if (i3 >= fragmentList2.size()) {
Z0(fragmentList2.size() - 1);
}
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.o6 o6Var) {
T1("single-session-remote-destroy-" + o6Var.a);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.v2 v2Var) {
T1(v2Var.a);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.d6 d6Var) {
TextView textView;
T1("session-sync-finish");
if (this.N0 != 0 || (textView = this.m) == null) {
return;
}
textView.setText(getString(ak.im.b2.session_title));
this.A0.setVisibility(8);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.t tVar) {
T1("bulk remote DestroyEvent finish");
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.u4 u4Var) {
T1("refresh-notice");
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.c6 c6Var) {
T1("session-changed:" + c6Var.getWith());
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.u uVar) {
T1("burn after all read");
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.a2 a2Var) {
T1("global-refresh-event,with:" + a2Var.a + ",type" + a2Var.f187b);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.a0 a0Var) {
T1("ChangeFeedbackMasterEvent");
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.b0 b0Var) {
T1("ChangeSupportFeedbackEvent");
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.e6 e6Var) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.handleSetAllMessageEvent(e6Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.s4 s4Var) {
Log.debug("MainActivity", "feedbackpop RefreshMessageEvent");
T1("receive-msg");
ChatMessage chatMessage = s4Var.a;
if (chatMessage == null || !"feedback".equals(chatMessage.getChatType())) {
return;
}
t();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.v3 v3Var) {
Log.debug("MainActivity", "feedbackpop PullFeedbackSessionFinishEvent " + v3Var.getCome());
t();
T1("prepare");
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.r3 r3Var) {
T1("prepare");
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.o2 o2Var) {
T1("group-remote-destroy-" + o2Var.a + "-" + o2Var.f242b);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.b7 b7Var) {
T1("custrom-service-changed");
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.g3 g3Var) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.handleNetChangeEvent(g3Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.n5 n5Var) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.handleSatelliteDeviceConnectStateEvent("satellite-connect");
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.o5 o5Var) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.handleSatelliteDeviceConnectStateEvent("satellite-disconnect");
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.u0 u0Var) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.handleGroupAvatarComposeCompleteEvent(u0Var);
}
eh0 contactFragment = getContactFragment();
if (contactFragment != null) {
contactFragment.handleComposedGroupAvatarEvent(u0Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.g1 g1Var) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.handleSessionDeleteEvent(g1Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.b bVar) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.handleChannelEvent(bVar);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.a aVar) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.handleBotEvent(aVar);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.i2 i2Var) {
eh0 contactFragment = getContactFragment();
if (contactFragment != null) {
contactFragment.handleGroupInfoChanged(i2Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.n4 n4Var) {
eh0 contactFragment = getContactFragment();
if (contactFragment != null) {
contactFragment.handleGroupRefreshEvent(n4Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.h6 h6Var) {
eh0 contactFragment = getContactFragment();
if (contactFragment != null) {
contactFragment.handleGroupRefreshEvent(new ak.event.n4());
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.a8 a8Var) {
eh0 contactFragment = getContactFragment();
if (contactFragment != null) {
contactFragment.handleUserInfoChangedEvent(a8Var);
}
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.onUserInfoChangedEvent();
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.i iVar) {
eh0 contactFragment = getContactFragment();
if (contactFragment != null) {
contactFragment.handleAddUserEvent(iVar);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.y7 y7Var) {
eh0 contactFragment = getContactFragment();
if (contactFragment != null) {
contactFragment.handleUserDeleteEvent(y7Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.g7 g7Var) {
eh0 contactFragment = getContactFragment();
if (contactFragment != null) {
contactFragment.handleFriendSyncFinishEvent(g7Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.i4 i4Var) {
eh0 contactFragment = getContactFragment();
if (contactFragment != null) {
contactFragment.refreshContact(i4Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.r5 r5Var) {
ak.im.i2.a.z0 workspaceFragment = getWorkspaceFragment();
if (workspaceFragment != null) {
workspaceFragment.handleSecurityChangedEvent(r5Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.f8 f8Var) {
ak.im.i2.a.z0 workspaceFragment = getWorkspaceFragment();
if (workspaceFragment != null) {
workspaceFragment.handleWorkflowChangedEvent(f8Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.q qVar) {
R1();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.x xVar) {
R1();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.q2 q2Var) {
if (q2Var.getCount() > 0) {
c2(q2Var.getCount());
} else {
x();
}
ih0 mineFragment = getMineFragment();
if (mineFragment != null) {
mineFragment.showReqFromOtherBox();
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.f4 f4Var) {
s();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.q7 q7Var) {
if (BadgeManager.MANUFACTURER_OF_HARDWARE_HUAWEI.equals(AKApplication.getPushType())) {
return;
}
registerForGooglePush();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.s6 s6Var) {
TextView textView;
if (this.N0 != 0 || (textView = this.m) == null) {
return;
}
textView.setText(getString(ak.im.b2.pulling));
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.u6 u6Var) {
if (this.N0 != 0 || this.m == null) {
return;
}
this.A0.setVisibility(0);
this.m.setText(getString(ak.im.b2.connecting));
}
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onEventMainThread(ak.event.l3 l3Var) {
Log.i("MainActivity", "OpenContactsFragmentEvent");
ak.im.ui.view.y3 tabAdapter = getTabAdapter();
if (tabAdapter == null) {
Log.w("MainActivity", "OpenContactsFragmentEvent adapter is null do not response for OpenContactsFragmentEvent");
return;
}
ArrayList<Fragment> fragmentList = tabAdapter.getFragmentList();
Log.i("MainActivity", "OpenContactsFragmentEvent " + fragmentList.size());
final int i2 = 0;
int i3 = 0;
while (true) {
if (i3 >= fragmentList.size()) {
break;
} else if (fragmentList.get(i3) instanceof eh0) {
Log.i("MainActivity", "OpenContactsFragmentEvent " + i3);
i2 = i3;
break;
} else {
i3++;
}
}
Log.i("MainActivity", "OpenContactsFragmentEvent " + i2);
runOnUiThread(new Runnable() {
@Override
public final void run() {
MainActivity.this.a1(i2);
}
});
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.h7 h7Var) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.onSystemFraudTipEvent(h7Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(FindBoxFailedEvent findBoxFailedEvent) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.onFindBoxFailedEvent(findBoxFailedEvent);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.j4 j4Var) {
kh0 sessionFragment = getSessionFragment();
if (sessionFragment != null) {
sessionFragment.onRefreshDeskTopStatusEvent(j4Var);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ak.event.m5 m5Var) {
ih0 mineFragment = getMineFragment();
if (mineFragment != null) {
mineFragment.onRoleChangedEvent();
}
}
}