Merge remote-tracking branch 'origin/master'

This commit is contained in:
18142669586 2023-04-08 17:29:36 +08:00
commit 9e7909ec70
20 changed files with 225 additions and 103 deletions

View File

@ -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();
AppManager.runDebugCode(()->{
//闪退后finish所有Activity并且杀死进程 //闪退后finish所有Activity并且杀死进程
/* for (WeakReference<Activity> activity : activities) { for (WeakReference<Activity> activity : activities) {
if (activity != null && activity.get() != null) { if (activity != null && activity.get() != null) {
activity.get().finish(); 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会打印异常信息

View File

@ -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,11 +105,11 @@ 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);
AppManager.runDebugCode(() -> errorWhile = false);
// return; // 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);

View File

@ -1,6 +1,5 @@
package com.yunbao.common.bean; package com.yunbao.common.bean;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
public class XydCompleteModel extends BaseModel { public class XydCompleteModel extends BaseModel {
@ -64,6 +63,17 @@ public class XydCompleteModel extends BaseModel {
private String equipment; private String equipment;
@SerializedName("bubble") @SerializedName("bubble")
private String 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() { public String getMethod() {
return method; return method;

View File

@ -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());
} }

View File

@ -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();
}
}
/** /**
* 退出应用程序 * 退出应用程序

View File

@ -4,16 +4,33 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="117dp">
<ImageView <ImageView
android:id="@+id/imageView2" android:id="@+id/imageView2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="117dp" android:layout_height="117dp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:background="@drawable/bg_xyd_add_item"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:background="@drawable/bg_xyd_add_item"
android:scaleType="centerInside" /> android:scaleType="centerInside" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="95dp"
android:layout_marginTop="60dp"
android:text="@string/add_gift2"
android:textColor="#4223CD"
android:textSize="16sp"
android:textStyle="bold" />
</FrameLayout>
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">

View File

@ -1118,4 +1118,5 @@ Limited ride And limited avatar frame</string>
<string name="live_play_setting">Play setting</string> <string name="live_play_setting">Play setting</string>
<string name="live_language_setting">language setting</string> <string name="live_language_setting">language setting</string>
<string name="traditional_chinese">Traditional Chinese</string> <string name="traditional_chinese">Traditional Chinese</string>
<string name="add_gift2">Add gifts, nobles, and guardian wishes</string>
</resources> </resources>

View File

@ -1116,5 +1116,6 @@
<string name="live_play_setting">播放設置</string> <string name="live_play_setting">播放設置</string>
<string name="live_language_setting">語言設定</string> <string name="live_language_setting">語言設定</string>
<string name="traditional_chinese">繁體中文</string> <string name="traditional_chinese">繁體中文</string>
<string name="add_gift2">添加禮物、貴族、守護心願</string>
</resources> </resources>

View File

@ -48,6 +48,7 @@ import com.yunbao.common.bean.LinkMicUserBean;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.LiveUserGiftBean;
import com.yunbao.common.bean.LiveUserMailBoxModel;
import com.yunbao.common.bean.SlideInfoModel; import com.yunbao.common.bean.SlideInfoModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.EffectsSettingsDialog; 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.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; 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.main.MainNetManager; import com.yunbao.common.http.main.MainNetManager;
import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager; 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_UID, mLiveUid);
bundle.putString(Constants.LIVE_STREAM, mStream); bundle.putString(Constants.LIVE_STREAM, mStream);
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.setOnDismissListener(dialog -> checkMsgRed());
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment"); 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_STREAM, mStream);
bundle.putString(Constants.LIVE_WISH_GIFTID, giftId); bundle.putString(Constants.LIVE_WISH_GIFTID, giftId);
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.setOnDismissListener(dialog -> checkMsgRed());
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment"); fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
} }
@ -462,6 +466,7 @@ public class LiveAudienceActivity extends LiveActivity {
bundle.putString("by", "1"); bundle.putString("by", "1");
} }
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.setOnDismissListener(dialog -> checkMsgRed());
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment"); 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_UID, mLiveUid);
bundle.putString(Constants.LIVE_STREAM, mStream); bundle.putString(Constants.LIVE_STREAM, mStream);
liveGiftDialogFragment.setArguments(bundle); liveGiftDialogFragment.setArguments(bundle);
liveGiftDialogFragment.setOnDismissListener(dialog -> checkMsgRed());
liveGiftDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment"); liveGiftDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
break; break;
case CURRENT_ACTIVITY: case CURRENT_ACTIVITY:
@ -1298,12 +1304,12 @@ public class LiveAudienceActivity extends LiveActivity {
break; break;
case WISH_LIST_PROGRESS: case WISH_LIST_PROGRESS:
if (manager != null) { if (manager != null) {
manager.wishListProgress(event.getWishListProgress(), event.getUname(),event.getLiveType()); manager.wishListProgress(event.getWishListProgress(), event.getUname(), event.getLiveType());
} }
break; break;
case XYD_COMPLETE: case XYD_COMPLETE:
if (manager != null) { if (manager != null) {
manager.showXydComplete(event.getXydCompleteModel()); manager.showXydComplete(event.getXydCompleteModel(), event.getLiveReceiveGiftBean());
} }
break; break;
@ -1467,5 +1473,36 @@ public class LiveAudienceActivity extends LiveActivity {
} }
/**
* 检查消息有未读就要显示红点
*/
private void checkMsgRed() {
LiveNetManager.get(mContext)
.getContactMsg(new com.yunbao.common.http.base.HttpCallback<List<LiveUserMailBoxModel>>() {
@Override
public void onSuccess(List<LiveUserMailBoxModel> 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<LiveUserMailBoxModel> data) {
for (LiveUserMailBoxModel model : data) {
if (model.getIsRead() == 0) {
showMsgRed(0);
return;
}
}
showMsgRed(-1);
}
});
}
} }

