From 9707898af9c331d814ad2b4879d22a885ff0387e Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sat, 8 Apr 2023 15:45:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E9=97=B4UI=20=E4=BF=AE=E5=A4=8D=E5=BF=83=E6=84=BF=E5=8D=95?= =?UTF-8?q?=E6=B5=AE=E7=AA=97=E4=B8=80=E5=A0=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shayu/phonelive/AppContext.java | 33 ++++++++++++------- .../com/shayu/phonelive/NeverCrashUtils.java | 23 +++++++------ .../common/http/live/LiveNetManager.java | 1 + .../com/yunbao/common/utils/AppManager.java | 11 +++++++ .../presenter/LiveRoomCheckLivePresenter.java | 3 ++ .../yunbao/live/views/LiveRoomViewHolder.java | 6 +++- .../live/views/PortraitLiveManager.java | 32 +++++++++++++++--- .../layout/view_live_top_banner_call_me.xml | 2 +- 8 files changed, 84 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 31fefcb5f..3783dfb0d 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -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 : activities) { - if (activity != null && activity.get() != null) { - activity.get().finish(); + AppManager.runDebugCode(()->{ + //闪退后finish所有Activity并且杀死进程 + for (WeakReference 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会打印异常信息 diff --git a/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java b/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java index 5e7fecaa1..e3593332a 100644 --- a/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java +++ b/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java @@ -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); diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 12e846038..fa80df2a6 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -371,6 +371,7 @@ public class LiveNetManager { }, new Consumer() { @Override public void accept(Throwable throwable) throws Exception { + Log.e("异常", "checkLive: ",throwable); if (callBack != null) { callBack.onError(throwable.getMessage()); } diff --git a/common/src/main/java/com/yunbao/common/utils/AppManager.java b/common/src/main/java/com/yunbao/common/utils/AppManager.java index 95f7d5a83..5bda4db57 100644 --- a/common/src/main/java/com/yunbao/common/utils/AppManager.java +++ b/common/src/main/java/com/yunbao/common/utils/AppManager.java @@ -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(); + } + } + /** * 退出应用程序 diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java index eb3670fe7..3a2cebade 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java @@ -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); diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 438f2528d..839cc3f58 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -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); } diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 56bc0d7c7..bcdb921ee 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -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()); diff --git a/live/src/main/res/layout/view_live_top_banner_call_me.xml b/live/src/main/res/layout/view_live_top_banner_call_me.xml index b9298a2e5..caf9e2661 100644 --- a/live/src/main/res/layout/view_live_top_banner_call_me.xml +++ b/live/src/main/res/layout/view_live_top_banner_call_me.xml @@ -7,7 +7,7 @@ Date: Sat, 8 Apr 2023 16:11:41 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=BA=A2=E7=82=B9=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/activity/LiveAudienceActivity.java | 39 ++++++++++++++++++- .../adapter/LiveUserAnchorMailBoxAdapter.java | 18 ++++++++- .../LiveUserAnchorMailBoxPopDialog.java | 6 ++- ...LiveUserAnchorMailBoxWebInfoPopDialog.java | 13 ++++++- 4 files changed, 70 insertions(+), 6 deletions(-) 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 cf0a289d3..fe3e1a885 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -48,6 +48,7 @@ import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserMailBoxModel; import com.yunbao.common.bean.SlideInfoModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.EffectsSettingsDialog; @@ -62,6 +63,7 @@ import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.main.MainNetManager; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; @@ -427,6 +429,7 @@ public class LiveAudienceActivity extends LiveActivity { bundle.putString(Constants.LIVE_UID, mLiveUid); bundle.putString(Constants.LIVE_STREAM, mStream); fragment.setArguments(bundle); + fragment.setOnDismissListener(dialog -> checkMsgRed()); fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment"); }); } @@ -443,6 +446,7 @@ public class LiveAudienceActivity extends LiveActivity { bundle.putString(Constants.LIVE_STREAM, mStream); bundle.putString(Constants.LIVE_WISH_GIFTID, giftId); fragment.setArguments(bundle); + fragment.setOnDismissListener(dialog -> checkMsgRed()); fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment"); } @@ -462,6 +466,7 @@ public class LiveAudienceActivity extends LiveActivity { bundle.putString("by", "1"); } fragment.setArguments(bundle); + fragment.setOnDismissListener(dialog -> checkMsgRed()); fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment"); }); @@ -986,6 +991,7 @@ public class LiveAudienceActivity extends LiveActivity { bundle.putString(Constants.LIVE_UID, mLiveUid); bundle.putString(Constants.LIVE_STREAM, mStream); liveGiftDialogFragment.setArguments(bundle); + liveGiftDialogFragment.setOnDismissListener(dialog -> checkMsgRed()); liveGiftDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment"); break; case CURRENT_ACTIVITY: @@ -1298,7 +1304,7 @@ public class LiveAudienceActivity extends LiveActivity { break; case WISH_LIST_PROGRESS: if (manager != null) { - manager.wishListProgress(event.getWishListProgress(), event.getUname(),event.getLiveType()); + manager.wishListProgress(event.getWishListProgress(), event.getUname(), event.getLiveType()); } break; case XYD_COMPLETE: @@ -1467,5 +1473,36 @@ public class LiveAudienceActivity extends LiveActivity { } + /** + * 检查消息,有未读就要显示红点 + */ + private void checkMsgRed() { + LiveNetManager.get(mContext) + .getContactMsg(new com.yunbao.common.http.base.HttpCallback>() { + @Override + public void onSuccess(List data) { + Log.i(TAG, "onSuccess: " + data.size()); + for (LiveUserMailBoxModel datum : data) { + Log.i(TAG, "for data : " + datum); + } + setData(data); + } + @Override + public void onError(String error) { + Log.e(TAG, "onError: " + error); + setData(new ArrayList<>()); + } + + void setData(List data) { + for (LiveUserMailBoxModel model : data) { + if (model.getIsRead() == 0) { + showMsgRed(0); + return; + } + } + showMsgRed(-1); + } + }); + } } diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java index 9503f63fb..825ae16bf 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java @@ -2,6 +2,7 @@ package com.yunbao.live.adapter; import android.app.Dialog; import android.content.Context; +import android.content.DialogInterface; import android.os.Build; import android.util.Log; import android.view.LayoutInflater; @@ -30,6 +31,7 @@ public class LiveUserAnchorMailBoxAdapter extends RecyclerView.Adapter list; OnItemClickListener onItemClickListener; + DialogInterface.OnDismissListener onWebDismissListener; public LiveUserAnchorMailBoxAdapter(Context mContext) { this.mContext = mContext; @@ -49,6 +51,11 @@ public class LiveUserAnchorMailBoxAdapter extends RecyclerView.Adapter { + if (onWebDismissListener != null) { + onWebDismissListener.onDismiss(dialog); + } + }) + .showDialog(); + if (onItemClickListener != null) { + onItemClickListener.onItemClick(box, 0); + } } } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxPopDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxPopDialog.java index 1b15d422d..6ef819417 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxPopDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxPopDialog.java @@ -1,6 +1,7 @@ package com.yunbao.live.dialog; import android.content.Context; +import android.content.DialogInterface; import android.util.Log; import android.view.View; @@ -58,6 +59,7 @@ public class LiveUserAnchorMailBoxPopDialog extends AbsDialogPopupWindow { list.setVisibility(GONE); } }); + adapter.setOnWebDismissListener(dialog -> initData()); initData(); } @@ -96,8 +98,8 @@ public class LiveUserAnchorMailBoxPopDialog extends AbsDialogPopupWindow { protected void onDismiss() { super.onDismiss(); for (LiveUserMailBoxModel model : adapter.getList()) { - if(model.getIsRead()==0){ - return; + if (model.getIsRead() == 0) { + return; } } Bus.get().post(new LiveAudienceEvent() diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxWebInfoPopDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxWebInfoPopDialog.java index 807d50fa5..4543e2f9b 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxWebInfoPopDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxWebInfoPopDialog.java @@ -1,6 +1,7 @@ package com.yunbao.live.dialog; import android.content.Context; +import android.content.DialogInterface; import android.os.Build; import android.webkit.WebSettings; import android.webkit.WebView; @@ -10,7 +11,6 @@ import android.widget.TextView; import androidx.annotation.NonNull; import com.lxj.xpopup.XPopup; -import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.dialog.AbsDialogPopupWindow; import com.yunbao.common.event.JavascriptInterfaceEvent; @@ -29,6 +29,7 @@ public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow String anchorName; String url; + DialogInterface.OnDismissListener dismissListener; public LiveUserAnchorMailBoxWebInfoPopDialog(@NonNull Context context) { super(context); @@ -45,6 +46,11 @@ public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow } + public LiveUserAnchorMailBoxWebInfoPopDialog setOnDismissListener(DialogInterface.OnDismissListener dismissListener) { + this.dismissListener = dismissListener; + return this; + } + @Override public int bindLayoutId() { return R.layout.dialog_live_user_mailbox_web; @@ -58,7 +64,7 @@ public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow textView = findViewById(R.id.title); textView.setText(String.format(WordUtil.getString(R.string.live_user_mailbox_web_title), anchorName)); mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance() - .setDialogClose(true) + .setDialogClose(true) .setmContext(CommonAppContext.getTopActivity(), mWebView), "androidObject"); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); @@ -92,6 +98,9 @@ public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow public void dismiss() { super.dismiss(); Bus.getOff(this); + if(dismissListener!=null) { + dismissListener.onDismiss(null); + } } @Subscribe(threadMode = ThreadMode.MAIN) From f76d6492333585864400482c59e3e11fc4c82a53 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sat, 8 Apr 2023 16:20:43 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=81=94=E7=B3=BB?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E6=B5=AE=E6=A0=87UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- live/src/main/res/layout/view_live_top_banner_call_me.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/live/src/main/res/layout/view_live_top_banner_call_me.xml b/live/src/main/res/layout/view_live_top_banner_call_me.xml index caf9e2661..c1ec92d48 100644 --- a/live/src/main/res/layout/view_live_top_banner_call_me.xml +++ b/live/src/main/res/layout/view_live_top_banner_call_me.xml @@ -35,7 +35,7 @@ android:paddingBottom="2dp" android:text="@string/live_ready_anchor_call_me" android:textColor="@color/white" - android:textSize="10sp" + android:textSize="8sp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/svga" /> From b44524b25fefb7c239a269c4d7253203af95ac89 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sat, 8 Apr 2023 16:27:33 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A5=B3=E7=A5=9E?= =?UTF-8?q?=E8=AF=B4=E4=B8=8D=E9=9A=90=E8=97=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java | 1 + live/src/main/res/layout/view_live_room.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 839cc3f58..6b9cb1cd3 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1512,6 +1512,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mPkRankTopIcon.setVisibility(View.GONE); mAnchorLayout.setBackgroundResource(R.drawable.bg_live_ico); mGoodNumberIcon.setVisibility(View.GONE); + mAnchorSay.setVisibility(View.INVISIBLE); } /** diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 3c315a548..51c32a909 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -1301,7 +1301,7 @@ android:layout_marginStart="5dp" android:layout_marginBottom="-30dp" android:background="@color/white" - android:visibility="visible" /> + android:visibility="invisible" /> Date: Sat, 8 Apr 2023 16:42:43 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=BF=83=E6=84=BF=E5=8D=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common/bean/XydCompleteModel.java | 12 ++++- .../live/activity/LiveAudienceActivity.java | 2 +- .../yunbao/live/event/LiveAudienceEvent.java | 11 +++++ .../live/presenter/LiveGiftAnimPresenter.java | 4 +- .../yunbao/live/socket/SocketRyClient.java | 3 +- .../yunbao/live/views/LiveRoomViewHolder.java | 49 +++---------------- .../live/views/PortraitLiveManager.java | 4 +- live/src/main/res/layout/view_live_room.xml | 10 ++-- 8 files changed, 39 insertions(+), 56 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/bean/XydCompleteModel.java b/common/src/main/java/com/yunbao/common/bean/XydCompleteModel.java index b21383f87..6155afba4 100644 --- a/common/src/main/java/com/yunbao/common/bean/XydCompleteModel.java +++ b/common/src/main/java/com/yunbao/common/bean/XydCompleteModel.java @@ -1,6 +1,5 @@ package com.yunbao.common.bean; -import com.google.gson.Gson; import com.google.gson.annotations.SerializedName; public class XydCompleteModel extends BaseModel { @@ -64,6 +63,17 @@ public class XydCompleteModel extends BaseModel { private String equipment; @SerializedName("bubble") private String bubble; + @SerializedName("xydgiftname") + private String xydgiftname; + + public String getXydgiftname() { + return xydgiftname; + } + + public XydCompleteModel setXydgiftname(String xydgiftname) { + this.xydgiftname = xydgiftname; + return this; + } public String getMethod() { return method; 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 fe3e1a885..cadaa3f2c 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -1309,7 +1309,7 @@ public class LiveAudienceActivity extends LiveActivity { break; case XYD_COMPLETE: if (manager != null) { - manager.showXydComplete(event.getXydCompleteModel()); + manager.showXydComplete(event.getXydCompleteModel(), event.getLiveReceiveGiftBean()); } break; diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 8b065d7ec..e1ed47740 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -11,6 +11,7 @@ import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.live.bean.LivePKUserListBean; +import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.OpenParametersModel; public class LiveAudienceEvent extends BaseModel { @@ -39,6 +40,16 @@ public class LiveAudienceEvent extends BaseModel { private String uname; private WishModel wishListProgress; private XydCompleteModel xydCompleteModel; + private LiveReceiveGiftBean liveReceiveGiftBean; + + public LiveReceiveGiftBean getLiveReceiveGiftBean() { + return liveReceiveGiftBean; + } + + public LiveAudienceEvent setLiveReceiveGiftBean(LiveReceiveGiftBean liveReceiveGiftBean) { + this.liveReceiveGiftBean = liveReceiveGiftBean; + return this; + } public XydCompleteModel getXydCompleteModel() { return xydCompleteModel; diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index c7bf249b4..9d03bcd4f 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -287,7 +287,7 @@ public class LiveGiftAnimPresenter { } public ConcurrentLinkedQueue getmQueue() { - return mQueue; + return mGifQueue; } private void downLoadIconGifCallback() { @@ -1074,7 +1074,7 @@ public class LiveGiftAnimPresenter { /** * 显示gif礼物 比如油纸伞 */ - private void showGifGift(final LiveReceiveGiftBean bean) { + public void showGifGift(final LiveReceiveGiftBean bean) { String url = bean.getGifUrl(); diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index 8879a2222..2c4dd2482 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -602,7 +602,8 @@ public class SocketRyClient { XydCompleteModel xydCompleteModel = GsonUtils.fromJson(map.toString(), XydCompleteModel.class); EventBus.getDefault().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.XYD_COMPLETE) - .setXydCompleteModel(xydCompleteModel)); + .setXydCompleteModel(xydCompleteModel) + .setLiveReceiveGiftBean(JSON.parseObject(map.toString(), LiveReceiveGiftBean.class))); break; case Constants.WISH_LIST_PROGRESS: StringBuffer conString = new StringBuffer(); diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 6b9cb1cd3..deb32880f 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -353,7 +353,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private ImageView mAnchorSayHide; //----!主播说组件---// private Banner topBanner1;//心愿单&联系方式 - private SVGAImageView xydSvg; public SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow; @Subscribe(threadMode = ThreadMode.MAIN) @@ -580,17 +579,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } - private Runnable xydCompleteRunnable = new Runnable() { - @Override - public void run() { - xydSvg.setVisibility(View.GONE); - if (xydCompleteModels.size() > 0) - showXydComplete(xydCompleteModels.get(0), true); - } - }; List xydCompleteModels = new ArrayList<>(); - public synchronized void showXydComplete(XydCompleteModel model, boolean isRunble) { + public synchronized void showXydComplete(XydCompleteModel model, boolean isRunble, LiveReceiveGiftBean liveReceiveGiftBean) { if (model.getLiveId().equals(mLiveUid)) { if (!isRunble) { @@ -598,43 +589,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis bean.setContent(model.getMsg()); bean.setUserNiceName(model.getUserName()); - bean.setAtUserName(model.getGiftname()) + bean.setAtUserName(model.getXydgiftname()) .setLevel(model.getLevel()); bean.setType(LiveChatBean.XYD_COMPLETE); mLiveChatAdapter.insertItem(bean); xydCompleteModels.add(model); } - - if (mLiveGiftAnimPresenter != null && mLiveGiftAnimPresenter.getmQueue().size() > 0) { - new Handler().postDelayed(xydCompleteRunnable, 1000); - } else { - try { - xydSvg.setLoops(1); - xydSvg.setVisibility(View.VISIBLE); - new SVGAParser(Contexts).parse(new URL(model.getSvg()), new SVGAParser.ParseCompletion() { - @Override - public void onComplete(SVGAVideoEntity videoItem) { - SVGADrawable drawable = new SVGADrawable(videoItem); - xydSvg.setImageDrawable(drawable); - - SVGAViewUtils.playEndClear(xydSvg); - - } - - @Override - public void onError() { - } - - }); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - - if (xydCompleteModels.size() > 0) { - xydCompleteModels.remove(0); - new Handler().postDelayed(xydCompleteRunnable, 1000); - } + if (mLiveGiftAnimPresenter == null) { + mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager); } + liveReceiveGiftBean.setGiftId(liveReceiveGiftBean.getGiftName()); + mLiveGiftAnimPresenter.showGifGift(liveReceiveGiftBean); + } } @@ -1422,7 +1388,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis new LoadDian9TuUtil().loadDian9TuAssets2(mContext, liveWksLayout, "rectangle_new.png", 1); new LoadDian9TuUtil().loadDian9TuAssets2(mContext, wishListLayout2, "rectangle_new.png", 1); - xydSvg = (SVGAImageView) findViewById(R.id.xyd_svg); } /** diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index bcdb921ee..1ee7a16c8 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -1980,9 +1980,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } - public void showXydComplete(XydCompleteModel model) { + public void showXydComplete(XydCompleteModel model, LiveReceiveGiftBean liveReceiveGiftBean) { if (mLiveRoomViewHolder != null) { - mLiveRoomViewHolder.showXydComplete(model, false); + mLiveRoomViewHolder.showXydComplete(model, false,liveReceiveGiftBean); } } } diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 51c32a909..4b173dd33 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -701,8 +701,8 @@ android:layout_width="52dp" android:layout_height="76dp" android:layout_below="@+id/live_rank_pk" - android:layout_marginTop="20dp" android:layout_alignParentRight="true" + android:layout_marginTop="20dp" android:layout_marginRight="5dp" app:delay_time="5000" app:indicator_height="8dp" @@ -2355,12 +2355,6 @@ android:layout_marginTop="60dp" android:visibility="gone" /> - + + \ No newline at end of file From 2ce527cee83d857447526374da1f8265aa6efa02 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Sat, 8 Apr 2023 17:26:39 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=BF=83=E6=84=BF=E5=8D=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/res/layout/view_live_new_wish.xml | 33 ++++++++++++++----- common/src/main/res/values-en/strings.xml | 1 + common/src/main/res/values/strings.xml | 1 + .../yunbao/live/views/LiveRoomViewHolder.java | 6 ++-- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/common/src/main/res/layout/view_live_new_wish.xml b/common/src/main/res/layout/view_live_new_wish.xml index b4fb1b7b1..7a3635f6c 100644 --- a/common/src/main/res/layout/view_live_new_wish.xml +++ b/common/src/main/res/layout/view_live_new_wish.xml @@ -4,15 +4,32 @@ android:layout_height="match_parent" android:orientation="vertical"> - + android:layout_height="117dp"> + + + + + + + Play setting language setting Traditional Chinese + Add gifts, nobles, and guardian wishes diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index d7ef14ef8..58c751518 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1116,5 +1116,6 @@ 播放設置 語言設定 繁體中文 + 添加禮物、貴族、守護心願 diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index deb32880f..ef3e07c6e 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1899,11 +1899,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (flipper.getChildCount() > 0) { flipper.removeAllViews(); } - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(13), DpUtil.dp2px(13)); - params.leftMargin = DpUtil.dp2px(6); - params.rightMargin = DpUtil.dp2px(2); + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16)); LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - textParams.leftMargin = DpUtil.dp2px(2); + textParams.leftMargin = DpUtil.dp2px(5); View hotView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); ImageView hotPic = hotView.findViewById(R.id.wish_pic);