Merge remote-tracking branch 'origin/master'

This commit is contained in:
zlzw 2023-04-06 14:29:41 +08:00
commit 11679a62a0
5 changed files with 223 additions and 43 deletions

View File

@ -0,0 +1,160 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class WishModel2 extends BaseModel {
@SerializedName("id")
private String id;
@SerializedName("dtime")
private String dtime;
@SerializedName("luid")
private String luid;
@SerializedName("lid")
private String lid;
@SerializedName("wishlist_icon")
private String wishlistIcon;
@SerializedName("wishlist_num")
private String wishlistNum;
@SerializedName("wishlist_progress")
private String wishlistProgress;
@SerializedName("wishlist_name")
private String wishlistName;
@SerializedName("create_time")
private String createTime;
@SerializedName("type")
private int type;
@SerializedName("gift_type")
private int giftType;
@SerializedName("price")
private int price;
public String getId() {
return id;
}
public WishModel2 setId(String id) {
this.id = id;
return this;
}
public String getDtime() {
return dtime;
}
public WishModel2 setDtime(String dtime) {
this.dtime = dtime;
return this;
}
public String getLuid() {
return luid;
}
public WishModel2 setLuid(String luid) {
this.luid = luid;
return this;
}
public String getLid() {
return lid;
}
public WishModel2 setLid(String lid) {
this.lid = lid;
return this;
}
public String getWishlistIcon() {
return wishlistIcon;
}
public WishModel2 setWishlistIcon(String wishlistIcon) {
this.wishlistIcon = wishlistIcon;
return this;
}
public String getWishlistNum() {
return wishlistNum;
}
public WishModel2 setWishlistNum(String wishlistNum) {
this.wishlistNum = wishlistNum;
return this;
}
public String getWishlistProgress() {
return wishlistProgress;
}
public WishModel2 setWishlistProgress(String wishlistProgress) {
this.wishlistProgress = wishlistProgress;
return this;
}
public String getWishlistName() {
return wishlistName;
}
public WishModel2 setWishlistName(String wishlistName) {
this.wishlistName = wishlistName;
return this;
}
public String getCreateTime() {
return createTime;
}
public WishModel2 setCreateTime(String createTime) {
this.createTime = createTime;
return this;
}
public int getType() {
return type;
}
public WishModel2 setType(int type) {
this.type = type;
return this;
}
public int getGiftType() {
return giftType;
}
public WishModel2 setGiftType(int giftType) {
this.giftType = giftType;
return this;
}
public int getPrice() {
return price;
}
public WishModel2 setPrice(int price) {
this.price = price;
return this;
}
public int wishProgress() {
int progress = 0;
try {
progress = Integer.parseInt(wishlistNum);
} catch (NumberFormatException e) {
progress = 0;
}
return progress;
}
public int wishCurrent() {
int current = 0;
try {
current = Integer.parseInt(wishlistProgress);
} catch (NumberFormatException e) {
current = 0;
}
return current;
}
}

View File

