diff --git a/common/build.gradle b/common/build.gradle index e97c145bd..45a880334 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -73,6 +73,7 @@ repositories { } + dependencies { annotationProcessor rootProject.ext.dependencies["arouter-compiler"] implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) @@ -245,5 +246,10 @@ dependencies { //ExoPlayer,腾讯的播放器不支持无缝切换 api 'com.google.android.exoplayer:exoplayer:2.18.2' api 'com.google.android.exoplayer:exoplayer-core:2.18.2@aar' + //文字渐变色 + 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..b1225176d --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardGetGuardUserInfoModel.java @@ -0,0 +1,142 @@ +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; + @SerializedName("is_open") + private String isOpen; + + public String getIsOpen() { + return isOpen; + } + + public GuardGetGuardUserInfoModel setIsOpen(String isOpen) { + this.isOpen = isOpen; + return this; + } + + 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/GuardModel.java b/common/src/main/java/com/yunbao/common/bean/GuardModel.java index c89531dcf..a13949fff 100644 --- a/common/src/main/java/com/yunbao/common/bean/GuardModel.java +++ b/common/src/main/java/com/yunbao/common/bean/GuardModel.java @@ -8,6 +8,17 @@ public class GuardModel extends BaseModel { private String type; @SerializedName("endtime") private String endtime; + @SerializedName("guard_type") + private String guardType; + + public String getGuardType() { + return guardType; + } + + public GuardModel setGuardType(String guardType) { + this.guardType = guardType; + return this; + } public String getType() { return type; 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..e339879ca --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardUserInfoModel.java @@ -0,0 +1,142 @@ +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 String exp; + @SerializedName("level") + private String level; + @SerializedName("endtime") + private String endtime; + @SerializedName("user_language") + private String userLanguage; + @SerializedName("live_language") + private String liveLanguage; + @SerializedName("is_open") + private String isOpen; + + public String getIsOpen() { + return isOpen; + } + + public GuardUserInfoModel setIsOpen(String isOpen) { + this.isOpen = isOpen; + return this; + } + + 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 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/NewGuardLevelModel.java b/common/src/main/java/com/yunbao/common/bean/NewGuardLevelModel.java new file mode 100644 index 000000000..8433114de --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/NewGuardLevelModel.java @@ -0,0 +1,37 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class NewGuardLevelModel extends BaseModel{ + + @SerializedName("guard_type") + private int guardType; + @SerializedName("cn") + private String cn; + @SerializedName("en") + private String en; + + public int getGuardType() { + return guardType; + } + + public void setGuardType(int guardType) { + this.guardType = guardType; + } + + public String getCn() { + return cn; + } + + public void setCn(String cn) { + this.cn = cn; + } + + public String getEn() { + return en; + } + + public void setEn(String en) { + this.en = en; + } +} 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..25a7e4f61 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java @@ -0,0 +1,112 @@ +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.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 (TextUtils.isEmpty(coin) && mGuardUserInfoModel == null && !isOpen && guardType == -200) { + content1.setVisibility(View.GONE); + contentTextView.setVisibility(View.VISIBLE); + buyTypeTextView.setVisibility(View.GONE); + content2.setVisibility(View.GONE); + contentTextView.setText(content); + } else { + 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 (TextUtils.equals(mGuardUserInfoModel.getIsOpen(), "1") && + guardType < mGuardUserInfoModel.getGuardType()) { + content1.setVisibility(View.GONE); + contentTextView.setVisibility(View.GONE); + buyTypeTextView.setVisibility(View.GONE); + content2.setVisibility(View.VISIBLE); + + } else if (TextUtils.equals(mGuardUserInfoModel.getIsOpen(), "1") && guardType > mGuardUserInfoModel.getGuardType()) { + content1.setVisibility(View.VISIBLE); + } else { + content1.setVisibility(View.GONE); + } + } 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..36b326d0c --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java @@ -0,0 +1,171 @@ +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()) + .append(" You can receive the following rewards") + ; + } + 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(2); + + 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/dialog/SkitCheckInWasSuccessfulPopup.java b/common/src/main/java/com/yunbao/common/dialog/SkitCheckInWasSuccessfulPopup.java new file mode 100644 index 000000000..b30192ef9 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/SkitCheckInWasSuccessfulPopup.java @@ -0,0 +1,32 @@ +package com.yunbao.common.dialog; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class SkitCheckInWasSuccessfulPopup extends CenterPopupView { + public SkitCheckInWasSuccessfulPopup(@NonNull Context context) { + super(context); + } + + @Override + protected int getImplLayoutId() { + return R.layout.skit_check_in_was_successful_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.icon_slice_368), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dismiss(); + } + }); + } +} diff --git a/common/src/main/java/com/yunbao/common/event/AllServerNotifyFFGGGDJANEvent.java b/common/src/main/java/com/yunbao/common/event/AllServerNotifyFFGGGDJANEvent.java new file mode 100644 index 000000000..447dfa5ab --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/AllServerNotifyFFGGGDJANEvent.java @@ -0,0 +1,227 @@ +package com.yunbao.common.event; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.bean.BaseModel; + +import java.util.List; + +public class AllServerNotifyFFGGGDJANEvent extends BaseModel { + + @SerializedName("_method_") + private String method; + @SerializedName("action") + private String action; + @SerializedName("msg_cn") + private String msgCn; + @SerializedName("msg_en") + private String msgEn; + @SerializedName("uid") + private String uid; + @SerializedName("liveuid") + private String liveuid; + @SerializedName("background_image") + private String backgroundImage; + @SerializedName("style") + private List style; + @SerializedName("jump_type") + private String jumpType; + @SerializedName("link") + private String link; + @SerializedName("button_image") + private String buttonImage; + @SerializedName("button_msg_cn") + private String buttonMsgCn; + @SerializedName("button_msg_en") + private String buttonMsgEn; + @SerializedName("button_style") + private List buttonStyle; + @SerializedName("h5_type") + private String h5Type; + + public String getH5Type() { + return h5Type; + } + + public AllServerNotifyFFGGGDJANEvent setH5Type(String h5Type) { + this.h5Type = h5Type; + 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 getMsgCn() { + return msgCn; + } + + public void setMsgCn(String msgCn) { + this.msgCn = msgCn; + } + + public String getMsgEn() { + return msgEn; + } + + public void setMsgEn(String msgEn) { + this.msgEn = msgEn; + } + + 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 getBackgroundImage() { + return backgroundImage; + } + + public void setBackgroundImage(String backgroundImage) { + this.backgroundImage = backgroundImage; + } + + public List getStyle() { + return style; + } + + public void setStyle(List style) { + this.style = style; + } + + public String getJumpType() { + return jumpType; + } + + public void setJumpType(String jumpType) { + this.jumpType = jumpType; + } + + public String getLink() { + return link; + } + + public void setLink(String link) { + this.link = link; + } + + public String getButtonImage() { + return buttonImage; + } + + public void setButtonImage(String buttonImage) { + this.buttonImage = buttonImage; + } + + public String getButtonMsgCn() { + return buttonMsgCn; + } + + public void setButtonMsgCn(String buttonMsgCn) { + this.buttonMsgCn = buttonMsgCn; + } + + public String getButtonMsgEn() { + return buttonMsgEn; + } + + public void setButtonMsgEn(String buttonMsgEn) { + this.buttonMsgEn = buttonMsgEn; + } + + public List getButtonStyle() { + return buttonStyle; + } + + public void setButtonStyle(List buttonStyle) { + this.buttonStyle = buttonStyle; + } + + public static class StyleDTO { + @SerializedName("str_cn") + private String strCn; + @SerializedName("str_en") + private String strEn; + @SerializedName("colour") + private String colour; + + public String getStrCn() { + return strCn; + } + + public void setStrCn(String strCn) { + this.strCn = strCn; + } + + public String getStrEn() { + return strEn; + } + + public void setStrEn(String strEn) { + this.strEn = strEn; + } + + public String getColour() { + return colour; + } + + public void setColour(String colour) { + this.colour = colour; + } + } + + public static class ButtonStyleDTO { + @SerializedName("str_cn") + private String strCn; + @SerializedName("str_en") + private String strEn; + @SerializedName("colour") + private String colour; + + public String getStrCn() { + return strCn; + } + + public void setStrCn(String strCn) { + this.strCn = strCn; + } + + public String getStrEn() { + return strEn; + } + + public void setStrEn(String strEn) { + this.strEn = strEn; + } + + public String getColour() { + return colour; + } + + public void setColour(String colour) { + this.colour = colour; + } + } +} 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 fa01db24f..2ff045248 100644 --- a/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java @@ -910,7 +910,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 46cb51c9e..3c380d201 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -14,6 +14,7 @@ import com.yunbao.common.bean.BlindBoxInfoModel; import com.yunbao.common.bean.CareerBean; 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; @@ -30,6 +31,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.HomeUserExhibitInfoBean; import com.yunbao.common.bean.HomeUserInfoBean; import com.yunbao.common.bean.HourRank; @@ -72,6 +75,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.ShareBean; import com.yunbao.common.bean.SlideInBannerModel; @@ -85,6 +89,7 @@ import com.yunbao.common.bean.UserBean; 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; @@ -1307,4 +1312,28 @@ public interface PDLiveApi { @GET("/api/public/?service=Pdlcommunity.userClickDynamicShare") Observable> shareCount(@Query("dynamic_id") String dynamic_id); + @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 405c40ade..46328d6bd 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 @@ -19,6 +19,7 @@ import com.yunbao.common.bean.BlindBoxInfoModel; import com.yunbao.common.bean.CareerBean; 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; @@ -33,6 +34,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.HomeUserExhibitInfoBean; import com.yunbao.common.bean.HomeUserInfoBean; import com.yunbao.common.bean.HttpCallbackModel; @@ -72,6 +75,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.ShareBean; import com.yunbao.common.bean.StarChallengeStatusModel; @@ -84,6 +88,7 @@ import com.yunbao.common.bean.UserBean; 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; @@ -2954,6 +2959,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(); + + } + public void getPdluserFriend(int p, HttpCallback> callback) { API.get().pdLiveApi(mContext) .getPdluserFriend(p) 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 8c09b980e..065e77ee5 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -58,6 +58,15 @@ public class IMLoginManager extends BaseCacheManager { private final String KEY_LANGUAGE = "language"; private final String KEY_GAME = "key_game"; + private final String GUARD_TYPE = "key_GUARD_TYPE"; + + public void setGuardType(int guardType) { + put(GUARD_TYPE, guardType); + } + + public int getGuardType() { + return getInt(GUARD_TYPE, 0); + } public void setRedPoint() { put("RedPoint", "1"); @@ -66,7 +75,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"); } @@ -521,7 +547,8 @@ public class IMLoginManager extends BaseCacheManager { } }); } - public void updateUserCoin(){ + + public void updateUserCoin() { HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance") .execute(new HttpCallback() { @Override @@ -538,14 +565,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/NewLevelManager.java b/common/src/main/java/com/yunbao/common/manager/NewLevelManager.java index 359dc032d..86ad9039b 100644 --- a/common/src/main/java/com/yunbao/common/manager/NewLevelManager.java +++ b/common/src/main/java/com/yunbao/common/manager/NewLevelManager.java @@ -5,6 +5,7 @@ import android.content.Context; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.yunbao.common.bean.FansModel; +import com.yunbao.common.bean.NewGuardLevelModel; import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.manager.base.BaseCacheManager; @@ -19,10 +20,12 @@ public class NewLevelManager extends BaseCacheManager { private final String KEY_ANCHOR_LEVEL = "keyAnchorLevel"; private final String KEY_LIVE_LEVEL = "keyLiveLevel"; private final String KEY_FANS_LEVEL = "keyFansLevel"; + private final String KEY_GUARD_LEVEL = "keyGuardLevel"; private List newLevelModels = new ArrayList<>(); private List keyAnchorLevel = new ArrayList<>(); private List fansModels = new ArrayList<>(); + private List newGuardLevelModels = new ArrayList<>(); public NewLevelManager(Context context) { super(context); @@ -62,6 +65,29 @@ public class NewLevelManager extends BaseCacheManager { return fansModel; } + public void upDataGuardLevel(String json) { + newGuardLevelModels = new Gson().fromJson(json, new TypeToken>() { + }.getType()); + put(KEY_GUARD_LEVEL, newGuardLevelModels); + } + + public List getGuardLevel() { + newGuardLevelModels = getList(KEY_GUARD_LEVEL, new TypeToken>() { + }.getType()); + return newGuardLevelModels; + } + + public NewGuardLevelModel getGuardModel(int type) { + getGuardLevel(); + NewGuardLevelModel guardLevelModel = null; + for (NewGuardLevelModel model : newGuardLevelModels) { + if (model.getGuardType() == type) { + guardLevelModel = model; + } + } + return guardLevelModel; + } + /** * 获取等级数据 * 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 c7641c707..10dc380c8 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 @@ -67,6 +67,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..8cab49049 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,6 +50,13 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder { } funGameName.setText(model.getTitle()); + if (total_image_red_point!=null){ + 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 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..e28f64048 --- /dev/null +++ b/common/src/main/res/layout/guard_upgrade_popup.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/skit_check_in_was_successful_popup.xml b/common/src/main/res/layout/skit_check_in_was_successful_popup.xml new file mode 100644 index 000000000..ff8583c03 --- /dev/null +++ b/common/src/main/res/layout/skit_check_in_was_successful_popup.xml @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_dragon_send_money_list.xml b/common/src/main/res/layout/view_dragon_send_money_list.xml new file mode 100644 index 000000000..93ba79c73 --- /dev/null +++ b/common/src/main/res/layout/view_dragon_send_money_list.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_fun_games_child_view.xml b/common/src/main/res/layout/view_fun_games_child_view.xml index eebec3aef..4ac669274 100644 --- a/common/src/main/res/layout/view_fun_games_child_view.xml +++ b/common/src/main/res/layout/view_fun_games_child_view.xml @@ -1,16 +1,37 @@ - + + + + + + + + + + + + \ 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..b95c96332 --- /dev/null +++ b/common/src/main/res/layout/view_live_buy_guard_slelect.xml @@ -0,0 +1,20 @@ + + + + + + \ 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..b8f2ff332 --- /dev/null +++ b/common/src/main/res/layout/view_live_buy_guard_slelect_item.xml @@ -0,0 +1,33 @@ + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_live_new_role_fun_games_child_view.xml b/common/src/main/res/layout/view_live_new_role_fun_games_child_view.xml index a32ea1d1c..4b46be732 100644 --- a/common/src/main/res/layout/view_live_new_role_fun_games_child_view.xml +++ b/common/src/main/res/layout/view_live_new_role_fun_games_child_view.xml @@ -13,11 +13,32 @@ android:layout_width="wrap_content" android:layout_height="wrap_content"> - + + + + + + + My Become the guardian of %s Open a guard for your favorite anchor - The guardian date expires at: %s + Guardianship date is up to: %s GET Only one can be given away~ Guard diff --git a/common/src/main/res/values-en-rUS/strings.xml b/common/src/main/res/values-en-rUS/strings.xml index c276ed84e..3b01089c0 100644 --- a/common/src/main/res/values-en-rUS/strings.xml +++ b/common/src/main/res/values-en-rUS/strings.xml @@ -36,4 +36,53 @@ Upload failed Please fill in the publication content Details + 【Star Guardian】 + + Guardianship privileges + Be the anchor‘s guardian + Not opened + Guardian group > + Activate King Guardian + Activate Star Guardian + Activate God Guardian + 1 month + 3 month + 6 month + 12 month + Quickly activate guardian for your favorite anchor! + Guard tasks + My level > + No one is guarding the anchor yet, come and guard it now~ + Contribution/week + Contribution + Opened + Dragon\'s Wealth + "Please enter the quantity of gold beans " + "The gold beans consumed this time will increase your guardian experience points " + Open activity + "1. Dragon's Wealth is a benefit that you provide to the audience of the live room after activating the 【God Guardian】. You can choose to customize the number of golden beans and summon Dragon God to divide the profits among the fans of the live broadcast room (the number of golden beans is not less than 1000), or you can choose not to activate the activity; " + "2. The consumption of gold beans this time will be included in the guardian contribution value and experience value growth. For every 10 gold beans provided, 1 contribution value will be obtained, which can be used to increase the guardian level; " + "3. Users who follow the anchor and participate in activities will receive the benefits you provide after a five minute countdown; " + 4. The final interpretation of this activity belongs to PDLIVE. + Participate + Renew now to extend guardian privileges\n + Now renew and enjoy guardian privileges again\n + Go to renew + Congratulations + Your guardian level has reached level 000 + View levels + Open up guard for your beloved anchor! + Due in + Expired + Renewal Guardian + You will spend %s diamonds for the anchor + You will spend %s diamonds to renew the anchor + Participate + Send benefits + (The original protection level will be retained, and the remaining validity period will be added to the new protection validity period according to the rules) + We are currently unable to activate this guard. Please try again after the current guard expires + 1.Dragon\'s Wealth is a free golden bean benefit provided to live stream viewers by users who have activated the 【God Guardian】 feature; + 2.Users who follow the anchor and participate in the activity will divide the gold beans of the activity after the countdown of five minutes ends; + 3.The final interpretation of this activity belongs to PDLIVE. + \ No newline at end of file diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 61b1c0969..35b7bdc6c 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -95,7 +95,6 @@ 請選擇正確的日期 溫馨提示:可以免費修改昵稱一次,之後修改需要鑽石1800一次 關注 - 短劇 主播哪裡做的不好~\n哥哥確定要取消關注嗎? 繼續關注 不再關注 @@ -1501,4 +1500,52 @@ 上傳失敗 請填寫發佈內容 詳情 + 【星之守护】 + 守護團特權 + 成為TA的專屬守護 + 暫未開通 + 守護團 > + 開通王之守護 + 開通星之守護 + 開通神之守護 + 1個月 + 3個月 + 6個月 + 12個月 + 快爲您喜歡的主播開通守護吧! + 守護任務 + 我的等級 > + 還沒人守護主播,快來守護TA吧~ + 本周貢獻值 + 貢獻度 + 已開通 + 神龍送財 + 請輸入金豆數量 + 您本次消耗的金豆將增長您的守護經驗值 + 開啓活動 + 1.龍神送財是您開通【神之守護】後給予直播間觀眾的福利,您可選擇自定義金豆數量並召喚龍神給直播间内主播粉丝瓜分(金豆數量不低於1000),或者您可以選擇不开启活动; + 2.此次金豆消耗将计入守护贡献值和经验值增长,每提供10金豆將獲得1貢獻值,貢獻值可用於增長守護等級; + 3.用戶關注主播並參與活動,將在五分鐘倒計時後將獲得您提供的福利; + 4.此活動的最終解釋權歸PDLIVE所有。 + 立即參與 + 延續守護特權 + 前往續費 + 恭喜升級 + 您的守護等級已達到123級 可以領取以下獎勵 + 查看等級 + 為心愛的TA開通守護吧! + 還有 + 天到期 + 保留守護等級 重享守護特權 + 續費守護 + 您將花費%s鑽石為主播續費 + 點擊參加 + 發放福利 + (原有的守護等級將會保留,剩餘有效期將按規則補充至新守護有效期中) + 暫時無法開通該守護,請當前守護到期後嘗試 + 1.神龍送財是開通【神之守護】的用戶給予直播間觀眾的免費金豆福利; + 2.用戶關注主播並參與活動,將在倒計時五分鐘結束後瓜分活動金豆; + 3.此活動的最終解釋權歸PDLIVE所有。 + 短劇 + 您將花費%s鑽石,為主播開通 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index d9bf98fa0..f483d583d 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -95,7 +95,6 @@ 請選擇正確的日期 溫馨提示:可以免費修改昵稱一次,之後修改需要鑽石1800一次 關注 - 短劇 主播哪裡做的不好~\n哥哥確定要取消關注嗎? 繼續關注 不再關注 @@ -1501,4 +1500,52 @@ 上傳失敗 請填寫發佈內容 詳情 + 【星之守护】 + 守護團特權 + 成為TA的專屬守護 + 暫未開通 + 守護團 > + 開通王之守護 + 開通星之守護 + 開通神之守護 + 1個月 + 3個月 + 6個月 + 12個月 + 快爲您喜歡的主播開通守護吧! + 守護任務 + 我的等級 > + 還沒人守護主播,快來守護TA吧~ + 本周貢獻值 + 貢獻度 + 已開通 + 神龍送財 + 請輸入金豆數量 + 您本次消耗的金豆將增長您的守護經驗值 + 開啓活動 + 1.龍神送財是您開通【神之守護】後給予直播間觀眾的福利,您可選擇自定義金豆數量並召喚龍神給直播间内主播粉丝瓜分(金豆數量不低於1000),或者您可以選擇不开启活动; + 2.此次金豆消耗将计入守护贡献值和经验值增长,每提供10金豆將獲得1貢獻值,貢獻值可用於增長守護等級; + 3.用戶關注主播並參與活動,將在五分鐘倒計時後將獲得您提供的福利; + 4.此活動的最終解釋權歸PDLIVE所有。 + 立即參與 + 延續守護特權 + 前往續費 + 恭喜升級 + 您的守護等級已達到123級 可以領取以下獎勵 + 查看等級 + 為心愛的TA開通守護吧! + 還有 + 天到期 + 保留守護等級 重享守護特權 + 續費守護 + 您將花費%s鑽石為主播續費 + 點擊參加 + 發放福利 + (原有的守護等級將會保留,剩餘有效期將按規則補充至新守護有效期中) + 暫時無法開通該守護,請當前守護到期後嘗試 + 1.神龍送財是開通【神之守護】的用戶給予直播間觀眾的免費金豆福利; + 2.用戶關注主播並參與活動,將在倒計時五分鐘結束後瓜分活動金豆; + 3.此活動的最終解釋權歸PDLIVE所有。 + 短劇 + 您將花費%s鑽石,為主播開通 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 7d1fc711f..976bf2ea7 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -96,7 +96,6 @@ 請選擇正確的日期 溫馨提示:可以免費修改昵稱一次,之後修改需要鑽石1800一次 關注 - 短劇 主播哪裡做的不好~\n哥哥確定要取消關注嗎? 繼續關注 不再關注 @@ -1499,4 +1498,52 @@ 上傳失敗 請填寫發佈內容 詳情 + 【星之守护】 + 守護團特權 + 成為TA的專屬守護 + 暫未開通 + 守護團 > + 開通王之守護 + 開通星之守護 + 開通神之守護 + 1個月 + 3個月 + 6個月 + 12個月 + 快爲您喜歡的主播開通守護吧! + 守護任務 + 我的等級 > + 還沒人守護主播,快來守護TA吧~ + 本周貢獻值 + 貢獻度 + 已開通 + 神龍送財 + 請輸入金豆數量 + 您本次消耗的金豆將增長您的守護經驗值 + 開啓活動 + 1.龍神送財是您開通【神之守護】後給予直播間觀眾的福利,您可選擇自定義金豆數量並召喚龍神給直播间内主播粉丝瓜分(金豆數量不低於1000),或者您可以選擇不开启活动; + 2.此次金豆消耗将计入守护贡献值和经验值增长,每提供10金豆將獲得1貢獻值,貢獻值可用於增長守護等級; + 3.用戶關注主播並參與活動,將在五分鐘倒計時後將獲得您提供的福利; + 4.此活動的最終解釋權歸PDLIVE所有。 + 立即參與 + 延續守護特權 + 前往續費 + 恭喜升級 + 您的守護等級已達到123級 可以領取以下獎勵 + 查看等級 + 為心愛的TA開通守護吧! + 還有 + 天到期 + 保留守護等級 重享守護特權 + 續費守護 + 您將花費%s鑽石為主播續費 + 點擊參加 + 發放福利 + (原有的守護等級將會保留,剩餘有效期將按規則補充至新守護有效期中) + 暫時無法開通該守護,請當前守護到期後嘗試 + 1.神龍送財是開通【神之守護】的用戶給予直播間觀眾的免費金豆福利; + 2.用戶關注主播並參與活動,將在倒計時五分鐘結束後瓜分活動金豆; + 3.此活動的最終解釋權歸PDLIVE所有。 + 短劇 + 您將花費%s鑽石,為主播開通 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index dcffd0d08..2d78c75df 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -96,7 +96,6 @@ Please select the correct date Warm tip: you can change your nickname once for free, and then 1800 diamonds will be needed Follow - Theater VIP Rosy Skin @@ -173,7 +172,7 @@ My Become the guardian of %s Open a guard for your favorite anchor - The guardian date expires at: %s + Guardianship date is up to: %s GET Only one can be given away~ Guard @@ -1522,4 +1521,53 @@ Limited ride And limited avatar frame 請填寫發佈內容 詳情 + 【Star Guardian】 + + Guardianship privileges + Be the anchor‘s guardian + Not opened + Guardian group > + Activate King Guardian + Activate Star Guardian + Activate God Guardian + 1 month + 3 month + 6 month + 12 month + Quickly activate guardian for your favorite anchor! + Guard tasks + My level > + No one is guarding the anchor yet, come and guard it now~ + Contribution/week + Contribution + Opened + Dragon\'s Wealth + "Please enter the quantity of gold beans " + "The gold beans consumed this time will increase your guardian experience points " + Open activity + "1. Dragon's Wealth is a benefit that you provide to the audience of the live room after activating the 【God Guardian】. You can choose to customize the number of golden beans and summon Dragon God to divide the profits among the fans of the live broadcast room (the number of golden beans is not less than 1000), or you can choose not to activate the activity; " + "2. The consumption of gold beans this time will be included in the guardian contribution value and experience value growth. For every 10 gold beans provided, 1 contribution value will be obtained, which can be used to increase the guardian level; " + "3. Users who follow the anchor and participate in activities will receive the benefits you provide after a five minute countdown; " + 4. The final interpretation of this activity belongs to PDLIVE. + Participate + Renew now to extend guardian privileges\n + Now renew and enjoy guardian privileges again\n + Go to renew + Congratulations + Your guardian level has reached level 000 + View levels + Open up guard for your beloved anchor! + Due in + Expired + Renewal Guardian + You will spend %s diamonds for the anchor + You will spend %s diamonds to renew the anchor + Participate + Send benefits + (The original protection level will be retained, and the remaining validity period will be added to the new protection validity period according to the rules) + We are currently unable to activate this guard. Please try again after the current guard expires + 1.Dragon\'s Wealth is a free golden bean benefit provided to live stream viewers by users who have activated the 【God Guardian】 feature; + 2.Users who follow the anchor and participate in the activity will divide the gold beans of the activity after the countdown of five minutes ends; + 3.The final interpretation of this activity belongs to PDLIVE. + Theater diff --git a/config.gradle b/config.gradle index d24b90a5a..5d32e6878 100644 --- a/config.gradle +++ b/config.gradle @@ -10,9 +10,9 @@ ext { ] manifestPlaceholders = [ //正式、 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", // 测试 - //serverHost : " https://ceshi.yaoulive.com", + serverHost : " https://ceshi.yaoulive.com", //百度语音识别 baiduAppId : "23774720", 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 791dd1829..ae1212ba2 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -21,6 +21,7 @@ import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; +import com.umeng.analytics.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; @@ -36,6 +37,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 +51,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,20 +67,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.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; @@ -734,7 +735,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 { @@ -1265,22 +1267,32 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL if (uid == null) { uid = mLiveUid; } + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + MobclickAgent.onEvent(mContext, "guardian_people", "守护席点击次数及人数"); + } + }, 500); + 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, mStream).showDialog(); } else { - LiveNewGuardListDialogFragment fragment = new LiveNewGuardListDialogFragment(); - 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, mStream).showDialog(); } } }); @@ -1405,18 +1417,28 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream) || mLiveGuardInfo == null) { return; } - LiveNewGuardBuyDialogFragment fragment = new LiveNewGuardBuyDialogFragment(); - fragment.setLiveGuardInfo(mLiveGuardInfo); - Bundle bundle = new Bundle(); - bundle.putString(Constants.COIN_NAME, mCoinName); - bundle.putString(Constants.LIVE_UID, mLiveUid); - bundle.putString(Constants.LIVE_ANCHER_NAME, mAncherName); - bundle.putString(Constants.STREAM, mStream); - bundle.putString(Constants.LIVE_ANCHER_ICON, mAncherIcon); - bundle.putString(Constants.USER_ICON, CommonAppConfig.getInstance().getUserBean().getAvatar()); - bundle.putString("by", by); - fragment.setArguments(bundle); - fragment.show(getSupportFragmentManager(), "LiveGuardBuyDialogFragment"); + LiveHttpUtil.getGuardList(mLiveUid, 1, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + List list = JSON.parseArray(Arrays.toString(info), GuardUserModel.class); + Log.e("getGuardList", list.toString()); + if (list.isEmpty()) { +// openNewBuyGuardWindow(true); + new LiveGuardDialog(mContext, true, mLiveUid, mStream).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"); + new LiveGuardDialog(mContext, false, mLiveUid, mStream).showDialog(); + } + } + }); } /** diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 9f20d812f..558d55e33 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -45,6 +45,7 @@ import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.CrashSaveBean; import com.yunbao.common.bean.CustomSidebarChildModel; +import com.yunbao.common.bean.GuardMaturityDateRemindModel; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LiveBean; @@ -52,6 +53,7 @@ import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveRoomVoteModel; import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.LiveUserMailBoxModel; +import com.yunbao.common.bean.SendMoneyLongModel; import com.yunbao.common.bean.SlideInfoModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.EffectsSettingsDialog; @@ -60,6 +62,7 @@ import com.yunbao.common.dialog.LiveChargeDialogFragment; import com.yunbao.common.dialog.SlideSettingsDialog; import com.yunbao.common.dialog.SudGameListPopup; import com.yunbao.common.dialog.YoursystemisolderDialog; +import com.yunbao.common.event.AllServerNotifyFFGGGDJANEvent; import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.GiftWallIlluminateEvent; @@ -71,6 +74,7 @@ import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent; import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent; import com.yunbao.common.event.QuickGiftingEvent; +import com.yunbao.common.event.SendMoneyLongEndEvent; import com.yunbao.common.event.ShowHideEvent; import com.yunbao.common.event.SlideEvent; import com.yunbao.common.glide.ImgLoader; @@ -108,6 +112,8 @@ import com.yunbao.live.adapter.VerticalPagerAdapter; import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.LiveChatBean; import com.yunbao.live.bean.LiveGuardInfo; +import com.yunbao.live.bean.NewAllServerNotifyGuardEvent; +import com.yunbao.live.dialog.DragonExpirePopup; import com.yunbao.live.dialog.LiveFansFragment; import com.yunbao.live.dialog.LiveGameDialogFragment; import com.yunbao.live.dialog.LiveGiftPopup; @@ -958,6 +964,8 @@ public class LiveAudienceActivity extends LiveActivity { } else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.guard_guard))) { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.GUARD)); + + manager.onGuardRed(); //跳转粉丝团 } else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.fan_club))) { Bus.get().post(new LiveAudienceEvent() @@ -1485,6 +1493,11 @@ public class LiveAudienceActivity extends LiveActivity { manager.showXydComplete(event.getXydCompleteModel(), event.getLiveReceiveGiftBean()); } break; + case GuardSpecialEffect: + if (manager != null) { + manager.guardSpecialEffect(event.getLiveReceiveGiftBean()); + } + break; case VOTE_CREATE: case VOTE_UPDATE: LiveRoomVoteModel voteModel = new LiveRoomVoteModel(); @@ -1849,6 +1862,7 @@ public class LiveAudienceActivity extends LiveActivity { } else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.guard_guard))) { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.GUARD)); + manager.onGuardRed(); //跳转粉丝团 } else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.fan_club))) { Bus.get().post(new LiveAudienceEvent() @@ -1897,7 +1911,7 @@ public class LiveAudienceActivity extends LiveActivity { if (isShow) { manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE); } else { - if (IMLoginManager.get(mContext).getRedPoint()) { + if (IMLoginManager.get(mContext).getRedPoint() || IMLoginManager.get(mContext).getGuardRedPoint()) { manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE); } else { manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.GONE); @@ -1918,6 +1932,55 @@ public class LiveAudienceActivity extends LiveActivity { } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onGuardMaturityDateRemind(GuardMaturityDateRemindModel maturityDateRemindModel) { + Log.e("DateRemindModel", maturityDateRemindModel.toString()); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + new XPopup.Builder(mContext) + .asCustom(new DragonExpirePopup(mContext, mLiveUid, maturityDateRemindModel, mStream)) + .show(); + } + }, 3000); + + + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onSendMoneyLongModel(SendMoneyLongModel sendMoneyLongModel) { + Log.e("DateRemindModel", sendMoneyLongModel.toString()); + if (manager != null) { + manager.onSendMoneyLongModel(sendMoneyLongModel); + } + + + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onNewAllServerNotifyGuardEvent(NewAllServerNotifyGuardEvent event) { + if (manager != null) { + manager.buyGuardNew(event); + } + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onAllServerNotifyFFGGGDJANEvent(AllServerNotifyFFGGGDJANEvent event) { + if (manager != null) { + manager.showAllServerNotifyFFGGGD(event); + } + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onSendMoneyLongEndEvent(SendMoneyLongEndEvent sendMoneyLongModel) { + Log.e("DateRemindModel", sendMoneyLongModel.toString()); + if (manager != null) { + manager.onSendMoneyLongEndEvent(sendMoneyLongModel); + } + + + } + /** * 检查消息,有未读就要显示红点 */ diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 6a4961c73..bf7d090bb 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -48,12 +48,15 @@ import com.yunbao.common.bean.LiveAiRobotBean; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.MicUserBean; +import com.yunbao.common.bean.SendMoneyLongModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.NotCancelableDialog; +import com.yunbao.common.event.AllServerNotifyFFGGGDJANEvent; import com.yunbao.common.event.GiftWallIlluminateEvent; import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent; import com.yunbao.common.event.LoginInvalidEvent; import com.yunbao.common.event.SendBlindGiftEvent; +import com.yunbao.common.event.SendMoneyLongEndEvent; import com.yunbao.common.event.ShowHideEvent; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; @@ -1709,9 +1712,27 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl liveInputDialogFragment.setArguments(liveInputBundle); liveInputDialogFragment.show(getSupportFragmentManager(), "LiveInputDialogFragment"); break; + } } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onSendMoneyLongModel(SendMoneyLongModel sendMoneyLongModel) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.onSendMoneyLongModel(sendMoneyLongModel); + } + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onSendMoneyLongEndEvent(SendMoneyLongEndEvent sendMoneyLongModel) { + Log.e("DateRemindModel", sendMoneyLongModel.toString()); + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.onSendMoneyLongEndEvent(sendMoneyLongModel); + } + + + } + @Subscribe(threadMode = ThreadMode.MAIN) public void GiftWallIlluminateEvent(GiftWallIlluminateEvent event) { if (mLiveRoomViewHolder != null) { @@ -1903,4 +1924,10 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onAllServerNotifyFFGGGDJANEvent(AllServerNotifyFFGGGDJANEvent event) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.showAllServerNotifyFFGGGD(event,false); + } + } } diff --git a/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java b/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java index f86e32423..c55118a49 100644 --- a/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java @@ -298,7 +298,7 @@ public class ZhuangBanActivity extends AbsActivity { public static void forward(Context context, String url, boolean addArgs, int isLive) { if (addArgs) { - url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); + url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); } Intent intent = new Intent(context, ZhuangBanActivity.class); Log.i("tag", url); @@ -310,6 +310,16 @@ public class ZhuangBanActivity extends AbsActivity { context.startActivity(intent); } + public static void forwardqeqweqq(Context context, String url, int isLive) { + + Intent intent = new Intent(context, ZhuangBanActivity.class); + Log.i("tag", url); + intent.putExtra(Constants.URL, url); + intent.putExtra("title", ""); + intent.putExtra("isLive", isLive); + context.startActivity(intent); + } + public static void forward(Context context, String url, int isLive) { forward(context, url, true, isLive); } diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveBuyGuardTopListAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveBuyGuardTopListAdapter.java new file mode 100644 index 000000000..6a367104d --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/LiveBuyGuardTopListAdapter.java @@ -0,0 +1,90 @@ +package com.yunbao.live.adapter; + +import android.content.Context; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.live.R; + +public class LiveBuyGuardTopListAdapter extends RecyclerView.Adapter{ + private Context mContext; + + public LiveBuyGuardTopListAdapter(Context mContext) { + this.mContext = mContext; + } + + + @NonNull + @Override + public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.view_vp_live_buy_guard,parent,false)); + } + + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, int position) { + holder.bind(position); + } + + @Override + public int getItemCount() { + return 3; + } + + public class ViewHolder extends RecyclerView.ViewHolder{ + ImageView imageView; + public ViewHolder(android.view.View itemView) { + super(itemView); + imageView=itemView.findViewById(R.id.bg); + Log.i("测试","额"); + itemView.setFocusable(true); + itemView.setFocusableInTouchMode(true); + itemView.getViewTreeObserver().addOnGlobalFocusChangeListener(new ViewTreeObserver.OnGlobalFocusChangeListener(){ + + @Override + public void onGlobalFocusChanged(View view, View view1) { + Log.i("测试","焦点变换:"+view+"|"+getAbsoluteAdapterPosition()); + } + }); + /* itemView.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View view, boolean b) { + Log.i("测试","焦点变换:"+b+"|"+getAbsoluteAdapterPosition()); + } + });*/ + } + + public void bind(int position) { + RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) itemView.getLayoutParams(); + int def=15; + int margin=15; + int marginDef=5; + if(position==0){ + params.leftMargin=DpUtil.dp2px(margin); + params.rightMargin=DpUtil.dp2px(marginDef); + }else if(position==getItemCount()-1){ + params.rightMargin=DpUtil.dp2px(margin); + params.leftMargin=DpUtil.dp2px(marginDef); + }else{ + params.leftMargin=DpUtil.dp2px(def); + params.rightMargin=DpUtil.dp2px(def); + } + itemView.setLayoutParams(params); + itemView.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View view, boolean b) { + System.out.println("~~~~~~~焦点 "+b); + } + }); + } + } +} 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/CoinModel.java b/live/src/main/java/com/yunbao/live/bean/CoinModel.java index b78325dbd..0d45a6fe5 100644 --- a/live/src/main/java/com/yunbao/live/bean/CoinModel.java +++ b/live/src/main/java/com/yunbao/live/bean/CoinModel.java @@ -31,6 +31,7 @@ public class CoinModel extends BaseModel { //包裹红点 @SerializedName("users_pack_red_dot") private String usersPackRedDot; + private long goldMoney; public String getCoin() { long coinMoney = Long.parseLong(coin); @@ -56,7 +57,7 @@ public class CoinModel extends BaseModel { } public String getGold() { - long goldMoney = Long.parseLong(gold); + goldMoney = Long.parseLong(gold); if (999999999 < goldMoney && goldMoney <= 999999999999L) { gold = gold.substring(0, gold.length() - 3); gold = gold + "k"; @@ -68,6 +69,15 @@ public class CoinModel extends BaseModel { return gold; } + public long getGoldMoney() { + return goldMoney; + } + + public CoinModel setGoldMoney(long goldMoney) { + this.goldMoney = goldMoney; + return this; + } + public CoinModel setGold(String gold) { this.gold = gold; return this; 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..119181051 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/GuardUserModel.java @@ -0,0 +1,210 @@ +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 String guardExp; + @SerializedName("guard_level") + private int guardLevel; + @SerializedName("guard_name") + private String guardName; + @SerializedName("guard_img") + private String guardImg; + @SerializedName("guard_level_card") + private String guardLevelCard; + + public String getGuardLevelCard() { + return guardLevelCard; + } + + public GuardUserModel setGuardLevelCard(String guardLevelCard) { + this.guardLevelCard = guardLevelCard; + return this; + } + + 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 String getGuardExp() { + return guardExp; + } + + public GuardUserModel setGuardExp(String 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/bean/LiveReceiveGiftBean.java b/live/src/main/java/com/yunbao/live/bean/LiveReceiveGiftBean.java index e505b5fc9..e35fb773f 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveReceiveGiftBean.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveReceiveGiftBean.java @@ -5,6 +5,7 @@ import android.text.TextUtils; import com.alibaba.fastjson.annotation.JSONField; import com.yunbao.common.bean.BaseModel; import com.yunbao.common.event.AllServerNotifyEvent; +import com.yunbao.common.event.AllServerNotifyFFGGGDJANEvent; /** * Created by cxf on 2017/8/22. @@ -62,6 +63,66 @@ public class LiveReceiveGiftBean extends BaseModel { private String namingUserAvatar; private String namingStatus; private String namingCoin; + private String medal_name; + private String msg; + private String msg_en; + private String guard_type; + private AllServerNotifyFFGGGDJANEvent notifyFFGGGDJANEvent; + private boolean showB; + + public boolean isShowB() { + return showB; + } + + public LiveReceiveGiftBean setShowB(boolean showB) { + this.showB = showB; + return this; + } + + public AllServerNotifyFFGGGDJANEvent getNotifyFFGGGDJANEvent() { + return notifyFFGGGDJANEvent; + } + + public LiveReceiveGiftBean setNotifyFFGGGDJANEvent(AllServerNotifyFFGGGDJANEvent notifyFFGGGDJANEvent) { + this.notifyFFGGGDJANEvent = notifyFFGGGDJANEvent; + return this; + } + + public String getMsg() { + return msg; + } + + public LiveReceiveGiftBean setMsg(String msg) { + this.msg = msg; + return this; + } + + public String getMsg_en() { + return msg_en; + } + + public LiveReceiveGiftBean setMsg_en(String msg_en) { + this.msg_en = msg_en; + return this; + } + + public String getGuard_type() { + return guard_type; + } + + public LiveReceiveGiftBean setGuard_type(String guard_type) { + this.guard_type = guard_type; + return this; + } + + public String getMedal_name() { + return medal_name; + } + + public LiveReceiveGiftBean setMedal_name(String medal_name) { + this.medal_name = medal_name; + return this; + } public String getNamingLiveuid() { return namingLiveuid; diff --git a/live/src/main/java/com/yunbao/live/bean/NewAllServerNotifyGuardEvent.java b/live/src/main/java/com/yunbao/live/bean/NewAllServerNotifyGuardEvent.java new file mode 100644 index 000000000..b7aa3f80f --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/NewAllServerNotifyGuardEvent.java @@ -0,0 +1,131 @@ +package com.yunbao.live.bean; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.bean.BaseModel; + +public class NewAllServerNotifyGuardEvent extends BaseModel { + /** + * { + * "_method_": "AllServerNotify", + * "action": "90", + * "guard_type": "1", // 守护类型 + * "uid": "98888", // 用户ID + * "uname": "周末暴打小朋友", // 用户昵称 + * "avatar": "https://downs.yaoulive.com/mannine.png", // 用户头像链接 + * "liveuid": "98889", // 主播ID + * "msg_cn": "周末暴打小朋友在接化发直播間開通【星之守護】", + * "msg_en": "周末暴打小朋友opened 【星之守護】 in 接化发 live broadcast room" + * } + */ + + @SerializedName("_method_") + private String method; + @SerializedName("action") + private String action; + @SerializedName("guard_type") + private String guardType; + @SerializedName("uid") + private String uid; + @SerializedName("uname") + private String uname; + @SerializedName("avatar") + private String avatar; + @SerializedName("liveuid") + private String liveuid; + @SerializedName("msg_cn") + private String msgCn; + @SerializedName("msg_en") + private String msgEn; + @SerializedName("is_onlookers") + private String isOnlookers ; + + public String getIsOnlookers() { + return isOnlookers; + } + + public NewAllServerNotifyGuardEvent setIsOnlookers(String isOnlookers) { + this.isOnlookers = isOnlookers; + return this; + } + + public String getMethod() { + return method; + } + + public NewAllServerNotifyGuardEvent setMethod(String method) { + this.method = method; + return this; + } + + public String getAction() { + return action; + } + + public NewAllServerNotifyGuardEvent setAction(String action) { + this.action = action; + return this; + } + + public String getGuardType() { + return guardType; + } + + public NewAllServerNotifyGuardEvent setGuardType(String guardType) { + this.guardType = guardType; + return this; + } + + public String getUid() { + return uid; + } + + public NewAllServerNotifyGuardEvent setUid(String uid) { + this.uid = uid; + return this; + } + + public String getUname() { + return uname; + } + + public NewAllServerNotifyGuardEvent setUname(String uname) { + this.uname = uname; + return this; + } + + public String getAvatar() { + return avatar; + } + + public NewAllServerNotifyGuardEvent setAvatar(String avatar) { + this.avatar = avatar; + return this; + } + + public String getLiveuid() { + return liveuid; + } + + public NewAllServerNotifyGuardEvent setLiveuid(String liveuid) { + this.liveuid = liveuid; + return this; + } + + public String getMsgCn() { + return msgCn; + } + + public NewAllServerNotifyGuardEvent setMsgCn(String msgCn) { + this.msgCn = msgCn; + return this; + } + + public String getMsgEn() { + return msgEn; + } + + public NewAllServerNotifyGuardEvent setMsgEn(String msgEn) { + this.msgEn = msgEn; + return this; + } +} diff --git a/live/src/main/java/com/yunbao/live/custom/LiveBuyGuardLinearLayoutManager.java b/live/src/main/java/com/yunbao/live/custom/LiveBuyGuardLinearLayoutManager.java new file mode 100644 index 000000000..89720e133 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/custom/LiveBuyGuardLinearLayoutManager.java @@ -0,0 +1,56 @@ +package com.yunbao.live.custom; + +import android.content.Context; +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.ScaleAnimation; + +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +public class LiveBuyGuardLinearLayoutManager extends LinearLayoutManager { + String TAG = "测试"; + + public LiveBuyGuardLinearLayoutManager(Context context) { + super(context); + } + + public LiveBuyGuardLinearLayoutManager(Context context, int orientation, boolean reverseLayout) { + super(context, orientation, reverseLayout); + } + + @Override + public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) { + int scroll = super.scrollHorizontallyBy(dx, recycler, state); + Log.i(TAG, "scrollHorizontallyBy: dx "+dx+"|"+state.hasTargetScrollPosition()+"|"+state.isPreLayout()+"|"+scroll); + View now = findViewByPosition(findFirstCompletelyVisibleItemPosition()); + View old = findViewByPosition(findFirstCompletelyVisibleItemPosition() - 1); + View next = findViewByPosition(findFirstCompletelyVisibleItemPosition() + 1); + if (now != null) { + toView(now, 1); + } + if (old != null) { + toView(old, 0.6f); + } + if (next != null) { + toView(next, 0.6f); + } + + //toView(now,1); + Log.i(TAG, "scrollHorizontallyBy: " + scroll); + + return scroll; + } + + //https://www.jianshu.com/p/b6c42e0f6422 + private void toView(View view, float scale) { + if (view == null) return; + if(view.getAnimation()!=null&&view.getAnimation().hasStarted()) return; + ScaleAnimation scaleAnimation = new ScaleAnimation(view.getScaleX(),scale,view.getScaleY(), scale); + //scaleAnimation.setDuration(100); + //view.startAnimation(scaleAnimation); + view.setScaleX(scale); + view.setScaleY(scale); + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/DragonExpirePopup.java b/live/src/main/java/com/yunbao/live/dialog/DragonExpirePopup.java new file mode 100644 index 000000000..60dcac6a3 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/DragonExpirePopup.java @@ -0,0 +1,137 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.os.Handler; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.fragment.app.FragmentActivity; + +import com.lxj.xpopup.core.CenterPopupView; +import com.makeramen.roundedimageview.RoundedImageView; +import com.yunbao.common.bean.GuardGetGuardUserInfoModel; +import com.yunbao.common.bean.GuardMaturityDateRemindModel; +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.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.live.R; + +public class DragonExpirePopup extends CenterPopupView { + FragmentActivity activity; + String mLiveUid; + String mStream; + RoundedImageView liveAvatar; + RoundedImageView userAvatar; + + TextView guardTitleTop; + TextView dueInGuard; + TextView userName; + TextView guardianPrivilege; + TextView dueIn; + TextView dueInGuard2; + GuardMaturityDateRemindModel maturityDateRemindModel; + GuardGetGuardUserInfoModel getGuardUserInfoModel = null; + + public DragonExpirePopup(@NonNull Context context, String liveUid, GuardMaturityDateRemindModel maturityDateRemindModel, String stream) { + super(context); + activity = (FragmentActivity) context; + mLiveUid = liveUid; + this.maturityDateRemindModel = maturityDateRemindModel; + mStream = stream; + } + + // 返回自定义弹窗的布局 + @Override + protected int getImplLayoutId() { + return R.layout.dragon_expire_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + liveAvatar = findViewById(R.id.live_avatar); + userAvatar = findViewById(R.id.user_avatar); + guardTitleTop = findViewById(R.id.guard_title_top); + dueInGuard = findViewById(R.id.due_in_guard); + userName = findViewById(R.id.user_name); + guardianPrivilege = findViewById(R.id.guardian_privilege); + dueInGuard2 = findViewById(R.id.due_in_guard2); + dueIn = findViewById(R.id.due_in); + + + ImgLoader.display(getContext(), maturityDateRemindModel.getUserAvatar(), userAvatar); + ImgLoader.display(getContext(), maturityDateRemindModel.getLiveAvatar(), liveAvatar); + + LiveNetManager.get(getContext()).getGuardUserInfo(mLiveUid, new HttpCallback() { + @Override + public void onSuccess(GuardGetGuardUserInfoModel data) { + getGuardUserInfoModel = data; + } + + @Override + public void onError(String error) { + + } + }); + + + String guardName = WordUtil.isNewZh() ? "星之守護" : "Star Guardian"; + switch (maturityDateRemindModel.getGuardType()) { + case "1": + guardName = WordUtil.isNewZh() ? "星之守護" : "Star Guardian"; + break; + case "2": + guardName = WordUtil.isNewZh() ? "王之守護" : "King Guardian"; + break; + default: + guardName = WordUtil.isNewZh() ? "神之守護" : "God Guardian"; + break; + } + StringBuffer guardTitleTopBuffer = new StringBuffer(); + if (WordUtil.isNewZh()) { + guardTitleTopBuffer.append("您的") + .append(guardName); + } else { + guardTitleTopBuffer.append("Your") + .append(guardName); + } + if (maturityDateRemindModel.getIsOverdue() == 0) { + guardianPrivilege.setText(WordUtil.getNewString(R.string.continuative_guardian_privilege)); + dueIn.setText(WordUtil.isNewZh() ? "還有" : "Due in "); + dueInGuard2.setText(WordUtil.isNewZh() ? "天到期" : " days "); + } else { + guardianPrivilege.setText(WordUtil.getNewString(R.string.continuative_guardian_privilege2)); + dueIn.setText(WordUtil.isNewZh() ? "已到期" : "Expired "); + dueInGuard2.setText(WordUtil.isNewZh() ? "天" : " days "); + } + dueInGuard.setText(String.valueOf(maturityDateRemindModel.getDays())); + guardTitleTop.setText(guardTitleTopBuffer.toString()); + StringBuffer userNameBuffer = new StringBuffer(); + userNameBuffer.append(maturityDateRemindModel.getLiveNicename()) + .append("&") + .append(maturityDateRemindModel.getUserNicename()); + userName.setText(userNameBuffer.toString()); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.dragon_close), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dismiss(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.travel_renewal), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dismiss(); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + new LiveBuyGuardDialog(activity, mLiveUid, mStream, getGuardUserInfoModel).showDialog(); + } + },1000); + + } + }); + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/DragonSendMoneyListPopup.java b/live/src/main/java/com/yunbao/live/dialog/DragonSendMoneyListPopup.java new file mode 100644 index 000000000..090aae4bf --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/DragonSendMoneyListPopup.java @@ -0,0 +1,159 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.text.TextUtils; + +import androidx.annotation.NonNull; +import androidx.fragment.app.FragmentActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.flyjingfish.gradienttextviewlib.GradientTextView; +import com.lxj.xpopup.XPopup; +import com.yunbao.common.adapter.DragonSendMoneyListAdapter; +import com.yunbao.common.bean.sendMoneyLongListModel; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.dialog.DragonRulePopup; +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.DragonSendMoneyListViewHolder; +import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.live.R; + +import java.util.ArrayList; +import java.util.List; + +public class DragonSendMoneyListPopup extends AbsDialogPopupWindow { + FragmentActivity activity; + String mLiveUid; + DragonSendMoneyListAdapter dragonSendMoneyListAdapter; + RecyclerView send_money_list; + boolean isAnchor; + GradientTextView title; + boolean isAttention; + + public DragonSendMoneyListPopup(@NonNull Context context, String liveUid, boolean isAnchor, boolean isAttention) { + super(context); + activity = (FragmentActivity) context; + mLiveUid = liveUid; + this.isAnchor = isAnchor; + this.isAttention = isAttention; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_dragon_send_money_list; + } + + @Override + protected void onCreate() { + super.onCreate(); + send_money_list = findViewById(R.id.send_money_list); + title = findViewById(R.id.title); + + send_money_list.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); + dragonSendMoneyListAdapter = new DragonSendMoneyListAdapter(send_money_list); + + send_money_list.setAdapter(dragonSendMoneyListAdapter); + dragonSendMoneyListAdapter.setAnchor(isAnchor); + dragonSendMoneyListAdapter.setAttention(isAttention); + dragonSendMoneyListAdapter.setCallBack(new DragonSendMoneyListViewHolder.DragonSendMoneyListClicksCallBack() { + @Override + public void onParticipate(sendMoneyLongListModel moneyLongListModel) { + if (isAttention) { + LiveNetManager.get(mContext) + .participateMoneyLong(mLiveUid, moneyLongListModel.getSendMoneyLongKey(), new HttpCallback() { + @Override + public void onSuccess(String data) { + ToastUtil.show(data); + LiveNetManager.get(mContext) + .sendMoneyLongList(mLiveUid, new HttpCallback>() { + @Override + public void onSuccess(List data) { + dragonSendMoneyListAdapter.setMoneyLongListModels(data); + send_money_list.getRecycledViewPool().setMaxRecycledViews(0, data.size()); + title.removeCallbacks(refreshRunnable); + title.postDelayed(refreshRunnable, 1000); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } else { + ToastUtil.show(WordUtil.isNewZh() ? "關注主播後可參與活動" : "Follow the anchor can participate in the activity"); + } + + } + }); + LiveNetManager.get(mContext) + .sendMoneyLongList(mLiveUid, new HttpCallback>() { + @Override + public void onSuccess(List data) { + dragonSendMoneyListAdapter.setMoneyLongListModels(data); + send_money_list.getRecycledViewPool().setMaxRecycledViews(0, data.size()); + title.removeCallbacks(refreshRunnable); + title.postDelayed(refreshRunnable, 1000); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.dragon_rule), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + new XPopup.Builder(getContext()) + .asCustom(new DragonRulePopup(getContext(),true)) + .show(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.money_back), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dismiss(); + } + }); + + } + + Runnable refreshRunnable = new Runnable() { + @Override + public void run() { + List moneyLongListModels = dragonSendMoneyListAdapter.getMoneyLongListModels(); + List models = new ArrayList<>(); + for (sendMoneyLongListModel listModel : moneyLongListModels) { + if (TextUtils.equals("0", listModel.getParticipate())) { + models.add(listModel); + } else { + String countdown = listModel.getCountdown(); + long countdownNumber = Long.parseLong(countdown); + countdownNumber = countdownNumber - 1; + if (countdownNumber > 0) { + listModel.setCountdown(String.valueOf(countdownNumber)); + models.add(listModel); + } + } + + } + dragonSendMoneyListAdapter.setMoneyLongListModels(models); + title.postDelayed(refreshRunnable, 1000); + } + }; +} diff --git a/live/src/main/java/com/yunbao/live/dialog/DragonSendsMoneyPopup.java b/live/src/main/java/com/yunbao/live/dialog/DragonSendsMoneyPopup.java new file mode 100644 index 000000000..6d4593949 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/DragonSendsMoneyPopup.java @@ -0,0 +1,124 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.text.TextUtils; +import android.widget.EditText; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.fragment.app.FragmentActivity; + +import com.blankj.utilcode.util.GsonUtils; +import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.dialog.DragonRulePopup; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpUtil; +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.bean.CoinModel; + +public class DragonSendsMoneyPopup extends CenterPopupView { + TextView my_gold_coin; + long goldMoney; + EditText dragon_money; + String mLiveUid; + FragmentActivity activity; + + public DragonSendsMoneyPopup(@NonNull Context context, String liveUid) { + super(context); + activity = (FragmentActivity) context; + mLiveUid = liveUid; + } + + // 返回自定义弹窗的布局 + @Override + protected int getImplLayoutId() { + return R.layout.dragon_sends_money_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + my_gold_coin = findViewById(R.id.my_gold_coin); + dragon_money = findViewById(R.id.dragon_money); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.dragon_close), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dismiss(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.dragon_rule), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + new XPopup.Builder(getContext()) + .asCustom(new DragonRulePopup(getContext(),false)) + .show(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.open_an_activity), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + String dragonMoney = dragon_money.getText().toString().trim(); + if (!TextUtils.isEmpty(dragonMoney)) { + long money = Long.parseLong(dragonMoney); + if (goldMoney >= money) { + if (money >= 1000) { + LiveNetManager.get(getContext()) + .sendMoneyLong(mLiveUid, String.valueOf(money), new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(String data) { + dismiss(); + ToastUtil.show(WordUtil.isNewZh() ? "開啓成功" : "Open successfully"); + + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } else { + ToastUtil.show(WordUtil.isNewZh() ? "金豆數量不低於1000" : "The number of golden beans is not less than 1000"); + } + + } else { + ToastUtil.show(WordUtil.isNewZh() ? "輸入數量不能大於自己的金豆總數量" : "The input quantity cannot be greater than the total number of gold beans"); + } + + } else { + ToastUtil.show(WordUtil.isNewZh() ? "輸入數量不能爲空" : "The input quantity cannot be empty"); + } + + } + }); + getCoin(); + + } + + private void getCoin() { + LiveHttpUtil.getCoin(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + if (!TextUtils.isEmpty(info[0])) { + CoinModel coinModel = GsonUtils.fromJson(info[0], CoinModel.class); + + my_gold_coin.setText(coinModel.getGold()); + goldMoney = coinModel.getGoldMoney(); + } + } + } + + + }); + } + + public interface DragonSendsMoneyCallBack { + void onSendMoneyLong(); + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java new file mode 100644 index 000000000..4d3ab6ff5 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java @@ -0,0 +1,617 @@ +package com.yunbao.live.dialog; + +import static com.yunbao.common.utils.RouteUtil.PATH_COIN; + +import android.animation.ObjectAnimator; +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.graphics.Paint; +import android.os.Bundle; +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.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.viewpager.widget.ViewPager; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.flyjingfish.gradienttextviewlib.GradientTextView; +import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.enums.PopupPosition; +import com.makeramen.roundedimageview.RoundedImageView; +import com.stx.xhb.androidx.XBanner; +import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.adapter.LiveBuyGuardPrivilegeAdapter; +import com.yunbao.common.bean.CheckUpgradesModel; +import com.yunbao.common.bean.GuardDataTipModel; +import com.yunbao.common.bean.GuardGetGuardOpenInfoModel; +import com.yunbao.common.bean.GuardGetGuardUserInfoModel; +import com.yunbao.common.bean.GuardPriceModel; +import com.yunbao.common.bean.GuardUserInfoModel; +import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.dialog.GuardBuyTipsDialog; +import com.yunbao.common.dialog.GuardUpgradePopup; +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.manager.IMLoginManager; +import com.yunbao.common.utils.DeviceUtils; +import com.yunbao.common.utils.DialogUitl; +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.activity.LiveAudienceActivity; +import com.yunbao.live.bean.BuyGuardBannerModel; +import com.yunbao.live.fragments.LiveBuyGuardVPFragment; + +import java.util.ArrayList; +import java.util.List; + +public class LiveBuyGuardDialog extends AbsDialogPopupWindow { + FragmentActivity activity; + + 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; + String mStream; + List guardDataTipModels; + List price = new ArrayList<>(); + TextView discountPrice, discount; + GuardPriceModel guardPriceModel; + RecyclerView guardPrivilege; + LiveBuyGuardPrivilegeAdapter buyGuardPrivilegeAdapter; + List guardPrivilegeStrings = new ArrayList<>(); + GuardDataTipModel dataTipModel; + GuardGetGuardUserInfoModel mGuardUserInfoModel; + GuardUserInfoModel userInfo; + + public LiveBuyGuardDialog(@NonNull Context context, String liveUid, String stream, GuardGetGuardUserInfoModel guardUserInfoModel) { + super(context); + activity = (FragmentActivity) context; + mLiveUid = liveUid; + mStream = stream; + mGuardUserInfoModel = guardUserInfoModel; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_live_buy_guard; + } + + //底部栏 + @Override + protected void onCreate() { + super.onCreate(); + 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 onSuccess(GuardGetGuardOpenInfoModel data) { + guardDataTipModels = data.getGuardData(); + userInfo = data.getUserInfo(); +// 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(WordUtil.isNewZh() ? R.mipmap.bg_star_guard : R.mipmap.bg_star_guard_en); + } else if (guardDataTipModel.getGuardType() == 2) { + guardBannerModel.setGuardOpen(R.mipmap.icon_bg_king_guard_open) + .setGradientColors(gradientColorsKing) + .setGuardImage(WordUtil.isNewZh() ? R.mipmap.bg_king_guard : R.mipmap.bg_king_guard_en); + } else { + guardBannerModel.setGuardOpen(R.mipmap.icon_god_guard_open) + .setGradientColors(gradientColorsGod) + .setGuardImage(WordUtil.isNewZh() ? R.mipmap.bg_god_guard : R.mipmap.bg_god_guard_en); + } + buyGuardBannerModels.add(guardBannerModel); + } + buyGuardBanner.setBannerData(R.layout.banner_item_buy_guard, buyGuardBannerModels); + buyGuardBanner.setIsClipChildrenMode(true); + guardPrivilegeStrings = data.getGuardData().get(0).getGuardPrivilege(); + buyGuardBanner.postDelayed(new Runnable() { + @Override + public void run() { + if (mGuardUserInfoModel != null) { + if (mGuardUserInfoModel.getGuardType() != 0 && TextUtils.equals(mGuardUserInfoModel.getIsOpen(), "1")) { + buyGuardBanner.setBannerCurrentItem(mGuardUserInfoModel.getGuardType() - 1); + } + + } + } + }, 500); + + + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + + 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); + ViewClicksAntiShake.clicksAntiShake(view.findViewById(R.id.tas_guardian_group), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + new LiveGuardDialog(mContext, false, mLiveUid, mStream).showDialog(); + dismiss(); + } + }); + + + } + }); + buyGuardBanner.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { + @Override + public void onPageScrolled(int position, float v, int i1) { + BuyGuardBannerModel guardBannerModel = buyGuardBannerModels.get(position); + Log.e("LiveBuyGuardDialog", "onPageScrolled name = " + guardBannerModel.getName() + " position=" + position); + } + + @Override + public void onPageSelected(int position) { + BuyGuardBannerModel guardBannerModel = buyGuardBannerModels.get(position); + dataTipModel = guardDataTipModels.get(position); + price = dataTipModel.getPrice(); + Log.e("LiveBuyGuardDialog", "onPageSelected BuyGuardBannerModel name = " + guardBannerModel.getName() + " position=" + position); + if (position == 0) { + MobclickAgent.onEvent(mContext, "star_guardian_people", "星之守护页面观看次数及人数"); + bottomPanel.setBackgroundResource(R.drawable.bg_star_guard_bottom_panel); + ImgLoader.display(getContext(), R.mipmap.btn_star_guard, btnGuard); + openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.isNewZh() ? "續費星之守護" : "Renew Star Guardian" + : WordUtil.getNewString(R.string.open_the_start_guard)); + + } else if (position == 1) { + MobclickAgent.onEvent(mContext, "king_guardian_people", "王之守护页面观看次数及人数"); + bottomPanel.setBackgroundResource(R.drawable.bg_king_guard_bottom_panel); + ImgLoader.display(getContext(), R.mipmap.btn_king_guard, btnGuard); + openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.isNewZh() ? "續費王之守護" : "Renew King Guardian" + : WordUtil.getNewString(R.string.open_the_kings_guard)); + } else if (position == 2) { + MobclickAgent.onEvent(mContext, "god_guardian_people", "神之守护页面观看次数及人数"); + bottomPanel.setBackgroundResource(R.drawable.bg_god_guard_bottom_panel); + ImgLoader.display(getContext(), R.mipmap.btn_god_guard, btnGuard); + openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.isNewZh() ? "續費神之守護" : "Renew God Guardian" + : 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())); + discount.setText(String.valueOf(guardPriceModel.getDiscount())); + originalPrice.post(new Runnable() { + @Override + public void run() { +// SpannableString spannableString = new SpannableString(String.valueOf(guardPriceModel.getOriginalPrice())); +// StrikethroughSpan strikethroughSpan = new StrikethroughSpan(); +// spannableString.setSpan(strikethroughSpan, 0, spannableString.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + originalPrice.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); + originalPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice())); + + } + }); + + } + guardMonth.setText(guardPriceModel.getOpeningTime()); + guardPrivilegeStrings = dataTipModel.getGuardPrivilege(); + if (buyGuardPrivilegeAdapter != null) { + buyGuardPrivilegeAdapter.setGuardPrivilege(guardPrivilegeStrings); + + } + + + } + + @Override + public void onPageScrollStateChanged(int position) { + BuyGuardBannerModel guardBannerModel = buyGuardBannerModels.get(position); + Log.e("LiveBuyGuardDialog", "onPageScrollStateChanged name = " + guardBannerModel.getName() + " position=" + position); + } + }); + + 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, guardPriceModel) + .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())); + discount.setText(String.valueOf(guardPriceModel.getDiscount())); + originalPrice.post(new Runnable() { + @Override + public void run() { +// SpannableString spannableString = new SpannableString(String.valueOf(guardPriceModel.getOriginalPrice())); +// StrikethroughSpan strikethroughSpan = new StrikethroughSpan(); +// spannableString.setSpan(strikethroughSpan, 0, spannableString.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE); +// originalPrice.setText(spannableString); + originalPrice.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); + originalPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice())); + + } + }); + } + guardMonth.setText(guardPriceModel.getOpeningTime()); + } + }) + ) + .show(); + } + }); + ViewClicksAntiShake.clicksAntiShake(openTheGuard, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (TextUtils.equals(userInfo.getIsOpen(), "1")) { + GuardBuyTipsDialog + .showBuyOrRenewDialog(mContext, + discountPrice.getText().toString(), + dataTipModel.getGuardName(), dataTipModel.isOpen(), + mGuardUserInfoModel, dataTipModel.getGuardType(), new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + dismiss(); + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + + LiveNetManager.get(activity) + .openGuard(mLiveUid, + String.valueOf(dataTipModel.getGuardType()), + String.valueOf(guardPriceModel.getPriceKey()), mStream, new HttpCallback() { + @Override + public void onSuccess(String data) { + if (TextUtils.equals(data, "22")) { + new DialogUitl.Builder(mContext) + .setView(R.layout.dialog_live_unfollow) + .setConfirmString(mContext.getString(R.string.charge)) + .setContent(mContext.getString(R.string.insufficient_balance)) + .setClickCallback(new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + LiveBuyGuardDialog.this.dismiss(); + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }).build().show(); + } else { + IMLoginManager.get(mContext).setGuardType(dataTipModel.getGuardType()); + ToastUtil.show(data); + dismiss(); + if (dataTipModel.getGuardType() == 3) { + new XPopup.Builder(mContext) + .dismissOnTouchOutside(false) // 点击外部是否关闭弹窗,默认为true + .asCustom(new DragonSendsMoneyPopup(mContext, mLiveUid)) + .show(); + } + } + + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + }); + } else { + if (userInfo.getGuardType() > dataTipModel.getGuardType()) { + String name = "星之守護"; + switch (userInfo.getGuardType()) { + case 1: + name = WordUtil.isNewZh() ? "星之守護" : "star guardian"; + break; + case 2: + name = WordUtil.isNewZh() ? "王之守護" : "king guardian"; + break; + case 3: + name = WordUtil.isNewZh() ? "神之守護" : "god guardian"; + break; + + } + StringBuffer buffer = new StringBuffer(); + if (WordUtil.isNewZh()) { + buffer.append("您的【") + .append(name).append("】已過期\n").append("開通相同或更高等級守護將會保留您的守護等級").append("開通低等級守護將重新計算您的守護等級"); + } else { + buffer.append("Your [") + .append(name).append("] has expired").append("active the same or higher level of guardian will retain your guardian level").append("active lower level guardian will recalculate your guardian level"); + } + GuardBuyTipsDialog + .showBuyOrRenewDialog(mContext, + null, + buffer.toString(), false, + null, -200, new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + GuardBuyTipsDialog + .showBuyOrRenewDialog(mContext, + discountPrice.getText().toString(), + dataTipModel.getGuardName(), dataTipModel.isOpen(), + mGuardUserInfoModel, dataTipModel.getGuardType(), new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + dismiss(); + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + + LiveNetManager.get(activity) + .openGuard(mLiveUid, + String.valueOf(dataTipModel.getGuardType()), + String.valueOf(guardPriceModel.getPriceKey()), mStream, new HttpCallback() { + @Override + public void onSuccess(String data) { + if (TextUtils.equals(data, "22")) { + new DialogUitl.Builder(mContext) + .setView(R.layout.dialog_live_unfollow) + .setConfirmString(mContext.getString(R.string.charge)) + .setContent(mContext.getString(R.string.insufficient_balance)) + .setClickCallback(new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + LiveBuyGuardDialog.this.dismiss(); + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }).build().show(); + } else { + IMLoginManager.get(mContext).setGuardType(dataTipModel.getGuardType()); + ToastUtil.show(data); + dismiss(); + if (dataTipModel.getGuardType() == 3) { + new XPopup.Builder(mContext) + .dismissOnTouchOutside(false) // 点击外部是否关闭弹窗,默认为true + .asCustom(new DragonSendsMoneyPopup(mContext, mLiveUid)) + .show(); + } + } + + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + }); + } + }); + }else { + GuardBuyTipsDialog + .showBuyOrRenewDialog(mContext, + discountPrice.getText().toString(), + dataTipModel.getGuardName(), dataTipModel.isOpen(), + mGuardUserInfoModel, dataTipModel.getGuardType(), new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + dismiss(); + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + + LiveNetManager.get(activity) + .openGuard(mLiveUid, + String.valueOf(dataTipModel.getGuardType()), + String.valueOf(guardPriceModel.getPriceKey()), mStream, new HttpCallback() { + @Override + public void onSuccess(String data) { + if (TextUtils.equals(data, "22")) { + new DialogUitl.Builder(mContext) + .setView(R.layout.dialog_live_unfollow) + .setConfirmString(mContext.getString(R.string.charge)) + .setContent(mContext.getString(R.string.insufficient_balance)) + .setClickCallback(new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + LiveBuyGuardDialog.this.dismiss(); + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }).build().show(); + } else { + IMLoginManager.get(mContext).setGuardType(dataTipModel.getGuardType()); + ToastUtil.show(data); + dismiss(); + if (dataTipModel.getGuardType() == 3) { + new XPopup.Builder(mContext) + .dismissOnTouchOutside(false) // 点击外部是否关闭弹窗,默认为true + .asCustom(new DragonSendsMoneyPopup(mContext, mLiveUid)) + .show(); + } + } + + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + }); + } + + + } + switch (dataTipModel.getGuardType()) { + case 1: + MobclickAgent.onEvent(mContext, "star_guardian_renew_btn", "星之守护开通/续费按钮点击次数及人数"); + break; + case 2: + MobclickAgent.onEvent(mContext, "king_guardian_renew_btn", "王之守护开通/续费按钮点击次数及人数"); + break; + case 3: + MobclickAgent.onEvent(mContext, "god_guardian_renew_btn", "神之守护开通/续费按钮点击次数及人数"); + break; + + } + + +// new XPopup.Builder(mContext) +// .asCustom(new DragonSendsMoneyPopup(mContext)) +// .show(); + } + }); + LiveNetManager.get(getContext()) + .checkUpgrades(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(CheckUpgradesModel data) { + if (!data.getRewards().isEmpty()) + new XPopup.Builder(mContext) + .asCustom(new GuardUpgradePopup(mContext, mLiveUid, data, new GuardUpgradePopup.GuardUpgradeCallBack() { + @Override + public void onGuardLevel() { + LiveBuyGuardDialog.this.dismiss(); + } + })) + .show(); + } + + @Override + public void onError(String error) { + + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.guard_rule), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + StringBuffer htmlUrl = new StringBuffer(); + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + htmlUrl.append(CommonAppConfig.HOST) + .append("/h5/Guard/rules.html") + .append("?token=") + .append(userInfo.getToken()) + .append("&uid=") + .append(userInfo.getId()) + .append("&anchorUid=") + .append(mLiveUid) + .append("&isZh=") + .append(((WordUtil.isNewZh()) ? "1" : "0")); + + Bundle bundle = new Bundle(); + bundle.putString("url", htmlUrl.toString()); + bundle.putInt("height", DeviceUtils.getScreenHeight(getActivity()) / 5 * 3); + LiveHDDialogFragment fragment = new LiveHDDialogFragment(); + fragment.setArguments(bundle); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + } + }); + + } + + 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/LiveGiftPopup.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java index b7da267e2..718d1f0ee 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java @@ -825,51 +825,54 @@ public class LiveGiftPopup extends AbsDialogFragment { giftSendLayout.setVisibility(View.VISIBLE); mBtnSendGroup.removeCallbacks(newLianSongRunnable); getCoin(); - LiveNetManager.get(mContext) - .getGiftNamingInfo(liveGiftModel.getId() + "", new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(GiftNamingInfoModel data) { - if (TextUtils.equals(data.getNamingStatus(), "1")) { - liveGiftModel = JSONObject.parseObject(GsonUtils.toJson(data), LiveGiftBean.class); - if (!TextUtils.isEmpty(liveGiftModel.getNamingLiveuid()) && - !TextUtils.isEmpty(liveGiftModel.getNamingUid()) && - !TextUtils.equals(liveGiftModel.getNamingLiveuid(), "0") && - !TextUtils.equals(liveGiftModel.getNamingUid(), "0")) { - namingLayout.setVisibility(View.VISIBLE); - ImgLoader.display(mContext, liveGiftModel.getNamingLiveAvatar(), namingAvatar); - StringBuffer namingNameText = new StringBuffer(); - if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - namingNameText.append("获取冠名:") - .append(liveGiftModel.getNamingUserCoin()) - .append(" "); + if (liveGiftModel!=null){ + LiveNetManager.get(mContext) + .getGiftNamingInfo(liveGiftModel.getId() + "", new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(GiftNamingInfoModel data) { + if (TextUtils.equals(data.getNamingStatus(), "1")) { + liveGiftModel = JSONObject.parseObject(GsonUtils.toJson(data), LiveGiftBean.class); + if (!TextUtils.isEmpty(liveGiftModel.getNamingLiveuid()) && + !TextUtils.isEmpty(liveGiftModel.getNamingUid()) && + !TextUtils.equals(liveGiftModel.getNamingLiveuid(), "0") && + !TextUtils.equals(liveGiftModel.getNamingUid(), "0")) { + namingLayout.setVisibility(View.VISIBLE); + ImgLoader.display(mContext, liveGiftModel.getNamingLiveAvatar(), namingAvatar); + StringBuffer namingNameText = new StringBuffer(); + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + namingNameText.append("获取冠名:") + .append(liveGiftModel.getNamingUserCoin()) + .append(" "); + } else { + namingNameText.append("Get title: ") + .append(liveGiftModel.getNamingUserCoin()) + .append(" "); + } + namingNameText.append(mContext.getText(com.yunbao.live.R.string.title_anchor)) + .append(liveGiftModel.getNamingLiveName()) + .append(" ") + .append(mContext.getText(com.yunbao.live.R.string.the_title_financier)) + .append(" ") + .append(liveGiftModel.getNamingUserName()); + namingName.setText(namingNameText.toString()); } else { - namingNameText.append("Get title: ") - .append(liveGiftModel.getNamingUserCoin()) - .append(" "); + namingLayout.setVisibility(View.GONE); + } - namingNameText.append(mContext.getText(com.yunbao.live.R.string.title_anchor)) - .append(liveGiftModel.getNamingLiveName()) - .append(" ") - .append(mContext.getText(com.yunbao.live.R.string.the_title_financier)) - .append(" ") - .append(liveGiftModel.getNamingUserName()); - namingName.setText(namingNameText.toString()); } else { namingLayout.setVisibility(View.GONE); - } - } else { - namingLayout.setVisibility(View.GONE); + } - } + @Override + public void onError(String error) { - @Override - public void onError(String error) { + } + }); + } - } - }); } /** 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..13721933c --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java @@ -0,0 +1,378 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; +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.umeng.analytics.MobclickAgent; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.common.bean.CheckUpgradesModel; +import com.yunbao.common.bean.GuardGetGuardUserInfoModel; +import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.custom.CommonRefreshView; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.dialog.GuardUpgradePopup; +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.manager.IMLoginManager; +import com.yunbao.common.utils.CommonIconUtil; +import com.yunbao.common.utils.DeviceUtils; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.utils.TimeUtils; +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.activity.LiveAudienceActivity; +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; + String mStream; + List guardUserModels = new ArrayList<>(); + + TextView userNickname, weekContribution, guardLevel; + ImageView userSex, tagKing; + RoundedImageView guardIcon; + SVGAImageView giftSvga; + TextView btnGuardOpen; + TextView guard_hint; + TextView guard_time; + View guardian_task_view; + GuardGetGuardUserInfoModel getGuardUserInfoModel = null; + + public LiveGuardDialog(@NonNull Context context, boolean isEmpty, String liveUid, String stream) { + super(context); + activity = (FragmentActivity) context; + this.isEmpty = isEmpty; + mLiveUid = liveUid; + mStream = stream; + } + + @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); + guard_time = findViewById(R.id.guard_time); + guard_hint = findViewById(R.id.guard_hint); + guardian_task_view = findViewById(R.id.guardian_task_view); + + 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_room2); + 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); + IMLoginManager.get(mContext).setGuardRedPoint(); + if (WordUtil.isNewZh()) { + ViewGroup.LayoutParams layoutParams = guardian_task_view.getLayoutParams(); + layoutParams.width = DpUtil.dp2px(50); + guardian_task_view.setLayoutParams(layoutParams); + } else { + ViewGroup.LayoutParams layoutParams = guardian_task_view.getLayoutParams(); + layoutParams.width = DpUtil.dp2px(78); + guardian_task_view.setLayoutParams(layoutParams); + + } + 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() { + MobclickAgent.onEvent(mContext, "guardian_renew_btn", "守护席开通守护/续费守护按钮点击次数及人数"); + dismiss(); + new LiveBuyGuardDialog(mContext, mLiveUid, mStream, getGuardUserInfoModel).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) { + getGuardUserInfoModel = data; + if (TextUtils.equals(data.getIsOpen(), "0")) { + guardianTask.setVisibility(GONE); + myGraudGrade.setVisibility(GONE); + btnGuardOpen.setText(WordUtil.isNewZh() ? "開通守護" : "Open Guard"); + guard_hint.setText(WordUtil.isNewZh() ? "快為您喜歡的主播開通守護吧!" : "Turn on the guard for your favorite anchor!"); + } else { + if (data.getGuardType() == 0) { + guardianTask.setVisibility(GONE); + myGraudGrade.setVisibility(GONE); + btnGuardOpen.setText(WordUtil.isNewZh() ? "開通守護" : "Open Guard"); + guard_hint.setText(WordUtil.isNewZh() ? "快為您喜歡的主播開通守護吧!" : "Turn on the guard for your favorite anchor!"); + } else { + guardianTask.setVisibility(VISIBLE); + myGraudGrade.setVisibility(VISIBLE); + btnGuardOpen.setText(WordUtil.isNewZh() ? "續費守護" : "Renewal"); + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append(WordUtil.isNewZh() ? "您是當前主播的" : "You are the "); + switch (data.getGuardType()) { + case 1: + stringBuffer.append(WordUtil.isNewZh() ? "【星之守護】" : "star guardian") + .append(WordUtil.isNewZh() ? " " :" of the current streamer"); + guard_hint.setText(stringBuffer.toString()); + break; + case 2: + stringBuffer.append(WordUtil.isNewZh() ? "【王之守護】" : "king guardian") + .append(WordUtil.isNewZh() ? " " :" of the current streamer"); + guard_hint.setText(stringBuffer.toString()); + break; + case 3: + stringBuffer.append(WordUtil.isNewZh() ? "【神之守護】" : "god guardian") + .append(WordUtil.isNewZh() ? " " :" of the current streamer"); + guard_hint.setText(stringBuffer.toString()); + break; + default: + guard_hint.setText(WordUtil.isNewZh() ? "快為您喜歡的主播開通守護吧!" : "Turn on the guard for your favorite anchor!"); + break; + } + } + } + + if (data.getEndtime() == 0) { + guard_time.setVisibility(GONE); + } else { + StringBuffer stringBuffer = new StringBuffer(); + if (WordUtil.isNewZh()) { + stringBuffer.append("守護日期截止到 ").append(TimeUtils.getDateToString(data.getEndtime() * 1000, "yyyy-MM-dd")); + } else { + stringBuffer.append("Guardianship date is up to ").append(TimeUtils.getDateToString(data.getEndtime() * 1000, "yyyy-MM-dd")); + } + + guard_time.setText(stringBuffer.toString()); + } + + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + guardianTask.setVisibility(GONE); + myGraudGrade.setVisibility(GONE); + btnGuardOpen.setText(WordUtil.isNewZh() ? "開通守護" : "Open Guard"); + } + }); + LiveNetManager.get(getContext()) + .checkUpgrades(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(CheckUpgradesModel data) { + if (!data.getRewards().isEmpty()) + new XPopup.Builder(mContext) + .asCustom(new GuardUpgradePopup(mContext, mLiveUid, data, new GuardUpgradePopup.GuardUpgradeCallBack() { + @Override + public void onGuardLevel() { + LiveGuardDialog.this.dismiss(); + } + })) + .show(); + } + + @Override + public void onError(String error) { + + } + }); + ViewClicksAntiShake.clicksAntiShake(guardianTask, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + MobclickAgent.onEvent(mContext, "my_guard_task_num", "守护任务页面访问次数和人数"); + StringBuffer htmlUrl = new StringBuffer(); + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + htmlUrl.append(CommonAppConfig.HOST) + .append("/h5/Guard/mission.html?") + .append("&token=") + .append(userInfo.getToken()) + .append("&uid=") + .append(userInfo.getId()) + .append("&&anchorUid=") + .append(mLiveUid) + .append("&isZh=") + .append(((WordUtil.isNewZh()) ? "1" : "0")); + + Bundle bundle = new Bundle(); + bundle.putString("url", htmlUrl.toString()); + bundle.putInt("height", DeviceUtils.getScreenHeight(getActivity()) / 5 * 3); + LiveHDDialogFragment fragment = new LiveHDDialogFragment(); + fragment.setArguments(bundle); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + } + }); + ViewClicksAntiShake.clicksAntiShake(myGraudGrade, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + MobclickAgent.onEvent(mContext, "my_guard_level_num", "我的等级页面访问次数和人数"); + dismiss(); + StringBuffer htmlUrl = new StringBuffer(); + IMLoginModel userInfo = IMLoginManager.get(mContext).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 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())); + + guardLevel.setText(String.valueOf(guardUserModel.getGuardLevel())); + ImgLoader.display(mContext, guardUserModel.getAvatar(), guardIcon); + giftSvga.setImageResource(R.mipmap.guardian_img_wings_p); + if (TextUtils.equals(guardUserModel.getGuardLevelCard(), "0")) { + switch (guardUserModel.getGuardType()) { + case 1: + ImgLoader.display(mContext, R.mipmap.tag_start_hui, tagKing); + break; + case 2: + ImgLoader.display(mContext, R.mipmap.tag_king_hui, tagKing); + break; + case 3: + ImgLoader.display(mContext, R.mipmap.tag_god_hui, tagKing); + break; + } + + } else { + switch (guardUserModel.getGuardType()) { + case 1: + ImgLoader.display(mContext, R.mipmap.tag_start, tagKing); + break; + case 2: + ImgLoader.display(mContext, R.mipmap.tag_king, tagKing); + break; + case 3: + ImgLoader.display(mContext, R.mipmap.tag_god, tagKing); + break; + } + } + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java index 5958a37a7..43e4a53c9 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java @@ -368,6 +368,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment { //守護 } else if (TextUtils.equals(event.getMethod(), "BuyProtection")) { ((LiveActivity) mContext).openNewBuyGuardWindow(event.getData()); + dismiss(); } else if (TextUtils.equals(event.getMethod(), "BuyVIP")) { UserBean u = CommonAppConfig.getInstance().getUserBean(); String url = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname=" diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardDialogFragment.java new file mode 100644 index 000000000..936906683 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardDialogFragment.java @@ -0,0 +1,239 @@ +package com.yunbao.live.dialog; + +import android.app.Dialog; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.view.Gravity; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.fragment.app.FragmentTransaction; +import androidx.recyclerview.widget.LinearLayoutManager; + +import com.alibaba.fastjson.JSON; +import com.opensource.svgaplayer.SVGAImageView; +import com.yunbao.common.Constants; +import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.common.custom.CommonRefreshView; +import com.yunbao.common.dialog.AbsDialogFragment; +import com.yunbao.common.dialog.GuardBuyTipsDialog; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpUtil; +import com.yunbao.common.utils.CommonIconUtil; +import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.ToastUtils; +import com.yunbao.live.R; +import com.yunbao.live.activity.LiveActivity; +import com.yunbao.live.adapter.GuardAdapter; +import com.yunbao.live.bean.GuardUserBean; +import com.yunbao.live.bean.LiveGuardInfo; +import com.yunbao.live.utils.LiveTextRender; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * 新版守护列表 + * 2024/02/22 + */ +public class LiveNewGuardDialogFragment extends AbsDialogFragment implements View.OnClickListener { + private ImageView guardIcon, userSex, userLevel; + private ConstraintLayout mRootLayout; + private CommonRefreshView mRefreshView; + private TextView mBtnBuy, userName, userGuard, tip1, tip2; + private SVGAImageView giftSvga; + private LinearLayout userLayout; + + private GuardAdapter mGuardAdapter; + private LiveGuardInfo mLiveGuardInfo; + private String mLiveUid; + private boolean mIsAnchor;//是否是主播 + private boolean showBuyView; + private List list = new ArrayList<>(); + private RelativeLayout relativeLayout; + + @Override + protected int getLayoutId() { + return R.layout.dialog_new_guard; + } + + @Override + protected int getDialogStyle() { + return R.style.dialog2; + } + + @Override + protected boolean canCancel() { + return true; + } + + public void setLiveGuardInfo(LiveGuardInfo info) { + mLiveGuardInfo = info; + } + + @Override + protected void setWindowAttributes(Window window) { + window.setWindowAnimations(R.style.bottomToTopAnim); + WindowManager.LayoutParams params = window.getAttributes(); + params.width = WindowManager.LayoutParams.MATCH_PARENT; + params.height = WindowManager.LayoutParams.WRAP_CONTENT; + params.gravity = Gravity.BOTTOM; + window.setAttributes(params); + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + Bundle bundle = getArguments(); + if (bundle == null) { + return; + } + mIsAnchor = bundle.getBoolean(Constants.ANCHOR, false); + mLiveUid = bundle.getString(Constants.LIVE_UID); + showBuyView = bundle.getBoolean("showBuyView", true); + guardIcon = mRootView.findViewById(R.id.guard_imageView); + mRootLayout = mRootView.findViewById(R.id.guard_constraintLayout); + mBtnBuy = mRootView.findViewById(R.id.guard_btn_buy); + giftSvga = mRootView.findViewById(R.id.gift_svga); + mRefreshView = mRootView.findViewById(R.id.refreshView); + userName = mRootView.findViewById(R.id.list_guard_list_user_name); + userGuard = mRootView.findViewById(R.id.list_guard_list_user_guard); + userLevel = mRootView.findViewById(R.id.list_guard_list_user_level); + userSex = mRootView.findViewById(R.id.list_guard_list_user_sex); + userLayout = mRootView.findViewById(R.id.guard_linearLayout); + tip1 = mRootView.findViewById(R.id.guard_tip1); + tip2 = mRootView.findViewById(R.id.guard_tip2); + relativeLayout = mRootView.findViewById(R.id.guard_relativeLayout); + mBtnBuy.setOnClickListener(this); + mBtnBuy.setEnabled(true); + mBtnBuy.setText(R.string.guard_buy_2); + initView(); + } + + private void initView() { + mRefreshView.setEmptyLayoutId(mIsAnchor ? R.layout.view_no_data_guard_anc : R.layout.view_no_data_guard_aud); + mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); + mGuardAdapter = new GuardAdapter(mContext, true, false); + mGuardAdapter.setList(list); + setAdapterData(); + mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() { + @Override + public RefreshAdapter getAdapter() { + if (mGuardAdapter == null) { + mGuardAdapter = new GuardAdapter(mContext, true, false); + } + return mGuardAdapter; + } + + @Override + public void loadData(int p, HttpCallback callback) { + LiveHttpUtil.getGuardList(mLiveUid, p, callback); + } + + @Override + public List processData(String[] info) { + List list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class); + if (!list.isEmpty()) { + LiveNewGuardDialogFragment.this.list = list; + setAdapterData(); + } + return list; + } + + @Override + public void onRefreshSuccess(List list, int listCount) { + + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { + + } + + @Override + public void onLoadMoreFailure() { + + } + }); + mRefreshView.setRecyclerViewAdapter(mGuardAdapter); + mGuardAdapter.notifyDataSetChanged(); + if (!showBuyView) { + relativeLayout.setVisibility(View.GONE); + } + } + + @Override + public void onClick(View view) { + dismiss(); + ((LiveActivity) mContext).openNewBuyGuardWindow(list.isEmpty()); + } + + @Override + public int show(@NonNull FragmentTransaction transaction, @Nullable String tag) { + int show = super.show(transaction, tag); + initView(); + return show; + } + + private void setAdapterData() { + if (list.isEmpty()) { + userLayout.setVisibility(View.INVISIBLE); + } else { + GuardUserBean bean = list.get(0); + giftSvga.setImageResource(R.mipmap.guardian_img_wings_p); + ImgLoader.display(mContext, bean.getAvatar(), guardIcon); + guardIcon.setVisibility(View.VISIBLE); + userName.setText(bean.getUserNiceName()); + String guardString = mContext.getString(R.string.guard_week_con); + userGuard.setText(guardString + " " + bean.getContribute()); + userSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); + + new LiveTextRender().getLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, userLevel); + } + + @Override + public void onLoadFailed() { + + } + }); + } + if (mLiveGuardInfo != null) { + int guardType = mLiveGuardInfo.getMyGuardType(); + if (guardType == Constants.GUARD_TYPE_NONE) { + tip1.setText(R.string.guard_tip_0); + } else if (guardType == Constants.GUARD_TYPE_DAY) { + tip1.setText(mContext.getString(R.string.guard_tip_day) + mLiveGuardInfo.getMyGuardEndTime()); + mBtnBuy.setText(R.string.guard_buy_3); + } else if (guardType == Constants.GUARD_TYPE_MONTH) { + tip1.setText(mContext.getString(R.string.guard_tip_1) + mLiveGuardInfo.getMyGuardEndTime()); + mBtnBuy.setText(R.string.guard_buy_3); + } else if (guardType == Constants.GUARD_TYPE_YEAR) { + tip1.setText(mContext.getString(R.string.guard_tip_2) + mLiveGuardInfo.getMyGuardEndTime()); + mBtnBuy.setText(R.string.guard_buy_3); + } + } + } + + public void setList(List list) { + this.list = list; + } +} diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 5e26ecbd4..54afe4314 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -488,7 +488,8 @@ public class LiveAudienceEvent extends BaseModel { GIFT_WALL(73, "礼物墙"), UPDATE_FANS_TASK_STATUS(74, "更新粉丝任务状态"), SUD_GAME_CREATE_ROOM(75, "主播创建sud游戏"), - PK_RANK_START(76, "PK排位赛开始"); + PK_RANK_START(76, "PK排位赛开始"), + GuardSpecialEffect(77, "PK排位赛开始"); private int type; private String name; diff --git a/live/src/main/java/com/yunbao/live/fragments/LiveBuyGuardVPFragment.java b/live/src/main/java/com/yunbao/live/fragments/LiveBuyGuardVPFragment.java new file mode 100644 index 000000000..ead17a048 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/fragments/LiveBuyGuardVPFragment.java @@ -0,0 +1,35 @@ +package com.yunbao.live.fragments; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.live.R; + +public class LiveBuyGuardVPFragment extends Fragment { + private int type; + public static LiveBuyGuardVPFragment newInstance(int type) { + return new LiveBuyGuardVPFragment(type); + } + + public LiveBuyGuardVPFragment(int type) { + this.type = type; + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.view_vp_live_buy_guard,container,false); + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + } +} diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index cadfb3330..b73e45d18 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -4,14 +4,20 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; +import android.app.Activity; import android.content.Context; +import android.graphics.Color; import android.graphics.drawable.Drawable; +import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; import android.os.Message; import android.text.Html; +import android.text.Spannable; +import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextUtils; +import android.text.style.ForegroundColorSpan; import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -33,19 +39,25 @@ import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; import com.opensource.svgaplayer.utils.SVGARect; +import com.umeng.analytics.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.HtmlConfig; import com.yunbao.common.activity.WebViewActivity; +import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.event.AllServerNotifyEvent; +import com.yunbao.common.event.AllServerNotifyFFGGGDJANEvent; +import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.DeviceUtils; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.HtmlTagHandler; @@ -54,14 +66,17 @@ import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.MicStatusManager; 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.activity.LiveAudienceActivity; +import com.yunbao.live.activity.ZhuangBanActivity; import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LiveReceiveGiftBean; +import com.yunbao.live.bean.NewAllServerNotifyGuardEvent; import com.yunbao.live.custom.FrameImageView; +import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.event.LiveAudienceEvent; -import com.yunbao.common.event.LiveRoomChangeEvent; -import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.live.utils.AllMsgTextRender; import com.yunbao.live.utils.LiveIconUtil; import com.yunbao.live.views.LiveGiftLuckTopViewHolder; @@ -123,7 +138,11 @@ public class LiveGiftAnimPresenter { private ObjectAnimator mGifGiftTipShowAnimatorAllServer; private ObjectAnimator mGifGiftTipHideAnimatorAllServer; private ObjectAnimator mGifGiftTipShowAnimatorBuyGuard; + private ObjectAnimator mGifGiftTipShowAnimatorBuyGuardNew; + private ObjectAnimator mGifGiftTipShowAnimatorfull_service_notice_new; private ObjectAnimator mGifGiftTipHideAnimatorBuyGuard; + private ObjectAnimator mGifGiftTipHideAnimatorBuyGuardNew; + private ObjectAnimator mGifGiftTipHideAnimatorfull_service_notice_new; private ObjectAnimator mGifGiftTipShowAnimatorBuyZuoji; private ObjectAnimator mGifGiftTipHideAnimatorBuyZuoji; @@ -160,7 +179,10 @@ public class LiveGiftAnimPresenter { private static final int WHAT_BUY_LIANG_NAME_2 = -12; private static final int WHAT_BUY_VIP_1 = -13; private static final int WHAT_BUY_VIP_2 = -14; - + private static final int WHAT_BUY_GUARD_NEW_1 = -15; + private static final int WHAT_BUY_GUARD_NEW_2 = -16; + private static final int full_service_notice_new_1 = -17; + private static final int full_service_notice_new_2 = -18; private boolean mShowGif; private boolean mShowBuyGuard; private boolean mShowAllServer; @@ -227,6 +249,7 @@ public class LiveGiftAnimPresenter { superNotice = v.findViewById(R.id.super_notice); bgAllServer = v.findViewById(R.id.bg_all_server); mIvLookBuyGuard = v.findViewById(R.id.iv_look_buy_guard); + mIvLookBuyGuardNew = v.findViewById(R.id.iv_look_buy_guard_new); svgaImageViewCallback(); @@ -235,7 +258,10 @@ public class LiveGiftAnimPresenter { mGifGiftTip = (TextView) v.findViewById(R.id.gif_gift_tip); mGifGiftTipAllServer = (TextView) v.findViewById(R.id.gif_gift_tip_all_server); mGifGiftTipGroupBuyGuard = v.findViewById(R.id.gif_gift_tip_group_buy_guard); + mGifGiftTipGroupBuyGuardNew = v.findViewById(R.id.gif_gift_tip_group_buy_guard_new); + guardAllServerNotifyBg = v.findViewById(R.id.guard_all_server_notify_bg); mGifGiftTipBuyGuard = (TextView) v.findViewById(R.id.gif_gift_tip_buy_guard); + mGifGiftTipBuyGuardNew = (TextView) v.findViewById(R.id.gif_gift_tip_buy_guard_new); mGifGiftTipGroupBuyZuoji = v.findViewById(R.id.gif_gift_tip_group_buy_zuoji); mGifGiftTipBuyZuoji = (TextView) v.findViewById(R.id.gif_gift_tip_buy_zuoji); @@ -247,21 +273,28 @@ public class LiveGiftAnimPresenter { ivGuardType = v.findViewById(R.id.ivGuardType); mFrameImageView = (FrameImageView) v.findViewById(R.id.all_frame_img); + full_service_notice_new = v.findViewById(R.id.full_service_notice_new); + full_service_notice_new_bg = v.findViewById(R.id.full_service_notice_new_bg); + full_service_notice_new_text = v.findViewById(R.id.full_service_notice_new_text); + iv_look_full_service_notice_new = v.findViewById(R.id.iv_look_full_service_notice_new); + iv_look_full_service_notice_new3 = v.findViewById(R.id.iv_look_full_service_notice_new3); + iv_look_full_service_notice_new2 = v.findViewById(R.id.iv_look_full_service_notice_new2); mIvLookClick(); mIvLookBuyGuardClick(); mIvLookBuyZuojiClick(); mIvLookBuyLiangNameClick(); mIvLookBuyVipClick(); - + onmIvLookBuyGuardNew(); + oniv_look_full_service_notice_new(); setGitTipAnimator1(); setGitTipAnimatorAllServer(); setGitTipAnimatorBuyGuard(); setGitTipAnimatorBuyZuoji(); setGitTipAnimatorBuyLiangName(); setGitTipAnimatorBuyVip(); - - + setGitTipAnimatorBuyGuardNew(); + setGitTipAnimatormGifGiftTipShowAnimatorfull_service_notice_new(); mSendString = "送了"; mLiveGiftViewHolders = new LiveGiftViewHolder[2]; mLiveGiftViewHolders[0] = new LiveGiftViewHolder(context, (ViewGroup) v.findViewById(R.id.gift_group_2)); @@ -374,7 +407,7 @@ public class LiveGiftAnimPresenter { mGifGiftTipGroupBuyZuoji.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - WebViewActivity.forward(mContext, HtmlConfig.SHOP + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"),true); + WebViewActivity.forward(mContext, HtmlConfig.SHOP + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"), true); } }); } @@ -383,7 +416,7 @@ public class LiveGiftAnimPresenter { mGifGiftTipGroupBuyLiangName.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - WebViewActivity.forward(mContext, HtmlConfig.SHOP + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"),true); + WebViewActivity.forward(mContext, HtmlConfig.SHOP + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"), true); } }); } @@ -404,7 +437,7 @@ public class LiveGiftAnimPresenter { String uid = mTempGifGiftBean.getUid(); String userId = CommonAppConfig.getInstance().getUid(); if (userId.equals(uid)) { - ToastUtil.show(WordUtil.isNewZh()?"已在当前直播间":"Already in the current studio"); + ToastUtil.show(WordUtil.isNewZh() ? "已在当前直播间" : "Already in the current studio"); return; } } @@ -507,6 +540,71 @@ public class LiveGiftAnimPresenter { }); } + private void setGitTipAnimatorBuyGuardNew() { + mDp500 = DpUtil.dp2px(500); + mGifGiftTipShowAnimatorBuyGuardNew = ObjectAnimator.ofFloat(mGifGiftTipGroupBuyGuardNew, "translationX", mDp500, 0); + mGifGiftTipShowAnimatorBuyGuardNew.setDuration(2000); + mGifGiftTipShowAnimatorBuyGuardNew.setInterpolator(new LinearInterpolator()); + mGifGiftTipShowAnimatorBuyGuardNew.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (mHandler != null) { + mHandler.sendEmptyMessageDelayed(WHAT_BUY_GUARD_NEW_1, 5000); + } + } + }); + mDp10 = DpUtil.dp2px(10); + mGifGiftTipHideAnimatorBuyGuardNew = ObjectAnimator.ofFloat(mGifGiftTipGroupBuyGuardNew, "translationX", 0); + mGifGiftTipHideAnimatorBuyGuardNew.setDuration(3000); + mGifGiftTipHideAnimatorBuyGuardNew.setInterpolator(new AccelerateDecelerateInterpolator()); + mGifGiftTipHideAnimatorBuyGuardNew.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + mGifGiftTipGroupBuyGuardNew.setAlpha(1 - animation.getAnimatedFraction()); + } + }); + mGifGiftTipHideAnimatorBuyGuardNew.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (mHandler != null) { + mHandler.sendEmptyMessageDelayed(WHAT_BUY_GUARD_NEW_2, 100); + } + } + }); + } + + private void setGitTipAnimatormGifGiftTipShowAnimatorfull_service_notice_new() { + mDp500 = DpUtil.dp2px(500); + mGifGiftTipShowAnimatorfull_service_notice_new = ObjectAnimator.ofFloat(full_service_notice_new, "translationX", mDp500, 0); + mGifGiftTipShowAnimatorfull_service_notice_new.setDuration(2000); + mGifGiftTipShowAnimatorfull_service_notice_new.setInterpolator(new LinearInterpolator()); + mGifGiftTipShowAnimatorfull_service_notice_new.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (mHandler != null) { + mHandler.sendEmptyMessageDelayed(full_service_notice_new_1, 5000); + } + } + }); + mDp10 = DpUtil.dp2px(10); + mGifGiftTipHideAnimatorfull_service_notice_new = ObjectAnimator.ofFloat(full_service_notice_new, "translationX", 0); + mGifGiftTipHideAnimatorfull_service_notice_new.setDuration(3000); + mGifGiftTipHideAnimatorfull_service_notice_new.setInterpolator(new AccelerateDecelerateInterpolator()); + mGifGiftTipHideAnimatorfull_service_notice_new.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + full_service_notice_new.setAlpha(1 - animation.getAnimatedFraction()); + } + }); + mGifGiftTipHideAnimatorfull_service_notice_new.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (mHandler != null) { + mHandler.sendEmptyMessageDelayed(full_service_notice_new_2, 100); + } + } + }); + } private void setGitTipAnimatorBuyZuoji() { mDp500 = DpUtil.dp2px(500); @@ -721,6 +819,12 @@ public class LiveGiftAnimPresenter { } else if (msg.what == WHAT_BUY_GUARD_1) { mGifGiftTipHideAnimatorBuyGuard.setFloatValues(0, -mDp10 - mGifGiftTipGroupBuyGuard.getWidth()); mGifGiftTipHideAnimatorBuyGuard.start(); + } else if (msg.what == WHAT_BUY_GUARD_NEW_1) { + mGifGiftTipHideAnimatorBuyGuardNew.setFloatValues(0, -mDp10 - mGifGiftTipGroupBuyGuardNew.getWidth()); + mGifGiftTipHideAnimatorBuyGuardNew.start(); + } else if (msg.what == full_service_notice_new_1) { + mGifGiftTipHideAnimatorfull_service_notice_new.setFloatValues(0, -mDp10 - full_service_notice_new.getWidth()); + mGifGiftTipHideAnimatorfull_service_notice_new.start(); } else if (msg.what == WHAT_BUY_GUARD_2) { mShowAllServer = false; heightOffsetArr[index4Guard] = 0; @@ -728,6 +832,20 @@ public class LiveGiftAnimPresenter { if (bean != null) { chooseInto(bean); } + } else if (msg.what == WHAT_BUY_GUARD_NEW_2) { + mShowAllServer = false; + heightOffsetArr[index4Guard] = 0; + LiveReceiveGiftBean bean = mGifAll.poll(); + if (bean != null) { + chooseInto(bean); + } + } else if (msg.what == full_service_notice_new_2) { + mShowAllServer = false; + heightOffsetArr[index4Guard] = 0; + LiveReceiveGiftBean bean = mGifAll.poll(); + if (bean != null) { + chooseInto(bean); + } } else if (msg.what == WHAT_BUY_ZUOJI_1) { mGifGiftTipHideAnimatorBuyZuoji.setFloatValues(0, -mDp10 - mGifGiftTipGroupBuyZuoji.getWidth()); mGifGiftTipHideAnimatorBuyZuoji.start(); @@ -785,6 +903,10 @@ public class LiveGiftAnimPresenter { showBuyVipGiftAnim(bean); } else if (action == 71) { showSystAnim(bean); + } else if (action == 90) { + showBuyGuardGiftAnimNew(notifyGuardEvent); + } else if (action == 91) { + showAllServerNotifyFFGGGD(bean.getNotifyFFGGGDJANEvent(), bean.isShowB()); } } @@ -970,6 +1092,219 @@ public class LiveGiftAnimPresenter { } } + View full_service_notice_new; + ImageView full_service_notice_new_bg; + TextView full_service_notice_new_text; + TextView iv_look_full_service_notice_new; + AllServerNotifyFFGGGDJANEvent notifyFFGGGDJANEvent; + View iv_look_full_service_notice_new3; + ImageView iv_look_full_service_notice_new2; + + public void showAllServerNotifyFFGGGD(AllServerNotifyFFGGGDJANEvent event, boolean showB) { + if (TextUtils.isEmpty(event.getBackgroundImage())) return; + + + mRoomNum = event.getLiveuid(); + if (mShowAllServer) { + if (mGifAll != null) { + LiveReceiveGiftBean bean = new LiveReceiveGiftBean(); + bean.setSendtype(91); + bean.setNotifyFFGGGDJANEvent(event); + bean.setShowB(showB); + mGifAll.offer(bean); + } + } else { + notifyFFGGGDJANEvent = event; + mShowAllServer = true; + index4Guard = getFirstIndexOfValue(heightOffsetArr, 0); + if (index4Guard >= 0) { + heightOffsetArr[index4Guard] = 1; + int y; + y = index4Guard * 60; + FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) full_service_notice_new.getLayoutParams(); + params.topMargin = DpUtil.dp2px(y); + full_service_notice_new.setLayoutParams(params); + } + full_service_notice_new.setAlpha(1f); + full_service_notice_new.setVisibility(View.VISIBLE); + ImgLoader.display(mContext, event.getBackgroundImage(), full_service_notice_new_bg); + SpannableStringBuilder builder = new SpannableStringBuilder(); + String msgN = WordUtil.isNewZh() ? event.getMsgCn() : event.getMsgEn(); + builder.append(msgN); + for (AllServerNotifyFFGGGDJANEvent.StyleDTO dto : event.getStyle()) { + String textMsg = WordUtil.isNewZh() ? dto.getStrCn() : dto.getStrEn(); + int unameIndexOf = msgN.indexOf(textMsg); + int unameSize = textMsg.length(); + builder.setSpan(new ForegroundColorSpan(Color.parseColor(dto.getColour())), unameIndexOf, unameIndexOf + unameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } + if (!showB){ + iv_look_full_service_notice_new3.setVisibility(View.GONE); + }else { + if (TextUtils.equals(event.getJumpType(),"0")){ + iv_look_full_service_notice_new3.setVisibility(View.GONE); + }else { + iv_look_full_service_notice_new3.setVisibility(View.VISIBLE); + } + } + + if (!TextUtils.isEmpty(event.getButtonImage())) { + + ImgLoader.display(mContext, event.getButtonImage(), iv_look_full_service_notice_new2); + SpannableStringBuilder stringBuilder = new SpannableStringBuilder(); + String buttonString = WordUtil.isNewZh() ? event.getButtonMsgCn() : event.getButtonMsgEn(); + stringBuilder.append(buttonString); + try { + for (AllServerNotifyFFGGGDJANEvent.ButtonStyleDTO dto : event.getButtonStyle()) { + String textMsg = WordUtil.isNewZh() ? dto.getStrCn() : dto.getStrEn(); + int unameIndexOf = buttonString.indexOf(textMsg); + int unameSize = textMsg.length(); + stringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor(dto.getColour())), unameIndexOf, unameIndexOf + unameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } + } catch (Exception e) { + iv_look_full_service_notice_new.setText(buttonString); + } + iv_look_full_service_notice_new.setText(stringBuilder); + } + full_service_notice_new_text.postDelayed(new Runnable() { + @Override + public void run() { + if (full_service_notice_new_text != null) { + full_service_notice_new_text.setSelected(true); + full_service_notice_new_text.setEllipsize(TextUtils.TruncateAt.MARQUEE); + full_service_notice_new_text.requestFocus(); + full_service_notice_new_text.setText(builder); + } + + } + }, 500); + mGifGiftTipShowAnimatorfull_service_notice_new.start(); + } + } + + View mGifGiftTipGroupBuyGuardNew; + LinearLayout guardAllServerNotifyBg; + TextView mGifGiftTipBuyGuardNew; + TextView mIvLookBuyGuardNew; + NewAllServerNotifyGuardEvent notifyGuardEvent; + + public void showBuyGuardGiftAnimNew(NewAllServerNotifyGuardEvent event) { + notifyGuardEvent = event; + mRoomNum = event.getLiveuid(); + if (mShowAllServer) { + if (mGifAll != null) { + LiveReceiveGiftBean bean = new LiveReceiveGiftBean(); + bean.setSendtype(90); + mGifAll.offer(bean); + } + } else { + mShowAllServer = true; + index4Guard = getFirstIndexOfValue(heightOffsetArr, 0); + if (index4Guard >= 0) { + heightOffsetArr[index4Guard] = 1; + int y; + y = index4Guard * 60; + FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mGifGiftTipGroupBuyGuardNew.getLayoutParams(); + params.topMargin = DpUtil.dp2px(y); + mGifGiftTipGroupBuyGuardNew.setLayoutParams(params); + } + mGifGiftTipGroupBuyGuardNew.setAlpha(1f); + mGifGiftTipGroupBuyGuardNew.setVisibility(View.VISIBLE); + switch (event.getGuardType()) { + case "1": + guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? + R.mipmap.background_all_server_notify_star_zh : + R.mipmap.background_all_server_notify_star_en); + mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#072A93")); + mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_star_guard_onlookers); + break; + case "2": + guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? + R.mipmap.background_all_server_notify_king_zh : + R.mipmap.background_all_server_notify_king_en); + mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#BF0B0A")); + mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_king_guard_onlookers); + break; + case "3": + guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? + R.mipmap.background_all_server_notify_god_zh : + R.mipmap.background_all_server_notify_sgod_en); + mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#41057E")); + mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_god_guard_onlookers); + break; + + } + if (!TextUtils.isEmpty(event.getIsOnlookers()) && TextUtils.equals("0", event.getIsOnlookers())) { + mIvLookBuyGuardNew.setVisibility(View.GONE); + } else { + mIvLookBuyGuardNew.setVisibility(View.VISIBLE); + mIvLookBuyGuardNew.setText(WordUtil.isNewZh() ? "圍觀" : "Views"); + } + mGifGiftTipShowAnimatorBuyGuardNew.start(); + + + mGifGiftTipBuyGuardNew.postDelayed(new Runnable() { + @Override + public void run() { + if (mGifGiftTipBuyGuardNew != null) { + mGifGiftTipBuyGuardNew.setSelected(true); + mGifGiftTipBuyGuardNew.setEllipsize(TextUtils.TruncateAt.MARQUEE); + mGifGiftTipBuyGuardNew.requestFocus(); + mGifGiftTipBuyGuardNew.setText(WordUtil.isNewZh() ? event.getMsgCn() : event.getMsgEn()); + } + } + }, 500); + + } + + } + + private void onmIvLookBuyGuardNew() { + ViewClicksAntiShake.clicksAntiShake(mIvLookBuyGuardNew, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + mIvLookBuyGuardNew.setVisibility(View.GONE); + changeLiveRoom(); + } + }); + } + + private void oniv_look_full_service_notice_new() { + ViewClicksAntiShake.clicksAntiShake(iv_look_full_service_notice_new, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + MobclickAgent.onEvent(mContext, "new_full_server", "全服的埋点"); + String jumpType = notifyFFGGGDJANEvent.getJumpType(); + if (TextUtils.equals(jumpType, "1")) { + changeLiveRoom(); + } else if (TextUtils.equals(jumpType, "2")) { + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + if (!TextUtils.isEmpty(notifyFFGGGDJANEvent.getLink())) { + StringBuffer htmlUrl = new StringBuffer(); + htmlUrl.append(notifyFFGGGDJANEvent.getLink()) + .append(notifyFFGGGDJANEvent.getLink().contains("?") ? "&uid=" : "?uid=") + .append(userInfo.getId()) + .append("&token=") + .append(userInfo.getToken()) + .append("&isZh=") + .append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + if (!TextUtils.isEmpty(notifyFFGGGDJANEvent.getH5Type())) { + if (TextUtils.equals(notifyFFGGGDJANEvent.getH5Type(), "1")) { + Bundle bundle = new Bundle(); + bundle.putString("url", htmlUrl.toString()); + bundle.putInt("height", DeviceUtils.getScreenHeight((Activity) mContext) / 5 * 3); + LiveHDDialogFragment fragment = new LiveHDDialogFragment(); + fragment.setArguments(bundle); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + } else if (TextUtils.equals(notifyFFGGGDJANEvent.getH5Type(), "2")) { + ZhuangBanActivity.forwardqeqweqq(mContext, htmlUrl.toString(), 1); + } + } + } + + } + } + }); + } //购买守护 全服通知 public void showBuyGuardGiftAnim(LiveReceiveGiftBean bean) { @@ -1510,12 +1845,24 @@ public class LiveGiftAnimPresenter { if (mGifGiftTipShowAnimatorBuyGuard != null) { mGifGiftTipShowAnimatorBuyGuard.cancel(); } + if (mGifGiftTipShowAnimatorBuyGuardNew != null) { + mGifGiftTipShowAnimatorBuyGuardNew.cancel(); + } if (mGifGiftTipHideAnimatorAllServer != null) { mGifGiftTipHideAnimatorAllServer.cancel(); } if (mGifGiftTipHideAnimatorBuyGuard != null) { mGifGiftTipHideAnimatorBuyGuard.cancel(); } + if (mGifGiftTipHideAnimatorBuyGuardNew != null) { + mGifGiftTipHideAnimatorBuyGuardNew.cancel(); + } + if (mGifGiftTipHideAnimatorfull_service_notice_new != null) { + mGifGiftTipHideAnimatorfull_service_notice_new.cancel(); + } + if (mGifGiftTipShowAnimatorfull_service_notice_new != null) { + mGifGiftTipShowAnimatorfull_service_notice_new.cancel(); + } if (mGifGiftTipShowAnimatorBuyZuoji != null) { mGifGiftTipShowAnimatorBuyZuoji.cancel(); diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java index 655b137fa..6192c56cc 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java @@ -102,7 +102,7 @@ public class SocketRyChatUtil { .param("uid", u.getId()) .param("liangname", u.getGoodName()) .param("vip_type", u.getVip().getType()) - .param("guard_type", guardType) + .param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType()) .param("medal_name", u.getMedalName()) .param("medal_level", model.getMedalLevel()) .param("good_num", u.getGoodnum()) @@ -132,7 +132,7 @@ public class SocketRyChatUtil { SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); } LiveNetManager.get(CommonAppContext.sInstance) - .addChatCount(LiveActivity.mStream,new com.yunbao.common.http.base.HttpCallback() { + .addChatCount(LiveActivity.mStream, new com.yunbao.common.http.base.HttpCallback() { @Override public void onSuccess(HttpCallbackModel data) { @@ -151,7 +151,7 @@ public class SocketRyChatUtil { if (errorCode.code == 23408) { ToastUtil.show(WordUtil.isNewZh() ? "您已被禁言" : "You have been banned"); } else { - ToastUtil.show(errorCode.code + ":" + errorCode.msg); + ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" + errorCode.code : "I'm sorry! An error occurred:" + errorCode.code); } } }); @@ -180,7 +180,7 @@ public class SocketRyChatUtil { .param("bubble", u.getDress().getBubble()) .param("medal", u.getDress().getMedal()) .param("medal_new", u.getDress().getMedal_new()) - .param("guard_type", guardType) + .param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType()) .param("medal_name", u.getMedalName()) .param("medal_level", u.getMedalLevel()) .param("good_num", u.getGoodnum()) @@ -492,7 +492,7 @@ public class SocketRyChatUtil { if (u == null) { return; } - String s = action == 1 ? "被設為管理員(Set as Administrator)": "被取消管理員(Cancelled administrator)"; + String s = action == 1 ? "被設為管理員(Set as Administrator)" : "被取消管理員(Cancelled administrator)"; final SocketSendBean msg = new SocketSendBean() .param("_method_", Constants.SOCKET_SET_ADMIN) .param("action", action) @@ -716,7 +716,7 @@ public class SocketRyChatUtil { .param("uhead", u.getAvatar()) .param("votestotal", votes) .param("guard_nums", guardNum) - .param("guard_type", guardType); + .param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType()); msg.create(); } @@ -742,7 +742,7 @@ public class SocketRyChatUtil { .param("bubble", u.getDress().getBubble()) .param("medal", u.getDress().getMedal()) .param("medal_new", u.getDress().getMedal_new()) - .param("guard_type", guardType); + .param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType()); msg.create(); } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index ffe270aba..549c32778 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -24,22 +24,26 @@ import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.FansModel; +import com.yunbao.common.bean.GuardMaturityDateRemindModel; import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketModel; +import com.yunbao.common.bean.SendMoneyLongModel; import com.yunbao.common.bean.SocketModel; import com.yunbao.common.bean.SudGameDateModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.event.AllServerNotifyEvent; +import com.yunbao.common.event.AllServerNotifyFFGGGDJANEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.event.GiftWallIlluminateEvent; import com.yunbao.common.event.QuickGiftingEvent; import com.yunbao.common.event.SendBlindGiftEvent; +import com.yunbao.common.event.SendMoneyLongEndEvent; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.manager.IMRTCManager; @@ -63,6 +67,7 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; +import com.yunbao.live.bean.NewAllServerNotifyGuardEvent; import com.yunbao.live.bean.SendQuickGiftModel; import com.yunbao.live.event.LiveAnchorEvent; import com.yunbao.live.event.LiveAudienceEvent; @@ -387,7 +392,7 @@ public class SocketRyClient { } else if (action2 == 61) {//赠送礼物 sendGiftByNotify(map); } else if (action2 == 62) {//购买守护 - buyGuardByNotify(map); +// buyGuardByNotify(map); // }else if (action2 == 63){ } else if (action2 == 63) {//购买vip buyVipByNotify(map); @@ -436,6 +441,13 @@ public class SocketRyClient { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.BLIND_BOX) .setAllServerNotifyEvent(allServerNotifyEvent)); + } else if (action2 == 90) { + NewAllServerNotifyGuardEvent notifyGuardEvent = GsonUtils.fromJson(map.toString(), NewAllServerNotifyGuardEvent.class); + Bus.get().post(notifyGuardEvent); + buyGuardInSameRoom(map); + }else if (action2==91){ + AllServerNotifyFFGGGDJANEvent notifyFFGGGDJANEvent = GsonUtils.fromJson(map.toString(), AllServerNotifyFFGGGDJANEvent.class); + Bus.get().post(notifyFFGGGDJANEvent); } break; case Constants.SOCKET_SEND_BARRAGE://发弹幕 @@ -680,6 +692,7 @@ public class SocketRyClient { .setCustomFullServiceNotifyEvent(customFullServiceNotifyEvent)); break; case Constants.XYD_COMPLETE: + // xydComplete(map); XydCompleteModel xydCompleteModel = GsonUtils.fromJson(map.toString(), XydCompleteModel.class); EventBus.getDefault().post(new LiveAudienceEvent() @@ -687,6 +700,13 @@ public class SocketRyClient { .setXydCompleteModel(xydCompleteModel) .setLiveReceiveGiftBean(JSON.parseObject(map.toString(), LiveReceiveGiftBean.class))); break; + case "GuardSpecialEffect": + LiveReceiveGiftBean giftBean = JSON.parseObject(map.toString(), LiveReceiveGiftBean.class); + giftBean.setMedal_name(map.getString("medal_name")); + EventBus.getDefault().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.GuardSpecialEffect) + .setLiveReceiveGiftBean(giftBean)); + break; case Constants.WISH_LIST_PROGRESS: StringBuffer conString = new StringBuffer(); conString.append(WordUtil.isNewZh() ? map.getString("msg") : map.getString("msg_en")); @@ -782,28 +802,41 @@ public class SocketRyClient { item.getString("pkuid_win_continuity"); pkRankBean = new PkRankBean(); pkRankBean.setBlueVal(item.getString("pkuid_win_continuity")); - pkRankBean.setRedVal( item.getString("uid_win_continuity")); + pkRankBean.setRedVal(item.getString("uid_win_continuity")); pkRankBean.setPkTopImgUrl(item.getString("pktt_img")); EventBus.getDefault().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.PK_RANK_START) .setObject(pkRankBean)); break; + case "guardMaturityDateRemind": + GuardMaturityDateRemindModel maturityDateRemindModel = GsonUtils.fromJson(map.toString(), GuardMaturityDateRemindModel.class); + Bus.get().post(maturityDateRemindModel); + break; + case "SendMoneyLong": + SendMoneyLongModel sendMoneyLongModel = GsonUtils.fromJson(map.toString(), SendMoneyLongModel.class); + Bus.get().post(sendMoneyLongModel); + break; + case "SendMoneyLongEnd": + Bus.get().post(new SendMoneyLongEndEvent()); + break; } } private void buyGuardInSameRoom(JSONObject map) { - String guardName = WordUtil.isNewZh() ? "周守護" : "Week Guardian"; + if (TextUtils.isEmpty(map.getString("ancherName")) || TextUtils.isEmpty(map.getString("uname"))) + return; + String guardName = WordUtil.isNewZh() ? "星之守護" : "Star Guardian"; switch (map.getIntValue("guard_type")) { case 1: - guardName = WordUtil.isNewZh() ? "周守護" : "Week Guardian"; + guardName = WordUtil.isNewZh() ? "星之守護" : "Star Guardian"; break; case 2: - guardName = WordUtil.isNewZh() ? "月守護" : "Month Guardian"; + guardName = WordUtil.isNewZh() ? "王之守護" : "King Guardian"; break; case 3: - guardName = WordUtil.isNewZh() ? "年守護" : "Year Guardian"; + guardName = WordUtil.isNewZh() ? "神之守護" : "God Guardian"; break; } String content = WordUtil.isNewZh() ? "%s在%s的直播間開通了%s" : "%s has been opened in %s live broadcast room %s"; @@ -819,7 +852,7 @@ public class SocketRyClient { private void buyGuardByNotify(JSONObject map) { if (mLiveUid.equals(map.getString("liveuid"))) { - buyGuardInSameRoom(map); +// buyGuardInSameRoom(map); //同一直播间,玩家自己开通,也能看到全服通知 String userId = CommonAppConfig.getInstance().getUid(); String uid = map.getString("uid"); diff --git a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java index 33b049c19..b220d8f07 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java @@ -32,9 +32,9 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.request.target.CustomTarget; import com.bumptech.glide.request.transition.Transition; import com.yunbao.common.CommonAppContext; -import com.yunbao.common.Constants; import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.MsgModel; +import com.yunbao.common.bean.NewGuardLevelModel; import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.custom.VerticalImageSpan; import com.yunbao.common.glide.ImgLoader; @@ -262,95 +262,170 @@ public class LiveTextRender { } + public interface CreatePrefixCallback { + void onPrefixCallback(SpannableStringBuilder builder); + } + /** * 生成前缀 */ - private SpannableStringBuilder createPrefix(Drawable levelDrawable, LiveChatBean bean) { - SpannableStringBuilder builder = new SpannableStringBuilder(); - int index = 0; + private void createPrefix(Drawable levelDrawable, LiveChatBean bean, CreatePrefixCallback createPrefixCallback) { - if (levelDrawable != null) { - builder.append(" "); - levelDrawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17)); - builder.setSpan(new VerticalImageSpan(levelDrawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - index = builder.length(); - } - if (gzDrawablesMap.containsKey(bean)) {//贵族 - builder.append(" "); - gzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(35), DpUtil.dp2px(20)); - builder.setSpan(new VerticalImageSpan(gzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - index = builder.length(); - } +// if (bean.getGuardType() != Constants.GUARD_TYPE_NONE) {//守护图标 +// Drawable drawable; +// if (bean.getGuardType() == Constants.GUARD_TYPE_MONTH) { +// drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_1); +// } else if (bean.getGuardType() == Constants.GUARD_TYPE_YEAR) { +// drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_2); +// } else { +// drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_0); +// } + getGuardImage(CommonAppContext.sInstance, bean.getGuardType(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + SpannableStringBuilder builder = new SpannableStringBuilder(); + int index = 0; - if (ryxzDrawablesMap.containsKey(bean)) {//荣誉勋章 - builder.append(" "); - ryxzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(18)); - builder.setSpan(new VerticalImageSpan(ryxzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - index = builder.length(); - } + if (levelDrawable != null) { + builder.append(" "); + levelDrawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17)); + builder.setSpan(new VerticalImageSpan(levelDrawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } - if (nhDrawablesMap.containsKey(bean)) {//靓号 - builder.append(" "); - nhDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17)); - builder.setSpan(new VerticalImageSpan(nhDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - index = builder.length(); - } + if (gzDrawablesMap.containsKey(bean)) {//贵族 + builder.append(" "); + gzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(35), DpUtil.dp2px(20)); + builder.setSpan(new VerticalImageSpan(gzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } - if (bean.getGuardType() != Constants.GUARD_TYPE_NONE) {//守护图标 - Drawable drawable; - if (bean.getGuardType() == Constants.GUARD_TYPE_MONTH) { - drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_1); - } else if (bean.getGuardType() == Constants.GUARD_TYPE_YEAR) { - drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_2); - } else { - drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_0); + if (ryxzDrawablesMap.containsKey(bean)) {//荣誉勋章 + builder.append(" "); + ryxzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(18)); + builder.setSpan(new VerticalImageSpan(ryxzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } + + if (nhDrawablesMap.containsKey(bean)) {//靓号 + builder.append(" "); + nhDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17)); + builder.setSpan(new VerticalImageSpan(nhDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } + if (drawable != null) { + builder.append(" "); + drawable.setBounds(0, 0, DpUtil.dp2px(34), DpUtil.dp2px(17)); + builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } + //在这里添加粉丝徽章的图片 + if (!TextUtils.isEmpty(bean.getMedalNmae()) && !TextUtils.isEmpty(bean.getMedalLevelImageUrl()) + && !bean.getMedalNmae().equals("null") && !bean.getMedalNmae().equals("(null)") && !bean.getMedalNmae().equals("")) {//粉丝徽章图标 + Drawable drawable2 = getMedalImage(bean); + if (drawable2 != null) { + builder.append(" "); + drawable2.setBounds(0, 0, DpUtil.dp2px(44), DpUtil.dp2px(17)); + builder.setSpan(new VerticalImageSpan(drawable2), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } + } + + + if (bean.isManager()) {//直播间管理员图标 + Drawable drawable3 = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_m); + if (drawable3 != null) { + builder.append(" "); + drawable3.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14)); + builder.setSpan(new VerticalImageSpan(drawable3), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } + } + + if (!TextUtils.isEmpty(bean.getLiangName())) {//靓号图标 + Drawable drawable4 = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_liang); + if (drawable4 != null) { + builder.append(" "); + drawable4.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14)); + builder.setSpan(new VerticalImageSpan(drawable4), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + // new add + index = builder.length(); + } + } + createPrefixCallback.onPrefixCallback(builder); } - if (drawable != null) { - builder.append(" "); - drawable.setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(16)); - builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - index = builder.length(); + @Override + public void onLoadFailed() { + SpannableStringBuilder builder = new SpannableStringBuilder(); + int index = 0; + + if (levelDrawable != null) { + builder.append(" "); + levelDrawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17)); + builder.setSpan(new VerticalImageSpan(levelDrawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } + + if (gzDrawablesMap.containsKey(bean)) {//贵族 + builder.append(" "); + gzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(35), DpUtil.dp2px(20)); + builder.setSpan(new VerticalImageSpan(gzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } + + if (ryxzDrawablesMap.containsKey(bean)) {//荣誉勋章 + builder.append(" "); + ryxzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(18)); + builder.setSpan(new VerticalImageSpan(ryxzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } + + if (nhDrawablesMap.containsKey(bean)) {//靓号 + builder.append(" "); + nhDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17)); + builder.setSpan(new VerticalImageSpan(nhDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } + //在这里添加粉丝徽章的图片 + if (!TextUtils.isEmpty(bean.getMedalNmae()) && !TextUtils.isEmpty(bean.getMedalLevelImageUrl()) + && !bean.getMedalNmae().equals("null") && !bean.getMedalNmae().equals("(null)") && !bean.getMedalNmae().equals("")) {//粉丝徽章图标 + Drawable drawable = getMedalImage(bean); + if (drawable != null) { + builder.append(" "); + drawable.setBounds(0, 0, DpUtil.dp2px(44), DpUtil.dp2px(17)); + builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } + } + + + if (bean.isManager()) {//直播间管理员图标 + Drawable drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_m); + if (drawable != null) { + builder.append(" "); + drawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14)); + builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + index = builder.length(); + } + } + + if (!TextUtils.isEmpty(bean.getLiangName())) {//靓号图标 + Drawable drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_liang); + if (drawable != null) { + builder.append(" "); + drawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14)); + builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + // new add + index = builder.length(); + } + } + createPrefixCallback.onPrefixCallback(builder); } - } - - //在这里添加粉丝徽章的图片 - if (!TextUtils.isEmpty(bean.getMedalNmae()) && !TextUtils.isEmpty(bean.getMedalLevelImageUrl()) - && !bean.getMedalNmae().equals("null") && !bean.getMedalNmae().equals("(null)") && !bean.getMedalNmae().equals("")) {//粉丝徽章图标 - Drawable drawable = getMedalImage(bean); - if (drawable != null) { - builder.append(" "); - drawable.setBounds(0, 0, DpUtil.dp2px(44), DpUtil.dp2px(17)); - builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - index = builder.length(); - } - } + }); - if (bean.isManager()) {//直播间管理员图标 - Drawable drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_m); - if (drawable != null) { - builder.append(" "); - drawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14)); - builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - index = builder.length(); - } - } - - if (!TextUtils.isEmpty(bean.getLiangName())) {//靓号图标 - Drawable drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_liang); - if (drawable != null) { - builder.append(" "); - drawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14)); - builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - // new add - index = builder.length(); - } - } - - - return builder; } private Drawable getMedalImage(final LiveChatBean bean) { @@ -439,6 +514,36 @@ public class LiveTextRender { }); } + public void getGuardImage(Context mContext, int guardType, ImgLoader.DrawableCallback callback) { + if (guardType==0){ + callback.onLoadFailed(); + }else { + if (mContext instanceof Activity) { + if (((Activity) mContext).isDestroyed()) { + mContext = CommonAppContext.getTopActivity(); + } + } + List models = new NewLevelManager(mContext).getGuardLevel(); + String imgUrl = WordUtil.isNewZh() ? "https://downs.yaoulive.com/%E6%98%9F%E4%B9%8B%E5%AE%88%E6%8A%A4%E9%93%AD%E7%89%8C.png" : "https://downs.yaoulive.com/%E6%98%9F%E5%AE%88%E9%8A%98%E7%89%8C-2.png"; + for (NewGuardLevelModel newGuardLevelModel : models) { + if (newGuardLevelModel.getGuardType() == guardType) { + imgUrl = WordUtil.isNewZh() ? newGuardLevelModel.getCn() : newGuardLevelModel.getEn(); + } + } + ImgLoader.displayDrawable(mContext, imgUrl, new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + callback.onLoadSuccess(drawable); + } + + @Override + public void onLoadFailed() { + callback.onLoadFailed(); + } + }); + } + + } /** * 等级设置 @@ -576,42 +681,53 @@ public class LiveTextRender { getLiveLevelImage(context, bean.getLevel(), false, new ImgLoader.DrawableCallback() { @Override public void onLoadSuccess(Drawable drawable) { - SpannableStringBuilder builder = createPrefix(drawable, bean); - int color = Color.parseColor("#68F1F4"); - if (bean.isAnchor()) { - color = Color.parseColor("#FBEABF"); - } else { - color = Color.parseColor("#68F1F4"); - } - switch (bean.getType()) { - case LiveChatBean.GIFT: - builder = renderGift(color, builder, bean); - break; - default: - builder = renderChat(color, builder, bean); - break; - } - textView.setText(builder); + + createPrefix(drawable, bean, new CreatePrefixCallback() { + @Override + public void onPrefixCallback(SpannableStringBuilder builder) { + int color = Color.parseColor("#68F1F4"); + if (bean.isAnchor()) { + color = Color.parseColor("#FBEABF"); + } else { + color = Color.parseColor("#68F1F4"); + } + switch (bean.getType()) { + case LiveChatBean.GIFT: + builder = renderGift(color, builder, bean); + break; + default: + builder = renderChat(color, builder, bean); + break; + } + textView.setText(builder); + } + }); + } @Override public void onLoadFailed() { - SpannableStringBuilder builder = createPrefix(null, bean); - int color = 0; - if (bean.isAnchor()) { - color = 0xffffdd00; - } else { - color = Color.parseColor("#68F1F4"); - } - switch (bean.getType()) { - case LiveChatBean.GIFT: - builder = renderGift(color, builder, bean); - break; - default: - builder = renderChat(color, builder, bean); - break; - } - textView.setText(builder); + createPrefix(null, bean, new CreatePrefixCallback() { + @Override + public void onPrefixCallback(SpannableStringBuilder builder) { + int color = 0; + if (bean.isAnchor()) { + color = 0xffffdd00; + } else { + color = Color.parseColor("#68F1F4"); + } + switch (bean.getType()) { + case LiveChatBean.GIFT: + builder = renderGift(color, builder, bean); + break; + default: + builder = renderChat(color, builder, bean); + break; + } + textView.setText(builder); + } + }); + } }); @@ -771,23 +887,33 @@ public class LiveTextRender { @Override public void onLoadSuccess(Drawable drawable) { if (textView != null) { - SpannableStringBuilder builder = createPrefix(drawable, bean); - int start = builder.length(); - String name = bean.getUserNiceName() + " "; - builder.append(name); - builder.append(bean.getContent()); - textView.setText(builder); + createPrefix(drawable, bean, new CreatePrefixCallback() { + @Override + public void onPrefixCallback(SpannableStringBuilder builder) { + int start = builder.length(); + String name = bean.getUserNiceName() + " "; + builder.append(name); + builder.append(bean.getContent()); + textView.setText(builder); + } + }); + } } @Override public void onLoadFailed() { if (textView != null) { - SpannableStringBuilder builder = createPrefix(null, bean); - int start = builder.length(); - String name = bean.getUserNiceName() + " "; - builder.append(name); - textView.setText(builder); + createPrefix(null, bean, new CreatePrefixCallback() { + @Override + public void onPrefixCallback(SpannableStringBuilder builder) { + int start = builder.length(); + String name = bean.getUserNiceName() + " "; + builder.append(name); + textView.setText(builder); + } + }); + } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 12ab63efc..08eccaa73 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -185,6 +185,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { .setActivity(false) .setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION)); + } }); //玩 @@ -368,6 +369,25 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { } } }); + if (IMLoginManager.get(mContext).getGuardRedPoint()) { + findViewById(R.id.total_image_red_point).setVisibility(View.VISIBLE); + } else { + findViewById(R.id.total_image_red_point).setVisibility(View.GONE); + } + } + + public void onGuardRed() { + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + if (IMLoginManager.get(mContext).getGuardRedPoint()) { + findViewById(R.id.total_image_red_point).setVisibility(View.VISIBLE); + } else { + findViewById(R.id.total_image_red_point).setVisibility(View.GONE); + } + } + },1000); + } public void setGiftRemainingQuantity(String giftRemainingQuantity) { diff --git a/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java index b6191ac04..c40b07bf1 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java @@ -5,6 +5,9 @@ import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST import android.app.Dialog; import android.content.Context; import android.graphics.drawable.Drawable; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Looper; @@ -886,16 +889,43 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl * 点击开始直播按钮 */ private void startLiveInit() { - boolean startPreview = ((LiveRyAnchorActivity) mContext).isStartPreview(); + if (isWifiProxy(mContext) || checkVPN((ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE))) { + ToastUtil.show(WordUtil.isNewZh()?"檢測開啓了VPN或者代理,請先關閉VPN或者代理再開播。": + "It is detected that VPN or proxy is turned on. Please turn off VPN or proxy before starting the broadcast."); + } else { + boolean startPreview = ((LiveRyAnchorActivity) mContext).isStartPreview(); // if (!startPreview) { // ToastUtil.show(R.string.please_wait); // return; // } - if (mLiveClassID == 0) { - ToastUtil.show(WordUtil.getNewString(R.string.live_choose_live_class)); - return; + if (mLiveClassID == 0) { + ToastUtil.show(WordUtil.getNewString(R.string.live_choose_live_class)); + return; + } + createRoom(); } - createRoom(); + } + + private boolean isWifiProxy(Context context) { + final boolean IS_ICS_OR_LATER = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH; + String proxyAddress; + int proxyPort; + if (IS_ICS_OR_LATER) { + proxyAddress = System.getProperty("http.proxyHost"); + String portStr = System.getProperty("http.proxyPort"); + proxyPort = Integer.parseInt((portStr != null ? portStr : "-1")); + } else { + proxyAddress = android.net.Proxy.getHost(context); + proxyPort = android.net.Proxy.getPort(context); + } + return (!TextUtils.isEmpty(proxyAddress)) && (proxyPort != -1); + } + + private boolean checkVPN(ConnectivityManager connMgr) { + //don't know why always returns null: + NetworkInfo networkInfo = connMgr.getNetworkInfo(ConnectivityManager.TYPE_VPN); + boolean isVpnConn = networkInfo == null ? false : networkInfo.isConnected(); + return isVpnConn; } /** diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index e7915f3eb..3d2cb2d03 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -91,6 +91,7 @@ import com.yunbao.common.bean.RankHourModel; import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketModel; import com.yunbao.common.bean.RewardAllModel; +import com.yunbao.common.bean.SendMoneyLongModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.SudGameDateModel; import com.yunbao.common.bean.TaskModel; @@ -98,10 +99,12 @@ import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.event.AllServerNotifyEvent; +import com.yunbao.common.event.AllServerNotifyFFGGGDJANEvent; import com.yunbao.common.event.AnchorInfoEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent; +import com.yunbao.common.event.SendMoneyLongEndEvent; import com.yunbao.common.event.SlideEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.API; @@ -158,9 +161,11 @@ import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveWishlistBean; +import com.yunbao.live.bean.NewAllServerNotifyGuardEvent; import com.yunbao.live.bean.WishlistItemModel; import com.yunbao.live.custom.LiveLightView; import com.yunbao.live.custom.RightGradual; +import com.yunbao.live.dialog.DragonSendMoneyListPopup; import com.yunbao.live.dialog.GiftWallDialog; import com.yunbao.live.dialog.LiveContactDetailsSendGiftDialog; import com.yunbao.live.dialog.LiveFaceUnityDialogFragment; @@ -389,6 +394,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private LinearLayout combo_layout; private TextView combo_number; private View quick_gift_reminder; + private int guardType = 0; + + public LiveRoomViewHolder setGuardType(int guardType) { + this.guardType = guardType; + return this; + } @Subscribe(threadMode = ThreadMode.MAIN) public void onUpdata(String str) { @@ -617,6 +628,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } + public void guardSpecialEffect(LiveReceiveGiftBean liveReceiveGiftBean) { +// LiveChatBean chatBean = new LiveChatBean(); +// chatBean.setContent( +// (WordUtil.isNewZh() ? liveReceiveGiftBean.getMsg() : liveReceiveGiftBean.getMsg_en())); +// chatBean.setType(LiveChatBean.SYSTEM); +// mLiveChatAdapter.insertItem(chatBean); + Log.e("guardSpecialEffect", "msg" + liveReceiveGiftBean.getMsg() + "msg-en" + liveReceiveGiftBean.getMsg_en() + "guard_type" + liveReceiveGiftBean.getGuard_type()); + if (mLiveGiftAnimPresenter == null) { + mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager); + } + liveReceiveGiftBean.setGiftId(liveReceiveGiftBean.getGiftName()); + mLiveGiftAnimPresenter.showGifGift(liveReceiveGiftBean); + + + } List xydCompleteModels = new ArrayList<>(); @@ -1568,10 +1594,42 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis pa_pao_layout.setVisibility(View.GONE); combo_layout.setVisibility(View.GONE); + dragonImmediateParticipation = (LinearLayout) findViewById(R.id.dragon_immediate_participation); + dragonImmediateParticipationTime = (LinearLayout) findViewById(R.id.dragon_immediate_participation_time); + participation_time = (TextView) findViewById(R.id.participation_time); + + ViewClicksAntiShake.clicksAntiShake(dragonImmediateParticipation, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + new DragonSendMoneyListPopup(mContext, mLiveUid, false, isAttention != 0).showDialog(); +// new XPopup.Builder(mContext) +// .asCustom(new GuardUpgradePopup(mContext, mLiveUid)) +// .show(); +// ttttttype = ttttttype + 1; +// buyGuardNew(new NewAllServerNotifyGuardEvent() +// .setAction("90") +// .setGuardType(String.valueOf(ttttttype)) +// .setMsgCn("周末暴打小朋友在接化发直播間開通【星之守護】") +// .setMsgEn("周末暴打小朋友opened 【星之守護】 in 接化发 live broadcast room") +// .setLiveuid("98915")); + } + }); + ViewClicksAntiShake.clicksAntiShake(dragonImmediateParticipationTime, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + new DragonSendMoneyListPopup(mContext, mLiveUid, true, isAttention != 0).showDialog(); +// new XPopup.Builder(mContext) +// .asCustom(new GuardUpgradePopup(mContext, mLiveUid)) +// .show(); + } + }); +// dragonImmediateParticipation.setVisibility(View.GONE); } + int ttttttype = 0; + private LinearLayout dragonImmediateParticipation, dragonImmediateParticipationTime; private FrameLayout redPacket; - private TextView redPacketCountdown, redSchedule, openRedPacket; + private TextView redPacketCountdown, redSchedule, openRedPacket, participation_time; private LinearLayout redPacketQueue; private int redTimeCountdown = 0; private RedPacketModel mRedPacketModel; @@ -1624,6 +1682,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } else { redPacket.setVisibility(View.GONE); + if (dragonImmediateParticipation.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + dragonImmediateParticipation.setLayoutParams(layoutParams); + } if (dragonImmediateParticipationTime.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } anchorTimeHandler.removeCallbacks(anchorTimeRunnable); LiveNetManager.get(mContext). endRedPacket(mLiveUid, mRedPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback() { @@ -1650,6 +1717,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mRedPacketModel = redPacketModel; if (redPacketModel.getIsShow() == 1) { redPacket.setVisibility(View.VISIBLE); + if (dragonImmediateParticipation.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(190); + dragonImmediateParticipation.setLayoutParams(layoutParams); + } + if (dragonImmediateParticipationTime.getVisibility() == View.VISIBLE&&mContext instanceof LiveRyAnchorActivity) { + RelativeLayout.LayoutParams layoutParamsredPacket = (RelativeLayout.LayoutParams) redPacket.getLayoutParams(); + layoutParamsredPacket.topMargin = DpUtil.dp2px(110); + redPacket.setLayoutParams(layoutParamsredPacket); + + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipationTime.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(190); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } + if (dragonImmediateParticipationTime.getVisibility() == View.GONE&&mContext instanceof LiveRyAnchorActivity){ + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) redPacket.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + redPacket.setLayoutParams(layoutParams); + } if (redPacketModel.getCountdown() > 180) { redPacketQueue.setVisibility(View.GONE); redPacketCountdown.setVisibility(View.VISIBLE); @@ -1721,6 +1807,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void hindeRedPacket() { redPacket.setVisibility(View.GONE); + if (dragonImmediateParticipation.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + dragonImmediateParticipation.setLayoutParams(layoutParams); + } + if (dragonImmediateParticipationTime.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipationTime.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } } public void setRedPacketInfoModel(RedPacketInfoModel redPacket) { @@ -2113,7 +2209,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void setLiveUid(String liveUid) { mLiveUid = liveUid; - LiveHttpUtil.geteEvent(mLiveUid, new HttpCallback() { + LiveHttpUtil.getAnchorActiveImgStatus(mLiveUid, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && imgEvent != null) { @@ -3114,6 +3210,101 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } + SendMoneyLongModel mSendMoneyLongModel; + + public void onSendMoneyLongModel(SendMoneyLongModel sendMoneyLongModel) { + + if (mLiveUid.contains(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()))) { + mSendMoneyLongModel = sendMoneyLongModel; + sendMoneyTime = Long.parseLong(sendMoneyLongModel.getCountdown()); + participation_time.removeCallbacks(sendMoneyRunnable); + dragonImmediateParticipationTime.setVisibility(View.VISIBLE); + if (redPacket.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(190); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } else { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } + String s1 = StringUtil.getDurationText(sendMoneyTime * 1000); + participation_time.setText(s1); + participation_time.post(sendMoneyRunnable); + } else { + dragonImmediateParticipation.setVisibility(View.VISIBLE); + if (redPacket.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(190); + dragonImmediateParticipation.setLayoutParams(layoutParams); + } else { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + dragonImmediateParticipation.setLayoutParams(layoutParams); + } + } + + } + + public void onSendMoneyLongEndEvent(SendMoneyLongEndEvent moneyLongEndEvent) { + if (mLiveUid.contains(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()))) { + dragonImmediateParticipationTime.setVisibility(View.GONE); + if (redPacket.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(190); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } else { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } + } else { + dragonImmediateParticipation.setVisibility(View.GONE); + + } + } + + private long sendMoneyTime; + Runnable sendMoneyRunnable = new Runnable() { + @Override + public void run() { + sendMoneyTime--; + if (sendMoneyTime > 0) { + String s1 = StringUtil.getDurationText(sendMoneyTime * 1000); + participation_time.setText(s1); + participation_time.postDelayed(sendMoneyRunnable, 1000); + } else { + participation_time.removeCallbacks(sendMoneyRunnable); + LiveNetManager.get(mContext) + .endSendMoneyLong(mLiveUid, mSendMoneyLongModel.getSendMoneyLongKey(), + new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(SendMoneyLongModel data) { + + } + + @Override + public void onError(String error) { + + } + }); + } + } + }; + + public void onSendMoneyLong() { + dragonImmediateParticipation.setVisibility(View.VISIBLE); + if (redPacket.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(190); + dragonImmediateParticipation.setLayoutParams(layoutParams); + } else { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + dragonImmediateParticipation.setLayoutParams(layoutParams); + } + } + /** * 设置礼物墙和周星榜 */ @@ -3812,6 +4003,24 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis setHotData(bean.getHot_num()); } + //新版购买守护 + public void buyGuardNew(NewAllServerNotifyGuardEvent event) { + if (mLiveGiftAnimPresenter == null) { + mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager); + } + mLiveGiftAnimPresenter.setLiveUidStream(mLiveUid, mStream); + mLiveGiftAnimPresenter.showBuyGuardGiftAnimNew(event); + + } + + public void showAllServerNotifyFFGGGD(AllServerNotifyFFGGGDJANEvent notifyFFGGGDJANEvent,boolean showB) { + if (mLiveGiftAnimPresenter == null) { + mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager); + } + mLiveGiftAnimPresenter.setLiveUidStream(mLiveUid, mStream); + mLiveGiftAnimPresenter.showAllServerNotifyFFGGGD(notifyFFGGGDJANEvent,showB); + } + //全服通知 购买坐骑 public void showBuyZuojiMessage(LiveReceiveGiftBean bean) { if (mLiveGiftAnimPresenter == null) { diff --git a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java index ccc49cf7d..d2be9d442 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java @@ -128,6 +128,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { btn_start_dr_pk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { + if (pk_nub <= 0) return; //開始多人PK HttpClient.getInstance().post("live.startDRPK", "live.startDRPK") .params("roomid", CommonAppConfig.getInstance().getUid()) @@ -438,7 +439,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { } public void setLiveUid(String liveUid) { - LiveHttpUtil.geteEvent(liveUid, new HttpCallback() { + LiveHttpUtil.getAnchorActiveImgStatus(liveUid, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0) { 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..6de8f39d7 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/views/NewGuardViewHolder.java @@ -0,0 +1,87 @@ +package com.yunbao.live.views; + +import android.text.TextUtils; +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())); + + contribution.setText(guardUserModel.getContribute()); + + if (TextUtils.equals(guardUserModel.getGuardLevelCard(), "0")) { + switch (guardUserModel.getGuardType()) { + case 1: + ImgLoader.display(itemView.getContext(), R.mipmap.tag_start_hui, tagKing); + break; + case 2: + ImgLoader.display(itemView.getContext(), R.mipmap.tag_king_hui, tagKing); + break; + case 3: + ImgLoader.display(itemView.getContext(), R.mipmap.tag_god_hui, tagKing); + break; + } + + } else { + switch (guardUserModel.getGuardType()) { + case 1: + ImgLoader.display(itemView.getContext(), R.mipmap.tag_start, tagKing); + break; + case 2: + ImgLoader.display(itemView.getContext(), R.mipmap.tag_king, tagKing); + break; + case 3: + ImgLoader.display(itemView.getContext(), R.mipmap.tag_god, tagKing); + break; + } + } + + } +} diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 2c1830419..5a5d012e2 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -43,6 +43,7 @@ import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketModel; +import com.yunbao.common.bean.SendMoneyLongModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.SudGameDateModel; import com.yunbao.common.bean.UserBean; @@ -50,6 +51,7 @@ import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.custom.MyViewPager; import com.yunbao.common.event.AllServerNotifyEvent; +import com.yunbao.common.event.AllServerNotifyFFGGGDJANEvent; import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.HideShowEvent; import com.yunbao.common.event.LiveFloatEvent; @@ -57,6 +59,7 @@ import com.yunbao.common.event.LiveGiftDialogEvent; import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent; import com.yunbao.common.event.SendBlindGiftEvent; +import com.yunbao.common.event.SendMoneyLongEndEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; @@ -90,6 +93,7 @@ import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; +import com.yunbao.live.bean.NewAllServerNotifyGuardEvent; import com.yunbao.live.bean.OpenParametersModel; import com.yunbao.live.dialog.BlowkissDialog; import com.yunbao.live.dialog.NewUserDialog; @@ -449,7 +453,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public void run() { //加入房间发送Im消息 LiveNetManager.get(mContext).userJoinRoomNew(mLiveBean.getStream(), mLiveBean.getUid()); - Log.e("观看时长","userJoinRoomNew-----------------------"+mLiveBean.getUid()); + Log.e("观看时长", "userJoinRoomNew-----------------------" + mLiveBean.getUid()); } }; @@ -462,7 +466,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe .enterRoomNew(mLiveBean.getStream(), mLiveBean.getUid(), mLiveBean.getCity(), new com.yunbao.common.http.base.HttpCallback() { @Override public void onSuccess(EnterRoomNewModel data) { - Log.e("观看时长","enterRoomNew-----------------------"+ mLiveBean.getUid()); + Log.e("观看时长", "enterRoomNew-----------------------" + mLiveBean.getUid()); isEnterRoom = true; if (TextUtils.isEmpty(leaveStream)) { leaveStream = mLiveBean.getStream(); @@ -624,7 +628,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (pkInfo != null && pkInfo.getIntValue("drpk_status") != 1) { String pkUid = pkInfo.getString("pkuid"); //初始化天梯赛信息 - mLiveRoomViewHolder.initRankPKInfo(String.valueOf(data.getLiveInfo().getUid()),pkUid); + mLiveRoomViewHolder.initRankPKInfo(String.valueOf(data.getLiveInfo().getUid()), pkUid); anyway = "1"; if (!TextUtils.isEmpty(pkUid) && !"0".equals(pkUid) && anyway.equals("0")) { if (mLiveSDK != Constants.LIVE_SDK_TX) { @@ -693,6 +697,17 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time")); } + if (data.getEnterRoomInfo().getGuard() != null) { + if (mLiveRoomViewHolder != null) { + if (TextUtils.isEmpty(data.getEnterRoomInfo().getGuard().getGuardType())) { + IMLoginManager.get(mContext).setGuardType(0); + } else { + int guardType = Integer.parseInt(data.getEnterRoomInfo().getGuard().getGuardType()); + IMLoginManager.get(mContext).setGuardType(guardType); + } + + } + } // mLivePlayViewHolder.setLayoutInterface(new LivePlayRyViewHolder.PlayViewLayoutInterface() { // @Override // public void playViewLayout(int width, int height) { @@ -762,6 +777,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } mLiveAudienceViewHolder.upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete()); + if (!TextUtils.isEmpty(data.getModel().getSendMoneyLongKey())) { + mLiveRoomViewHolder.onSendMoneyLong(); + } } @@ -817,7 +835,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe Log.e("直播间接口调用排查", "onRemove---------------"); LiveNetManager.get(mContext).cancelLive(); liveHandler.removeCallbacks(sendFIm); - pkInfo=null; + pkInfo = null; linkMicPkStartHandler.removeCallbacks(linkMicPkStartRunnable); LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE); LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM); @@ -1294,6 +1312,18 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } + public void buyGuardNew(NewAllServerNotifyGuardEvent event) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.buyGuardNew(event); + } + } + + public void showAllServerNotifyFFGGGD(AllServerNotifyFFGGGDJANEvent notifyFFGGGDJANEvent) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.showAllServerNotifyFFGGGD(notifyFFGGGDJANEvent,true); + } + } + @Override public void onBuyZuoji(LiveReceiveGiftBean bean) { if (mLiveRoomViewHolder != null) { @@ -2179,6 +2209,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } + public void guardSpecialEffect(LiveReceiveGiftBean liveReceiveGiftBean) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.guardSpecialEffect(liveReceiveGiftBean); + } + } + public void blindBoxAllServerNotify(AllServerNotifyEvent event) { if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.blindBoxAllServerNotify(event); @@ -2206,4 +2242,22 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public boolean isEnterRoom() { return isEnterRoom; } + + public void onSendMoneyLongModel(SendMoneyLongModel sendMoneyLongModel) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.onSendMoneyLongModel(sendMoneyLongModel); + } + } + + public void onSendMoneyLongEndEvent(SendMoneyLongEndEvent moneyLongEndEvent) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.onSendMoneyLongEndEvent(moneyLongEndEvent); + } + } + + public void onGuardRed() { + if (mLiveAudienceViewHolder != null) { + mLiveAudienceViewHolder.onGuardRed(); + } + } } diff --git a/live/src/main/res/drawable/backgroud_dragon_send_money_list.xml b/live/src/main/res/drawable/backgroud_dragon_send_money_list.xml new file mode 100644 index 000000000..c412cb880 --- /dev/null +++ b/live/src/main/res/drawable/backgroud_dragon_send_money_list.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file 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/drawable/guard_buy_bottom_bg.xml b/live/src/main/res/drawable/guard_buy_bottom_bg.xml new file mode 100644 index 000000000..04bb75341 --- /dev/null +++ b/live/src/main/res/drawable/guard_buy_bottom_bg.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/guard_buy_center_bg.xml b/live/src/main/res/drawable/guard_buy_center_bg.xml new file mode 100644 index 000000000..5fd926d13 --- /dev/null +++ b/live/src/main/res/drawable/guard_buy_center_bg.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/live/src/main/res/drawable/guard_buy_top_bg.xml b/live/src/main/res/drawable/guard_buy_top_bg.xml new file mode 100644 index 000000000..7b46e52b4 --- /dev/null +++ b/live/src/main/res/drawable/guard_buy_top_bg.xml @@ -0,0 +1,13 @@ + + + + + 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..271d0825d --- /dev/null +++ b/live/src/main/res/layout/banner_item_buy_guard.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_dragon_send_money_list.xml b/live/src/main/res/layout/dialog_dragon_send_money_list.xml new file mode 100644 index 000000000..326e8215d --- /dev/null +++ b/live/src/main/res/layout/dialog_dragon_send_money_list.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ 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 new file mode 100644 index 000000000..7bfcc1fa3 --- /dev/null +++ b/live/src/main/res/layout/dialog_live_buy_guard.xml @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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..53b607437 --- /dev/null +++ b/live/src/main/res/layout/dialog_live_guard.xml @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_new_guard.xml b/live/src/main/res/layout/dialog_new_guard.xml new file mode 100644 index 000000000..6130d180e --- /dev/null +++ b/live/src/main/res/layout/dialog_new_guard.xml @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dragon_expire_popup.xml b/live/src/main/res/layout/dragon_expire_popup.xml new file mode 100644 index 000000000..a581dab13 --- /dev/null +++ b/live/src/main/res/layout/dragon_expire_popup.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +