diff --git a/common/build.gradle b/common/build.gradle index b9ff40117..d59049c32 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -221,5 +221,10 @@ dependencies { //samsung插件包 api project(':IAP6Helper') + //文字渐变色 + 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/DragonSendMoneyListAdapter.java b/common/src/main/java/com/yunbao/common/adapter/DragonSendMoneyListAdapter.java new file mode 100644 index 000000000..fd0eddc56 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/DragonSendMoneyListAdapter.java @@ -0,0 +1,93 @@ +package com.yunbao.common.adapter; + +import android.os.CountDownTimer; +import android.util.SparseArray; +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.sendMoneyLongListModel; +import com.yunbao.common.views.DragonSendMoneyListViewHolder; + +import java.util.ArrayList; +import java.util.List; + +public class DragonSendMoneyListAdapter extends RecyclerView.Adapter { + RecyclerView send_money_list; + boolean isAnchor; + SparseArray countDownMap; + boolean isAttention; + + public DragonSendMoneyListAdapter setAnchor(boolean anchor) { + isAnchor = anchor; + return this; + } + + public DragonSendMoneyListAdapter setAttention(boolean attention) { + isAttention = attention; + return this; + } + + public List getMoneyLongListModels() { + return moneyLongListModels; + } + + public DragonSendMoneyListAdapter(RecyclerView send_money_list) { + this.send_money_list = send_money_list; + countDownMap = new SparseArray<>(); + } + + List moneyLongListModels = new ArrayList<>(); + DragonSendMoneyListViewHolder.DragonSendMoneyListClicksCallBack callBack; + + public void setCallBack(DragonSendMoneyListViewHolder.DragonSendMoneyListClicksCallBack callBack) { + this.callBack = callBack; + } + + public void setMoneyLongListModels(List models) { + + moneyLongListModels.clear(); + moneyLongListModels.addAll(models); + notifyDataSetChanged(); + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + + View goodGiftsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_dragon_send_money_list, parent, false); + + return new DragonSendMoneyListViewHolder(goodGiftsView); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + DragonSendMoneyListViewHolder sendMoneyListViewHolder = (DragonSendMoneyListViewHolder) holder; +// sendMoneyLongListModel model = moneyLongListModels.get(position); +// long mPkTimeCount2 = Long.parseLong(model.getCountdown()); +// long time = mPkTimeCount2 * 1000; +// if (sendMoneyListViewHolder.countDownTimer != null) { +// sendMoneyListViewHolder.countDownTimer.cancel(); +// } +// if (time > 0) { +// +// } + sendMoneyListViewHolder.setData(moneyLongListModels.get(position), callBack, isAnchor,isAttention); + + + } + + @Override + public int getItemCount() { + return moneyLongListModels.size(); + } + + @Override + public int getItemViewType(int position) { + return super.getItemViewType(position); + } +} 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..63175a6a2 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/LiveBuyGuardSelectAdapter.java @@ -0,0 +1,50 @@ +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<>(); + GuardPriceModel model; + + public LiveBuyGuardSelectAdapter(List price, GuardPriceModel mModel) { + this.price = price; + model = mModel; + } + + @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,model); + } + + @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/adapter/SudTitleSelectAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java index 82bf6df02..b51026f63 100644 --- a/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java @@ -45,7 +45,6 @@ public class SudTitleSelectAdapter extends RecyclerView.Adapter { } } }); - } @Override diff --git a/common/src/main/java/com/yunbao/common/bean/CheckUpgradesModel.java b/common/src/main/java/com/yunbao/common/bean/CheckUpgradesModel.java new file mode 100644 index 000000000..f6b5510f8 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/CheckUpgradesModel.java @@ -0,0 +1,48 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class CheckUpgradesModel extends BaseModel { + /** + * { + * "level": 33, // 等级 + * "rewards": [ // 奖励信息 + * { + * "id": 1, + * "reward_name": "星之守護等級牌", // 奖励名称 + * "image_path": "https://ceshi.yaoulive.com/data/upload/20240304/tequan_1.png" // 图片链接 + * }, + * { + * "id": 2, + * "reward_name": "人氣票", + * "image_path": "https://ceshi.yaoulive.com/data/upload/20240304/tequan_1.png" + * } + * ] + * } + * } + */ + @SerializedName("level") + private String level; + @SerializedName("rewards") + private List rewards; + + public String getLevel() { + return level; + } + + public CheckUpgradesModel setLevel(String level) { + this.level = level; + return this; + } + + public List getRewards() { + return rewards; + } + + public CheckUpgradesModel setRewards(List rewards) { + this.rewards = rewards; + return this; + } +} 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 049be7908..7ecda8f0f 100644 --- a/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java +++ b/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java @@ -43,6 +43,17 @@ public class EnterRoomNewModel extends BaseModel { private int quickGiftRemainingQuantity;//剩余的小PD礼物数量 @SerializedName("if_viewing_duration_complete") private int ifViewingDurationComplete;//通过观看时间获取小PD礼物的次数 + @SerializedName("sendMoneyLongStatus") + private SendMoneyLongStatusModel model; + + public SendMoneyLongStatusModel getModel() { + return model; + } + + public EnterRoomNewModel setModel(SendMoneyLongStatusModel model) { + this.model = model; + return this; + } public int getQuickGiftRemainingQuantity() { return quickGiftRemainingQuantity; 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..ded88a7eb --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardDataTipModel.java @@ -0,0 +1,142 @@ +package com.yunbao.common.bean; + +import android.text.TextUtils; + +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 String 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 TextUtils.equals(isOpen, "1"); + } + + public String getIsOpen() { + return isOpen; + } + + public GuardDataTipModel setIsOpen(String isOpen) { + this.isOpen = isOpen; + 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..7a8fcd48c --- /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 String exp; + @SerializedName("level") + private int level; + @SerializedName("endtime") + private long 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 String getExp() { + return exp; + } + + public GuardGetGuardUserInfoModel setExp(String exp) { + this.exp = exp; + return this; + } + + public int getLevel() { + return level; + } + + public GuardGetGuardUserInfoModel setLevel(int level) { + this.level = level; + return this; + } + + public long getEndtime() { + return endtime; + } + + public GuardGetGuardUserInfoModel setEndtime(long 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/GuardMaturityDateRemindModel.java b/common/src/main/java/com/yunbao/common/bean/GuardMaturityDateRemindModel.java new file mode 100644 index 000000000..c6556d552 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardMaturityDateRemindModel.java @@ -0,0 +1,145 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class GuardMaturityDateRemindModel extends BaseModel{ + + @SerializedName("_method_") + private String method; + @SerializedName("action") + private String action; + @SerializedName("is_overdue") + private int isOverdue; + @SerializedName("days") + private int days; + @SerializedName("uid") + private String uid; + @SerializedName("liveuid") + private String liveuid; + @SerializedName("user_avatar") + private String userAvatar; + @SerializedName("user_nicename") + private String userNicename; + @SerializedName("live_avatar") + private String liveAvatar; + @SerializedName("live_nicename") + private String liveNicename; + @SerializedName("ct") + private String ct; + @SerializedName("guard_type") + private String guardType; + + public String getGuardType() { + return guardType; + } + + public GuardMaturityDateRemindModel setGuardType(String guardType) { + this.guardType = guardType; + return this; + } + + public String getMethod() { + return method; + } + + public void setMethod(String method) { + this.method = method; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public int getIsOverdue() { + return isOverdue; + } + + public void setIsOverdue(int isOverdue) { + this.isOverdue = isOverdue; + } + + public int getDays() { + return days; + } + + public void setDays(int days) { + this.days = days; + } + + public String getUid() { + return uid; + } + + public void setUid(String uid) { + this.uid = uid; + } + + public String getLiveuid() { + return liveuid; + } + + public void setLiveuid(String liveuid) { + this.liveuid = liveuid; + } + + public String getUserAvatar() { + return userAvatar; + } + + public void setUserAvatar(String userAvatar) { + this.userAvatar = userAvatar; + } + + public String getUserNicename() { + return userNicename; + } + + public void setUserNicename(String userNicename) { + this.userNicename = userNicename; + } + + public String getLiveAvatar() { + return liveAvatar; + } + + public void setLiveAvatar(String liveAvatar) { + this.liveAvatar = liveAvatar; + } + + public String getLiveNicename() { + return liveNicename; + } + + public void setLiveNicename(String liveNicename) { + this.liveNicename = liveNicename; + } + + public String getCt() { + return ct; + } + + public void setCt(String ct) { + this.ct = ct; + } + + @Override + public String toString() { + return "GuardMaturityDateRemindModel{" + + "method='" + method + '\'' + + ", action='" + action + '\'' + + ", isOverdue=" + isOverdue + + ", days=" + days + + ", uid='" + uid + '\'' + + ", liveuid='" + liveuid + '\'' + + ", userAvatar='" + userAvatar + '\'' + + ", userNicename='" + userNicename + '\'' + + ", liveAvatar='" + liveAvatar + '\'' + + ", liveNicename='" + liveNicename + '\'' + + ", ct='" + ct + '\'' + + '}'; + } +} 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..07f46433f --- /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 String guardType; + @SerializedName("exp") + private String exp; + @SerializedName("level") + private String level; + @SerializedName("endtime") + private String 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 String getGuardType() { + return guardType; + } + + public GuardUserInfoModel setGuardType(String guardType) { + this.guardType = guardType; + return this; + } + + public String getExp() { + return exp; + } + + public GuardUserInfoModel setExp(String exp) { + this.exp = exp; + return this; + } + + public String getLevel() { + return level; + } + + public GuardUserInfoModel setLevel(String level) { + this.level = level; + return this; + } + + public String getEndtime() { + return endtime; + } + + public GuardUserInfoModel setEndtime(String 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/bean/LiveBean.java b/common/src/main/java/com/yunbao/common/bean/LiveBean.java index 11de89a26..27f18a989 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveBean.java @@ -56,6 +56,18 @@ public class LiveBean implements Parcelable { private int redPacketStatus; @SerializedName("giftId") private String giftId; + @SerializedName("sendMoneyLongStatus ") + private int sendMoneyLongStatus ; + + public int getSendMoneyLongStatus() { + return sendMoneyLongStatus; + } + + public LiveBean setSendMoneyLongStatus(int sendMoneyLongStatus) { + this.sendMoneyLongStatus = sendMoneyLongStatus; + return this; + } + private Map params;//用于跳转Activity时扩展参数,例:从首页Banner跳转到直播间时需要根据携带参数判断是否弹出新人特惠对话框 public String getRecommendCardIconSizeTwo() { diff --git a/common/src/main/java/com/yunbao/common/bean/RewardsModel.java b/common/src/main/java/com/yunbao/common/bean/RewardsModel.java new file mode 100644 index 000000000..c8dffcde9 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/RewardsModel.java @@ -0,0 +1,39 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class RewardsModel extends BaseModel { + @SerializedName("id") + private int id; + @SerializedName("reward_name") + private String rewardName; + @SerializedName("image_path") + private String imagePath; + + public int getId() { + return id; + } + + public RewardsModel setId(int id) { + this.id = id; + return this; + } + + public String getRewardName() { + return rewardName; + } + + public RewardsModel setRewardName(String rewardName) { + this.rewardName = rewardName; + return this; + } + + public String getImagePath() { + return imagePath; + } + + public RewardsModel setImagePath(String imagePath) { + this.imagePath = imagePath; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/SendMoneyLongModel.java b/common/src/main/java/com/yunbao/common/bean/SendMoneyLongModel.java new file mode 100644 index 000000000..e363878eb --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/SendMoneyLongModel.java @@ -0,0 +1,137 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class SendMoneyLongModel extends BaseModel { + /** + * { + * "_method_": "SendMoneyLong", + * "action": "0", + * "uid": "98888", + * "user_nicename": "周末暴打小朋友", + * "user_avatar": "https://downs.yaoulive.com/mannine.png", + * "liveuid": "98889", + * "add_time": 1710318757, + * "gold_num": "5000" + * "countdown": 300 // 倒计时 + * "send_money_long_key": "1710384258446", + * } + */ + + @SerializedName("_method_") + private String method; + @SerializedName("action") + private String action; + @SerializedName("uid") + private String uid; + @SerializedName("user_nicename") + private String userNicename; + @SerializedName("user_avatar") + private String userAvatar; + @SerializedName("liveuid") + private String liveuid; + @SerializedName("add_time") + private String addTime; + @SerializedName("gold_num") + private String goldNum; + @SerializedName("countdown") + private String countdown; + @SerializedName("send_money_long_key") + private String sendMoneyLongKey; + + public String getSendMoneyLongKey() { + return sendMoneyLongKey; + } + + public SendMoneyLongModel setSendMoneyLongKey(String sendMoneyLongKey) { + this.sendMoneyLongKey = sendMoneyLongKey; + return this; + } + + public String getCountdown() { + return countdown; + } + + public SendMoneyLongModel setCountdown(String countdown) { + this.countdown = countdown; + return this; + } + + public String getMethod() { + return method; + } + + public void setMethod(String method) { + this.method = method; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getUid() { + return uid; + } + + public void setUid(String uid) { + this.uid = uid; + } + + public String getUserNicename() { + return userNicename; + } + + public void setUserNicename(String userNicename) { + this.userNicename = userNicename; + } + + public String getUserAvatar() { + return userAvatar; + } + + public void setUserAvatar(String userAvatar) { + this.userAvatar = userAvatar; + } + + public String getLiveuid() { + return liveuid; + } + + public void setLiveuid(String liveuid) { + this.liveuid = liveuid; + } + + public String getAddTime() { + return addTime; + } + + public void setAddTime(String addTime) { + this.addTime = addTime; + } + + public String getGoldNum() { + return goldNum; + } + + public void setGoldNum(String goldNum) { + this.goldNum = goldNum; + } + + @Override + public String toString() { + return "SendMoneyLongModel{" + + "method='" + method + '\'' + + ", action='" + action + '\'' + + ", uid='" + uid + '\'' + + ", userNicename='" + userNicename + '\'' + + ", userAvatar='" + userAvatar + '\'' + + ", liveuid='" + liveuid + '\'' + + ", addTime=" + addTime + + ", goldNum='" + goldNum + '\'' + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/SendMoneyLongStatusModel.java b/common/src/main/java/com/yunbao/common/bean/SendMoneyLongStatusModel.java new file mode 100644 index 000000000..6c0b00918 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/SendMoneyLongStatusModel.java @@ -0,0 +1,154 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class SendMoneyLongStatusModel extends BaseModel { + /** + * "sendMoneyLongStatus": { // 未查询到数据时为空数组 + * "liveuid": "98889", // 主播ID + * "uid": "98888", // 发起用户ID + * "addtime": "1710384258446", // 开始时间 毫秒时间戳 + * "gold_num": "5000", // 金豆数量 + * "user_nicename": "周末暴打小朋友", // 用户昵称 + * "user_avatar": "https://downs.yaoulive.com/mannine.png", // 用户头像链接 + * "countdown": 300 // 倒计时 + * "start_status": false, + * "start_time": "", + * "send_money_long_key": "1710397575473", + * "participate": 0, + * "add_time": "1710397575473" + * } + */ + @SerializedName("liveuid") + private String liveuid; + @SerializedName("uid") + private String uid; + @SerializedName("addtime") + private String addtime; + @SerializedName("gold_num") + private String goldNum; + @SerializedName("user_nicename") + private String userNicename; + @SerializedName("user_avatar") + private String userAvatar; + @SerializedName("countdown") + private String countdown; + @SerializedName("start_status") + private String startStatus; + @SerializedName("start_time") + private String startTime; + @SerializedName("send_money_long_key") + private String sendMoneyLongKey; + @SerializedName("participate") + private String participate; + @SerializedName("add_time") + private String addTime; + + public String getLiveuid() { + return liveuid; + } + + public SendMoneyLongStatusModel setLiveuid(String liveuid) { + this.liveuid = liveuid; + return this; + } + + public String getUid() { + return uid; + } + + public SendMoneyLongStatusModel setUid(String uid) { + this.uid = uid; + return this; + } + + public String getAddtime() { + return addtime; + } + + public SendMoneyLongStatusModel setAddtime(String addtime) { + this.addtime = addtime; + return this; + } + + public String getGoldNum() { + return goldNum; + } + + public SendMoneyLongStatusModel setGoldNum(String goldNum) { + this.goldNum = goldNum; + return this; + } + + public String getUserNicename() { + return userNicename; + } + + public SendMoneyLongStatusModel setUserNicename(String userNicename) { + this.userNicename = userNicename; + return this; + } + + public String getUserAvatar() { + return userAvatar; + } + + public SendMoneyLongStatusModel setUserAvatar(String userAvatar) { + this.userAvatar = userAvatar; + return this; + } + + public String getCountdown() { + return countdown; + } + + public SendMoneyLongStatusModel setCountdown(String countdown) { + this.countdown = countdown; + return this; + } + + public String getStartStatus() { + return startStatus; + } + + public SendMoneyLongStatusModel setStartStatus(String startStatus) { + this.startStatus = startStatus; + return this; + } + + public String getStartTime() { + return startTime; + } + + public SendMoneyLongStatusModel setStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + public String getSendMoneyLongKey() { + return sendMoneyLongKey; + } + + public SendMoneyLongStatusModel setSendMoneyLongKey(String sendMoneyLongKey) { + this.sendMoneyLongKey = sendMoneyLongKey; + return this; + } + + public String getParticipate() { + return participate; + } + + public SendMoneyLongStatusModel setParticipate(String participate) { + this.participate = participate; + return this; + } + + public String getAddTime() { + return addTime; + } + + public SendMoneyLongStatusModel setAddTime(String addTime) { + this.addTime = addTime; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/sendMoneyLongListModel.java b/common/src/main/java/com/yunbao/common/bean/sendMoneyLongListModel.java new file mode 100644 index 000000000..743d1ad8b --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/sendMoneyLongListModel.java @@ -0,0 +1,154 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class sendMoneyLongListModel extends BaseModel { + /** + * { + * "liveuid": "98889", // 主播ID + * "uid": "98888", // 用户ID + * "addtime": "1710397350011", // 创建时间 毫秒时间戳 + * "gold_num": "5000", // 金豆数量 + * "user_nicename": "周末暴打小朋友", // 用户昵称 + * "user_avatar": "https://downs.yaoulive.com/mannine.png", // 用户头像 + * "countdown": 300, // 倒计时 + * "start_status": false, + * "start_time": "", + * "send_money_long_key": "1710397485729", + * "participate": 0, // 是否参与活动 0.未参与 1.已参与 + * "add_time": "1710397485729" + * } + */ + @SerializedName("liveuid") + private String liveuid; + @SerializedName("uid") + private String uid; + @SerializedName("addtime") + private String addtime; + @SerializedName("gold_num") + private String goldNum; + @SerializedName("user_nicename") + private String userNicename; + @SerializedName("user_avatar") + private String userAvatar; + @SerializedName("countdown") + private String countdown; + @SerializedName("start_status") + private boolean startStatus; + @SerializedName("start_time") + private String startTime; + @SerializedName("send_money_long_key") + private String sendMoneyLongKey; + @SerializedName("participate") + private String participate; + @SerializedName("add_time") + private String addTime; + + public String getLiveuid() { + return liveuid; + } + + public sendMoneyLongListModel setLiveuid(String liveuid) { + this.liveuid = liveuid; + return this; + } + + public String getUid() { + return uid; + } + + public sendMoneyLongListModel setUid(String uid) { + this.uid = uid; + return this; + } + + public String getAddtime() { + return addtime; + } + + public sendMoneyLongListModel setAddtime(String addtime) { + this.addtime = addtime; + return this; + } + + public String getGoldNum() { + return goldNum; + } + + public sendMoneyLongListModel setGoldNum(String goldNum) { + this.goldNum = goldNum; + return this; + } + + public String getUserNicename() { + return userNicename; + } + + public sendMoneyLongListModel setUserNicename(String userNicename) { + this.userNicename = userNicename; + return this; + } + + public String getUserAvatar() { + return userAvatar; + } + + public sendMoneyLongListModel setUserAvatar(String userAvatar) { + this.userAvatar = userAvatar; + return this; + } + + public String getCountdown() { + return countdown; + } + + public sendMoneyLongListModel setCountdown(String countdown) { + this.countdown = countdown; + return this; + } + + public boolean isStartStatus() { + return startStatus; + } + + public sendMoneyLongListModel setStartStatus(boolean startStatus) { + this.startStatus = startStatus; + return this; + } + + public String getStartTime() { + return startTime; + } + + public sendMoneyLongListModel setStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + public String getSendMoneyLongKey() { + return sendMoneyLongKey; + } + + public sendMoneyLongListModel setSendMoneyLongKey(String sendMoneyLongKey) { + this.sendMoneyLongKey = sendMoneyLongKey; + return this; + } + + public String getParticipate() { + return participate; + } + + public sendMoneyLongListModel setParticipate(String participate) { + this.participate = participate; + return this; + } + + public String getAddTime() { + return addTime; + } + + public sendMoneyLongListModel setAddTime(String addTime) { + this.addTime = addTime; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/DragonRulePopup.java b/common/src/main/java/com/yunbao/common/dialog/DragonRulePopup.java new file mode 100644 index 000000000..8babfe15e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/DragonRulePopup.java @@ -0,0 +1,49 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.widget.LinearLayout; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class DragonRulePopup extends CenterPopupView { + LinearLayout list_no; + LinearLayout list; + + boolean isList; + + public DragonRulePopup(@NonNull Context context, boolean isList) { + super(context); + this.isList = isList; + } + + // 返回自定义弹窗的布局 + @Override + protected int getImplLayoutId() { + return R.layout.dragon_rule_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + list_no = findViewById(R.id.list_no); + list = findViewById(R.id.list); + if (!isList){ + list_no.setVisibility(VISIBLE); + list.setVisibility(GONE); + }else { + list_no.setVisibility(GONE); + list.setVisibility(VISIBLE); + } + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.dragon_close), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dismiss(); + } + }); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java b/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java new file mode 100644 index 000000000..27b8e9e19 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java @@ -0,0 +1,103 @@ +package com.yunbao.common.dialog; + +import android.app.Activity; +import android.app.Dialog; +import android.content.Context; +import android.text.TextUtils; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import com.yunbao.common.R; +import com.yunbao.common.bean.GuardGetGuardUserInfoModel; +import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.WordUtil; + +public class GuardBuyTipsDialog { + + /** + * @param context + * @param coin 钻石 + * @param content 购买类型名称 + * @param simpleCallback + */ + public static void showBuyOrRenewDialog(Context context, String coin, String content, + boolean isOpen, GuardGetGuardUserInfoModel mGuardUserInfoModel, int guardType, + DialogUitl.SimpleCallback simpleCallback) { + if (context instanceof Activity) { + if (((Activity) context).isDestroyed() || ((Activity) context).isFinishing()) { + return; + } + } + + final Dialog dialog = new Dialog(context, R.style.dialog2); + dialog.setContentView(R.layout.dialog_guard_buy_tips); + dialog.setCancelable(true); + dialog.setCanceledOnTouchOutside(true); + TextView btn_confirm = dialog.findViewById(R.id.btn_confirm); + TextView content1 = dialog.findViewById(R.id.content1); + TextView content2 = dialog.findViewById(R.id.content2); + TextView contentTextView = dialog.findViewById(R.id.content); + TextView buyTypeTextView = dialog.findViewById(R.id.buyType); + content1.setVisibility(View.VISIBLE); + contentTextView.setVisibility(View.VISIBLE); + buyTypeTextView.setVisibility(View.VISIBLE); + content2.setVisibility(View.GONE); + if (!isOpen) { + if (!TextUtils.isEmpty(coin)) { + contentTextView.setText(context.getString(R.string.guard_buy_tips_1, coin)); + } + if (!TextUtils.isEmpty(content)) { + buyTypeTextView.setText("【" + content + "】"); + } + } else { + if (!TextUtils.isEmpty(coin)) { + contentTextView.setText(context.getString(R.string.guard_buy_tips_2, coin)); + } + if (!TextUtils.isEmpty(content)) { + buyTypeTextView.setText("【" + content + "】"); + } + } + if (mGuardUserInfoModel != null) { + if (mGuardUserInfoModel.getGuardType() != 0) { + if (guardType < mGuardUserInfoModel.getGuardType()) { + content1.setVisibility(View.GONE); + contentTextView.setVisibility(View.GONE); + buyTypeTextView.setVisibility(View.GONE); + content2.setVisibility(View.VISIBLE); + + } else if (guardType==mGuardUserInfoModel.getGuardType()){ + content1.setVisibility(View.GONE); + }else { + content1.setVisibility(View.VISIBLE); + } + } else { + content1.setVisibility(View.GONE); + } + } else { + content1.setVisibility(View.GONE); + } + + dialog.findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dialog.dismiss(); + } + }); + btn_confirm.setText(WordUtil.isNewZh() ? "確認" : "Confirm"); + btn_confirm.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (content2.getVisibility()==View.VISIBLE){ + dialog.dismiss(); + }else { + simpleCallback.onConfirmClick(dialog, ""); + dialog.dismiss(); + } + + } + }); + dialog.show(); + } + +} diff --git a/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java b/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java new file mode 100644 index 000000000..8520bf64a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java @@ -0,0 +1,170 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.fragment.app.FragmentActivity; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.R; +import com.yunbao.common.bean.CheckUpgradesModel; +import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.bean.RewardsModel; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + + +public class GuardUpgradePopup extends CenterPopupView { + FragmentActivity activity; + String mLiveUid; + CheckUpgradesModel mUpgradesModel; + TextView leave_hint; + LinearLayout rewards_line1, rewards_line2, rewards_line3; + ImageView rewards_img1, rewards_img2, rewards_img3; + TextView rewards_text1, rewards_text2, rewards_text3; + + public GuardUpgradePopup(@NonNull Context context, String liveUid, CheckUpgradesModel upgradesModel, GuardUpgradeCallBack guardUpgradeCallBack) { + super(context); + activity = (FragmentActivity) context; + mLiveUid = liveUid; + mUpgradesModel = upgradesModel; + mGuardUpgradeCallBack = guardUpgradeCallBack; + } + + @Override + protected int getImplLayoutId() { + return R.layout.guard_upgrade_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + leave_hint = findViewById(R.id.leave_hint); + rewards_line1 = findViewById(R.id.rewards_line1); + rewards_line2 = findViewById(R.id.rewards_line2); + rewards_line3 = findViewById(R.id.rewards_line3); + rewards_img1 = findViewById(R.id.rewards_img1); + rewards_img2 = findViewById(R.id.rewards_img2); + rewards_img3 = findViewById(R.id.rewards_img3); + rewards_text1 = findViewById(R.id.rewards_text1); + rewards_text2 = findViewById(R.id.rewards_text2); + rewards_text3 = findViewById(R.id.rewards_text3); + StringBuffer hintStringBuffer = new StringBuffer(); + if (WordUtil.isNewZh()) { + hintStringBuffer.append("您的守護等級已達到") + .append(mUpgradesModel.getLevel()) + .append("級 可以領取以下獎勵"); + } else { + hintStringBuffer.append("Your guardian level has reached level ") + .append(mUpgradesModel.getLevel()) + ; + } + leave_hint.setText(hintStringBuffer.toString()); + if (mUpgradesModel.getRewards().size() > 0) { + if (mUpgradesModel.getRewards().size() == 1) { + rewards_line1.setVisibility(INVISIBLE); + rewards_line2.setVisibility(VISIBLE); + rewards_line3.setVisibility(INVISIBLE); + RewardsModel rewardsModel = mUpgradesModel.getRewards().get(0); + ImgLoader.display(getContext(), rewardsModel.getImagePath(), rewards_img2); + rewards_text2.setText(rewardsModel.getRewardName()); + } else if (mUpgradesModel.getRewards().size() == 2) { + rewards_line1.setVisibility(VISIBLE); + rewards_line2.setVisibility(INVISIBLE); + rewards_line3.setVisibility(VISIBLE); + RewardsModel rewardsModel1 = mUpgradesModel.getRewards().get(0); + RewardsModel rewardsModel3 = mUpgradesModel.getRewards().get(1); + + ImgLoader.display(getContext(), rewardsModel1.getImagePath(), rewards_img1); + rewards_text1.setText(rewardsModel1.getRewardName()); + + ImgLoader.display(getContext(), rewardsModel3.getImagePath(), rewards_img3); + rewards_text3.setText(rewardsModel3.getRewardName()); + + } else if (mUpgradesModel.getRewards().size() == 3) { + rewards_line1.setVisibility(VISIBLE); + rewards_line2.setVisibility(VISIBLE); + rewards_line3.setVisibility(VISIBLE); + RewardsModel rewardsModel1 = mUpgradesModel.getRewards().get(0); + RewardsModel rewardsModel2 = mUpgradesModel.getRewards().get(1); + RewardsModel rewardsModel3 = mUpgradesModel.getRewards().get(3); + + ImgLoader.display(getContext(), rewardsModel1.getImagePath(), rewards_img1); + rewards_text1.setText(rewardsModel1.getRewardName()); + + ImgLoader.display(getContext(), rewardsModel2.getImagePath(), rewards_img2); + rewards_text2.setText(rewardsModel2.getRewardName()); + + ImgLoader.display(getContext(), rewardsModel3.getImagePath(), rewards_img3); + rewards_text3.setText(rewardsModel3.getRewardName()); + } else { + rewards_line1.setVisibility(INVISIBLE); + rewards_line2.setVisibility(INVISIBLE); + rewards_line3.setVisibility(INVISIBLE); + } + } else { + rewards_line1.setVisibility(INVISIBLE); + rewards_line2.setVisibility(INVISIBLE); + rewards_line3.setVisibility(INVISIBLE); + } + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.confirm), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + LiveNetManager.get(getContext()) + .guardGetRewards(mUpgradesModel.getLevel(), mLiveUid, new HttpCallback() { + @Override + public void onSuccess(Object data) { + ToastUtil.show(WordUtil.isNewZh() ? "領取成功" : "Receive successfully"); + dismiss(); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.view_grade), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (mGuardUpgradeCallBack != null) { + mGuardUpgradeCallBack.onGuardLevel(); + } + dismiss(); + StringBuffer htmlUrl = new StringBuffer(); + IMLoginModel userInfo = IMLoginManager.get(getContext()).getUserInfo(); + htmlUrl.append(CommonAppConfig.HOST) + .append("/h5/Guard/level.html?") + .append("&token=") + .append(userInfo.getToken()) + .append("&uid=") + .append(userInfo.getId()) + .append("&&anchorUid=") + .append(mLiveUid) + .append("&isZh=") + .append(((WordUtil.isNewZh()) ? "1" : "0")); + RouteUtil.forwardZhuangBanActivity(htmlUrl.toString()); + } + }); + + } + + private GuardUpgradeCallBack mGuardUpgradeCallBack; + + public interface GuardUpgradeCallBack { + void onGuardLevel(); + } +} 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..d2dae98a5 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/LiveBuyGuardSelectPopup.java @@ -0,0 +1,134 @@ +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; + GuardPriceModel model; + + public LiveBuyGuardSelectPopup(@NonNull Context context, List mPrice, GuardPriceModel mModel) { + super(context); + price = mPrice; + model = mModel; + } + + 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,model); + 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); +// } +// } +// }); + + if (model == null) { + + } else { + + } + } + + 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/event/DragonSendsMoneyEvent.java b/common/src/main/java/com/yunbao/common/event/DragonSendsMoneyEvent.java new file mode 100644 index 000000000..ce83aa267 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/DragonSendsMoneyEvent.java @@ -0,0 +1,6 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +class DragonSendsMoneyEvent extends BaseModel { +} diff --git a/common/src/main/java/com/yunbao/common/event/SendMoneyLongEndEvent.java b/common/src/main/java/com/yunbao/common/event/SendMoneyLongEndEvent.java new file mode 100644 index 000000000..47b74e5d4 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/SendMoneyLongEndEvent.java @@ -0,0 +1,6 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class SendMoneyLongEndEvent extends BaseModel { +} diff --git a/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java b/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java index 616a2d0f7..cc37ea45f 100644 --- a/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java @@ -906,7 +906,11 @@ public class LiveHttpUtil { .params("anchorUid", anchor_id) .execute(callback); } - + public static void getAnchorActiveImgStatus(String anchor_id, HttpCallback callback) { + HttpClient.getInstance().get("Live.getAnchorActiveImgStatus", LiveHttpConsts.GET_EVENT) + .params("anchorUid", anchor_id) + .execute(callback); + } /** * 重置活动 */ 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..c656fedea 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -11,6 +11,7 @@ import com.yunbao.common.bean.BattlePassUserInfoBean; import com.yunbao.common.bean.BlindBoxInfoModel; import com.yunbao.common.bean.CheckLiveModel; import com.yunbao.common.bean.CheckRemainingBalance; +import com.yunbao.common.bean.CheckUpgradesModel; import com.yunbao.common.bean.ContributeModel; import com.yunbao.common.bean.CoolConfig; import com.yunbao.common.bean.CreateSudRoomModel; @@ -26,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.HourRank; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.IMLoginModel; @@ -60,6 +63,7 @@ import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.bean.RoomMicStatusModel; import com.yunbao.common.bean.SearchModel; +import com.yunbao.common.bean.SendMoneyLongModel; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SlideInBannerModel; import com.yunbao.common.bean.StarChallengeStatusModel; @@ -71,6 +75,7 @@ import com.yunbao.common.bean.UserAvatarSelectBean; import com.yunbao.common.bean.VipModel; import com.yunbao.common.bean.WishListGiftConfModel; import com.yunbao.common.bean.WishListModel; +import com.yunbao.common.bean.sendMoneyLongListModel; import com.yunbao.common.event.CheckCurrencyModel; import java.util.List; @@ -1162,4 +1167,28 @@ 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); + + @GET("/api/public/?service=Guard.openGuard") + Observable> openGuard(@Query("liveuid") String liveUid, @Query("guard_type") String guardType, @Query("price_key") String priceKey, @Query("stream") String stream); + + @GET("/api/public/?service=Guard.sendMoneyLong") + Observable> sendMoneyLong(@Query("liveuid") String liveUid, @Query("gold_num") String goldNum); + + @GET("/api/public/?service=Guard.sendMoneyLongList") + Observable>> sendMoneyLongList(@Query("liveuid") String liveUid); + + @GET("/api/public/?service=Guard.participateMoneyLong") + Observable> participateMoneyLong(@Query("liveuid") String liveUid, @Query("send_money_long_key") String sendMoneyLongKey); + @GET("/api/public/?service=Guard.endSendMoneyLong") + Observable> endSendMoneyLong(@Query("liveuid") String liveUid, @Query("send_money_long_key") String sendMoneyLongKey); + @GET("/api/public/?service=Guard.checkUpgrades") + Observable> checkUpgrades(@Query("liveuid") String liveUid); + @GET("/api/public/?service=Guard.getRewards") + Observable> guardGetRewards(@Query("guard_level") String guardLevel,@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..974ab71af 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 @@ -14,6 +14,7 @@ import com.yunbao.common.bean.BattlePassUserInfoBean; import com.yunbao.common.bean.BlindBoxInfoModel; import com.yunbao.common.bean.CheckLiveModel; import com.yunbao.common.bean.CheckRemainingBalance; +import com.yunbao.common.bean.CheckUpgradesModel; import com.yunbao.common.bean.CoolConfig; import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CustomSidebarInfoModel; @@ -27,6 +28,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; @@ -57,6 +60,7 @@ import com.yunbao.common.bean.RedPacketGiftModel; import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.bean.RoomMicStatusModel; +import com.yunbao.common.bean.SendMoneyLongModel; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.SudGameUserModel; @@ -67,6 +71,7 @@ import com.yunbao.common.bean.UserAvatarSelectBean; import com.yunbao.common.bean.VipModel; import com.yunbao.common.bean.WishListGiftConfModel; import com.yunbao.common.bean.WishListModel; +import com.yunbao.common.bean.sendMoneyLongListModel; import com.yunbao.common.event.CheckCurrencyModel; import com.yunbao.common.http.API; import com.yunbao.common.http.ResponseModel; @@ -2770,7 +2775,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 +2936,230 @@ 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(); + + } + + public void openGuard(String liveUid, String guardType, String priceKey, String stream, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .openGuard(liveUid, guardType, priceKey, stream) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel stringResponseModel) throws Exception { + if (callback != null) { + if (stringResponseModel.getData().getCode() == 0) { + callback.onSuccess(stringResponseModel.getData().getMsg()); + } else if (stringResponseModel.getData().getCode() == 1001) { + callback.onSuccess("22"); + } else { + callback.onError(stringResponseModel.getData().getMsg()); + } + + } + } + }, 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 sendMoneyLongList(String liveUid, HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .sendMoneyLongList(liveUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> stringResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(stringResponseModel.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 sendMoneyLong(String liveUid, String goldNum, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .sendMoneyLong(liveUid, goldNum) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel stringResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(stringResponseModel.getData().getMsg()); + } + } + }, 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 participateMoneyLong(String liveUid, String sendMoneyLongKey, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .participateMoneyLong(liveUid, sendMoneyLongKey) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel stringResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(stringResponseModel.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 endSendMoneyLong(String liveUid, String sendMoneyLongKey, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .endSendMoneyLong(liveUid, sendMoneyLongKey) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel stringResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(stringResponseModel.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 checkUpgrades(String liveUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .checkUpgrades(liveUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.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 guardGetRewards(String guardLevel, String liveUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .guardGetRewards("0", liveUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.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/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index cb7684922..62585d204 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -62,7 +62,24 @@ public class IMLoginManager extends BaseCacheManager { public boolean getRedPoint() { return !TextUtils.isEmpty(getString("RedPoint")) || !TextUtils.equals(getString("RedPoint"), "1"); } - public void setQuickGiftIfFirst() { + + public void setGuardRedPoint() { + put("GuardRedPoint", "1"); + } + + public boolean getGuardRedPoint() { + String GuardRedPoint = getString("GuardRedPoint"); + if (TextUtils.isEmpty(GuardRedPoint)) { + return true; + } + if (!TextUtils.equals(GuardRedPoint, "1")) { + return true; + } + + return false; + } + + public void setQuickGiftIfFirst() { put("quick_gift_if_first", "1"); } @@ -511,7 +528,8 @@ public class IMLoginManager extends BaseCacheManager { } }); } - public void updateUserCoin(){ + + public void updateUserCoin() { HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance") .execute(new HttpCallback() { @Override @@ -528,14 +546,15 @@ public class IMLoginManager extends BaseCacheManager { } }); } - public void updateUserCoin(OnItemClickListener listener){ + + public void updateUserCoin(OnItemClickListener listener) { HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance") .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0) { JSONObject obj = JSONObject.parseObject(info[0]); - listener.onItemClick(obj,0); + listener.onItemClick(obj, 0); String golds = obj.getString("gold"); String coins = obj.getString("coin"); String yuanbaos = obj.getString("yuanbao"); diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java index ae27de871..dec1d5638 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java @@ -66,6 +66,7 @@ public class RongcloudIMManager { SpeechUtility.createUtility(application.getApplicationContext(), params); } + private static RongIMClient.OnReceiveMessageWrapperListener mListener; /** diff --git a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java index 781507ddd..b4ca839b5 100644 --- a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java @@ -8,7 +8,7 @@ import android.app.Activity; import android.app.Dialog; import android.os.Handler; import android.os.Looper; -import android.util.Log; +import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.webkit.JavascriptInterface; @@ -17,14 +17,19 @@ import android.webkit.WebView; import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; +import com.lxj.xpopup.XPopup; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; +import com.yunbao.common.bean.CheckUpgradesModel; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.ReportCommunityBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.VideoBean; import com.yunbao.common.bean.VideoListBean; +import com.yunbao.common.dialog.GuardUpgradePopup; import com.yunbao.common.event.JavascriptInterfaceEvent; import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.QuickGiftingEvent; @@ -372,6 +377,13 @@ public class JavascriptInterfaceUtils { RouteUtil.forwardZhuangBanActivity(url); } + @JavascriptInterface + public void openWebViewNew(String url) { + Bus.get().post(new JavascriptInterfaceEvent().setMethod("openWebView").setData(url)); + Constants.isTitle = false; + RouteUtil.forwardZhuangBanActivity(CommonAppConfig.HOST + url); + } + @JavascriptInterface public void openWebViewTitle(String url) { Constants.isTitle = true; @@ -688,4 +700,17 @@ public class JavascriptInterfaceUtils { public void androidtoCommunityVideo() { RouteUtil.forwardCommunityActivity(); } + + @JavascriptInterface + public void getRewards(String checkUpgradesJson) { + try { + CheckUpgradesModel upgradesModel = new Gson().fromJson(checkUpgradesJson, CheckUpgradesModel.class); + if (!TextUtils.isEmpty(upgradesModel.getLevel())) + new XPopup.Builder(mWebView.getContext()) + .asCustom(new GuardUpgradePopup(mWebView.getContext(), "", upgradesModel,null)) + .show(); + } catch (JsonSyntaxException e) { + throw new RuntimeException(e); + } + } } diff --git a/common/src/main/java/com/yunbao/common/utils/TimeUtils.java b/common/src/main/java/com/yunbao/common/utils/TimeUtils.java index ef038c26b..919c17168 100644 --- a/common/src/main/java/com/yunbao/common/utils/TimeUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/TimeUtils.java @@ -1,5 +1,8 @@ package com.yunbao.common.utils; +import java.text.SimpleDateFormat; +import java.util.Date; + /** * 时间处理 */ @@ -67,4 +70,16 @@ public class TimeUtils { } return hour + minute + ":" + second; } + + /** + * 时间戳转换成字符窜 + * @param milSecond + * @param pattern + * @return + */ + public static String getDateToString(long milSecond, String pattern) { + Date date = new Date(milSecond); + SimpleDateFormat format = new SimpleDateFormat(pattern); + return format.format(date); + } } diff --git a/common/src/main/java/com/yunbao/common/views/DragonSendMoneyListViewHolder.java b/common/src/main/java/com/yunbao/common/views/DragonSendMoneyListViewHolder.java new file mode 100644 index 000000000..ca5f0d7d8 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/DragonSendMoneyListViewHolder.java @@ -0,0 +1,96 @@ +package com.yunbao.common.views; + +import android.os.CountDownTimer; +import android.os.Handler; +import android.text.TextUtils; +import android.view.View; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.makeramen.roundedimageview.RoundedImageView; +import com.yunbao.common.R; +import com.yunbao.common.bean.sendMoneyLongListModel; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.StringUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class DragonSendMoneyListViewHolder extends RecyclerView.ViewHolder { + RoundedImageView live_avatar; + TextView user_nicename; + TextView gold_num; + TextView participate; + TextView send_benefits_time; + TextView send_benefits; + LinearLayout button_participate; + long mPkTimeCount2; + public CountDownTimer countDownTimer; + + public DragonSendMoneyListViewHolder(@NonNull View itemView) { + super(itemView); + live_avatar = itemView.findViewById(R.id.live_avatar); + user_nicename = itemView.findViewById(R.id.user_nicename); + gold_num = itemView.findViewById(R.id.gold_num); + button_participate = itemView.findViewById(R.id.button_participate); + participate = itemView.findViewById(R.id.participate); + send_benefits_time = itemView.findViewById(R.id.send_benefits_time); + send_benefits = itemView.findViewById(R.id.send_benefits); + } + + public void setData(sendMoneyLongListModel model, DragonSendMoneyListClicksCallBack callBack,boolean isAnchor, boolean isAttention) { + ImgLoader.display(itemView.getContext(), model.getUserAvatar(), live_avatar); + user_nicename.setText(String.valueOf(model.getUserNicename())); + gold_num.setText(String.valueOf(model.getGoldNum())); + + if (TextUtils.equals("0", model.getParticipate()) && !isAnchor) { + participate.setVisibility(View.VISIBLE); + send_benefits_time.setVisibility(View.GONE); + send_benefits.setVisibility(View.GONE); + button_participate.setBackgroundResource(R.mipmap.icon_participate); + } else { + participate.setVisibility(View.GONE); + send_benefits_time.setVisibility(View.VISIBLE); + send_benefits.setVisibility(View.VISIBLE); + button_participate.setBackgroundResource(R.mipmap.icon_send_benefits); + } + if (send_benefits_time.getVisibility() == View.VISIBLE) { +// handler.removeCallbacks(runnable); + mPkTimeCount2 = Long.parseLong(model.getCountdown()); + String s1 = StringUtil.getDurationText(mPkTimeCount2 * 1000); + send_benefits_time.setText(s1); +// handler.postDelayed(runnable, 1000); + } + ViewClicksAntiShake.clicksAntiShake(button_participate, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (!isAnchor && callBack != null && TextUtils.equals("0", model.getParticipate())) { + callBack.onParticipate(model); +// handler.removeCallbacks(runnable); + } + } + }); + + } + +// Handler handler = new Handler(); +// Runnable runnable = new Runnable() { +// @Override +// public void run() { +// mPkTimeCount2--; +// if (mPkTimeCount2 > 0) { +// String s1 = StringUtil.getDurationText(mPkTimeCount2 * 1000); +// send_benefits_time.setText(s1); +// handler.postDelayed(runnable, 1000); +// } else { +// handler.removeCallbacks(runnable); +// } +// +// } +// }; + + public interface DragonSendMoneyListClicksCallBack { + void onParticipate(sendMoneyLongListModel moneyLongListModel); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java index 13023f15c..49c5342a3 100644 --- a/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java @@ -22,11 +22,13 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake; public class FunGamesChildViewHolder extends RecyclerView.ViewHolder { private ImageView funGamePic; private TextView funGameName; + private View total_image_red_point; public FunGamesChildViewHolder(@NonNull View itemView) { super(itemView); funGamePic = itemView.findViewById(R.id.fun_game_pic); funGameName = itemView.findViewById(R.id.fun_game_name); + total_image_red_point = itemView.findViewById(R.id.total_image_red_point); } public void setData(CustomSidebarChildModel model, boolean rigts) { @@ -38,7 +40,11 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder { funGameName.setText(model.getTitle()); - + if (TextUtils.equals(model.getTitle(), WordUtil.getNewString(com.yunbao.common.R.string.guard_guard)) && IMLoginManager.get(itemView.getContext()).getGuardRedPoint()) { + total_image_red_point.setVisibility(View.VISIBLE); + } else { + total_image_red_point.setVisibility(View.GONE); + } ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { @@ -59,7 +65,7 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder { .append("&uid=") .append(userInfo.getId()) .append("&token=") - .append(userInfo.getToken()) .append("&isZh=") + .append(userInfo.getToken()).append("&isZh=") .append(WordUtil.isNewZh() ? "1" : 0); } else { htmlUrl.append(CommonAppConfig.HOST) @@ -68,7 +74,7 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder { .append("?uid=") .append(userInfo.getId()) .append("&token=") - .append(userInfo.getToken()) .append("&isZh=") + .append(userInfo.getToken()).append("&isZh=") .append(WordUtil.isNewZh() ? "1" : 0); } Bus.get().post(new CustomDrawerPopupEvent() 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..6a2c8ddb5 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/LiveBuyGuardSelectViewHolder.java @@ -0,0 +1,44 @@ +package com.yunbao.common.views; + +import android.text.TextUtils; +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; + View layout; + + public LiveBuyGuardSelectViewHolder(@NonNull View itemView) { + super(itemView); + opening_time = itemView.findViewById(R.id.opening_time); + discount = itemView.findViewById(R.id.discount); + layout = itemView.findViewById(R.id.layout); + } + + public void setData(GuardPriceModel guardPriceModel, LiveBuyGuardSelectClickListener liveBuyGuardSelectClickListener, GuardPriceModel mModel) { + if (mModel != null && TextUtils.equals(String.valueOf(guardPriceModel.getPriceKey()), String.valueOf(mModel.getPriceKey()))) { + layout.setSelected(true); + } + 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/java/com/yunbao/common/views/NewRoleFunGamesChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/NewRoleFunGamesChildViewHolder.java index 3a6b460ad..8dc3ee7fa 100644 --- a/common/src/main/java/com/yunbao/common/views/NewRoleFunGamesChildViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/NewRoleFunGamesChildViewHolder.java @@ -26,13 +26,14 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder { private TextView funGameName; private View red_point; private boolean showRed = false; - + private View total_image_red_point; public NewRoleFunGamesChildViewHolder(@NonNull View itemView, boolean showRed) { super(itemView); this.showRed = showRed; funGamePic = itemView.findViewById(R.id.fun_game_pic); funGameName = itemView.findViewById(R.id.fun_game_name); red_point = itemView.findViewById(R.id.red_point); + total_image_red_point = itemView.findViewById(R.id.total_image_red_point); } public void setData(CustomSidebarChildModel model, boolean rigts) { @@ -49,7 +50,11 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder { } funGameName.setText(model.getTitle()); - + if (TextUtils.equals(model.getTitle(), WordUtil.getNewString(com.yunbao.common.R.string.guard_guard)) && IMLoginManager.get(itemView.getContext()).getGuardRedPoint()) { + total_image_red_point.setVisibility(View.VISIBLE); + } else { + total_image_red_point.setVisibility(View.GONE); + } ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { diff --git a/common/src/main/res/drawable/background_dragon_immediate_participation.xml b/common/src/main/res/drawable/background_dragon_immediate_participation.xml new file mode 100644 index 000000000..bcfa65051 --- /dev/null +++ b/common/src/main/res/drawable/background_dragon_immediate_participation.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/background_live_buy_guard_slelect_item.xml b/common/src/main/res/drawable/background_live_buy_guard_slelect_item.xml new file mode 100644 index 000000000..02b5be79d --- /dev/null +++ b/common/src/main/res/drawable/background_live_buy_guard_slelect_item.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/background_live_buy_guard_slelect_item1.xml b/common/src/main/res/drawable/background_live_buy_guard_slelect_item1.xml new file mode 100644 index 000000000..c68437969 --- /dev/null +++ b/common/src/main/res/drawable/background_live_buy_guard_slelect_item1.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/background_live_buy_guard_slelect_item2.xml b/common/src/main/res/drawable/background_live_buy_guard_slelect_item2.xml new file mode 100644 index 000000000..955a92c9a --- /dev/null +++ b/common/src/main/res/drawable/background_live_buy_guard_slelect_item2.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file 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/drawable/button_dragon_expire.xml b/common/src/main/res/drawable/button_dragon_expire.xml new file mode 100644 index 000000000..9806ee194 --- /dev/null +++ b/common/src/main/res/drawable/button_dragon_expire.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/button_dragon_sure.xml b/common/src/main/res/drawable/button_dragon_sure.xml new file mode 100644 index 000000000..c722e1673 --- /dev/null +++ b/common/src/main/res/drawable/button_dragon_sure.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/button_guard_upgrade.xml b/common/src/main/res/drawable/button_guard_upgrade.xml new file mode 100644 index 000000000..c722e1673 --- /dev/null +++ b/common/src/main/res/drawable/button_guard_upgrade.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/guard_buy_tips_bg.xml b/common/src/main/res/drawable/guard_buy_tips_bg.xml new file mode 100644 index 000000000..66300b845 --- /dev/null +++ b/common/src/main/res/drawable/guard_buy_tips_bg.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/common/src/main/res/drawable/guard_buy_tips_sure_bg.xml b/common/src/main/res/drawable/guard_buy_tips_sure_bg.xml new file mode 100644 index 000000000..bafb39e8f --- /dev/null +++ b/common/src/main/res/drawable/guard_buy_tips_sure_bg.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/common/src/main/res/drawable/input_dragon_money.xml b/common/src/main/res/drawable/input_dragon_money.xml new file mode 100644 index 000000000..431619486 --- /dev/null +++ b/common/src/main/res/drawable/input_dragon_money.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_guard_buy_tips.xml b/common/src/main/res/layout/dialog_guard_buy_tips.xml new file mode 100644 index 000000000..349c6fab4 --- /dev/null +++ b/common/src/main/res/layout/dialog_guard_buy_tips.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dragon_rule_popup.xml b/common/src/main/res/layout/dragon_rule_popup.xml new file mode 100644 index 000000000..fbdffa72a --- /dev/null +++ b/common/src/main/res/layout/dragon_rule_popup.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/guard_upgrade_popup.xml b/common/src/main/res/layout/guard_upgrade_popup.xml new file mode 100644 index 000000000..2bb16b8d9 --- /dev/null +++ b/common/src/main/res/layout/guard_upgrade_popup.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +