diff --git a/common/build.gradle b/common/build.gradle index bd3c956ed..d59049c32 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -223,6 +223,8 @@ dependencies { //文字渐变色 api 'com.github.FlyJingFish:GradientTextView:1.2.4' + //轮播 一屏显示多个 + api 'com.github.xiaohaibin:XBanner:androidx_v1.2.6' } diff --git a/common/src/main/java/com/yunbao/common/adapter/LiveBuyGuardPrivilegeAdapter.java b/common/src/main/java/com/yunbao/common/adapter/LiveBuyGuardPrivilegeAdapter.java new file mode 100644 index 000000000..dc17fdc1d --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/LiveBuyGuardPrivilegeAdapter.java @@ -0,0 +1,46 @@ +package com.yunbao.common.adapter; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.views.LiveBuyGuardPrivilegeViewHolder; + +import java.util.ArrayList; +import java.util.List; + +public class LiveBuyGuardPrivilegeAdapter extends RecyclerView.Adapter { + List guardPrivilege = new ArrayList<>(); + + public void setGuardPrivilege(List privilege) { + guardPrivilege.clear(); + guardPrivilege.addAll(privilege); + notifyDataSetChanged(); + } + + public LiveBuyGuardPrivilegeAdapter(List guardPrivilege) { + this.guardPrivilege = guardPrivilege; + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_buy_guard_privilege_item, parent, false); + return new LiveBuyGuardPrivilegeViewHolder(herdView); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + LiveBuyGuardPrivilegeViewHolder buyGuardSelectViewHolder = (LiveBuyGuardPrivilegeViewHolder) holder; + buyGuardSelectViewHolder.setData(guardPrivilege.get(position)); + } + + @Override + public int getItemCount() { + return guardPrivilege.size(); + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/LiveBuyGuardSelectAdapter.java b/common/src/main/java/com/yunbao/common/adapter/LiveBuyGuardSelectAdapter.java new file mode 100644 index 000000000..e241cf151 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/LiveBuyGuardSelectAdapter.java @@ -0,0 +1,48 @@ +package com.yunbao.common.adapter; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.bean.GuardPriceModel; +import com.yunbao.common.views.LiveBuyGuardSelectViewHolder; + +import java.util.ArrayList; +import java.util.List; + +public class LiveBuyGuardSelectAdapter extends RecyclerView.Adapter { + List price = new ArrayList<>(); + + public LiveBuyGuardSelectAdapter(List price) { + this.price = price; + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_buy_guard_slelect_item, parent, false); + return new LiveBuyGuardSelectViewHolder(herdView); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + LiveBuyGuardSelectViewHolder buyGuardSelectViewHolder = (LiveBuyGuardSelectViewHolder) holder; + buyGuardSelectViewHolder.setData(price.get(position), liveBuyGuardSelectClickListener); + } + + @Override + public int getItemCount() { + return price.size(); + } + + private LiveBuyGuardSelectViewHolder.LiveBuyGuardSelectClickListener liveBuyGuardSelectClickListener; + + public LiveBuyGuardSelectAdapter setLiveBuyGuardSelectClickListener(LiveBuyGuardSelectViewHolder.LiveBuyGuardSelectClickListener liveBuyGuardSelectClickListener) { + this.liveBuyGuardSelectClickListener = liveBuyGuardSelectClickListener; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GuardDataTipModel.java b/common/src/main/java/com/yunbao/common/bean/GuardDataTipModel.java new file mode 100644 index 000000000..d08b56f6b --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardDataTipModel.java @@ -0,0 +1,136 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class GuardDataTipModel extends BaseModel { + /** + * { + * "guard_name": "星之守護", // 守护名称 + * "guard_type": 1, // 守护类型 + * "close_img": "https://ceshi.yaoulive.com/data/upload/20240304/guard_xing_close.png", // 未开通图标 + * "open_img": "https://ceshi.yaoulive.com/data/upload/20240304/guard_xing_open.png", // 已开通图标 + * "is_open": true, // 是否开通 是.true 否.false + * "price": { // 价格 + * { + * "opening_time": "1個月", // 开通时长 + * "original_price": "188000", // 原价 + * "discount_price": "", // 折扣价 + * "discount": "", // 折扣 + * "price_key": 1 + * }, + * { + * "opening_time": "3個月", + * "original_price": "564000", + * "discount_price": "398000", + * "discount": "7.1折", + * "price_key": 3 + * }, + * { + * "opening_time": "6個月", + * "original_price": "1128000", + * "discount_price": "738000", + * "discount": "6.5折", + * "price_key": 6 + * }, + * { + * "opening_time": "12個月", + * "original_price": "2256000", + * "discount_price": "1314000", + * "discount": "5.8折", + * "price_key": 12 + * } + * ], + * "guard_privilege": [ + * "https://ceshi.yaoulive.com/data/upload/20240304/tequan_1.png", + * "https://ceshi.yaoulive.com/data/upload/20240304/tequan_2.png", + * "https://ceshi.yaoulive.com/data/upload/20240304/tequan_3.png", + * "https://ceshi.yaoulive.com/data/upload/20240304/tequan_1.png", + * "https://ceshi.yaoulive.com/data/upload/20240304/tequan_2.png", + * "https://ceshi.yaoulive.com/data/upload/20240304/tequan_3.png", + * "https://ceshi.yaoulive.com/data/upload/20240304/tequan_1.png", + * "https://ceshi.yaoulive.com/data/upload/20240304/tequan_1.png", + * "https://ceshi.yaoulive.com/data/upload/20240304/tequan_2.png", + * "https://ceshi.yaoulive.com/data/upload/20240304/tequan_3.png" + * ] + * } + */ + @SerializedName("guard_name") + private String guardName; + @SerializedName("guard_type") + private int guardType; + @SerializedName("close_img") + private String closeImg; + @SerializedName("open_img") + private String openImg; + @SerializedName("is_open") + private boolean isOpen; + @SerializedName("price") + private List price; + @SerializedName("guard_privilege") + private List guardPrivilege; + + public String getGuardName() { + return guardName; + } + + public GuardDataTipModel setGuardName(String guardName) { + this.guardName = guardName; + return this; + } + + public int getGuardType() { + return guardType; + } + + public GuardDataTipModel setGuardType(int guardType) { + this.guardType = guardType; + return this; + } + + public String getCloseImg() { + return closeImg; + } + + public GuardDataTipModel setCloseImg(String closeImg) { + this.closeImg = closeImg; + return this; + } + + public String getOpenImg() { + return openImg; + } + + public GuardDataTipModel setOpenImg(String openImg) { + this.openImg = openImg; + return this; + } + + public boolean isOpen() { + return isOpen; + } + + public GuardDataTipModel setOpen(boolean open) { + isOpen = open; + return this; + } + + public List getPrice() { + return price; + } + + public GuardDataTipModel setPrice(List price) { + this.price = price; + return this; + } + + public List getGuardPrivilege() { + return guardPrivilege; + } + + public GuardDataTipModel setGuardPrivilege(List guardPrivilege) { + this.guardPrivilege = guardPrivilege; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GuardGetGuardOpenInfoModel.java b/common/src/main/java/com/yunbao/common/bean/GuardGetGuardOpenInfoModel.java new file mode 100644 index 000000000..61c19c244 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardGetGuardOpenInfoModel.java @@ -0,0 +1,31 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class GuardGetGuardOpenInfoModel extends BaseModel { + + @SerializedName("user_info") + private GuardUserInfoModel userInfo; + @SerializedName("guard_data") + private List guardData; + + public GuardUserInfoModel getUserInfo() { + return userInfo; + } + + public GuardGetGuardOpenInfoModel setUserInfo(GuardUserInfoModel userInfo) { + this.userInfo = userInfo; + return this; + } + + public List getGuardData() { + return guardData; + } + + public GuardGetGuardOpenInfoModel setGuardData(List guardData) { + this.guardData = guardData; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GuardGetGuardUserInfoModel.java b/common/src/main/java/com/yunbao/common/bean/GuardGetGuardUserInfoModel.java new file mode 100644 index 000000000..d887b76f8 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardGetGuardUserInfoModel.java @@ -0,0 +1,131 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class GuardGetGuardUserInfoModel extends BaseModel { + /** + * "info": { + * "uid": "98923", // 用户ID + * "user_avatar": "https://downs.yaoulive.com/20230706/0572c0f694601f4d2695cd210effbe93.jpeg?imageView2/2/w/600/h/600", // 用户头像链接 + * "liveuid": "98889", // 主播ID + * "live_avatar": "https://ceshi.yaoulive.com/data/upload/20230522/20230526102906.png", // 主播头像链接 + * "guard_type": 0, // 守护类型 0.未开通 1.星之守护 2.王之守护 3.神之守护 + * "exp": 0, // 守护经验值 + * "level": 0, // 守护等级 + * "endtime": 0, // 到期时间 + * "user_language": "chinese", + * "live_language": "chinese" + * } + * } + */ + @SerializedName("uid") + private String uid; + @SerializedName("user_avatar") + private String userAvatar; + @SerializedName("liveuid") + private String liveuid; + @SerializedName("live_avatar") + private String liveAvatar; + @SerializedName("guard_type") + private int guardType; + @SerializedName("exp") + private int exp; + @SerializedName("level") + private int level; + @SerializedName("endtime") + private int endtime; + @SerializedName("user_language") + private String userLanguage; + @SerializedName("live_language") + private String liveLanguage; + + public String getUid() { + return uid; + } + + public GuardGetGuardUserInfoModel setUid(String uid) { + this.uid = uid; + return this; + } + + public String getUserAvatar() { + return userAvatar; + } + + public GuardGetGuardUserInfoModel setUserAvatar(String userAvatar) { + this.userAvatar = userAvatar; + return this; + } + + public String getLiveuid() { + return liveuid; + } + + public GuardGetGuardUserInfoModel setLiveuid(String liveuid) { + this.liveuid = liveuid; + return this; + } + + public String getLiveAvatar() { + return liveAvatar; + } + + public GuardGetGuardUserInfoModel setLiveAvatar(String liveAvatar) { + this.liveAvatar = liveAvatar; + return this; + } + + public int getGuardType() { + return guardType; + } + + public GuardGetGuardUserInfoModel setGuardType(int guardType) { + this.guardType = guardType; + return this; + } + + public int getExp() { + return exp; + } + + public GuardGetGuardUserInfoModel setExp(int exp) { + this.exp = exp; + return this; + } + + public int getLevel() { + return level; + } + + public GuardGetGuardUserInfoModel setLevel(int level) { + this.level = level; + return this; + } + + public int getEndtime() { + return endtime; + } + + public GuardGetGuardUserInfoModel setEndtime(int endtime) { + this.endtime = endtime; + return this; + } + + public String getUserLanguage() { + return userLanguage; + } + + public GuardGetGuardUserInfoModel setUserLanguage(String userLanguage) { + this.userLanguage = userLanguage; + return this; + } + + public String getLiveLanguage() { + return liveLanguage; + } + + public GuardGetGuardUserInfoModel setLiveLanguage(String liveLanguage) { + this.liveLanguage = liveLanguage; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GuardPriceModel.java b/common/src/main/java/com/yunbao/common/bean/GuardPriceModel.java new file mode 100644 index 000000000..24568f683 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardPriceModel.java @@ -0,0 +1,70 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class GuardPriceModel extends BaseModel { + /** + * { + * "opening_time": "1個月", // 开通时长 + * "original_price": "188000", // 原价 + * "discount_price": "", // 折扣价 + * "discount": "", // 折扣 + * "price_key": 1 + * } + */ + @SerializedName("opening_time") + private String openingTime; + @SerializedName("original_price") + private String originalPrice; + @SerializedName("discount_price") + private String discountPrice; + @SerializedName("discount") + private String discount; + @SerializedName("price_key") + private int priceKey; + + public String getOpeningTime() { + return openingTime; + } + + public GuardPriceModel setOpeningTime(String openingTime) { + this.openingTime = openingTime; + return this; + } + + public String getOriginalPrice() { + return originalPrice; + } + + public GuardPriceModel setOriginalPrice(String originalPrice) { + this.originalPrice = originalPrice; + return this; + } + + public String getDiscountPrice() { + return discountPrice; + } + + public GuardPriceModel setDiscountPrice(String discountPrice) { + this.discountPrice = discountPrice; + return this; + } + + public String getDiscount() { + return discount; + } + + public GuardPriceModel setDiscount(String discount) { + this.discount = discount; + return this; + } + + public int getPriceKey() { + return priceKey; + } + + public GuardPriceModel setPriceKey(int priceKey) { + this.priceKey = priceKey; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GuardUserInfoModel.java b/common/src/main/java/com/yunbao/common/bean/GuardUserInfoModel.java new file mode 100644 index 000000000..4f34f1006 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardUserInfoModel.java @@ -0,0 +1,131 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class GuardUserInfoModel extends BaseModel { + /** + * { + * "user_info": { // 用户开通信息 + * "uid": "98888", // 用户ID + * "user_avatar": "https://downs.yaoulive.com/mannine.png", // 用户头像链接 + * "liveuid": "98889", // 主播ID + * "live_avatar": "https://ceshi.yaoulive.com/data/upload/20230522/20230526102906.png", // 主播头像链接 + * "guard_type": 1, // 守护类型 + * "exp": 0, // 经验值 + * "level": 1, // 等级 + * "endtime": 1710145929, // 到期时间 + * "user_language": "chinese", // 用户语言 + * "live_language": "chinese" // 主播语言 + * } + */ + @SerializedName("uid") + private String uid; + @SerializedName("user_avatar") + private String userAvatar; + @SerializedName("liveuid") + private String liveuid; + @SerializedName("live_avatar") + private String liveAvatar; + @SerializedName("guard_type") + private int guardType; + @SerializedName("exp") + private int exp; + @SerializedName("level") + private int level; + @SerializedName("endtime") + private int endtime; + @SerializedName("user_language") + private String userLanguage; + @SerializedName("live_language") + private String liveLanguage; + + public String getUid() { + return uid; + } + + public GuardUserInfoModel setUid(String uid) { + this.uid = uid; + return this; + } + + public String getUserAvatar() { + return userAvatar; + } + + public GuardUserInfoModel setUserAvatar(String userAvatar) { + this.userAvatar = userAvatar; + return this; + } + + public String getLiveuid() { + return liveuid; + } + + public GuardUserInfoModel setLiveuid(String liveuid) { + this.liveuid = liveuid; + return this; + } + + public String getLiveAvatar() { + return liveAvatar; + } + + public GuardUserInfoModel setLiveAvatar(String liveAvatar) { + this.liveAvatar = liveAvatar; + return this; + } + + public int getGuardType() { + return guardType; + } + + public GuardUserInfoModel setGuardType(int guardType) { + this.guardType = guardType; + return this; + } + + public int getExp() { + return exp; + } + + public GuardUserInfoModel setExp(int exp) { + this.exp = exp; + return this; + } + + public int getLevel() { + return level; + } + + public GuardUserInfoModel setLevel(int level) { + this.level = level; + return this; + } + + public int getEndtime() { + return endtime; + } + + public GuardUserInfoModel setEndtime(int endtime) { + this.endtime = endtime; + return this; + } + + public String getUserLanguage() { + return userLanguage; + } + + public GuardUserInfoModel setUserLanguage(String userLanguage) { + this.userLanguage = userLanguage; + return this; + } + + public String getLiveLanguage() { + return liveLanguage; + } + + public GuardUserInfoModel setLiveLanguage(String liveLanguage) { + this.liveLanguage = liveLanguage; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/LiveBuyGuardSelectPopup.java b/common/src/main/java/com/yunbao/common/dialog/LiveBuyGuardSelectPopup.java new file mode 100644 index 000000000..043790f29 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/LiveBuyGuardSelectPopup.java @@ -0,0 +1,127 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.content.DialogInterface; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.lxj.xpopup.core.AttachPopupView; +import com.yunbao.common.R; +import com.yunbao.common.adapter.LiveBuyGuardSelectAdapter; +import com.yunbao.common.bean.GuardPriceModel; +import com.yunbao.common.views.LiveBuyGuardSelectViewHolder; + +import java.util.ArrayList; +import java.util.List; + +public class LiveBuyGuardSelectPopup extends AttachPopupView { + private int mType; + private DialogInterface.OnDismissListener onDismissListener; + + private LiveBuyGuardSelectListener buyGuardSelectListener; + List price = new ArrayList<>(); + LiveBuyGuardSelectAdapter liveBuyGuardSelectAdapter; + RecyclerView live_buy_guard_list; + + public LiveBuyGuardSelectPopup(@NonNull Context context, List mPrice) { + super(context); + price = mPrice; + } + + protected int getImplLayoutId() { + return R.layout.view_live_buy_guard_slelect; + } + + @Override + protected void onCreate() { + live_buy_guard_list = findViewById(R.id.live_buy_guard_list); + liveBuyGuardSelectAdapter = new LiveBuyGuardSelectAdapter(price); + live_buy_guard_list.setAdapter(liveBuyGuardSelectAdapter); + live_buy_guard_list.setLayoutManager(new LinearLayoutManager(getContext())); + liveBuyGuardSelectAdapter.setLiveBuyGuardSelectClickListener(new LiveBuyGuardSelectViewHolder.LiveBuyGuardSelectClickListener() { + @Override + public void onClickListener(GuardPriceModel guardPriceModel) { + dialog.dismiss(); + if (onDismissListener != null) { + onDismissListener.onDismiss(null); + } + if (buyGuardSelectListener != null) { + buyGuardSelectListener.onLiveBuyGuardSelectListener(guardPriceModel); + } + } + }); +// ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.one_month), new ViewClicksAntiShake.ViewClicksCallBack() { +// @Override +// public void onViewClicks() { +// dialog.dismiss(); +// if (onDismissListener != null) { +// onDismissListener.onDismiss(null); +// } +// if (buyGuardSelectListener != null) { +// buyGuardSelectListener.onLiveBuyGuardSelectListener(0); +// } +// } +// }); +// ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.tree_month), new ViewClicksAntiShake.ViewClicksCallBack() { +// @Override +// public void onViewClicks() { +// dialog.dismiss(); +// if (onDismissListener != null) { +// onDismissListener.onDismiss(null); +// } +// if (buyGuardSelectListener != null) { +// buyGuardSelectListener.onLiveBuyGuardSelectListener(1); +// } +// } +// }); +// ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.six_month), new ViewClicksAntiShake.ViewClicksCallBack() { +// @Override +// public void onViewClicks() { +// dialog.dismiss(); +// if (onDismissListener != null) { +// onDismissListener.onDismiss(null); +// } +// if (buyGuardSelectListener != null) { +// buyGuardSelectListener.onLiveBuyGuardSelectListener(2); +// } +// } +// }); +// ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.one_two_month), new ViewClicksAntiShake.ViewClicksCallBack() { +// @Override +// public void onViewClicks() { +// dialog.dismiss(); +// if (onDismissListener != null) { +// onDismissListener.onDismiss(null); +// } +// if (buyGuardSelectListener != null) { +// buyGuardSelectListener.onLiveBuyGuardSelectListener(3); +// } +// } +// }); + + } + + public LiveBuyGuardSelectPopup setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) { + this.onDismissListener = onDismissListener; + return this; + } + + public LiveBuyGuardSelectPopup setBuyGuardSelectListener(LiveBuyGuardSelectListener buyGuardSelectListener) { + this.buyGuardSelectListener = buyGuardSelectListener; + return this; + } + + @Override + protected void onDismiss() { + super.onDismiss(); + if (onDismissListener != null) { + onDismissListener.onDismiss(null); + } + } + + public interface LiveBuyGuardSelectListener { + void onLiveBuyGuardSelectListener(GuardPriceModel guardPriceModel); + } +} diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 537b97f59..44f52fcf6 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -26,6 +26,8 @@ import com.yunbao.common.bean.GiftGuideModel; import com.yunbao.common.bean.GiftNamingInfoModel; import com.yunbao.common.bean.GiftWallGiftDetail; import com.yunbao.common.bean.GiftWallModel; +import com.yunbao.common.bean.GuardGetGuardOpenInfoModel; +import com.yunbao.common.bean.GuardGetGuardUserInfoModel; import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.IMLoginModel; @@ -1162,4 +1164,9 @@ public interface PDLiveApi { @GET("/api/public/?service=Sudgameserver.getRoomMicStatus") Observable> getRoomMicStatus(); + + @GET("/api/public/?service=Guard.getGuardUserInfo") + Observable> getGuardUserInfo(@Query("liveuid") String liveUid); + @GET("/api/public/?service=Guard.getGuardOpenInfo") + Observable> getGuardOpenInfo(@Query("liveuid") String liveUid); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 9b4321c7a..4d08b1e1d 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -27,6 +27,8 @@ import com.yunbao.common.bean.GiftGuideModel; import com.yunbao.common.bean.GiftNamingInfoModel; import com.yunbao.common.bean.GiftWallGiftDetail; import com.yunbao.common.bean.GiftWallModel; +import com.yunbao.common.bean.GuardGetGuardOpenInfoModel; +import com.yunbao.common.bean.GuardGetGuardUserInfoModel; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LinkMicUserBeanV2; @@ -2770,7 +2772,7 @@ public class LiveNetManager { }).isDisposed(); } - public void addChatCount(String stream,HttpCallback callback) { + public void addChatCount(String stream, HttpCallback callback) { API.get().pdLiveApi(mContext) .addChatCount(stream) .subscribeOn(Schedulers.io()) @@ -2931,6 +2933,54 @@ public class LiveNetManager { } + public void getGuardUserInfo(String liveUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getGuardUserInfo(liveUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel guardGetGuardUserInfoModelResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(guardGetGuardUserInfoModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + + } + + public void getGuardOpenInfo(String liveUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getGuardOpenInfo(liveUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel guardGetGuardOpenInfoModelResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(guardGetGuardOpenInfoModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/views/LiveBuyGuardPrivilegeViewHolder.java b/common/src/main/java/com/yunbao/common/views/LiveBuyGuardPrivilegeViewHolder.java new file mode 100644 index 000000000..e838c2ddf --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/LiveBuyGuardPrivilegeViewHolder.java @@ -0,0 +1,25 @@ +package com.yunbao.common.views; + +import android.util.Log; +import android.view.View; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.glide.ImgLoader; + +public class LiveBuyGuardPrivilegeViewHolder extends RecyclerView.ViewHolder { + ImageView guard_privilege; + + public LiveBuyGuardPrivilegeViewHolder(@NonNull View itemView) { + super(itemView); + guard_privilege = itemView.findViewById(R.id.guard_privilege); + } + + public void setData(String url) { + Log.e("LiveBuyGuardPrivilege", url); + ImgLoader.display(itemView.getContext(), url, guard_privilege); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/LiveBuyGuardSelectViewHolder.java b/common/src/main/java/com/yunbao/common/views/LiveBuyGuardSelectViewHolder.java new file mode 100644 index 000000000..d55edc933 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/LiveBuyGuardSelectViewHolder.java @@ -0,0 +1,37 @@ +package com.yunbao.common.views; + +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.bean.GuardPriceModel; + +public class LiveBuyGuardSelectViewHolder extends RecyclerView.ViewHolder { + TextView opening_time, discount; + + public LiveBuyGuardSelectViewHolder(@NonNull View itemView) { + super(itemView); + opening_time = itemView.findViewById(R.id.opening_time); + discount = itemView.findViewById(R.id.discount); + } + + public void setData(GuardPriceModel guardPriceModel,LiveBuyGuardSelectClickListener liveBuyGuardSelectClickListener) { + opening_time.setText(String.valueOf(guardPriceModel.getOpeningTime())); + discount.setText(String.valueOf(guardPriceModel.getDiscount())); + itemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (liveBuyGuardSelectClickListener!=null){ + liveBuyGuardSelectClickListener.onClickListener(guardPriceModel); + } + } + }); + + } + public interface LiveBuyGuardSelectClickListener{ + void onClickListener(GuardPriceModel guardPriceModel); + } +} diff --git a/common/src/main/res/drawable/bg_god_guard_bottom_panel.xml b/common/src/main/res/drawable/bg_god_guard_bottom_panel.xml new file mode 100644 index 000000000..849c375ca --- /dev/null +++ b/common/src/main/res/drawable/bg_god_guard_bottom_panel.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_king_guard_bottom_panel.xml b/common/src/main/res/drawable/bg_king_guard_bottom_panel.xml new file mode 100644 index 000000000..bbac5f838 --- /dev/null +++ b/common/src/main/res/drawable/bg_king_guard_bottom_panel.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_buy_guard_select.xml b/common/src/main/res/drawable/bg_live_buy_guard_select.xml new file mode 100644 index 000000000..2bd715324 --- /dev/null +++ b/common/src/main/res/drawable/bg_live_buy_guard_select.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_star_guard_bottom_panel.xml b/common/src/main/res/drawable/bg_star_guard_bottom_panel.xml new file mode 100644 index 000000000..7773d2e48 --- /dev/null +++ b/common/src/main/res/drawable/bg_star_guard_bottom_panel.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_live_buy_guard_privilege_item.xml b/common/src/main/res/layout/view_live_buy_guard_privilege_item.xml new file mode 100644 index 000000000..be60e9b7f --- /dev/null +++ b/common/src/main/res/layout/view_live_buy_guard_privilege_item.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_live_buy_guard_slelect.xml b/common/src/main/res/layout/view_live_buy_guard_slelect.xml new file mode 100644 index 000000000..c22623956 --- /dev/null +++ b/common/src/main/res/layout/view_live_buy_guard_slelect.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_live_buy_guard_slelect_item.xml b/common/src/main/res/layout/view_live_buy_guard_slelect_item.xml new file mode 100644 index 000000000..46ff3bc13 --- /dev/null +++ b/common/src/main/res/layout/view_live_buy_guard_slelect_item.xml @@ -0,0 +1,30 @@ + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-xxhdpi/background_guarding_the_anchor.png b/common/src/main/res/mipmap-xxhdpi/background_guarding_the_anchor.png new file mode 100644 index 000000000..6619c35ed Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/background_guarding_the_anchor.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/btn_god_guard.png b/common/src/main/res/mipmap-xxhdpi/btn_god_guard.png new file mode 100644 index 000000000..abe2fb577 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/btn_god_guard.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/btn_king_guard.png b/common/src/main/res/mipmap-xxhdpi/btn_king_guard.png new file mode 100644 index 000000000..cc8519d93 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/btn_king_guard.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/btn_star_guard.png b/common/src/main/res/mipmap-xxhdpi/btn_star_guard.png new file mode 100644 index 000000000..5bf30be92 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/btn_star_guard.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_bg_king_guard_open.png b/common/src/main/res/mipmap-xxhdpi/icon_bg_king_guard_open.png new file mode 100644 index 000000000..fcb4fdc5b Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_bg_king_guard_open.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_bg_star_guard_open.png b/common/src/main/res/mipmap-xxhdpi/icon_bg_star_guard_open.png new file mode 100644 index 000000000..89c8eee2a Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_bg_star_guard_open.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_god_guard_open.png b/common/src/main/res/mipmap-xxhdpi/icon_god_guard_open.png new file mode 100644 index 000000000..eec257c19 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_god_guard_open.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_guard_rule.png b/common/src/main/res/mipmap-xxhdpi/icon_guard_rule.png new file mode 100644 index 000000000..aa5e41546 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_guard_rule.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_guardian_task.png b/common/src/main/res/mipmap-xxhdpi/icon_guardian_task.png new file mode 100644 index 000000000..e1e8db81a Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_guardian_task.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_star_guardian_medal_grey.png b/common/src/main/res/mipmap-xxhdpi/icon_star_guardian_medal_grey.png new file mode 100644 index 000000000..bd8cbbefe Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_star_guardian_medal_grey.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/tequan_1.png b/common/src/main/res/mipmap-xxhdpi/tequan_1.png new file mode 100644 index 000000000..19217ae4c Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/tequan_1.png differ diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 45b7f1cb1..796942da7 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1459,4 +1459,26 @@ Limited ride And limited avatar frame 【星之守护】 + 守護團特權 + 成爲TA的專屬守護 為TA保駕護航 + 暫未開通 + TA的守護團 > + 開通王之守護 + 續費王之守護 + 開通星之守護 + 續費星之守護 + 開通神之守護 + 續費神之守護 + 1個月 + 3個月 + 6個月 + 12個月 + 快爲您喜歡的主播開通守護吧! + 守護任務 + 我的等級 > + 還沒人守護主播,快來守護TA吧~ + 本周貢獻值 + 貢獻度 + 已開通 + diff --git a/config.gradle b/config.gradle index 56053f057..3dab052eb 100644 --- a/config.gradle +++ b/config.gradle @@ -5,13 +5,13 @@ ext { minSdkVersion : 21, targetSdkVersion : 33, versionCode : 464, - versionName : "6.6.5" + versionName : "6.6.6" ] manifestPlaceholders = [ //正式、 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", // 测试 - //serverHost : "https://ceshi.yaoulive.com", + serverHost : "https://ceshi.yaoulive.com", //百度语音识别 diff --git a/gradle.properties b/gradle.properties index 55b4ba5d7..4659a6458 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ # org.gradle.parallel=true #Thu Feb 04 00:05:45 CST 2021 android.injected.testOnly=false -org.gradle.daemon=true +org.gradle.daemon=true org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.parallel=true org.gradle.configureondemand=true @@ -23,6 +23,6 @@ android.enableJetifier=true systemProp.http.proxyHost=127.0.0.1 systemProp.https.proxyHost=127.0.0.1 -systemProp.https.proxyPort=7980 +systemProp.https.proxyPort=7890 systemProp.http.proxyPort=7890 #android.enableR8.fullMode=true \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index 24760589f..bdda1d876 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -36,6 +36,8 @@ import com.yunbao.common.event.CoinChangeEvent; import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.SendBlindGiftEvent; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpConsts; +import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.KeyBoardHeightChangeListener; import com.yunbao.common.manager.IMLoginManager; @@ -48,7 +50,7 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.formatBigNum; import com.yunbao.live.R; -import com.yunbao.live.bean.GuardUserBean; +import com.yunbao.live.bean.GuardUserModel; import com.yunbao.live.bean.LiveBuyGuardMsgBean; import com.yunbao.live.bean.LiveChatBean; import com.yunbao.live.bean.LiveDanMuBean; @@ -64,21 +66,18 @@ import com.yunbao.live.dialog.LiveFansFragment; import com.yunbao.live.dialog.LiveFansMedalOkDialogFragment; import com.yunbao.live.dialog.LiveGiveHotDialogFragment; import com.yunbao.live.dialog.LiveGuardBuyDialogFragment; +import com.yunbao.live.dialog.LiveGuardDialog; import com.yunbao.live.dialog.LiveGuardDialogFragment; import com.yunbao.live.dialog.LiveInputDialogFragment; import com.yunbao.live.dialog.LiveMicAnchorDialogFragment; import com.yunbao.live.dialog.LiveMoreDialogFragment; import com.yunbao.live.dialog.LiveNewGuardBuyDialogFragment; -import com.yunbao.live.dialog.LiveNewGuardDialogFragment; -import com.yunbao.live.dialog.LiveNewGuardListDialogFragment; import com.yunbao.live.dialog.LiveRedPackListDialogFragment; import com.yunbao.live.dialog.LiveRedPackSendDialogFragment; import com.yunbao.live.dialog.LiveShareDialogFragment; import com.yunbao.live.dialog.LiveUserAnchorMailBoxPopDialog; import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveUserMoreDialogFragment; -import com.yunbao.common.http.LiveHttpConsts; -import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter; import com.yunbao.live.presenter.LiveLinkMicPkPresenter; import com.yunbao.live.presenter.LiveLinkMicPresenter; @@ -735,7 +734,8 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL } } - public Handler mHandler = new Handler(); + + public Handler mHandler = new Handler(); public pkRunnable pr; public class pkRunnable implements Runnable { @@ -1269,19 +1269,22 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL LiveHttpUtil.getGuardList(uid, 1, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - List list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class); + List list = JSON.parseArray(Arrays.toString(info), GuardUserModel.class); + Log.e("getGuardList", list.toString()); if (list.isEmpty()) { - openNewBuyGuardWindow(true); +// openNewBuyGuardWindow(true); + new LiveGuardDialog(mContext, true,mLiveUid).showDialog(); } else { - LiveNewGuardDialogFragment fragment = new LiveNewGuardDialogFragment(); - fragment.setList(list); - fragment.setLiveGuardInfo(mLiveGuardInfo); - Bundle bundle = new Bundle(); - bundle.putString(Constants.LIVE_UID, mLiveUid); - bundle.putBoolean(Constants.ANCHOR, mIsAnchor); - bundle.putBoolean("showBuyView", !showBuyView); - fragment.setArguments(bundle); - fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment"); +// LiveNewGuardDialogFragment fragment = new LiveNewGuardDialogFragment(); +// fragment.setList(list); +// fragment.setLiveGuardInfo(mLiveGuardInfo); +// Bundle bundle = new Bundle(); +// bundle.putString(Constants.LIVE_UID, mLiveUid); +// bundle.putBoolean(Constants.ANCHOR, mIsAnchor); +// bundle.putBoolean("showBuyView", !showBuyView); +// fragment.setArguments(bundle); +// fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment"); + new LiveGuardDialog(mContext, false,mLiveUid).showDialog(); } } }); diff --git a/live/src/main/java/com/yunbao/live/adapter/NewGuardAdapter.java b/live/src/main/java/com/yunbao/live/adapter/NewGuardAdapter.java new file mode 100644 index 000000000..6f1e3201c --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/NewGuardAdapter.java @@ -0,0 +1,35 @@ +package com.yunbao.live.adapter; + +import android.content.Context; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.live.R; +import com.yunbao.live.bean.GuardUserModel; +import com.yunbao.live.views.NewGuardViewHolder; + +public class NewGuardAdapter extends RefreshAdapter { + public NewGuardAdapter(Context context) { + super(context); + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new NewGuardViewHolder(mInflater.inflate(R.layout.view_new_guard_item, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + NewGuardViewHolder newGuardViewHolder = (NewGuardViewHolder) holder; + newGuardViewHolder.setData(mList.get(position), position); + } + + @Override + public int getItemCount() { + return mList.size(); + } +} diff --git a/live/src/main/java/com/yunbao/live/bean/BuyGuardBannerModel.java b/live/src/main/java/com/yunbao/live/bean/BuyGuardBannerModel.java new file mode 100644 index 000000000..1f24db05c --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/BuyGuardBannerModel.java @@ -0,0 +1,98 @@ +package com.yunbao.live.bean; + +import com.stx.xhb.androidx.entity.BaseBannerInfo; + +public class BuyGuardBannerModel implements BaseBannerInfo { + private int guardImage; + private String name; + + private String guardianMedal; + private int guardOpen; + private int[] gradientColors; + private String userAvatar; + private String liveAvatar; + private boolean isOpen; + + public boolean isOpen() { + return isOpen; + } + + public BuyGuardBannerModel setOpen(boolean open) { + isOpen = open; + return this; + } + + public String getUserAvatar() { + return userAvatar; + } + + public BuyGuardBannerModel setUserAvatar(String userAvatar) { + this.userAvatar = userAvatar; + return this; + } + + public String getLiveAvatar() { + return liveAvatar; + } + + public BuyGuardBannerModel setLiveAvatar(String liveAvatar) { + this.liveAvatar = liveAvatar; + return this; + } + + public int[] getGradientColors() { + return gradientColors; + } + + public BuyGuardBannerModel setGradientColors(int[] gradientColors) { + this.gradientColors = gradientColors; + return this; + } + + public int getGuardOpen() { + return guardOpen; + } + + public BuyGuardBannerModel setGuardOpen(int guardOpen) { + this.guardOpen = guardOpen; + return this; + } + + public String getGuardianMedal() { + return guardianMedal; + } + + public BuyGuardBannerModel setGuardImage(int guardImage) { + this.guardImage = guardImage; + return this; + } + + public BuyGuardBannerModel setGuardianMedal(String guardianMedal) { + this.guardianMedal = guardianMedal; + return this; + } + + public String getName() { + return name; + } + + public BuyGuardBannerModel setName(String name) { + this.name = name; + return this; + } + + public int getGuardImage() { + return guardImage; + } + + + @Override + public Object getXBannerUrl() { + return null; + } + + @Override + public String getXBannerTitle() { + return null; + } +} diff --git a/live/src/main/java/com/yunbao/live/bean/GuardUserModel.java b/live/src/main/java/com/yunbao/live/bean/GuardUserModel.java new file mode 100644 index 000000000..f4aaaa0b5 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/GuardUserModel.java @@ -0,0 +1,199 @@ +package com.yunbao.live.bean; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.bean.BaseModel; + +public class GuardUserModel extends BaseModel { + /** + * { + * "id": 98888, + * "user_nicename": "周末暴打小朋友", + * "avatar": "https://downs.yaoulive.com/mannine.png", + * "sex": 1, + * "type": 1, + * "level": "33", + * "dress_img": "https://downs.yaoulive.com/dress/effect/huangdi-touxiang.svga", + * "contribute": "40680", + * "level_thumb": "https://downs.yaoulive.com/level/user_lv30_bg.png", + * "guard_type": 1, + * "guard_exp": 0, + * "guard_level": 1, + * "guard_name": "星之守護", + * "guard_img": "https://ceshi.yaoulive.com/data/upload/20240304/guard_xing_open.png" + * } + */ + @SerializedName("id") + private int id; + @SerializedName("user_nicename") + private String userNicename; + @SerializedName("avatar") + private String avatar; + @SerializedName("sex") + private int sex; + @SerializedName("type") + private int type; + @SerializedName("level") + private String level; + @SerializedName("dress_img") + private String dressImg; + @SerializedName("contribute") + private String contribute; + @SerializedName("level_thumb") + private String levelThumb; + @SerializedName("guard_type") + private int guardType; + @SerializedName("guard_exp") + private int guardExp; + @SerializedName("guard_level") + private int guardLevel; + @SerializedName("guard_name") + private String guardName; + @SerializedName("guard_img") + private String guardImg; + + public int getId() { + return id; + } + + public GuardUserModel setId(int id) { + this.id = id; + return this; + } + + public String getUserNicename() { + return userNicename; + } + + public GuardUserModel setUserNicename(String userNicename) { + this.userNicename = userNicename; + return this; + } + + public String getAvatar() { + return avatar; + } + + public GuardUserModel setAvatar(String avatar) { + this.avatar = avatar; + return this; + } + + public int getSex() { + return sex; + } + + public GuardUserModel setSex(int sex) { + this.sex = sex; + return this; + } + + public int getType() { + return type; + } + + public GuardUserModel setType(int type) { + this.type = type; + return this; + } + + public String getLevel() { + return level; + } + + public GuardUserModel setLevel(String level) { + this.level = level; + return this; + } + + public String getDressImg() { + return dressImg; + } + + public GuardUserModel setDressImg(String dressImg) { + this.dressImg = dressImg; + return this; + } + + public String getContribute() { + return contribute; + } + + public GuardUserModel setContribute(String contribute) { + this.contribute = contribute; + return this; + } + + public String getLevelThumb() { + return levelThumb; + } + + public GuardUserModel setLevelThumb(String levelThumb) { + this.levelThumb = levelThumb; + return this; + } + + public int getGuardType() { + return guardType; + } + + public GuardUserModel setGuardType(int guardType) { + this.guardType = guardType; + return this; + } + + public int getGuardExp() { + return guardExp; + } + + public GuardUserModel setGuardExp(int guardExp) { + this.guardExp = guardExp; + return this; + } + + public int getGuardLevel() { + return guardLevel; + } + + public GuardUserModel setGuardLevel(int guardLevel) { + this.guardLevel = guardLevel; + return this; + } + + public String getGuardName() { + return guardName; + } + + public GuardUserModel setGuardName(String guardName) { + this.guardName = guardName; + return this; + } + + public String getGuardImg() { + return guardImg; + } + + public GuardUserModel setGuardImg(String guardImg) { + this.guardImg = guardImg; + return this; + } + + @Override + public String toString() { + return "GuardUserModel{" + + "id=" + id + + ", userNicename='" + userNicename + '\'' + + ", avatar='" + avatar + '\'' + + ", sex=" + sex + + ", type=" + type + + ", level='" + level + '\'' + + ", dressImg='" + dressImg + '\'' + + ", contribute='" + contribute + '\'' + + ", levelThumb='" + levelThumb + '\'' + + ", guardType=" + guardType + + ", guardExp=" + guardExp + + ", guardLevel=" + guardLevel + + ", guardName='" + guardName + '\'' + + ", guardImg='" + guardImg + '\'' + + '}'; + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java index 8dfdbbf47..c9a16d99b 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java @@ -1,22 +1,44 @@ package com.yunbao.live.dialog; +import android.animation.ObjectAnimator; import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.graphics.Paint; +import android.text.TextUtils; +import android.util.Log; +import android.view.View; +import android.view.animation.LinearInterpolator; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.PagerSnapHelper; +import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import androidx.viewpager2.adapter.FragmentStateAdapter; -import androidx.viewpager2.widget.ViewPager2; +import androidx.viewpager.widget.ViewPager; +import com.flyjingfish.gradienttextviewlib.GradientTextView; import com.lxj.xpopup.XPopup; -import com.yunbao.common.custom.ItemDecoration; +import com.lxj.xpopup.enums.PopupPosition; +import com.makeramen.roundedimageview.RoundedImageView; +import com.stx.xhb.androidx.XBanner; +import com.yunbao.common.adapter.LiveBuyGuardPrivilegeAdapter; +import com.yunbao.common.bean.GuardDataTipModel; +import com.yunbao.common.bean.GuardGetGuardOpenInfoModel; +import com.yunbao.common.bean.GuardPriceModel; import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.dialog.LiveBuyGuardSelectPopup; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; -import com.yunbao.live.adapter.LiveBuyGuardTopListAdapter; -import com.yunbao.live.custom.LiveBuyGuardLinearLayoutManager; +import com.yunbao.live.bean.BuyGuardBannerModel; import com.yunbao.live.fragments.LiveBuyGuardVPFragment; import java.util.ArrayList; @@ -24,11 +46,31 @@ import java.util.List; public class LiveBuyGuardDialog extends AbsDialogPopupWindow { FragmentActivity activity; - RecyclerView recyclerView; - List fragments=new ArrayList<>(); - public LiveBuyGuardDialog(@NonNull Context context) { + + List fragments = new ArrayList<>(); + XBanner buyGuardBanner; + List buyGuardBannerModels = new ArrayList<>(); + + FrameLayout bottomPanel; + ImageView btnGuard; + TextView openTheGuard; + TextView originalPrice; + long animDuration = 500; + ImageView guardArrow; + TextView guardMonth; + String mLiveUid; + List guardDataTipModels; + List price = new ArrayList<>(); + TextView discountPrice, discount; + GuardPriceModel guardPriceModel; + RecyclerView guardPrivilege; + LiveBuyGuardPrivilegeAdapter buyGuardPrivilegeAdapter; + List guardPrivilegeStrings = new ArrayList<>(); + + public LiveBuyGuardDialog(@NonNull Context context, String liveUid) { super(context); - activity=(FragmentActivity) context; + activity = (FragmentActivity) context; + mLiveUid = liveUid; } @Override @@ -41,26 +83,197 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow { return R.layout.dialog_live_buy_guard; } + //底部栏 @Override protected void onCreate() { super.onCreate(); - recyclerView=findViewById(R.id.recycler_view); - recyclerView.setAdapter(new LiveBuyGuardTopListAdapter(mContext)); - LiveBuyGuardLinearLayoutManager layoutManager=new LiveBuyGuardLinearLayoutManager(mContext,RecyclerView.HORIZONTAL,false); - recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener(){ + buyGuardBanner = findViewById(R.id.buy_guard_banner); + bottomPanel = findViewById(R.id.bottom_panel); + btnGuard = findViewById(R.id.btn_guard); + openTheGuard = findViewById(R.id.open_the_guard); + originalPrice = findViewById(R.id.original_price); + guardArrow = findViewById(R.id.guard_arrow); + guardMonth = findViewById(R.id.guard_month); + discountPrice = findViewById(R.id.discount_price); + discount = findViewById(R.id.discount); + guardPrivilege = findViewById(R.id.guard_privilege); + + originalPrice.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG); + guardPrivilege.setLayoutManager(new GridLayoutManager(getContext(), 4)); + buyGuardPrivilegeAdapter = new LiveBuyGuardPrivilegeAdapter(guardPrivilegeStrings); + guardPrivilege.setAdapter(buyGuardPrivilegeAdapter); + int[] gradientColorsStart = {Color.parseColor("#68B4F9"), Color.parseColor("#DCE3F9")}; + int[] gradientColorsKing = {Color.parseColor("#F5DBD5"), Color.parseColor("#FFF8F1")}; + int[] gradientColorsGod = {Color.parseColor("#FFC179"), Color.parseColor("#FFF2D7")}; + int[] openColorsGod = {Color.parseColor("#FFFFFF"), Color.parseColor("#FFFFFF")}; + LiveNetManager.get(mContext).getGuardOpenInfo(mLiveUid, new HttpCallback() { @Override - public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { - super.onScrollStateChanged(recyclerView, newState); + public void onSuccess(GuardGetGuardOpenInfoModel data) { + guardDataTipModels = data.getGuardData(); + guardDataTipModels.get(0).setOpen(true); + for (GuardDataTipModel guardDataTipModel : guardDataTipModels) { + BuyGuardBannerModel guardBannerModel = new BuyGuardBannerModel(); + guardBannerModel.setGuardianMedal(guardDataTipModel.isOpen() ? guardDataTipModel.getOpenImg() : guardDataTipModel.getCloseImg()) + .setName(guardDataTipModel.getGuardName()) + .setLiveAvatar(data.getUserInfo().getLiveAvatar()) + .setUserAvatar(data.getUserInfo().getUserAvatar()) + .setOpen(guardDataTipModel.isOpen()); + if (guardDataTipModel.getGuardType() == 1) { + guardBannerModel.setGradientColors(gradientColorsStart) + .setGuardOpen(R.mipmap.icon_bg_star_guard_open) + .setGuardImage(R.mipmap.bg_star_guard); + } else if (guardDataTipModel.getGuardType() == 2) { + guardBannerModel.setGuardOpen(R.mipmap.icon_bg_king_guard_open) + .setGradientColors(gradientColorsKing) + .setGuardImage(R.mipmap.bg_king_guard); + } else { + guardBannerModel.setGuardOpen(R.mipmap.icon_god_guard_open) + .setGradientColors(gradientColorsGod) + .setGuardImage(R.mipmap.bg_god_guard); + } + buyGuardBannerModels.add(guardBannerModel); + } + buyGuardBanner.setBannerData(R.layout.banner_item_buy_guard, buyGuardBannerModels); + buyGuardBanner.setIsClipChildrenMode(true); + guardPrivilegeStrings = data.getGuardData().get(0).getGuardPrivilege(); + + } + + @Override + public void onError(String error) { + ToastUtil.show(error); } }); - ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 25, 0); - decoration.setOnlySetItemOffsetsButNoDraw(true); - //recyclerView.addItemDecoration(decoration); - recyclerView.setLayoutManager(layoutManager); - PagerSnapHelper snapHelper=new PagerSnapHelper(); - snapHelper.attachToRecyclerView(recyclerView); + + buyGuardBanner.loadImage(new XBanner.XBannerAdapter() { + @Override + public void loadBanner(XBanner banner, Object model, View view, int position) { + + BuyGuardBannerModel guardBannerModel = ((BuyGuardBannerModel) model); + ImageView bg = view.findViewById(R.id.bg); + ImageView guardianMedal = view.findViewById(R.id.guardian_medal); + ImageView guardOpen = view.findViewById(R.id.guard_open); + GradientTextView godGuard = view.findViewById(R.id.god_guard); + RoundedImageView userAvatar = view.findViewById(R.id.user_avatar); + RoundedImageView liveAvatar = view.findViewById(R.id.live_avatar); + + godGuard.setGradientColors(guardBannerModel.isOpen() ? openColorsGod : guardBannerModel.getGradientColors()); + godGuard.setText(guardBannerModel.isOpen() ? WordUtil.getNewString(R.string.have_opened) : WordUtil.getNewString(R.string.not_yet_open)); + ImgLoader.display(getContext(), guardBannerModel.getGuardImage(), bg); + ImgLoader.display(getContext(), guardBannerModel.getGuardianMedal(), guardianMedal); + ImgLoader.display(getContext(), guardBannerModel.getGuardOpen(), guardOpen); + ImgLoader.display(getContext(), guardBannerModel.getUserAvatar(), userAvatar); + ImgLoader.display(getContext(), guardBannerModel.getLiveAvatar(), liveAvatar); + + + } + }); + buyGuardBanner.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { + @Override + public void onPageScrolled(int i, float v, int i1) { + } + + @Override + public void onPageSelected(int position) { + BuyGuardBannerModel guardBannerModel = buyGuardBannerModels.get(position); + GuardDataTipModel dataTipModel = guardDataTipModels.get(position); + price = dataTipModel.getPrice(); + Log.e("LiveBuyGuardDialog", "name = " + guardBannerModel.getName() + " position=" + position); + if (position == 0) { + bottomPanel.setBackgroundResource(R.drawable.bg_star_guard_bottom_panel); + ImgLoader.display(getContext(), R.mipmap.btn_star_guard, btnGuard); + openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.getNewString(R.string.renew_the_start_guard) + : WordUtil.getNewString(R.string.open_the_start_guard)); + + } else if (position == 1) { + bottomPanel.setBackgroundResource(R.drawable.bg_king_guard_bottom_panel); + ImgLoader.display(getContext(), R.mipmap.btn_king_guard, btnGuard); + openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.getNewString(R.string.renew_the_kings_guard) + : WordUtil.getNewString(R.string.open_the_kings_guard)); + } else if (position == 2) { + bottomPanel.setBackgroundResource(R.drawable.bg_god_guard_bottom_panel); + ImgLoader.display(getContext(), R.mipmap.btn_god_guard, btnGuard); + openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.getNewString(R.string.renew_the_god_guard) + : WordUtil.getNewString(R.string.open_the_god_guard)); + } + guardPriceModel = price.get(0); + if (TextUtils.isEmpty(guardPriceModel.getDiscountPrice())) { + discountPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice())); + originalPrice.setVisibility(GONE); + discount.setVisibility(GONE); + } else { + originalPrice.setVisibility(VISIBLE); + discount.setVisibility(VISIBLE); + discountPrice.setText(String.valueOf(guardPriceModel.getDiscountPrice())); + originalPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice())); + discount.setText(String.valueOf(guardPriceModel.getDiscount())); + } + guardMonth.setText(guardPriceModel.getOpeningTime()); + guardPrivilegeStrings = dataTipModel.getGuardPrivilege(); + if (buyGuardPrivilegeAdapter != null){ + buyGuardPrivilegeAdapter.setGuardPrivilege(guardPrivilegeStrings); + + } + + + } + + @Override + public void onPageScrollStateChanged(int i) { + + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.guard_month_linear), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + ObjectAnimator animator = ObjectAnimator.ofFloat(guardArrow, "rotation", 0f, -90f); + animator.setDuration(500); + animator.setInterpolator(new LinearInterpolator()); + animator.start(); + XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.guard_month_linear)); + builder.hasShadowBg(false) + .isDestroyOnDismiss(true) + .isLightStatusBar(false) + .popupPosition(PopupPosition.Top) + .asCustom(new LiveBuyGuardSelectPopup(getContext(), price) + .setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + closeAnimSudGameListEvent(guardArrow); + } + }).setBuyGuardSelectListener(new LiveBuyGuardSelectPopup.LiveBuyGuardSelectListener() { + @Override + public void onLiveBuyGuardSelectListener(GuardPriceModel model) { + guardPriceModel = model; + if (TextUtils.isEmpty(guardPriceModel.getDiscountPrice())) { + discountPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice())); + originalPrice.setVisibility(GONE); + discount.setVisibility(GONE); + } else { + originalPrice.setVisibility(VISIBLE); + discount.setVisibility(VISIBLE); + discountPrice.setText(String.valueOf(guardPriceModel.getDiscountPrice())); + originalPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice())); + discount.setText(String.valueOf(guardPriceModel.getDiscount())); + } + guardMonth.setText(guardPriceModel.getOpeningTime()); + } + }) + ) + .show(); + } + }); + } - private void initViewPage(){ + + private void closeAnimSudGameListEvent(View view) { + ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotation", -90f, 0f); + animator.setDuration(animDuration); + animator.setInterpolator(new LinearInterpolator()); + animator.start(); + } + + private void initViewPage() { fragments.add(LiveBuyGuardVPFragment.newInstance(0)); fragments.add(LiveBuyGuardVPFragment.newInstance(1)); } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java new file mode 100644 index 000000000..561daba2b --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java @@ -0,0 +1,206 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.fragment.app.FragmentActivity; +import androidx.recyclerview.widget.LinearLayoutManager; + +import com.alibaba.fastjson.JSON; +import com.lxj.xpopup.XPopup; +import com.makeramen.roundedimageview.RoundedImageView; +import com.opensource.svgaplayer.SVGAImageView; +import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.common.bean.GuardGetGuardUserInfoModel; +import com.yunbao.common.custom.CommonRefreshView; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpUtil; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.CommonIconUtil; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.live.R; +import com.yunbao.live.adapter.NewGuardAdapter; +import com.yunbao.live.bean.GuardUserModel; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class LiveGuardDialog extends AbsDialogPopupWindow { + FragmentActivity activity; + boolean isEmpty = true; + + FrameLayout guardianTask; + FrameLayout myGraudGrade, guardingTheAnchor; + + NewGuardAdapter newGuardAdapter; + + CommonRefreshView mRefreshView; + String mLiveUid; + List guardUserModels = new ArrayList<>(); + + TextView userNickname, weekContribution, guardLevel; + ImageView userSex, tagKing; + RoundedImageView guardIcon; + SVGAImageView giftSvga; + ImageView btnGuardOpen; + + public LiveGuardDialog(@NonNull Context context, boolean isEmpty, String liveUid) { + super(context); + activity = (FragmentActivity) context; + this.isEmpty = isEmpty; + mLiveUid = liveUid; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_live_guard; + } + + //底部栏 + @Override + protected void onCreate() { + super.onCreate(); + guardianTask = findViewById(R.id.guardian_task); + myGraudGrade = findViewById(R.id.my_graud_grade); + guardingTheAnchor = findViewById(R.id.guarding_the_anchor); + + mRefreshView = findViewById(R.id.refreshView); + mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); + newGuardAdapter = new NewGuardAdapter(mContext); + mRefreshView.setRecyclerViewAdapter(newGuardAdapter); + mRefreshView.setEmptyLayoutId(R.layout.view_no_data_admin_room); + userNickname = findViewById(R.id.user_nickname); + weekContribution = findViewById(R.id.week_contribution); + guardLevel = findViewById(R.id.guard_level); + userSex = findViewById(R.id.sex); + tagKing = findViewById(R.id.tag_king); + guardIcon = findViewById(R.id.guard_imageView); + giftSvga = findViewById(R.id.gift_svga); + btnGuardOpen = findViewById(R.id.btn_guard_open); + mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() { + @Override + public RefreshAdapter getAdapter() { + + return null; + } + + @Override + public void loadData(int p, HttpCallback callback) { + LiveHttpUtil.getGuardList(mLiveUid, p, callback); + } + + @Override + public List processData(String[] info) { + List guardUserModelList = JSON.parseArray(Arrays.toString(info), GuardUserModel.class); + if (guardUserModels.isEmpty() && !guardUserModelList.isEmpty()) { + guardUserModels = guardUserModelList; + setAdapterData(); + } + return guardUserModelList; + + } + + @Override + public void onRefreshSuccess(List list, int listCount) { + + + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { + if (loadItemList.size() > 0) + newGuardAdapter.insertList(loadItemList); + } + + @Override + public void onLoadMoreFailure() { + + } + }); + + mRefreshView.initData(); + if (isEmpty) { + + guardingTheAnchor.setVisibility(VISIBLE); + } else { + + guardingTheAnchor.setVisibility(GONE); + } + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_guard_open), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + new LiveBuyGuardDialog(mContext, mLiveUid).showDialog(); + } + }); + userNickname.setVisibility(GONE); + weekContribution.setVisibility(GONE); + userSex.setVisibility(GONE); + tagKing.setVisibility(GONE); + guardLevel.setVisibility(GONE); + guardIcon.setVisibility(GONE); + giftSvga.setImageResource(R.mipmap.guardian_img_wings); + LiveNetManager.get(mContext).getGuardUserInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(GuardGetGuardUserInfoModel data) { + if (data.getGuardType() == 0) { + guardianTask.setVisibility(GONE); + myGraudGrade.setVisibility(GONE); + + ImgLoader.display(mContext,R.mipmap.btn_guard_open,btnGuardOpen); + } else { + guardianTask.setVisibility(VISIBLE); + myGraudGrade.setVisibility(VISIBLE); + ImgLoader.display(mContext,R.mipmap.btn_renewal_guard,btnGuardOpen);//续费守护 + } + + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + guardianTask.setVisibility(GONE); + myGraudGrade.setVisibility(GONE); + ImgLoader.display(mContext,R.mipmap.btn_guard_open,btnGuardOpen); + } + }); + } + + private void setAdapterData() { + if (guardUserModels.isEmpty()) return; + GuardUserModel guardUserModel = guardUserModels.get(0); + + userNickname.setVisibility(VISIBLE); + weekContribution.setVisibility(VISIBLE); + userSex.setVisibility(VISIBLE); + tagKing.setVisibility(VISIBLE); + guardLevel.setVisibility(VISIBLE); + guardIcon.setVisibility(View.VISIBLE); + userNickname.setText(guardUserModel.getUserNicename()); + weekContribution.setText(WordUtil.getNewString(R.string.this_week_contribution) + " " + guardUserModel.getContribute()); + userSex.setImageResource(CommonIconUtil.getSexIcon(guardUserModel.getSex())); + ImgLoader.display(mContext, guardUserModel.getGuardImg(), tagKing); + guardLevel.setText(String.valueOf(guardUserModel.getGuardLevel())); + ImgLoader.display(mContext, guardUserModel.getAvatar(), guardIcon); + giftSvga.setImageResource(R.mipmap.guardian_img_wings_p); + } +} diff --git a/live/src/main/java/com/yunbao/live/views/NewGuardViewHolder.java b/live/src/main/java/com/yunbao/live/views/NewGuardViewHolder.java new file mode 100644 index 000000000..16c03320c --- /dev/null +++ b/live/src/main/java/com/yunbao/live/views/NewGuardViewHolder.java @@ -0,0 +1,58 @@ +package com.yunbao.live.views; + +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.makeramen.roundedimageview.RoundedImageView; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.CommonIconUtil; +import com.yunbao.live.R; +import com.yunbao.live.bean.GuardUserModel; + +public class NewGuardViewHolder extends RecyclerView.ViewHolder { + ImageView guard_number_img, userSex, tagKing; + TextView guard_number_text, user_nicename, guardLevel, contribution; + RoundedImageView avatar; + + public NewGuardViewHolder(@NonNull View itemView) { + super(itemView); + guard_number_img = itemView.findViewById(R.id.guard_number_img); + guard_number_text = itemView.findViewById(R.id.guard_number_text); + avatar = itemView.findViewById(R.id.avatar); + user_nicename = itemView.findViewById(R.id.user_nicename); + userSex = itemView.findViewById(R.id.sex); + guardLevel = itemView.findViewById(R.id.guard_level); + tagKing = itemView.findViewById(R.id.tag_king); + contribution = itemView.findViewById(R.id.contribution); + } + + public void setData(GuardUserModel guardUserModel, int position) { + if (position == 0) { + guard_number_img.setVisibility(View.VISIBLE); + guard_number_text.setVisibility(View.GONE); + ImgLoader.display(itemView.getContext(), R.mipmap.icon_one_guard, guard_number_img); + } else if (position == 1) { + guard_number_img.setVisibility(View.VISIBLE); + guard_number_text.setVisibility(View.GONE); + ImgLoader.display(itemView.getContext(), R.mipmap.icon_two_guard, guard_number_img); + } else if (position == 2) { + guard_number_img.setVisibility(View.VISIBLE); + guard_number_text.setVisibility(View.GONE); + ImgLoader.display(itemView.getContext(), R.mipmap.icon_three_guard, guard_number_img); + } else { + guard_number_img.setVisibility(View.GONE); + guard_number_text.setVisibility(View.VISIBLE); + guard_number_text.setText(String.valueOf(position + 1)); + } + ImgLoader.display(itemView.getContext(), guardUserModel.getAvatar(), avatar); + user_nicename.setText(guardUserModel.getUserNicename()); + userSex.setImageResource(CommonIconUtil.getSexIcon(guardUserModel.getSex())); + guardLevel.setText(String.valueOf(guardUserModel.getGuardLevel())); + ImgLoader.display(itemView.getContext(), guardUserModel.getGuardImg(), tagKing); + contribution.setText(guardUserModel.getContribute()); + } +} diff --git a/live/src/main/res/drawable/background_live_guard.xml b/live/src/main/res/drawable/background_live_guard.xml new file mode 100644 index 000000000..beebd73a3 --- /dev/null +++ b/live/src/main/res/drawable/background_live_guard.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/background_live_guard2.xml b/live/src/main/res/drawable/background_live_guard2.xml new file mode 100644 index 000000000..e5907adf1 --- /dev/null +++ b/live/src/main/res/drawable/background_live_guard2.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/background_live_guard3.xml b/live/src/main/res/drawable/background_live_guard3.xml new file mode 100644 index 000000000..c114af283 --- /dev/null +++ b/live/src/main/res/drawable/background_live_guard3.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/banner_item_buy_guard.xml b/live/src/main/res/layout/banner_item_buy_guard.xml new file mode 100644 index 000000000..572170bd8 --- /dev/null +++ b/live/src/main/res/layout/banner_item_buy_guard.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_buy_guard.xml b/live/src/main/res/layout/dialog_live_buy_guard.xml index 9da5d76a1..2d776faae 100644 --- a/live/src/main/res/layout/dialog_live_buy_guard.xml +++ b/live/src/main/res/layout/dialog_live_buy_guard.xml @@ -1,5 +1,5 @@ - + android:src="@mipmap/dialog_live_buy_guard_bg" /> - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_guard.xml b/live/src/main/res/layout/dialog_live_guard.xml new file mode 100644 index 000000000..1224eeb00 --- /dev/null +++ b/live/src/main/res/layout/dialog_live_guard.xml @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_new_guard_item.xml b/live/src/main/res/layout/view_new_guard_item.xml new file mode 100644 index 000000000..c0f3966dd --- /dev/null +++ b/live/src/main/res/layout/view_new_guard_item.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/mipmap-xhdpi/bg_god_guard.png b/live/src/main/res/mipmap-xhdpi/bg_god_guard.png new file mode 100644 index 000000000..c7df022fa Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/bg_god_guard.png differ diff --git a/live/src/main/res/mipmap-xhdpi/bg_king_guard.png b/live/src/main/res/mipmap-xhdpi/bg_king_guard.png new file mode 100644 index 000000000..a611dd889 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/bg_king_guard.png differ diff --git a/live/src/main/res/mipmap-xhdpi/bg_star_guard.png b/live/src/main/res/mipmap-xhdpi/bg_star_guard.png index bb3105a3f..484b14f16 100644 Binary files a/live/src/main/res/mipmap-xhdpi/bg_star_guard.png and b/live/src/main/res/mipmap-xhdpi/bg_star_guard.png differ diff --git a/live/src/main/res/mipmap-xhdpi/icon_god_guardian_medal.png b/live/src/main/res/mipmap-xhdpi/icon_god_guardian_medal.png new file mode 100644 index 000000000..b3af93b15 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/icon_god_guardian_medal.png differ diff --git a/live/src/main/res/mipmap-xhdpi/icon_god_guardian_medal_grey.png b/live/src/main/res/mipmap-xhdpi/icon_god_guardian_medal_grey.png new file mode 100644 index 000000000..d74e0ce91 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/icon_god_guardian_medal_grey.png differ diff --git a/live/src/main/res/mipmap-xhdpi/icon_king_guardian_medal.png b/live/src/main/res/mipmap-xhdpi/icon_king_guardian_medal.png new file mode 100644 index 000000000..8f40779a0 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/icon_king_guardian_medal.png differ diff --git a/live/src/main/res/mipmap-xhdpi/icon_king_guardian_medal_grey.png b/live/src/main/res/mipmap-xhdpi/icon_king_guardian_medal_grey.png new file mode 100644 index 000000000..9ef4936f1 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/icon_king_guardian_medal_grey.png differ diff --git a/live/src/main/res/mipmap-xhdpi/icon_star_guardian_medal.png b/live/src/main/res/mipmap-xhdpi/icon_star_guardian_medal.png new file mode 100644 index 000000000..df9c482b0 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/icon_star_guardian_medal.png differ diff --git a/live/src/main/res/mipmap-xhdpi/icon_star_guardian_medal_grey.png b/live/src/main/res/mipmap-xhdpi/icon_star_guardian_medal_grey.png new file mode 100644 index 000000000..f27e656e5 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/icon_star_guardian_medal_grey.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/btn_guard_open.png b/live/src/main/res/mipmap-xxxhdpi/btn_guard_open.png new file mode 100644 index 000000000..360e10274 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/btn_guard_open.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/btn_renewal_guard.png b/live/src/main/res/mipmap-xxxhdpi/btn_renewal_guard.png new file mode 100644 index 000000000..612c2c222 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/btn_renewal_guard.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/icon_one_guard.png b/live/src/main/res/mipmap-xxxhdpi/icon_one_guard.png new file mode 100644 index 000000000..3abf5768b Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/icon_one_guard.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/icon_tag_king.png b/live/src/main/res/mipmap-xxxhdpi/icon_tag_king.png new file mode 100644 index 000000000..505858ee6 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/icon_tag_king.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/icon_three_guard.png b/live/src/main/res/mipmap-xxxhdpi/icon_three_guard.png new file mode 100644 index 000000000..e01b05325 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/icon_three_guard.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/icon_two_guard.png b/live/src/main/res/mipmap-xxxhdpi/icon_two_guard.png new file mode 100644 index 000000000..9d60ad85d Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/icon_two_guard.png differ diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java index bd6cb2dae..2675c657d 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java @@ -11,6 +11,7 @@ import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.event.FloatWarOrderEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.live.dialog.LiveBuyGuardDialog; +import com.yunbao.live.dialog.LiveGuardDialog; import com.yunbao.main.R; import org.greenrobot.eventbus.EventBus; @@ -50,13 +51,13 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder { ImgLoader.display(mContext, "https://downs.yaoulive.com/gif_trophy.gif", img_trophy); - img_trophy.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View view) { - new LiveBuyGuardDialog(mContext).showDialog(); - return true; - } - }); +// img_trophy.setOnLongClickListener(new View.OnLongClickListener() { +// @Override +// public boolean onLongClick(View view) { +// +// return true; +// } +// }); }