diff --git a/common/src/main/java/com/yunbao/common/bean/BannerBean.java b/common/src/main/java/com/yunbao/common/bean/BannerBean.java index 75a8fc7ea..7eab80175 100644 --- a/common/src/main/java/com/yunbao/common/bean/BannerBean.java +++ b/common/src/main/java/com/yunbao/common/bean/BannerBean.java @@ -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; diff --git a/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java b/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java index e0228b8d0..9e9b84a10 100644 --- a/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java +++ b/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java @@ -30,6 +30,17 @@ public class EnterRoomNewModel extends BaseModel { private List 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 getLiveRoomActivityModels() { return liveRoomActivityModels; diff --git a/common/src/main/res/drawable/bg_live_wish_top.xml b/common/src/main/res/drawable/bg_live_wish_top.xml new file mode 100644 index 000000000..5fb4ea684 --- /dev/null +++ b/common/src/main/res/drawable/bg_live_wish_top.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 3d5889f67..f46917ebe 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1112,5 +1112,6 @@ 您有一張%s,是否使用?使用後開通花費鉆石%s,返還金豆%s 不使用 使用 + 心願 diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index fdeca7838..d76e5c309 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -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"); + } } } }) diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index fd0361d52..73a003987 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -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) { diff --git a/live/src/main/java/com/yunbao/live/views/TopBannerCustomViewHolder.java b/live/src/main/java/com/yunbao/live/views/TopBannerCustomViewHolder.java index a9edba0e6..6c8e0bd17 100644 --- a/live/src/main/java/com/yunbao/live/views/TopBannerCustomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/TopBannerCustomViewHolder.java @@ -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 { 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); diff --git a/live/src/main/res/layout/view_live_top_banner_wish.xml b/live/src/main/res/layout/view_live_top_banner_wish.xml new file mode 100644 index 000000000..7f3c7a9d9 --- /dev/null +++ b/live/src/main/res/layout/view_live_top_banner_wish.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/mipmap-xxxhdpi/bg_xyd.png b/live/src/main/res/mipmap-xxxhdpi/bg_xyd.png new file mode 100644 index 000000000..def0be8d7 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/bg_xyd.png differ diff --git a/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java b/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java index 72dd7d5db..84644df8c 100644 --- a/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java @@ -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 {