调整直播间UI
修复心愿单浮窗一堆问题
This commit is contained in:
parent
9c3fbe0506
commit
9707898af9
@ -13,6 +13,7 @@ import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.os.Process;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -42,6 +43,7 @@ import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.socket.SocketRyClient;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
import com.yunbao.live.views.PortraitLiveManager;
|
||||
@ -128,6 +130,12 @@ public class AppContext extends CommonAppContext {
|
||||
if (!isMainProcess()) {
|
||||
return;
|
||||
}
|
||||
AppManager.runDebugCode(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ToastUtil.show("Debug代码");
|
||||
}
|
||||
});
|
||||
CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis());
|
||||
//注册全局异常捕获
|
||||
registerError();
|
||||
@ -280,18 +288,21 @@ public class AppContext extends CommonAppContext {
|
||||
.setMainCrashHandler((t, e) -> {
|
||||
Log.e("ApplicationError", "主线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
||||
e.printStackTrace();
|
||||
//闪退后finish所有Activity并且杀死进程
|
||||
/* for (WeakReference<Activity> activity : activities) {
|
||||
if (activity != null && activity.get() != null) {
|
||||
activity.get().finish();
|
||||
AppManager.runDebugCode(()->{
|
||||
//闪退后finish所有Activity并且杀死进程
|
||||
for (WeakReference<Activity> activity : activities) {
|
||||
if (activity != null && activity.get() != null) {
|
||||
activity.get().finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
*//* Process.killProcess(Process.myPid());
|
||||
System.exit(0);*//*
|
||||
setFirebaseCrashData();
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
throw new RuntimeException(e);
|
||||
}, 100);*/
|
||||
Process.killProcess(Process.myPid());
|
||||
System.exit(0);
|
||||
setFirebaseCrashData();
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
throw new RuntimeException(e);
|
||||
}, 100);
|
||||
});
|
||||
|
||||
})
|
||||
.setUncaughtCrashHandler((t, e) -> {
|
||||
Log.e("ApplicationError", "子线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
||||
|
@ -10,6 +10,7 @@ import android.widget.Toast;
|
||||
|
||||
import com.yunbao.common.BuildConfig;
|
||||
import com.yunbao.common.bean.CrashSaveBean;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.FileUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
|
||||
@ -91,10 +92,12 @@ public class NeverCrashUtils {
|
||||
*
|
||||
* @param application application
|
||||
*/
|
||||
private boolean errorWhile = true;
|
||||
|
||||
public void register(Application application) {
|
||||
//主线程异常拦截
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
while (true) {
|
||||
while (errorWhile) {
|
||||
try {
|
||||
Looper.loop();
|
||||
} catch (Throwable e) {
|
||||
@ -102,12 +105,12 @@ public class NeverCrashUtils {
|
||||
Log.e(TAG, "未捕获的主线程异常行为", e);
|
||||
}
|
||||
e.printStackTrace();
|
||||
if(BuildConfig.DEBUG) {
|
||||
Toast.makeText(application, "发生闪退:"+e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
AppManager.runDebugCode(() -> Toast.makeText(application, "发生闪退:" + e.getMessage(), 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);
|
||||
// return;
|
||||
AppManager.runDebugCode(() -> errorWhile = false);
|
||||
// return;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -142,11 +145,11 @@ public class NeverCrashUtils {
|
||||
writer.write("PhoneName=" + Build.BRAND + "\n");
|
||||
writer.write("Phone=" + Build.MODEL + "\n");
|
||||
writer.write("CPU=" + Arrays.toString(Build.SUPPORTED_ABIS) + "\n");
|
||||
writer.write("runTime=" + (System.currentTimeMillis() - CrashSaveBean.getInstance().getStartTime())+ "\n");
|
||||
writer.write("enterRoom=" + CrashSaveBean.getInstance().getEnterRoom()+ "\n");
|
||||
writer.write("slidingRoom=" + CrashSaveBean.getInstance().getSlidingRoom()+ "\n");
|
||||
writer.write("playSvga=" + CrashSaveBean.getInstance().getPlaySvga()+ "\n");
|
||||
writer.write("ActivitySize=" + CrashSaveBean.getInstance().getActivitySize()+ "\n");
|
||||
writer.write("runTime=" + (System.currentTimeMillis() - CrashSaveBean.getInstance().getStartTime()) + "\n");
|
||||
writer.write("enterRoom=" + CrashSaveBean.getInstance().getEnterRoom() + "\n");
|
||||
writer.write("slidingRoom=" + CrashSaveBean.getInstance().getSlidingRoom() + "\n");
|
||||
writer.write("playSvga=" + CrashSaveBean.getInstance().getPlaySvga() + "\n");
|
||||
writer.write("ActivitySize=" + CrashSaveBean.getInstance().getActivitySize() + "\n");
|
||||
writer.write("UserData=" + SpUtil.getInstance().getStringValue(SpUtil.USER_INFO) + "\n");
|
||||
writer.write("[ERROR]");
|
||||
PrintWriter printWriter = new PrintWriter(writer);
|
||||
|
@ -371,6 +371,7 @@ public class LiveNetManager {
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Log.e("异常", "checkLive: ",throwable);
|
||||
if (callBack != null) {
|
||||
callBack.onError(throwable.getMessage());
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package com.yunbao.common.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.yunbao.common.BuildConfig;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
public class AppManager {
|
||||
@ -114,6 +116,15 @@ public class AppManager {
|
||||
activityStack.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
*仅在debug下运行的代码
|
||||
*/
|
||||
public static void runDebugCode(Runnable runnable) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退出应用程序
|
||||
|
@ -4,6 +4,7 @@ import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@ -109,6 +110,7 @@ public class LiveRoomCheckLivePresenter {
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
Log.e("直播间异常", "onError: "+error );
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_ROOM_EXCEPTION));
|
||||
ToastUtil.show(error);
|
||||
@ -159,6 +161,7 @@ public class LiveRoomCheckLivePresenter {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.e("直播间异常", "Error: "+msg );
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_ROOM_EXCEPTION));
|
||||
ToastUtil.show(msg);
|
||||
|
@ -4742,7 +4742,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
.setmLink(CommonAppConfig.HOST + "/index.php")
|
||||
.setType(1);
|
||||
bannerBean.setShow_type("2");
|
||||
mTopBannerList.add(bannerBean);
|
||||
if (mTopBannerList.size() == 1 || mTopBannerList.size() == 0) {
|
||||
mTopBannerList.add(bannerBean);
|
||||
} else {
|
||||
mTopBannerList.set(1, bannerBean);
|
||||
}
|
||||
topBanner1.update(mTopBannerList);
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
@ -191,6 +192,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
private String leaveStream = "", leaveGroupId = "";
|
||||
public static PortraitLiveManager portraitLiveManager;
|
||||
private WishModel wishListProgress;
|
||||
private static int waitShowTopBannerTime = 6000;
|
||||
|
||||
public PortraitLiveManager setQuitF(boolean quitF) {
|
||||
isQuitF = quitF;
|
||||
@ -203,6 +205,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
liveImDeletUtil = new LiveImDeletUtil();
|
||||
portraitLiveManager = this;
|
||||
ininView();
|
||||
AppManager.runDebugCode(() -> waitShowTopBannerTime = 1000);
|
||||
}
|
||||
|
||||
|
||||
@ -253,9 +256,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
public void run() {
|
||||
loading.setVisibility(View.GONE);
|
||||
enterRoomLeaveHandler.post(enterRoomLeaveRunnable);
|
||||
if (topBannerRunnable != null) {
|
||||
topBannerHandler.postDelayed(topBannerRunnable, 1000);
|
||||
if (topBannerRunnable == null || topBannerHandler == null) {
|
||||
initTopBannerHandler();
|
||||
}
|
||||
topBannerHandler.postDelayed(topBannerRunnable, waitShowTopBannerTime);
|
||||
}
|
||||
};
|
||||
private Runnable topBannerRunnable = new Runnable() {
|
||||
@ -274,6 +278,24 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
};
|
||||
private Handler topBannerHandler = new Handler();
|
||||
|
||||
private void initTopBannerHandler() {
|
||||
topBannerHandler = new Handler();
|
||||
topBannerRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
//初始化顶部banner
|
||||
mLiveRoomViewHolder.initTopBanner();
|
||||
mLiveRoomViewHolder.updateTopBanner();
|
||||
topBannerHandler.removeCallbacks(topBannerRunnable);
|
||||
topBannerRunnable = null;
|
||||
topBannerHandler = null;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) {
|
||||
isEnterRoom = false;
|
||||
@ -359,7 +381,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveRoomViewHolder.resetView();
|
||||
enterRoomModel.clear();
|
||||
enterRoomLeaveHandler.removeCallbacks(enterRoomLeaveRunnable);
|
||||
topBannerHandler.removeCallbacks(topBannerRunnable);
|
||||
if (topBannerHandler != null && topBannerRunnable != null) {
|
||||
topBannerHandler.removeCallbacks(topBannerRunnable);
|
||||
}
|
||||
mLiveRoomViewHolder.setAvatar(data.getAvatar());
|
||||
mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor());
|
||||
mLiveRoomViewHolder.setName(data.getUserNiceName());
|
||||
@ -418,7 +442,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLivePlayViewHolder.setAnchorPlayModel(anchorClarityType);
|
||||
//是否热度卡加成
|
||||
liveHandler.postDelayed(() -> {
|
||||
if(mLiveRoomViewHolder==null){
|
||||
if (mLiveRoomViewHolder == null) {
|
||||
return;
|
||||
}
|
||||
mLiveRoomViewHolder.getIsHot(data.getIsUseHotCard());
|
||||
|
@ -7,7 +7,7 @@
|
||||
<ImageView
|
||||
android:id="@+id/imageView7"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_height="56dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
Loading…
Reference in New Issue
Block a user