View File

@ -2,6 +2,7 @@ package com.yunbao.live.adapter;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.os.Build; import android.os.Build;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -30,6 +31,7 @@ public class LiveUserAnchorMailBoxAdapter extends RecyclerView.Adapter<LiveUserA
private Context mContext; private Context mContext;
private List<LiveUserMailBoxModel> list; private List<LiveUserMailBoxModel> list;
OnItemClickListener<LiveUserMailBoxModel> onItemClickListener; OnItemClickListener<LiveUserMailBoxModel> onItemClickListener;
DialogInterface.OnDismissListener onWebDismissListener;
public LiveUserAnchorMailBoxAdapter(Context mContext) { public LiveUserAnchorMailBoxAdapter(Context mContext) {
this.mContext = mContext; this.mContext = mContext;
@ -49,6 +51,11 @@ public class LiveUserAnchorMailBoxAdapter extends RecyclerView.Adapter<LiveUserA
this.onItemClickListener = onItemClickListener; this.onItemClickListener = onItemClickListener;
} }
public LiveUserAnchorMailBoxAdapter setOnWebDismissListener(DialogInterface.OnDismissListener onWebDismissListener) {
this.onWebDismissListener = onWebDismissListener;
return this;
}
@NonNull @NonNull
@Override @Override
public MailBoxViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public MailBoxViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -129,7 +136,16 @@ public class LiveUserAnchorMailBoxAdapter extends RecyclerView.Adapter<LiveUserA
@Override @Override
public void onClick(View v) { public void onClick(View v) {
new LiveUserAnchorMailBoxWebInfoPopDialog(mContext, box.getAnchorName(), box.getUrl()).showDialog(); new LiveUserAnchorMailBoxWebInfoPopDialog(mContext, box.getAnchorName(), box.getUrl())
.setOnDismissListener(dialog -> {
if (onWebDismissListener != null) {
onWebDismissListener.onDismiss(dialog);
}
})
.showDialog();
if (onItemClickListener != null) {
onItemClickListener.onItemClick(box, 0);
}
} }
} }
} }

View File

