fix:修复首次进入随机进密码房弹dialog导致闪退问题
This commit is contained in:
parent
9cb4714b78
commit
818e04c687
@ -4,13 +4,16 @@ import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.net.http.HttpResponseCache;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustConfig;
|
||||
@ -33,6 +36,8 @@ import com.yunbao.common.manager.imrongcloud.InstructorSendReward;
|
||||
import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider;
|
||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
|
||||
import com.yunbao.common.utils.FileUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.views.RecommendLiveRoomProvider;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.L;
|
||||
@ -44,6 +49,8 @@ import com.yunbao.main.activity.MsgSettActivity;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.rong.imkit.config.RongConfigCenter;
|
||||
@ -208,7 +215,7 @@ public class AppContext extends CommonAppContext {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
package com.shayu.phonelive;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.yunbao.common.utils.FileUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
/**
|
||||
* @ClassName NeverCrashUtils
|
||||
@ -86,6 +94,8 @@ public class NeverCrashUtils {
|
||||
if (isDebugMode()) {
|
||||
Log.e(TAG, "未捕获的主线程异常行为", e);
|
||||
}
|
||||
Toast.makeText(application, "发生闪退", Toast.LENGTH_SHORT).show();
|
||||
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()),throwableToString(e),"error.log");
|
||||
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);
|
||||
}
|
||||
}
|
||||
@ -96,7 +106,11 @@ public class NeverCrashUtils {
|
||||
if (isDebugMode()) {
|
||||
Log.e(TAG, "未捕获的子线程异常行为", e);
|
||||
}
|
||||
Toast.makeText(application, "发生闪退", Toast.LENGTH_SHORT).show();
|
||||
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()),throwableToString(e),"error.log");
|
||||
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);
|
||||
getUncaughtCrashHandler().uncaughtException(t, e);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@ -107,4 +121,10 @@ public class NeverCrashUtils {
|
||||
public interface UncaughtCrashHandler {
|
||||
void uncaughtException(Thread t, Throwable e);
|
||||
}
|
||||
private static String throwableToString(Throwable e) {
|
||||
StringWriter writer=new StringWriter();
|
||||
PrintWriter printWriter=new PrintWriter(writer);
|
||||
e.printStackTrace(printWriter);
|
||||
return "[ERROR]"+writer.toString();
|
||||
}
|
||||
}
|
@ -92,9 +92,10 @@ public class LoginActivity extends AbsActivity {
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_login;
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRegSuccessEvent(RegSuccessEvent e) {
|
||||
if (!isFinishing()){
|
||||
if (!isFinishing()) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
@ -318,13 +319,12 @@ public class LoginActivity extends AbsActivity {
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info[0] != null && mFirstLogin == true) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if(obj.containsKey("home_zdy_img_us")) {
|
||||
if (obj.containsKey("home_zdy_img_us")) {
|
||||
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
||||
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||
}
|
||||
MainActivity.forward(LoginActivity.this, false);
|
||||
finish();
|
||||
gotoLive(obj.getString("anchor_id"));
|
||||
//gotoLive(obj.getString("anchor_id"));
|
||||
IMLoginManager.get(mContext).setisNewUserOne(true);
|
||||
IMLoginManager.get(mContext).setNewUserGif(true);
|
||||
if (obj.containsKey("home_zdy_pop")) {
|
||||
@ -332,8 +332,8 @@ public class LoginActivity extends AbsActivity {
|
||||
}
|
||||
} else {
|
||||
MainActivity.forward(LoginActivity.this, false);
|
||||
finish();
|
||||
}
|
||||
finish();
|
||||
|
||||
}
|
||||
});
|
||||
@ -349,6 +349,7 @@ public class LoginActivity extends AbsActivity {
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 三方登录
|
||||
*/
|
||||
@ -383,7 +384,6 @@ public class LoginActivity extends AbsActivity {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mAnimator != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user