Merge remote-tracking branch 'origin/master'

# Conflicts:
#	live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
This commit is contained in:
zlzw 2022-08-29 16:51:14 +08:00
commit 313309ba5d
7 changed files with 49 additions and 21 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:topLeftRadius="12dp" android:topRightRadius="12dp" /> <corners android:topLeftRadius="12dp" android:topRightRadius="12dp" />
<solid android:color="#333333" /> <solid android:color="#000" />
</shape> </shape>

View File

@ -10,9 +10,9 @@ ext {
manifestPlaceholders = [ manifestPlaceholders = [
// //
serverHost : "https://napi.yaoulive.com", // serverHost : "https://napi.yaoulive.com",
// //
// serverHost : "https://ceshi.yaoulive.com", serverHost : "https://ceshi.yaoulive.com",
// //
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",

View File

@ -418,6 +418,8 @@ public class LiveAudienceActivity extends LiveActivity {
} else if (Micing == 2) { } else if (Micing == 2) {
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal); manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
} else { } else {
manager.exitLiveRoom();
manager.onRemove();
super.onBackPressed(); super.onBackPressed();
} }
@ -438,6 +440,7 @@ public class LiveAudienceActivity extends LiveActivity {
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
Bus.getOff(this); Bus.getOff(this);
L.e("LiveAudienceActivity-------onDestroy------->"); L.e("LiveAudienceActivity-------onDestroy------->");
} }
@ -703,7 +706,7 @@ public class LiveAudienceActivity extends LiveActivity {
bundle.putString(Constants.LIVE_UID, mLiveUid); bundle.putString(Constants.LIVE_UID, mLiveUid);
fragment4Audience.setArguments(bundle); fragment4Audience.setArguments(bundle);
if (mContext instanceof LiveAudienceActivity) { if (mContext instanceof LiveAudienceActivity) {
fragment4Audience.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragmentAudience"); fragment4Audience.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragment4Audience");
} }
break; break;
case OPEN_PARAMETERS: case OPEN_PARAMETERS:

View File

@ -115,4 +115,8 @@ public class WishlistItemModel extends BaseModel {
this.wishlistProgress = wishlistProgress; this.wishlistProgress = wishlistProgress;
return this; return this;
} }
public String getWishlistNumP() {
return wishlistProgress + "/" + wishlistNum;
}
} }

View File

