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.text.TextUtils;
import android.util.Log;
import android.os.Process;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -42,6 +43,7 @@ import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.utils.LiveImDeletUtil;
import com.yunbao.live.views.PortraitLiveManager;
@ -128,6 +130,12 @@ public class AppContext extends CommonAppContext {
if (!isMainProcess()) {
return;
}
AppManager.runDebugCode(new Runnable() {
@Override
public void run() {
ToastUtil.show("Debug代码");
}
});
CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis());
//注册全局异常捕获
registerError();
@ -280,18 +288,21 @@ public class AppContext extends CommonAppContext {
.setMainCrashHandler((t, e) -> {
Log.e("ApplicationError", "主线程异常");//此处log只是展示当debug为true时主类内部log会打印异常信息
e.printStackTrace();
//闪退后finish所有Activity并且杀死进程
/* for (WeakReference<Activity> activity : activities) {
if (activity != null && activity.get() != null) {
activity.get().finish();
AppManager.runDebugCode(()->{
//闪退后finish所有Activity并且杀死进程
for (WeakReference<Activity> activity : activities) {
if (activity != null && activity.get() != null) {
activity.get().finish();
}
}
}
*//* Process.killProcess(Process.myPid());
System.exit(0);*//*
setFirebaseCrashData();
new Handler(Looper.getMainLooper()).postDelayed(() -> {
throw new RuntimeException(e);
}, 100);*/
Process.killProcess(Process.myPid());
System.exit(0);
setFirebaseCrashData();
new Handler(Looper.getMainLooper()).postDelayed(() -> {
throw new RuntimeException(e);
}, 100);
});
})
.setUncaughtCrashHandler((t, e) -> {
Log.e("ApplicationError", "子线程异常");//此处log只是展示当debug为true时主类内部log会打印异常信息

View File

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

View File

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

View File

@ -371,6 +371,7 @@ public class LiveNetManager {
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
Log.e("异常", "checkLive: ",throwable);
if (callBack != null) {
callBack.onError(throwable.getMessage());
}

View File

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

View File

@ -4,15 +4,32 @@
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView2"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="117dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_xyd_add_item"
android:layout_marginBottom="4dp"
android:scaleType="centerInside" />
android:layout_height="117dp">
<ImageView
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="117dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="4dp"
android:background="@drawable/bg_xyd_add_item"
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
android:layout_width="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_language_setting">language setting</string>
<string name="traditional_chinese">Traditional Chinese</string>
<string name="add_gift2">Add gifts, nobles, and guardian wishes</string>
</resources>

View File

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

View File

@ -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,12 +1304,12 @@ 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:
if (manager != null) {
manager.showXydComplete(event.getXydCompleteModel());
manager.showXydComplete(event.getXydCompleteModel(), event.getLiveReceiveGiftBean());
}
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.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<LiveUserA
private Context mContext;
private List<LiveUserMailBoxModel> list;
OnItemClickListener<LiveUserMailBoxModel> onItemClickListener;
DialogInterface.OnDismissListener onWebDismissListener;
public LiveUserAnchorMailBoxAdapter(Context mContext) {
this.mContext = mContext;
@ -49,6 +51,11 @@ public class LiveUserAnchorMailBoxAdapter extends RecyclerView.Adapter<LiveUserA
this.onItemClickListener = onItemClickListener;
}
public LiveUserAnchorMailBoxAdapter setOnWebDismissListener(DialogInterface.OnDismissListener onWebDismissListener) {
this.onWebDismissListener = onWebDismissListener;
return this;
}
@NonNull
@Override
public MailBoxViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -129,7 +136,16 @@ public class LiveUserAnchorMailBoxAdapter extends RecyclerView.Adapter<LiveUserA
@Override
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;
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()

View File

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

View File

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

View File

@ -287,7 +287,7 @@ public class LiveGiftAnimPresenter {
}
public ConcurrentLinkedQueue<LiveReceiveGiftBean> 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();

View File

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

View File

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

View File

@ -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<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 (!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);
}
/**
@ -1512,6 +1477,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);
}
/**
@ -1933,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);
@ -4742,7 +4706,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);
}

View File

@ -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());
@ -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) {
mLiveRoomViewHolder.showXydComplete(model, false);
mLiveRoomViewHolder.showXydComplete(model, false,liveReceiveGiftBean);
}
}
}

View File

@ -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"
@ -1301,7 +1301,7 @@
android:layout_marginStart="5dp"
android:layout_marginBottom="-30dp"
android:background="@color/white"
android:visibility="visible" />
android:visibility="invisible" />
<ImageView
@ -2355,12 +2355,6 @@
android:layout_marginTop="60dp"
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
android:id="@+id/svga_new_user_gif"
@ -2391,4 +2385,6 @@
android:layout_gravity="center_vertical"
android:layout_marginTop="80dp"
app:autoPlay="true" />
</RelativeLayout>

View File

@ -7,7 +7,7 @@
<ImageView
android:id="@+id/imageView7"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_height="56dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
@ -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" />