@ -10,12 +10,12 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.adapter.LiveNewWishAdapter; import com.yunbao.common.adapter.LiveNewWishAdapter;
import com.yunbao.common.bean.WishListModel; import com.yunbao.common.bean.WishListModel;
import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.WishModel;
import com.yunbao.common.bean.WishModel2;
import com.yunbao.common.event.LiveNewWishListCloseEvent; import com.yunbao.common.event.LiveNewWishListCloseEvent;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
@ -24,7 +24,6 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.LiveNewWishGiftPopup; import com.yunbao.common.views.LiveNewWishGiftPopup;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import java.lang.reflect.Modifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -102,17 +101,16 @@ public class LiveNewWishListFragment extends BaseFragment {
public void saveWish() { public void saveWish() {
List<WishModel> wishList = liveNewWishAdapter.getWishList(); List<WishModel> wishList = liveNewWishAdapter.getWishList();
wishList.remove(wishList.size() - 1); wishList.remove(wishList.size() - 1);
// 1. Gson构造器 List<WishModel2> wishList2 = new ArrayList<>();
GsonBuilder builder = new GsonBuilder(); Gson gson = new Gson();
// 2. 排除使用特定修饰符的字段 for (WishModel model : wishList) {
builder.excludeFieldsWithoutExposeAnnotation(); WishModel2 model2 = gson.fromJson(gson.toJson(model), WishModel2.class);
// 3. 格式良好的输出 wishList2.add(model2);
builder.setPrettyPrinting(); }
// 4. 创建Gson对象
Gson gson = builder.create();
LiveNetManager.get(getContext()). LiveNetManager.get(getContext()).
setWishlistV2(type, gson.toJson(wishList), new HttpCallback<String>() { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() {
@Override @Override
public void onSuccess(String data) { public void onSuccess(String data) {
ToastUtil.show(data); ToastUtil.show(data);

View File

@ -20,6 +20,7 @@ import com.lxj.xpopup.core.BottomPopupView;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.adapter.LiveNewWishListAdapter; import com.yunbao.common.adapter.LiveNewWishListAdapter;
import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.WishModel;
import com.yunbao.common.bean.WishModel2;
import com.yunbao.common.event.LiveNewWishListCloseEvent; import com.yunbao.common.event.LiveNewWishListCloseEvent;
import com.yunbao.common.event.LiveNewWishListEvent; import com.yunbao.common.event.LiveNewWishListEvent;
import com.yunbao.common.fragment.LiveNewWishListFragment; import com.yunbao.common.fragment.LiveNewWishListFragment;
@ -287,17 +288,11 @@ public class LiveNewWishListPopup extends BottomPopupView {
seasonalWish = false; seasonalWish = false;
break; break;
} }
List<WishModel> wishList = new ArrayList<>(); List<WishModel2> wishList2 = new ArrayList<>();
// 1. Gson构造器 Gson gson = new Gson();
GsonBuilder builder = new GsonBuilder();
// 2. 排除使用特定修饰符的字段
builder.excludeFieldsWithoutExposeAnnotation();
// 3. 格式良好的输出
builder.setPrettyPrinting();
// 4. 创建Gson对象
Gson gson = builder.create();
LiveNetManager.get(getContext()). LiveNetManager.get(getContext()).
setWishlistV2(type, gson.toJson(wishList), new HttpCallback<String>() { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() {
@Override @Override
public void onSuccess(String data) { public void onSuccess(String data) {
ToastUtil.show(data); ToastUtil.show(data);

View File

@ -1321,6 +1321,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
updataCleanMic(); updataCleanMic();
// initStarChallengeStatus(); // initStarChallengeStatus();
enterRoomLeave.setVisibility(View.GONE); enterRoomLeave.setVisibility(View.GONE);
topBanner1.setVisibility(View.GONE);
} }
public void clearChat() { public void clearChat() {
@ -4046,6 +4047,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
new Handler(Looper.getMainLooper()).postDelayed(this::initPkRank, 300); new Handler(Looper.getMainLooper()).postDelayed(this::initPkRank, 300);
break; break;
case PK_TWO_END: case PK_TWO_END:
EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", "")); EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", ""));
closePkTwo(); closePkTwo();
showAnchorSayAndCallAnchor(); showAnchorSayAndCallAnchor();
@ -4493,7 +4495,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
} }
public void updateTopBanner(WishModel wishListProgress) { private WishModel wishListProgress;
public LiveRoomViewHolder setWishListProgress(WishModel wishListProgress) {
this.wishListProgress = wishListProgress;
return this;
}
public void updateTopBanner() {
if (!TextUtils.isEmpty(wishListProgress.getWishlistName())||!TextUtils.isEmpty(wishListProgress.getWishlistProgress())) {
if (mTopBannerList == null) { if (mTopBannerList == null) {
mTopBannerList = new ArrayList<>(); mTopBannerList = new ArrayList<>();
} }
@ -4512,6 +4522,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
topBanner1.update(mTopBannerList); topBanner1.update(mTopBannerList);
} }
}
public void initTopBanner() { public void initTopBanner() {
checkNewLetter(); checkNewLetter();
mTopBannerList = new ArrayList<>(); mTopBannerList = new ArrayList<>();
@ -4590,6 +4602,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
System.out.println("!>>>>> 获取联系方式:" + error); System.out.println("!>>>>> 获取联系方式:" + error);
} }
}); });
updateTopBanner();
} }
private void checkNewLetter() { private void checkNewLetter() {

View File

@ -40,6 +40,7 @@ import com.yunbao.common.bean.LiveUserGiftBean;
import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.bean.WishModel;
import com.yunbao.common.custom.MyViewPager; import com.yunbao.common.custom.MyViewPager;
import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.event.LiveFloatEvent; import com.yunbao.common.event.LiveFloatEvent;
@ -188,7 +189,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
private int landscape; private int landscape;
private String leaveStream = "", leaveGroupId = ""; private String leaveStream = "", leaveGroupId = "";
public static PortraitLiveManager portraitLiveManager; public static PortraitLiveManager portraitLiveManager;
private WishModel wishListProgress;
public PortraitLiveManager setQuitF(boolean quitF) { public PortraitLiveManager setQuitF(boolean quitF) {
isQuitF = quitF; isQuitF = quitF;
@ -251,8 +252,21 @@ 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);
topBannerHandler.postDelayed(topBannerRunnable, 6000);
} }
}; };
private Runnable topBannerRunnable = new Runnable() {
@Override
public void run() {
if (mLiveRoomViewHolder != null) {
//初始化顶部banner
mLiveRoomViewHolder.initTopBanner();
}
}
};
private Handler topBannerHandler = new Handler();
@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) {
@ -339,6 +353,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.resetView(); mLiveRoomViewHolder.resetView();
enterRoomModel.clear(); enterRoomModel.clear();
enterRoomLeaveHandler.removeCallbacks(enterRoomLeaveRunnable); enterRoomLeaveHandler.removeCallbacks(enterRoomLeaveRunnable);
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());
@ -477,12 +492,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.setMedaRankNum(data.getEnterRoomInfo().getMedalRankNum()); mLiveRoomViewHolder.setMedaRankNum(data.getEnterRoomInfo().getMedalRankNum());
//初始化女神说 //初始化女神说
mLiveRoomViewHolder.initAnchorSay(); mLiveRoomViewHolder.initAnchorSay();
//初始化顶部banner
mLiveRoomViewHolder.initTopBanner(); wishListProgress = data.getWishListProgress();
//心愿单顶部bannner //心愿单顶部bannner
if (data.getWishListProgress().getIsShow()!=0){
mLiveRoomViewHolder.updateTopBanner(data.getWishListProgress()); mLiveRoomViewHolder.setWishListProgress(wishListProgress);
}
isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention()); isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention());
if (isattention == 0) { if (isattention == 0) {