@ -1,6 +1,7 @@
package com.yunbao.live.dialog; package com.yunbao.live.dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@ -58,6 +59,7 @@ public class LiveUserAnchorMailBoxPopDialog extends AbsDialogPopupWindow {
list.setVisibility(GONE); list.setVisibility(GONE);
} }
}); });
adapter.setOnWebDismissListener(dialog -> initData());
initData(); initData();
} }
@ -96,7 +98,7 @@ public class LiveUserAnchorMailBoxPopDialog extends AbsDialogPopupWindow {
protected void onDismiss() { protected void onDismiss() {
super.onDismiss(); super.onDismiss();
for (LiveUserMailBoxModel model : adapter.getList()) { for (LiveUserMailBoxModel model : adapter.getList()) {
if(model.getIsRead()==0){ if (model.getIsRead() == 0) {
return; return;
} }
} }

View File

@ -1,6 +1,7 @@
package com.yunbao.live.dialog; package com.yunbao.live.dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.os.Build; import android.os.Build;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
@ -10,7 +11,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext; import com.yunbao.common.CommonAppContext;
import com.yunbao.common.dialog.AbsDialogPopupWindow; import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.event.JavascriptInterfaceEvent; import com.yunbao.common.event.JavascriptInterfaceEvent;
@ -29,6 +29,7 @@ public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow
String anchorName; String anchorName;
String url; String url;
DialogInterface.OnDismissListener dismissListener;
public LiveUserAnchorMailBoxWebInfoPopDialog(@NonNull Context context) { public LiveUserAnchorMailBoxWebInfoPopDialog(@NonNull Context context) {
super(context); super(context);
@ -45,6 +46,11 @@ public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow
} }
public LiveUserAnchorMailBoxWebInfoPopDialog setOnDismissListener(DialogInterface.OnDismissListener dismissListener) {
this.dismissListener = dismissListener;
return this;
}
@Override @Override
public int bindLayoutId() { public int bindLayoutId() {
return R.layout.dialog_live_user_mailbox_web; return R.layout.dialog_live_user_mailbox_web;
@ -92,6 +98,9 @@ public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow
public void dismiss() { public void dismiss() {
super.dismiss(); super.dismiss();
Bus.getOff(this); Bus.getOff(this);
if(dismissListener!=null) {
dismissListener.onDismiss(null);
}
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)

View File

@ -11,6 +11,7 @@ import com.yunbao.common.bean.WishModel;
import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.bean.XydCompleteModel;
import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.bean.LiveReceiveGiftBean;
import com.yunbao.live.bean.OpenParametersModel; import com.yunbao.live.bean.OpenParametersModel;
public class LiveAudienceEvent extends BaseModel { public class LiveAudienceEvent extends BaseModel {
@ -39,6 +40,16 @@ public class LiveAudienceEvent extends BaseModel {
private String uname; private String uname;
private WishModel wishListProgress; private WishModel wishListProgress;
private XydCompleteModel xydCompleteModel; private XydCompleteModel xydCompleteModel;
private LiveReceiveGiftBean liveReceiveGiftBean;
public LiveReceiveGiftBean getLiveReceiveGiftBean() {
return liveReceiveGiftBean;
}
public LiveAudienceEvent setLiveReceiveGiftBean(LiveReceiveGiftBean liveReceiveGiftBean) {
this.liveReceiveGiftBean = liveReceiveGiftBean;
return this;
}
public XydCompleteModel getXydCompleteModel() { public XydCompleteModel getXydCompleteModel() {
return xydCompleteModel; return xydCompleteModel;

View File

@ -287,7 +287,7 @@ public class LiveGiftAnimPresenter {
} }
public ConcurrentLinkedQueue<LiveReceiveGiftBean> getmQueue() { public ConcurrentLinkedQueue<LiveReceiveGiftBean> getmQueue() {
return mQueue; return mGifQueue;
} }
private void downLoadIconGifCallback() { private void downLoadIconGifCallback() {
@ -1074,7 +1074,7 @@ public class LiveGiftAnimPresenter {
/** /**
* 显示gif礼物 比如油纸伞 * 显示gif礼物 比如油纸伞
*/ */
private void showGifGift(final LiveReceiveGiftBean bean) { public void showGifGift(final LiveReceiveGiftBean bean) {
String url = bean.getGifUrl(); String url = bean.getGifUrl();

View File

@ -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);

View File

@ -602,7 +602,8 @@ public class SocketRyClient {
XydCompleteModel xydCompleteModel = GsonUtils.fromJson(map.toString(), XydCompleteModel.class); XydCompleteModel xydCompleteModel = GsonUtils.fromJson(map.toString(), XydCompleteModel.class);
EventBus.getDefault().post(new LiveAudienceEvent() EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.XYD_COMPLETE) .setType(LiveAudienceEvent.LiveAudienceType.XYD_COMPLETE)
.setXydCompleteModel(xydCompleteModel)); .setXydCompleteModel(xydCompleteModel)
.setLiveReceiveGiftBean(JSON.parseObject(map.toString(), LiveReceiveGiftBean.class)));
break; break;
case Constants.WISH_LIST_PROGRESS: case Constants.WISH_LIST_PROGRESS:
StringBuffer conString = new StringBuffer(); StringBuffer conString = new StringBuffer();

View File

@ -353,7 +353,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private ImageView mAnchorSayHide; private ImageView mAnchorSayHide;
//----!主播说组件---// //----!主播说组件---//
private Banner topBanner1;//心愿单&联系方式 private Banner topBanner1;//心愿单&联系方式
private SVGAImageView xydSvg;
public SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow; public SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow;
@Subscribe(threadMode = ThreadMode.MAIN) @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<XydCompleteModel> xydCompleteModels = new ArrayList<>(); List<XydCompleteModel> 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 (model.getLiveId().equals(mLiveUid)) {
if (!isRunble) { if (!isRunble) {
@ -598,43 +589,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
bean.setContent(model.getMsg()); bean.setContent(model.getMsg());
bean.setUserNiceName(model.getUserName()); bean.setUserNiceName(model.getUserName());
bean.setAtUserName(model.getGiftname()) bean.setAtUserName(model.getXydgiftname())
.setLevel(model.getLevel()); .setLevel(model.getLevel());
bean.setType(LiveChatBean.XYD_COMPLETE); bean.setType(LiveChatBean.XYD_COMPLETE);
mLiveChatAdapter.insertItem(bean); mLiveChatAdapter.insertItem(bean);
xydCompleteModels.add(model); xydCompleteModels.add(model);
} }
if (mLiveGiftAnimPresenter == null) {
if (mLiveGiftAnimPresenter != null && mLiveGiftAnimPresenter.getmQueue().size() > 0) { mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager);
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);
} }
liveReceiveGiftBean.setGiftId(liveReceiveGiftBean.getGiftName());
mLiveGiftAnimPresenter.showGifGift(liveReceiveGiftBean);
@Override
public void onError() {
}
});
} catch (MalformedURLException e) {
e.printStackTrace();
}
if (xydCompleteModels.size() > 0) {
xydCompleteModels.remove(0);
new Handler().postDelayed(xydCompleteRunnable, 1000);
}
}
} }
} }
@ -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, liveWksLayout, "rectangle_new.png", 1);
new LoadDian9TuUtil().loadDian9TuAssets2(mContext, wishListLayout2, "rectangle_new.png", 1); new LoadDian9TuUtil().loadDian9TuAssets2(mContext, wishListLayout2, "rectangle_new.png", 1);
xydSvg = (SVGAImageView) findViewById(R.id.xyd_svg);
} }
/** /**
@ -1512,6 +1477,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mPkRankTopIcon.setVisibility(View.GONE); mPkRankTopIcon.setVisibility(View.GONE);
mAnchorLayout.setBackgroundResource(R.drawable.bg_live_ico); mAnchorLayout.setBackgroundResource(R.drawable.bg_live_ico);
mGoodNumberIcon.setVisibility(View.GONE); mGoodNumberIcon.setVisibility(View.GONE);
mAnchorSay.setVisibility(View.INVISIBLE);
} }
/** /**
@ -1933,11 +1899,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (flipper.getChildCount() > 0) { if (flipper.getChildCount() > 0) {
flipper.removeAllViews(); flipper.removeAllViews();
} }
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(13), DpUtil.dp2px(13)); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16));
params.leftMargin = DpUtil.dp2px(6);
params.rightMargin = DpUtil.dp2px(2);
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); 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 hotView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
View hourView = 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); ImageView hotPic = hotView.findViewById(R.id.wish_pic);
@ -4742,7 +4706,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");
if (mTopBannerList.size() == 1 || mTopBannerList.size() == 0) {
mTopBannerList.add(bannerBean); mTopBannerList.add(bannerBean);
} else {
mTopBannerList.set(1, bannerBean);
}
topBanner1.update(mTopBannerList); topBanner1.update(mTopBannerList);
} }

View File

@ -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);
if (topBannerHandler != null && topBannerRunnable != null) {
topBannerHandler.removeCallbacks(topBannerRunnable); 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());
@ -1956,9 +1980,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
} }
public void showXydComplete(XydCompleteModel model) { public void showXydComplete(XydCompleteModel model, LiveReceiveGiftBean liveReceiveGiftBean) {
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.showXydComplete(model, false); mLiveRoomViewHolder.showXydComplete(model, false,liveReceiveGiftBean);
} }
} }
} }

View File

@ -701,8 +701,8 @@
android:layout_width="52dp" android:layout_width="52dp"
android:layout_height="76dp" android:layout_height="76dp"
android:layout_below="@+id/live_rank_pk" android:layout_below="@+id/live_rank_pk"
android:layout_marginTop="20dp"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginTop="20dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
app:delay_time="5000" app:delay_time="5000"
app:indicator_height="8dp" app:indicator_height="8dp"
@ -1301,7 +1301,7 @@
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginBottom="-30dp" android:layout_marginBottom="-30dp"
android:background="@color/white" android:background="@color/white"
android:visibility="visible" /> android:visibility="invisible" />
<ImageView <ImageView
@ -2355,12 +2355,6 @@
android:layout_marginTop="60dp" android:layout_marginTop="60dp"
android:visibility="gone" /> android:visibility="gone" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/xyd_svg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:visibility="gone" />
<com.opensource.svgaplayer.SVGAImageView <com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga_new_user_gif" android:id="@+id/svga_new_user_gif"
@ -2391,4 +2385,6 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginTop="80dp" android:layout_marginTop="80dp"
app:autoPlay="true" /> app:autoPlay="true" />
</RelativeLayout> </RelativeLayout>

View File

@ -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"
@ -35,7 +35,7 @@
android:paddingBottom="2dp" android:paddingBottom="2dp"
android:text="@string/live_ready_anchor_call_me" android:text="@string/live_ready_anchor_call_me"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="10sp" android:textSize="8sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/svga" /> app:layout_constraintTop_toBottomOf="@+id/svga" />