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"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:topLeftRadius="12dp" android:topRightRadius="12dp" />
<solid android:color="#333333" />
<solid android:color="#000" />
</shape>

View File

@ -10,9 +10,9 @@ ext {
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",

View File

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

View File

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

View File

@ -116,7 +116,6 @@ import java.util.Random;
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.mFirebaseAnalytics;
@ -253,6 +252,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter;
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) {
super(context, parentView);
@ -853,11 +854,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
});
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.setLayoutManager(new LinearLayoutManager(mContext,LinearLayoutManager.HORIZONTAL,false));
fastMessageRecyclerViewAdapter=new LiveRoomFastMessageRecyclerViewAdapter(mContext);
fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
fastMessageRecyclerViewAdapter = new LiveRoomFastMessageRecyclerViewAdapter(mContext);
fastMsgRecyclerView.setAdapter(fastMessageRecyclerViewAdapter);
fastMessageRecyclerViewAdapter.setMessageListener(msg -> {
//点击的消息发送出去
@ -1044,24 +1045,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
*/
public void initWishList(List<WishlistItemModel> wishlist) {
if (wishlist.size() > 0) {
this.wishlist = wishlist;
wishListLayout.setVisibility(View.VISIBLE);
} else {
wishListLayout.setVisibility(View.GONE);
}
((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++) {
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);
TextView wishIndex = wish.findViewById(R.id.wish_index);
ImgLoader.display(mContext, wishlist.get(i).getWishlistIcon(), wishPic);
wishIndex.setText((i + 1) + "/" + wishlist.size());
wishIndex.setText(wishlist.get(i).getWishlistNumP());
wishListFlipper.addView(wish);
}
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() {
livePKUserListBean = new LivePKUserListBean();
@ -1441,7 +1460,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private void setGuardIcon(LiveUserGiftBean guard) {
if (guard != null) {
nowGuardUser=guard;
nowGuardUser = guard;
ImgLoader.displayAvatar(mContext, guard.getAvatar(), userGuard);
gift_svga.setVisibility(View.VISIBLE);
}
@ -1796,13 +1815,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (bean == null) {
return;
}
if (mLiveEnterRoomAnimPresenter != null) {
mLiveEnterRoomAnimPresenter.enterRoom(bean);
}
room_hot.setText(formatBigNum.formatBigNum(bean.getLiveChatBean().getHot_num()));
LiveUserGiftBean chatBean = bean.getUserBean();
if(chatBean!=null&&nowGuardUser!=null) {
if (chatBean != null && nowGuardUser != null) {
LiveUserGiftBean tmp = null;
if (chatBean.getGuardType() != 0 && chatBean.getGuardType() > nowGuardUser.getGuardType()) {
tmp = chatBean;
@ -1816,10 +1834,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
/**
* 用户离开房间
*
* @param bean 用户
*/
public void onExitRoom(UserBean bean){
// getGuardInfo();
public void onExitRoom(UserBean bean) {
// getGuardInfo();
}
/**

View File

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

View File

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