心愿单直播间轮播入口

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;
import com.alibaba.fastjson.annotation.JSONField;
import com.google.gson.annotations.SerializedName;
/**
* Created by cxf on 2019/3/30.
@ -15,8 +16,80 @@ public class BannerBean {
private String mIntoUrl;
private int type;
private String name;
private int activityId=0;
private int activityId = 0;
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;
@ -80,22 +153,27 @@ public class BannerBean {
public int getType() {
return type;
}
@JSONField(name = "type")
public void setType(int type) {
this.type = type;
}
@JSONField(name = "name")
public String getName() {
return name;
}
@JSONField(name = "name")
public void setName(String name) {
this.name = name;
}
@JSONField(name = "active_id")
public int getActivityId() {
return activityId;
}
@JSONField(name = "active_id")
public void setActivityId(int activityId) {
this.activityId = activityId;

View File

@ -30,6 +30,17 @@ public class EnterRoomNewModel extends BaseModel {
private List<LiveRoomActivityModel> liveRoomActivityModels = new ArrayList<>();//活动列表
@SerializedName("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() {
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_no">不使用</string>
<string name="live_use_discount_yes">使用</string>
<string name="live_use_wish">心願</string>
</resources>

View File

@ -44,7 +44,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.SizeUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
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.TaskModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.bean.WishModel;
import com.yunbao.common.event.AnchorInfoEvent;
import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.common.glide.ImgLoader;
@ -1918,7 +1918,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override
public void onError(String error) {
ToastUtil.show( R.string.net_error);
ToastUtil.show(R.string.net_error);
}
});
@ -4401,6 +4401,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
});
enterRoomLeave.startAnimation(animationSet1);
}
LiveAnchorSayModel sayModel;
public void initAnchorSayData() {
@ -4455,7 +4456,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
initAnchorSayData();
}
public void hideAnchorSayAndCallAnchor(){
public void hideAnchorSayAndCallAnchor() {
mAnchorSay.setX((float) mAnchorSayImage.getTag());
mAnchorSayImage.setTag(null);
mAnchorSayImage.setVisibility(View.VISIBLE);
@ -4463,7 +4464,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_show);
topBanner1.setVisibility(View.GONE);
}
public void showAnchorSayAndCallAnchor(){
public void showAnchorSayAndCallAnchor() {
mAnchorSayImage.setTag(mAnchorSay.getX());
mAnchorSay.setX(-DpUtil.dp2px(45));
mAnchorSayImage.setVisibility(View.INVISIBLE);
@ -4471,6 +4473,26 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_hide);
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() {
checkNewLetter();
mTopBannerList = new ArrayList<>();
@ -4498,6 +4520,32 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
bundle.putBoolean("isContactGift", true);
fragment.setArguments(bundle);
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();
//初始化顶部banner
mLiveRoomViewHolder.initTopBanner();
//心愿单顶部bannner
mLiveRoomViewHolder.updateTopBanner(data.getWishListProgress());
isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention());
if (isattention == 0) {
if (countDownTimer != null) {

View File

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

View File

@ -94,7 +94,7 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
if (outRankHide != null) {
for (String hideId : outRankHide) {
if (i < 3) {
hv.setData(list.get(i).setHide(TextUtils.equals(list.get(i).getUid(), hideId)), i);
hv.setData(list.get(i).setHide(TextUtils .equals(list.get(i).getUid(), hideId)), i);
}
}
} else {