From 83ee1f94df751eca2912df3b444605bb52b4cfd2 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 15 Aug 2023 10:37:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E5=A4=84=E9=97=AA?= =?UTF-8?q?=E9=80=80bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shayu/phonelive/AppContext.java | 2 +- .../com/shayu/phonelive/NeverCrashUtils.java | 5 ++++- .../live/activity/LiveAudienceActivity.java | 22 +++++++++++-------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 98dc3348a..b2674d02c 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -333,7 +333,7 @@ public class AppContext extends CommonAppContext { } - private void setFirebaseCrashData() { + public static void setFirebaseCrashData() { if (!CommonAppConfig.IS_UPLOAD_ERROR_LOG) { return; } diff --git a/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java b/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java index e3593332a..350f23aab 100644 --- a/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java +++ b/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java @@ -8,11 +8,13 @@ import android.os.Looper; import android.util.Log; import android.widget.Toast; +import com.google.firebase.crashlytics.FirebaseCrashlytics; 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; +import com.yunbao.common.utils.ToastUtil; import java.io.File; import java.io.PrintWriter; @@ -105,7 +107,8 @@ public class NeverCrashUtils { Log.e(TAG, "未捕获的主线程异常行为", e); } e.printStackTrace(); - + AppContext.setFirebaseCrashData(); + FirebaseCrashlytics.getInstance().recordException(e); 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); diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 732c3949b..9569d4951 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -1072,9 +1072,9 @@ public class LiveAudienceActivity extends LiveActivity { "?uid=" + userInfo.getId() + "&token=" + userInfo.getToken() + "&anchorUid=" + mLiveUid); } - bundle.putString("liveUid",mLiveUid); - bundle.putString("anchorName",mAncherName); - bundle.putString("mStream",mStream); + bundle.putString("liveUid", mLiveUid); + bundle.putString("anchorName", mAncherName); + bundle.putString("mStream", mStream); liveFansFragment.setArguments(bundle); liveFansFragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment"); break; @@ -1448,7 +1448,7 @@ public class LiveAudienceActivity extends LiveActivity { break; case GIFT_WALL: if (manager != null) { - manager.showGiftWall(event.getUid(),event.isVoicePress(),event.getUname(),event.getAvatar()); + manager.showGiftWall(event.getUid(), event.isVoicePress(), event.getUname(), event.getAvatar()); } break; @@ -1568,7 +1568,7 @@ public class LiveAudienceActivity extends LiveActivity { JSONObject item = (JSONObject) o; List giftlist = JSONArray.parseArray(item.getJSONArray("giftlist").toJSONString(), LiveGiftBean.class); for (LiveGiftBean bean : giftlist) { - if (bean!=null&&!bean.getSwf().isEmpty()) { + if (bean != null && !bean.getSwf().isEmpty()) { giftBeanList.add(bean); } } @@ -1594,7 +1594,7 @@ public class LiveAudienceActivity extends LiveActivity { @SuppressLint("SetTextI18n") public void showMsgRed(int num) { - if (manager == null) { + if (manager == null || manager.mLiveAudienceViewHolder == null || manager.mLiveAudienceViewHolder.mRedPoint == null) { return; } if (num == -1) { @@ -1605,10 +1605,14 @@ public class LiveAudienceActivity extends LiveActivity { } manager.mLiveAudienceViewHolder.mRedPoint.setVisibility(View.VISIBLE); } - public void setShowCrownRed(boolean isShow){ - if(isShow){ + + public void setShowCrownRed(boolean isShow) { + if (manager == null || manager.mLiveAudienceViewHolder == null || manager.mLiveAudienceViewHolder.mRedPointPrivilege == null) { + return; + } + if (isShow) { manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE); - }else{ + } else { manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.GONE); } }