心愿单直播间轮播入口

This commit is contained in:
18401019693 2023-04-01 14:45:48 +08:00
parent c4ae047a4b
commit 849677e50e
10 changed files with 207 additions and 14 deletions

View File

@ -1,6 +1,7 @@
package com.yunbao.common.bean; package com.yunbao.common.bean;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.google.gson.annotations.SerializedName;
/** /**
* Created by cxf on 2019/3/30. * Created by cxf on 2019/3/30.
@ -17,6 +18,78 @@ public class BannerBean {
private String name; private String name;
private int activityId = 0; private int activityId = 0;
private int mIconRes; private int mIconRes;
//心愿单展示数据
@SerializedName("wishlist_icon")
private String wishlistIcon;
@SerializedName("wishlist_num")
private String wishlistNum;
@SerializedName("wishlist_progress")
private String wishlistProgress;
@SerializedName("wishlist_name")
private String wishlistName;
public String getmImageUrl() {
return mImageUrl;
}
public BannerBean setmImageUrl(String mImageUrl) {
this.mImageUrl = mImageUrl;
return this;
}
public String getmLink() {
return mLink;
}
public BannerBean setmLink(String mLink) {
this.mLink = mLink;
return this;
}
public int getmIconRes() {
return mIconRes;
}
public BannerBean setmIconRes(int mIconRes) {
this.mIconRes = mIconRes;
return this;
}
public String getWishlistIcon() {
return wishlistIcon;
}
public BannerBean setWishlistIcon(String wishlistIcon) {
this.wishlistIcon = wishlistIcon;
return this;
}
public String getWishlistNum() {
return wishlistNum;
}
public BannerBean setWishlistNum(String wishlistNum) {
this.wishlistNum = wishlistNum;
return this;
}
public String getWishlistProgress() {
return wishlistProgress;
}
public BannerBean setWishlistProgress(String wishlistProgress) {
this.wishlistProgress = wishlistProgress;
return this;
}
public String getWishlistName() {
return wishlistName;
}
public BannerBean setWishlistName(String wishlistName) {
this.wishlistName = wishlistName;
return this;
}
private StarChallengeStatusModel model; private StarChallengeStatusModel model;
@ -80,22 +153,27 @@ public class BannerBean {
public int getType() { public int getType() {
return type; return type;
} }
@JSONField(name = "type") @JSONField(name = "type")
public void setType(int type) { public void setType(int type) {
this.type = type; this.type = type;
} }
@JSONField(name = "name") @JSONField(name = "name")
public String getName() { public String getName() {
return name; return name;
} }
@JSONField(name = "name") @JSONField(name = "name")
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
@JSONField(name = "active_id") @JSONField(name = "active_id")
public int getActivityId() { public int getActivityId() {
return activityId; return activityId;
} }
@JSONField(name = "active_id") @JSONField(name = "active_id")
public void setActivityId(int activityId) { public void setActivityId(int activityId) {
this.activityId = activityId; this.activityId = activityId;

View File

@ -30,6 +30,17 @@ public class EnterRoomNewModel extends BaseModel {
private List<LiveRoomActivityModel> liveRoomActivityModels = new ArrayList<>();//活动列表 private List<LiveRoomActivityModel> liveRoomActivityModels = new ArrayList<>();//活动列表
@SerializedName("clarityType") @SerializedName("clarityType")
private int clarityType; private int clarityType;
@SerializedName("wishListProgress")
private WishModel wishListProgress;
public WishModel getWishListProgress() {
return wishListProgress;
}
public EnterRoomNewModel setWishListProgress(WishModel wishListProgress) {
this.wishListProgress = wishListProgress;
return this;
}
public List<LiveRoomActivityModel> getLiveRoomActivityModels() { public List<LiveRoomActivityModel> getLiveRoomActivityModels() {
return liveRoomActivityModels; return liveRoomActivityModels;

View File

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

View File

@ -1112,5 +1112,6 @@
<string name="live_use_discount_content">您有一張%s是否使用使用後開通花費鉆石%s返還金豆%s</string> <string name="live_use_discount_content">您有一張%s是否使用使用後開通花費鉆石%s返還金豆%s</string>
<string name="live_use_discount_no">不使用</string> <string name="live_use_discount_no">不使用</string>
<string name="live_use_discount_yes">使用</string> <string name="live_use_discount_yes">使用</string>
<string name="live_use_wish">心願</string>
</resources> </resources>

View File

@ -44,7 +44,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.SizeUtils;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource; import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException; import com.bumptech.glide.load.engine.GlideException;
@ -87,6 +86,7 @@ import com.yunbao.common.bean.RewardAllModel;
import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.TaskModel; import com.yunbao.common.bean.TaskModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.bean.WishModel;
import com.yunbao.common.event.AnchorInfoEvent; import com.yunbao.common.event.AnchorInfoEvent;
import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
@ -4401,6 +4401,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}); });
enterRoomLeave.startAnimation(animationSet1); enterRoomLeave.startAnimation(animationSet1);
} }
LiveAnchorSayModel sayModel; LiveAnchorSayModel sayModel;
public void initAnchorSayData() { public void initAnchorSayData() {
@ -4463,6 +4464,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_show); mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_show);
topBanner1.setVisibility(View.GONE); topBanner1.setVisibility(View.GONE);
} }
public void showAnchorSayAndCallAnchor() { public void showAnchorSayAndCallAnchor() {
mAnchorSayImage.setTag(mAnchorSay.getX()); mAnchorSayImage.setTag(mAnchorSay.getX());
mAnchorSay.setX(-DpUtil.dp2px(45)); mAnchorSay.setX(-DpUtil.dp2px(45));
@ -4471,6 +4473,26 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_hide); mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_hide);
topBanner1.setVisibility(View.VISIBLE); topBanner1.setVisibility(View.VISIBLE);
} }
public void updateTopBanner(WishModel wishListProgress) {
if (mTopBannerList == null) {
mTopBannerList = new ArrayList<>();
}
topBanner1.setVisibility(View.VISIBLE);
BannerBean bannerBean = new BannerBean();
bannerBean.setWishlistIcon(wishListProgress.getWishlistIcon())
.setWishlistName(wishListProgress.getWishlistName())
.setWishlistNum(wishListProgress.getWishlistNum())
.setWishlistProgress(wishListProgress.getWishlistProgress())
.setmLink(CommonAppConfig.HOST + "/index.php")
.setType(1)
;
bannerBean.setShow_type("2");
mTopBannerList.add(bannerBean);
topBanner1.update(mTopBannerList);
}
public void initTopBanner() { public void initTopBanner() {
checkNewLetter(); checkNewLetter();
mTopBannerList = new ArrayList<>(); mTopBannerList = new ArrayList<>();
@ -4498,6 +4520,32 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
bundle.putBoolean("isContactGift", true); bundle.putBoolean("isContactGift", true);
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment"); fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
} else {
BannerBean bean = mTopBannerList.get(position);
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
String type = "";
StringBuffer htmlUrl = new StringBuffer();
htmlUrl.append(bean.getLink())
.append(bean.getLink().contains("?") ? "&uid=" : "?uid=")
.append(userInfo.getId())
.append("&token=")
.append(userInfo.getToken())
.append("&anchorUid=")
.append(mLiveUid)
.append("&liveUid=")
.append(mLiveUid)
.append("&t=")
.append(System.currentTimeMillis())
.append("&g=Appapi&m=Wish&a=index");
if (TextUtils.equals(type, "1")) {
ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false);
} else {
Bundle bundle = new Bundle();
bundle.putString("url", htmlUrl.toString());
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
} }
} }
}) })

View File

@ -479,7 +479,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.initAnchorSay(); mLiveRoomViewHolder.initAnchorSay();
//初始化顶部banner //初始化顶部banner
mLiveRoomViewHolder.initTopBanner(); mLiveRoomViewHolder.initTopBanner();
//心愿单顶部bannner
mLiveRoomViewHolder.updateTopBanner(data.getWishListProgress());
isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention()); isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention());
if (isattention == 0) { if (isattention == 0) {
if (countDownTimer != null) { if (countDownTimer != null) {

View File

@ -5,6 +5,7 @@ import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import com.ms.banner.holder.BannerViewHolder; import com.ms.banner.holder.BannerViewHolder;
import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGADrawable;
@ -24,13 +25,13 @@ public class TopBannerCustomViewHolder implements BannerViewHolder<BannerBean> {
public View createView(Context context, int position, BannerBean data) { public View createView(Context context, int position, BannerBean data) {
View view = null; View view = null;
if (data.getType() == TYPE_IMAGE) { if (data.getType() == TYPE_IMAGE) {
ImageView icon = new ImageView(context); view = LayoutInflater.from(context).inflate(R.layout.view_live_top_banner_wish, null);
if (data.getIconRes() != 0) { ImageView wishlistIcon = view.findViewById(R.id.wishlist_icon);
ImgLoader.display(context, data.getIconRes(), icon); TextView wishlistName = view.findViewById(R.id.wishlist_name);
} else { TextView wishlistProgress = view.findViewById(R.id.wishlist_progress);
ImgLoader.display(context, data.getImageUrl(), icon); ImgLoader.display(context, data.getWishlistIcon(), wishlistIcon);
} wishlistName.setText(data.getWishlistName());
view = icon; wishlistProgress.setText(String.format("%s/%s", data.getWishlistProgress(), data.getWishlistNum()));
} else { } else {
view = LayoutInflater.from(context).inflate(R.layout.view_live_top_banner_call_me, null); view = LayoutInflater.from(context).inflate(R.layout.view_live_top_banner_call_me, null);
SVGAImageView svga = view.findViewById(R.id.svga); SVGAImageView svga = view.findViewById(R.id.svga);

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="52dp"
android:layout_height="52dp"
android:background="@mipmap/bg_xyd">
<ImageView
android:id="@+id/wishlist_icon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="4dp"
android:text="@string/live_use_wish"
android:textColor="@color/white"
android:textSize="8sp" />
<TextView
android:id="@+id/wishlist_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="5dp"
android:text="sjhasdjkjk"
android:textColor="@color/white"
android:textSize="8sp" />
</FrameLayout>
<TextView
android:id="@+id/wishlist_progress"
android:layout_width="52dp"
android:layout_height="10dp"
android:layout_marginTop="2dp"
android:background="@drawable/bg_live_wish_top"
android:gravity="center"
android:text="23/100"
android:textColor="@color/white"
android:textSize="8sp" />
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB