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.app.ActivityManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.http.HttpResponseCache;
|
import android.net.http.HttpResponseCache;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
|
||||||
import com.adjust.sdk.Adjust;
|
import com.adjust.sdk.Adjust;
|
||||||
import com.adjust.sdk.AdjustConfig;
|
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.InstructorSendRewardProvider;
|
||||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||||
import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
|
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.live.views.RecommendLiveRoomProvider;
|
||||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
@ -44,6 +49,8 @@ import com.yunbao.main.activity.MsgSettActivity;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import io.rong.imkit.config.RongConfigCenter;
|
import io.rong.imkit.config.RongConfigCenter;
|
||||||
@ -208,7 +215,7 @@ public class AppContext extends CommonAppContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
package com.shayu.phonelive;
|
package com.shayu.phonelive;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
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
|
* @ClassName NeverCrashUtils
|
||||||
@ -86,6 +94,8 @@ public class NeverCrashUtils {
|
|||||||
if (isDebugMode()) {
|
if (isDebugMode()) {
|
||||||
Log.e(TAG, "未捕获的主线程异常行为", e);
|
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);
|
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,7 +106,11 @@ public class NeverCrashUtils {
|
|||||||
if (isDebugMode()) {
|
if (isDebugMode()) {
|
||||||
Log.e(TAG, "未捕获的子线程异常行为", e);
|
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);
|
getUncaughtCrashHandler().uncaughtException(t, e);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,4 +121,10 @@ public class NeverCrashUtils {
|
|||||||
public interface UncaughtCrashHandler {
|
public interface UncaughtCrashHandler {
|
||||||
void uncaughtException(Thread t, Throwable e);
|
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() {
|
protected int getLayoutId() {
|
||||||
return R.layout.activity_login;
|
return R.layout.activity_login;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onRegSuccessEvent(RegSuccessEvent e) {
|
public void onRegSuccessEvent(RegSuccessEvent e) {
|
||||||
if (!isFinishing()){
|
if (!isFinishing()) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,13 +319,12 @@ public class LoginActivity extends AbsActivity {
|
|||||||
public void onSuccess(int code, String msg, String[] info) {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
if (info[0] != null && mFirstLogin == true) {
|
if (info[0] != null && mFirstLogin == true) {
|
||||||
JSONObject obj = JSON.parseObject(info[0]);
|
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_us = obj.getString("home_zdy_img_us");
|
||||||
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||||
}
|
}
|
||||||
MainActivity.forward(LoginActivity.this, false);
|
MainActivity.forward(LoginActivity.this, false);
|
||||||
finish();
|
//gotoLive(obj.getString("anchor_id"));
|
||||||
gotoLive(obj.getString("anchor_id"));
|
|
||||||
IMLoginManager.get(mContext).setisNewUserOne(true);
|
IMLoginManager.get(mContext).setisNewUserOne(true);
|
||||||
IMLoginManager.get(mContext).setNewUserGif(true);
|
IMLoginManager.get(mContext).setNewUserGif(true);
|
||||||
if (obj.containsKey("home_zdy_pop")) {
|
if (obj.containsKey("home_zdy_pop")) {
|
||||||
@ -332,8 +332,8 @@ public class LoginActivity extends AbsActivity {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MainActivity.forward(LoginActivity.this, false);
|
MainActivity.forward(LoginActivity.this, false);
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -349,6 +349,7 @@ public class LoginActivity extends AbsActivity {
|
|||||||
this.finish();
|
this.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 三方登录
|
* 三方登录
|
||||||
*/
|
*/
|
||||||
@ -383,7 +384,6 @@ public class LoginActivity extends AbsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
if (mAnimator != null) {
|
if (mAnimator != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user