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