@ -116,7 +116,6 @@ import java.util.Random;
import pl.droidsonroids.gif.GifImageView; import pl.droidsonroids.gif.GifImageView;
import static com.blankj.utilcode.util.ActivityUtils.startActivity;
import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
@ -253,6 +252,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter; private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter;
private LiveUserGiftBean nowGuardUser; private LiveUserGiftBean nowGuardUser;
private ViewFlipper wishListFlipper;
private List<WishlistItemModel> wishlist = new ArrayList<>();
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
super(context, parentView); super(context, parentView);
@ -853,11 +854,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}); });
loadWishlistData(); loadWishlistData();
//打开活动窗口 //打开活动窗口
ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", ""))); ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> mContext.startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", "")));
//打招呼消息 //打招呼消息
fastMsgRecyclerView = (RecyclerView) findViewById(R.id.room_fast_msg); fastMsgRecyclerView = (RecyclerView) findViewById(R.id.room_fast_msg);
fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext,LinearLayoutManager.HORIZONTAL,false)); fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
fastMessageRecyclerViewAdapter=new LiveRoomFastMessageRecyclerViewAdapter(mContext); fastMessageRecyclerViewAdapter = new LiveRoomFastMessageRecyclerViewAdapter(mContext);
fastMsgRecyclerView.setAdapter(fastMessageRecyclerViewAdapter); fastMsgRecyclerView.setAdapter(fastMessageRecyclerViewAdapter);
fastMessageRecyclerViewAdapter.setMessageListener(msg -> { fastMessageRecyclerViewAdapter.setMessageListener(msg -> {
//点击的消息发送出去 //点击的消息发送出去
@ -1044,24 +1045,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
*/ */
public void initWishList(List<WishlistItemModel> wishlist) { public void initWishList(List<WishlistItemModel> wishlist) {
if (wishlist.size() > 0) { if (wishlist.size() > 0) {
this.wishlist = wishlist;
wishListLayout.setVisibility(View.VISIBLE); wishListLayout.setVisibility(View.VISIBLE);
} else { } else {
wishListLayout.setVisibility(View.GONE); wishListLayout.setVisibility(View.GONE);
} }
((Activity) mContext).runOnUiThread(() -> { ((Activity) mContext).runOnUiThread(() -> {
ViewFlipper wishListFlipper = (ViewFlipper) findViewById(R.id.wish_list); wishListFlipper = (ViewFlipper) findViewById(R.id.wish_list);
for (int i = 0; i < wishlist.size(); i++) { for (int i = 0; i < wishlist.size(); i++) {
View wish = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); View wish = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
wish.setTag(wishlist.get(i).getId());
ImageView wishPic = wish.findViewById(R.id.wish_pic); ImageView wishPic = wish.findViewById(R.id.wish_pic);
TextView wishIndex = wish.findViewById(R.id.wish_index); TextView wishIndex = wish.findViewById(R.id.wish_index);
ImgLoader.display(mContext, wishlist.get(i).getWishlistIcon(), wishPic); ImgLoader.display(mContext, wishlist.get(i).getWishlistIcon(), wishPic);
wishIndex.setText((i + 1) + "/" + wishlist.size()); wishIndex.setText(wishlist.get(i).getWishlistNumP());
wishListFlipper.addView(wish); wishListFlipper.addView(wish);
} }
wishListFlipper.startFlipping(); wishListFlipper.startFlipping();
}); });
} }
/** /**
* 初始化小时榜 * 初始化小时榜
* 等待接口 * 等待接口
@ -1088,6 +1090,23 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}); });
} }
/**
* 更新心愿单进度
*
* @param giftId 礼物ID
* @param giftCount 礼物数量
*/
public void updataWishList(String giftId, int giftCount) {
for (WishlistItemModel model : wishlist) {
if (TextUtils.equals(giftId, model.getLid())) {
int number = Integer.parseInt(model.getWishlistProgress()) + giftCount;
model.setWishlistProgress(String.valueOf(number));
}
}
wishListFlipper.removeAllViews();
initWishList(wishlist);
}
//点击头像 //点击头像
private void clickAvatar() { private void clickAvatar() {
livePKUserListBean = new LivePKUserListBean(); livePKUserListBean = new LivePKUserListBean();
@ -1441,7 +1460,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private void setGuardIcon(LiveUserGiftBean guard) { private void setGuardIcon(LiveUserGiftBean guard) {
if (guard != null) { if (guard != null) {
nowGuardUser=guard; nowGuardUser = guard;
ImgLoader.displayAvatar(mContext, guard.getAvatar(), userGuard); ImgLoader.displayAvatar(mContext, guard.getAvatar(), userGuard);
gift_svga.setVisibility(View.VISIBLE); gift_svga.setVisibility(View.VISIBLE);
} }
@ -1796,13 +1815,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (bean == null) { if (bean == null) {
return; return;
} }
if (mLiveEnterRoomAnimPresenter != null) { if (mLiveEnterRoomAnimPresenter != null) {
mLiveEnterRoomAnimPresenter.enterRoom(bean); mLiveEnterRoomAnimPresenter.enterRoom(bean);
} }
room_hot.setText(formatBigNum.formatBigNum(bean.getLiveChatBean().getHot_num())); room_hot.setText(formatBigNum.formatBigNum(bean.getLiveChatBean().getHot_num()));
LiveUserGiftBean chatBean = bean.getUserBean(); LiveUserGiftBean chatBean = bean.getUserBean();
if(chatBean!=null&&nowGuardUser!=null) { if (chatBean != null && nowGuardUser != null) {
LiveUserGiftBean tmp = null; LiveUserGiftBean tmp = null;
if (chatBean.getGuardType() != 0 && chatBean.getGuardType() > nowGuardUser.getGuardType()) { if (chatBean.getGuardType() != 0 && chatBean.getGuardType() > nowGuardUser.getGuardType()) {
tmp = chatBean; tmp = chatBean;
@ -1816,10 +1834,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
/** /**
* 用户离开房间 * 用户离开房间
*
* @param bean 用户 * @param bean 用户
*/ */
public void onExitRoom(UserBean bean){ public void onExitRoom(UserBean bean) {
// getGuardInfo(); // getGuardInfo();
} }
/** /**

View File

@ -164,7 +164,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
private boolean mFirstConnectSocket;//是否是第一次连接成功socket private boolean mFirstConnectSocket;//是否是第一次连接成功socket
private int liveBg; private int liveBg;
private LiveImDeletUtil liveImDeletUtil; private LiveImDeletUtil liveImDeletUtil;
private List<String> greetings = new ArrayList<>(); private List<String> greetings = new ArrayList<>();
public PortraitLiveManager(Activity context, Intent intent) { public PortraitLiveManager(Activity context, Intent intent) {
this.mContext = context; this.mContext = context;
@ -576,7 +576,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveLinkMicPresenter.onAudienceLeaveRoom(bean); mLiveLinkMicPresenter.onAudienceLeaveRoom(bean);
} }
try { try {
if(mLiveRoomViewHolder!=null){ if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.onExitRoom(bean); mLiveRoomViewHolder.onExitRoom(bean);
if (mLiveRoomViewHolder.room_hot != null) { if (mLiveRoomViewHolder.room_hot != null) {
if (!"".equals(bean.getHot_num()) && !"0".equals(bean.getHot_num())) { if (!"".equals(bean.getHot_num()) && !"0".equals(bean.getHot_num())) {
@ -597,13 +597,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.showGuardGifMessage(bean); mLiveRoomViewHolder.showGuardGifMessage(bean);
} }
} else { } else {
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
if (bean.getmLiveUId().equals(bean.getRoomnum())) { if (bean.getmLiveUId().equals(bean.getRoomnum())) {
mLiveRoomViewHolder.insertChat(bean.getLiveChatBean(), 1); mLiveRoomViewHolder.insertChat(bean.getLiveChatBean(), 1);
} }
mLiveRoomViewHolder.showGiftMessage(bean, false); mLiveRoomViewHolder.showGiftMessage(bean, false);
mLiveRoomViewHolder.updataWishList(bean.getGiftId(), bean.getGiftCount());
} }
} }
} }

View File

@ -7,8 +7,8 @@
<ImageView <ImageView
android:id="@+id/wish_pic" android:id="@+id/wish_pic"
android:layout_width="20dp" android:layout_width="17dp"
android:layout_height="20dp" /> android:layout_height="17dp" />
<com.yunbao.common.views.weight.MarqueeTextView <com.yunbao.common.views.weight.MarqueeTextView
android:id="@+id/wish_index" android:id="@+id/wish_index"