diff --git a/common/src/main/java/com/yunbao/common/bean/AnchorRecommendModel.java b/common/src/main/java/com/yunbao/common/bean/AnchorRecommendModel.java index 21125ed50..80c69327c 100644 --- a/common/src/main/java/com/yunbao/common/bean/AnchorRecommendModel.java +++ b/common/src/main/java/com/yunbao/common/bean/AnchorRecommendModel.java @@ -17,6 +17,8 @@ public class AnchorRecommendModel extends BaseModel { //是否展示0=不展示1=展示 @SerializedName("list_show") private int listShow = 0; + @SerializedName("red_packet_show") + private int showRedPacket = 0;//是否显示首页红包浮窗 //是否支持换一批0=不支持 1=支持 @SerializedName("up_show") private int upShow = 0; @@ -24,6 +26,10 @@ public class AnchorRecommendModel extends BaseModel { private List list = new ArrayList<>(); @SerializedName("slide") private List slide = new ArrayList<>(); + @SerializedName("red_packet_total") + private int redPacketTotal = 100; + @SerializedName("red_packet_day_create_num") + private int redPacketNum = 0; public List getSlide() { return slide; @@ -52,6 +58,30 @@ public class AnchorRecommendModel extends BaseModel { return this; } + public int getShowRedPacket() { + return showRedPacket; + } + + public void setShowRedPacket(int showRedPacket) { + this.showRedPacket = showRedPacket; + } + + public int getRedPacketTotal() { + return redPacketTotal; + } + + public void setRedPacketTotal(int redPacketTotal) { + this.redPacketTotal = redPacketTotal; + } + + public int getRedPacketNum() { + return redPacketNum; + } + + public void setRedPacketNum(int redPacketNum) { + this.redPacketNum = redPacketNum; + } + public List getList() { return list; } 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 7dbafa055..f4cec2ec4 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveBean.java @@ -5,6 +5,7 @@ import android.os.Parcelable; import android.text.TextUtils; import com.alibaba.fastjson.annotation.JSONField; +import com.google.gson.annotations.SerializedName; import java.util.ArrayList; import java.util.List; @@ -51,6 +52,8 @@ public class LiveBean implements Parcelable { private String recommendCardtype = ""; private String recommendCardIconSizeTwo = ""; private String recommendCardIconSizeThree = ""; + @SerializedName("red_packet_status") + private int redPacketStatus; private Map params;//用于跳转Activity时扩展参数,例:从首页Banner跳转到直播间时需要根据携带参数判断是否弹出新人特惠对话框 @@ -382,6 +385,14 @@ public class LiveBean implements Parcelable { this.islive = islive; } + public int getRedPacketStatus() { + return redPacketStatus; + } + + public void setRedPacketStatus(int redPacketStatus) { + this.redPacketStatus = redPacketStatus; + } + /** * 显示靓号 */ @@ -529,6 +540,7 @@ public class LiveBean implements Parcelable { ", recommendCardtype='" + recommendCardtype + '\'' + ", recommendCardIconSizeTwo='" + recommendCardIconSizeTwo + '\'' + ", recommendCardIconSizeThree='" + recommendCardIconSizeThree + '\'' + + ", redPacketStatus=" + redPacketStatus + ", params=" + params + ", mWeekList=" + mWeekList + '}'; diff --git a/common/src/main/java/com/yunbao/common/bean/LiveTaskModel.java b/common/src/main/java/com/yunbao/common/bean/LiveTaskModel.java index 647c776a9..c33012e1f 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveTaskModel.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveTaskModel.java @@ -68,7 +68,7 @@ public class LiveTaskModel extends BaseModel { '}'; } - public static class NewUser { + public static class NewUser implements Serializable{ @SerializedName("isNew") private int isNew; @SerializedName("endTime") diff --git a/common/src/main/java/com/yunbao/common/bean/RedPacketDetailsBean.java b/common/src/main/java/com/yunbao/common/bean/RedPacketDetailsBean.java new file mode 100644 index 000000000..671b61313 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/RedPacketDetailsBean.java @@ -0,0 +1,165 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.CommonAppConfig; + +import java.util.List; + +public class RedPacketDetailsBean extends BaseModel { + @SerializedName("u_nicename") + private String niceName; + @SerializedName("avatar_thumb") + private String avatarThumb; + @SerializedName("avatar") + private String avatar; + @SerializedName("red_packet_money") + private long money;// 红包金豆总数量 + @SerializedName("red_packet_quantity") + private int quantity; // 领取的红包总数量 + @SerializedName("red_packet_quantity_already") + private int already; // 领取的红包总数量 + @SerializedName("red_packet_record_details") + private List details; + + public String getNiceName() { + return niceName; + } + + public void setNiceName(String niceName) { + this.niceName=niceName; + } + + public String getAvatarThumb() { + avatarThumb=avatarThumb.replace("\\",""); + if(!avatarThumb.startsWith("http")){ + avatarThumb= CommonAppConfig.HOST+"/"+avatarThumb; + } + return avatarThumb; + } + + public void setAvatarThumb(String avatarThumb) { + this.avatarThumb = avatarThumb; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public long getMoney() { + return money; + } + + public void setMoney(long money) { + this.money = money; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public int getAlready() { + return already; + } + + public void setAlready(int already) { + this.already = already; + } + + public List getDetails() { + return details; + } + + public void setDetails(List details) { + this.details = details; + } + + @Override + public String toString() { + return "RedPacketDetailsBean{" + + "niceName='" + niceName + '\'' + + ", avatarThumb='" + avatarThumb + '\'' + + ", avatar='" + avatar + '\'' + + ", money=" + money + + ", quantity=" + quantity + + ", already=" + already + + ", details=" + details + + '}'; + } + + public static class Detail extends BaseModel { + @SerializedName("receive_money") + private long money; + @SerializedName("user_nicename") + private String niceName; + @SerializedName("receive_time") + private String time; + @SerializedName("avatar_thumb") + private String avatarThumb; + @SerializedName("avatar") + private String avatar; + + + public long getMoney() { + return money; + } + + public void setMoney(long money) { + this.money = money; + } + + public String getNiceName() { + return niceName; + } + + public void setNiceName(String niceName) { + this.niceName=niceName; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getAvatarThumb() { + avatarThumb=avatarThumb.replace("\\",""); + if(!avatarThumb.startsWith("http")){ + avatarThumb= CommonAppConfig.HOST+"/"+avatarThumb; + } + return avatarThumb; + } + + public void setAvatarThumb(String avatarThumb) { + this.avatarThumb = avatarThumb; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + @Override + public String toString() { + return "Detail{" + + "money=" + money + + ", niceName='" + niceName + '\'' + + ", time='" + time + '\'' + + ", avatarThumb='" + avatarThumb + '\'' + + ", avatar='" + avatar + '\'' + + '}'; + } + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/RedPacketListBean.java b/common/src/main/java/com/yunbao/common/bean/RedPacketListBean.java new file mode 100644 index 000000000..8d37ab67f --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/RedPacketListBean.java @@ -0,0 +1,117 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class RedPacketListBean extends BaseModel { + public static final int RED_PACKET_STATUS_SUCCESS=1;//红包消费 + public static final int RED_PACKET_STATUS_BACK=2;//红包退回 + public static final int RED_PACKET_CURRENT_STATUS_SUCCESS=1;//红包已生效 + public static final int RED_PACKET_CURRENT_STATUS_TIMEOUT=2;//红包已过期 + @SerializedName("id") + private int id; + @SerializedName("live_nicename") + private String liveNicename; + @SerializedName("create_time") + private String createTime; + @SerializedName("red_packet_money") + private long redPacketMoney; + @SerializedName("red_packet_status") + private int redPacketStatus; + @SerializedName("current_status") + private int currentStatus; + @SerializedName("uid") + private long uid; + + @SerializedName("amount_diamond") + private long amountDiamond; + @SerializedName("amount_refund") + private long amountRefund; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getLiveNicename() { + return liveNicename; + } + + public void setLiveNicename(String liveNicename) { + this.liveNicename = liveNicename; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public long getRedPacketMoney() { + return redPacketMoney; + } + + public void setRedPacketMoney(long redPacketMoney) { + this.redPacketMoney = redPacketMoney; + } + + public int getRedPacketStatus() { + return redPacketStatus; + } + + public void setRedPacketStatus(int redPacketStatus) { + this.redPacketStatus = redPacketStatus; + } + + public long getUid() { + return uid; + } + + public void setUid(long uid) { + this.uid = uid; + } + + public int getCurrentStatus() { + return currentStatus; + } + + public void setCurrentStatus(int currentStatus) { + this.currentStatus = currentStatus; + } + + public long getAmountDiamond() { + return amountDiamond; + } + + public void setAmountDiamond(long amountDiamond) { + this.amountDiamond = amountDiamond; + } + + public long getAmountRefund() { + return amountRefund; + } + + public void setAmountRefund(long amountRefund) { + this.amountRefund = amountRefund; + } + + @Override + public String toString() { + return "RedPacketListBean{" + + "id=" + id + + ", liveNicename='" + liveNicename + '\'' + + ", createTime='" + createTime + '\'' + + ", redPacketMoney=" + redPacketMoney + + ", redPacketStatus=" + redPacketStatus + + ", currentStatus=" + currentStatus + + ", uid=" + uid + + ", amountDiamond=" + amountDiamond + + ", amountRefund=" + amountRefund + + '}'; + } +} 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 1e1fa32c3..4a4fba729 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -2,6 +2,7 @@ package com.yunbao.common.http; import com.alibaba.fastjson.JSONObject; import com.yunbao.common.bean.ActiveModel; +import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.BlindBoxInfoModel; @@ -19,6 +20,7 @@ import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.LiveAiRobotBean; import com.yunbao.common.bean.LiveAnchorCallMeModel; import com.yunbao.common.bean.LiveAnchorSayModel; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; @@ -35,6 +37,8 @@ import com.yunbao.common.bean.PrankGiftBean; import com.yunbao.common.bean.PrankHttpTurntableBean; import com.yunbao.common.bean.RandomPkUserBean; import com.yunbao.common.bean.RankPkInfoBean; +import com.yunbao.common.bean.RedPacketDetailsBean; +import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.bean.SearchModel; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SlideInBannerModel; @@ -730,4 +734,23 @@ public interface PDLiveApi { */ @GET("/api/public/?service=Live.getBlindBoxInfo") Observable>> getBlindBoxInfo(); + + /** + * 获取红包记录列表 + */ + @GET("/api/public/?service=Live.redPacketRecord") + Observable>> getRedPacketList(); + + /** + * 获取红包詳情 + */ + @GET("/api/public/?service=Live.redPacketRecordDetails") + Observable> getRedPacketDetails(@Query("red_packet_id") int id); + + /** + * 获取直播间上下滑动红包集合 + */ + @GET("/api/public/?service=Home.getRedPacket") + Observable>> getRedPacket(); + } 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 e68000a1b..0d072003c 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 @@ -34,6 +34,8 @@ import com.yunbao.common.bean.PrankGiftBean; import com.yunbao.common.bean.PrankHttpTurntableBean; import com.yunbao.common.bean.RandomPkUserBean; import com.yunbao.common.bean.RankPkInfoBean; +import com.yunbao.common.bean.RedPacketDetailsBean; +import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.UserAreaBean; @@ -1550,7 +1552,54 @@ public class LiveNetManager { } }).isDisposed(); } - + /** + * 获取红包记录列表 + */ + public void getRedPacketList(HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .getRedPacketList() + .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 { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + /** + * 获取红包记录列表 + */ + public void getRedPacketUserList(int id,HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getRedPacketDetails(id) + .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 { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/http/main/MainNetManager.java b/common/src/main/java/com/yunbao/common/http/main/MainNetManager.java index 0807642a7..793a3ae88 100644 --- a/common/src/main/java/com/yunbao/common/http/main/MainNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/main/MainNetManager.java @@ -2,8 +2,8 @@ package com.yunbao.common.http.main; import android.app.Activity; +import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.AnchorRecommendModel; -import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.FaceBookUpModel; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.MsgSwitchDetailModel; @@ -13,7 +13,6 @@ import com.yunbao.common.http.API; import com.yunbao.common.http.ResponseData; import com.yunbao.common.http.ResponseModel; import com.yunbao.common.http.base.HttpCallback; -import com.yunbao.common.utils.ToastUtil; import java.util.List; @@ -207,13 +206,14 @@ public class MainNetManager { /** * 获取推送关注的设置和关注列表 + * * @param callback */ public void getMsgSwitchDetail(HttpCallback callback) { API.get().pdLiveApi(mContext).getMsgSwitchDetail() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) - .subscribe(msgSwitchDetailModelResponseModel -> { + .subscribe(msgSwitchDetailModelResponseModel -> { if (callback != null) { MsgSwitchDetailModel msgSwitchDetailModel = msgSwitchDetailModelResponseModel.getData().getInfo(); callback.onSuccess(msgSwitchDetailModel); @@ -227,13 +227,14 @@ public class MainNetManager { /** * 推送开关设置 + * * @param callback */ - public void setMsgMasterSwitch(String status,String type,HttpCallback callback) { - API.get().pdLiveApi(mContext).setMsgMasterSwitch(status,type) + public void setMsgMasterSwitch(String status, String type, HttpCallback callback) { + API.get().pdLiveApi(mContext).setMsgMasterSwitch(status, type) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) - .subscribe(BaseModel -> { + .subscribe(BaseModel -> { if (callback != null) { ResponseData responseData = BaseModel.getData(); callback.onSuccess(responseData); @@ -247,13 +248,14 @@ public class MainNetManager { /** * 主播开播推送开关设置 + * * @param callback */ - public void setBeginShowMsgSwitch(String status,String isAll,String liveuid,HttpCallback callback) { - API.get().pdLiveApi(mContext).setBeginShowMsgSwitch(status,isAll,liveuid) + public void setBeginShowMsgSwitch(String status, String isAll, String liveuid, HttpCallback callback) { + API.get().pdLiveApi(mContext).setBeginShowMsgSwitch(status, isAll, liveuid) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) - .subscribe(BaseModel -> { + .subscribe(BaseModel -> { if (callback != null) { ResponseData responseData = BaseModel.getData(); callback.onSuccess(responseData); @@ -264,5 +266,22 @@ public class MainNetManager { } }).isDisposed(); } + /** + * 获取直播间上下滑动红包集合 + */ + public void getRedPacket(HttpCallback> callback) { + API.get().pdLiveApi(mContext).getRedPacket() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(msgSwitchDetailModelResponseModel -> { + if (callback != null) { + callback.onSuccess(msgSwitchDetailModelResponseModel.getData().getInfo()); + } + }, throwable -> { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + }).isDisposed(); + } } diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index 9e442e132..aaae75cc4 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -10,6 +10,7 @@ import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.HtmlConfig; import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.manager.IMLoginManager; import java.util.Locale; @@ -39,6 +40,9 @@ public class RouteUtil { public static final String PATH_MYWEBVIEWACTIVTITY2 = "/main/MyWebViewActivity2"; public static final String PATH_LOGIN = "/main/LoginActivity"; public static final String PATH_CS = "/main/CustomerServiceWebViewActivity"; + public static final String PATH_RED_PACKET_LIST = "/main/RedPacketListActivity"; + public static final String PATH_RED_PACKET_INFO = "/main/RedPacketInfoActivity"; + public static final String PATH_RED_PACKET_USER = "/main/RedPacketUsersActivity"; public static void forwardFansActivity(String uid) { ARouter.getInstance().build(PATH_FANSACTIVITY) @@ -80,6 +84,7 @@ public class RouteUtil { .withBoolean("forwardEntry", true) .navigation(); } + /** * 只回到登录页,不提示东西 */ @@ -188,6 +193,7 @@ public class RouteUtil { ARouter.getInstance().build(PATH_EDITPROFILE) .navigation(); } + /** * 修改个人资料 */ @@ -256,9 +262,36 @@ public class RouteUtil { /** * 客服页面 */ - public static void forwardCustomerService(String url){ + public static void forwardCustomerService(String url) { ARouter.getInstance().build(PATH_CS) - .withString(Constants.URL,url) + .withString(Constants.URL, url) + .navigation(); + } + + /** + * 红包记录列表 + */ + public static void forwardRedPacketList() { + ARouter.getInstance().build(PATH_RED_PACKET_LIST) + .navigation(); + } + + /** + * 红包详情 + */ + public static void forwardRedPacketInfo(RedPacketListBean bean) { + ARouter.getInstance().build(PATH_RED_PACKET_INFO) + .withSerializable("bean", bean) + .navigation(); + } + + /** + * 红包发放情况 + * @param id 发放者uid + */ + public static void forwardRedPacketUser(int id) { + ARouter.getInstance().build(PATH_RED_PACKET_USER) + .withInt("id", id) .navigation(); } } diff --git a/common/src/main/res/layout/item_red_packet.xml b/common/src/main/res/layout/item_red_packet.xml new file mode 100644 index 000000000..130bb6199 --- /dev/null +++ b/common/src/main/res/layout/item_red_packet.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/item_user_red_packet.xml b/common/src/main/res/layout/item_user_red_packet.xml new file mode 100644 index 000000000..3a11a1cd2 --- /dev/null +++ b/common/src/main/res/layout/item_user_red_packet.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_title.xml b/common/src/main/res/layout/view_title.xml index dee8fcc61..74a2b02c8 100644 --- a/common/src/main/res/layout/view_title.xml +++ b/common/src/main/res/layout/view_title.xml @@ -1,5 +1,7 @@ + tools:visibility="visible" /> + + + diff --git a/common/src/main/res/layout/view_title2.xml b/common/src/main/res/layout/view_title2.xml new file mode 100644 index 000000000..d1d192362 --- /dev/null +++ b/common/src/main/res/layout/view_title2.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + diff --git a/common/src/main/res/mipmap-mdpi/ic_red_packet_record.png b/common/src/main/res/mipmap-mdpi/ic_red_packet_record.png new file mode 100644 index 000000000..dfcec8360 Binary files /dev/null and b/common/src/main/res/mipmap-mdpi/ic_red_packet_record.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/bg_float_red_packet.png b/common/src/main/res/mipmap-xxhdpi/bg_float_red_packet.png new file mode 100644 index 000000000..e4f16244f Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/bg_float_red_packet.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_diamond2.png b/common/src/main/res/mipmap-xxhdpi/icon_diamond2.png new file mode 100644 index 000000000..e5517f232 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_diamond2.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_red_packet_float_text_en.png b/common/src/main/res/mipmap-xxhdpi/icon_red_packet_float_text_en.png new file mode 100644 index 000000000..b3ffd5706 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_red_packet_float_text_en.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_red_packet_float_text_zh.png b/common/src/main/res/mipmap-xxhdpi/icon_red_packet_float_text_zh.png new file mode 100644 index 000000000..a6ed1436f Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_red_packet_float_text_zh.png differ diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index f1af38581..7a4fb1493 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1196,4 +1196,20 @@ Limited ride And limited avatar frame Over the maximum value Insufficient balance, continue to recharge Time limit gag + Red packet record + Last 30 days record (as of yesterday) + Current status + Red packet Took effect + Red packet Expired + Red Packet Details + Check + Pay Time + Mode of Pay + diamond + opened + Residual return + None + Return to account + Popularity Red packet + Red packets diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index bee2faa9f..4a8ed2ef9 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1191,4 +1191,20 @@ 超过最大值 餘額不足,繼續充值 期限禁言 + 紅包記錄 + 近30天記錄(截至到昨天) + 當前狀態 + 紅包已生效 + 紅包已過期 + 紅包詳情 + 查看 + 支付時間 + 支付方式 + 鉆石餘額 + 已打開 + 剩餘退回 + + 退回賬戶 + 攢人氣紅包 + 紅包專區 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index dc2735243..bd87f6cda 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1190,4 +1190,20 @@ 超过最大值 餘額不足,繼續充值 期限禁言 + 紅包記錄 + 近30天記錄(截至到昨天) + 當前狀態 + 紅包已生效 + 紅包已過期 + 紅包詳情 + 查看 + 支付時間 + 支付方式 + 鉆石餘額 + 已打開 + 剩餘退回 + + 退回賬戶 + 攢人氣紅包 + 紅包專區 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 0870f2363..95b56959c 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1191,4 +1191,20 @@ 超过最大值 餘額不足,繼續充值 期限禁言 + 紅包記錄 + 近30天記錄(截至到昨天) + 當前狀態 + 紅包已生效 + 紅包已過期 + 紅包詳情 + 查看 + 支付時間 + 支付方式 + 鉆石餘額 + 已打開 + 剩餘退回 + + 退回賬戶 + 攢人氣紅包 + 紅包專區 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 81850c6b9..0a3d0e170 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1197,4 +1197,20 @@ Limited ride And limited avatar frame Over the maximum value Insufficient balance, continue to recharge Time limit gag + Red packet record + Last 30 days record (as of yesterday) + Current status + Red packet Took effect + Red packet Expired + Red Packet Details + Check + Pay Time + Mode of Pay + diamond + opened + Residual return + None + Return to account + Popularity Red packet + Red packets diff --git a/config.gradle b/config.gradle index 013cf6403..1894327c6 100644 --- a/config.gradle +++ b/config.gradle @@ -5,7 +5,7 @@ ext { minSdkVersion : 21, targetSdkVersion : 31, versionCode : 430, - versionName : "6.5.2" + versionName : "6.5.3" ] manifestPlaceholders = [ //正式、 @@ -24,7 +24,7 @@ ext { baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnRB", baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", // true表示谷歌支付 false - isGooglePlay : false, + isGooglePlay : true, //是否上报异常日志 isUploadLog : true, //是否打包成插件包模式 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 1bbc86181..7b2ce69ef 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -159,6 +159,7 @@ public class LiveAudienceActivity extends LiveActivity { private View titleLine; private boolean liveIndex = true; private boolean isPk = false; + private boolean isRadPacetModle = false; @Override public T findViewById(@IdRes int id) { @@ -183,6 +184,7 @@ public class LiveAudienceActivity extends LiveActivity { L.e(TAG, "直播sdk----->" + (mLiveSDK == Constants.LIVE_SDK_KSY ? "金山云" : "腾讯云")); mLiveType = intent.getIntExtra(Constants.LIVE_TYPE, Constants.LIVE_TYPE_NORMAL); mLiveTypeVal = intent.getIntExtra(Constants.LIVE_TYPE_VAL, 0); + isRadPacetModle = !StringUtil.isEmpty(intent.getStringExtra("redPacket")) && intent.getStringExtra("redPacket").equals("true"); initView(); setVolumeControlStream(AudioManager.STREAM_MUSIC); manager = new PortraitLiveManager(this, intent); @@ -267,21 +269,40 @@ public class LiveAudienceActivity extends LiveActivity { manager.resetLight(); Log.e(TAG, "mCurrentItem:" + mCurrentItem); if (mCurrentItem == itemModelList.size() - 1) { - MainNetManager.get(mContext) - .anchorRecommendType("30", new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(AnchorRecommendModel data) { - if (TextUtils.equals(data.getList().get(0).getUid(), mLiveBean.getUid())) { - data.getList().remove(0); + if (isRadPacetModle) {//从红包专区进去的走红包专区列表 + MainNetManager.get(mContext) + .getRedPacket(new com.yunbao.common.http.base.HttpCallback>() { + @Override + public void onSuccess(List data) { + if (TextUtils.equals(data.get(0).getUid(), mLiveBean.getUid())) { + data.remove(0); + } + itemModelList.addAll(data); + mPagerAdapter.notifyDataSetChanged(); } - itemModelList.addAll(data.getList()); - mPagerAdapter.notifyDataSetChanged(); - } - @Override - public void onError(String error) { - } - }); + @Override + public void onError(String error) { + + } + }); + } else { + MainNetManager.get(mContext) + .anchorRecommendType("30", new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(AnchorRecommendModel data) { + if (TextUtils.equals(data.getList().get(0).getUid(), mLiveBean.getUid())) { + data.getList().remove(0); + } + itemModelList.addAll(data.getList()); + mPagerAdapter.notifyDataSetChanged(); + } + + @Override + public void onError(String error) { + } + }); + } } } @@ -861,7 +882,7 @@ public class LiveAudienceActivity extends LiveActivity { if (TextUtils.equals(htmlUrl, "recharge")) { RouteUtil.forwardMyCoin(mContext); } else if (TextUtils.equals(htmlUrl, "to_me_information")) { - RouteUtil.forwardEditProfileActivity(); + RouteUtil.forwardEditProfileActivity(); } else { if (!screen) { ZhuangBanActivity.forward(mContext, htmlUrl, false); 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 994c4d589..05a061da8 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -825,7 +825,7 @@ public class SocketRyClient { chatBean.setContentColor(map.getString("contentColor"));//文字内容颜色 chatBean.setAtUserName(map.getString("atUserName"));//@名字 chatBean.setAtUserID(map.getString("atUserID"));//@ID - if (!map.getString("guard_type").equals("undefined")) { + if (map.containsKey("guard_type")&&!map.getString("guard_type").equals("undefined")) { chatBean.setGuardType(map.getIntValue("guard_type")); } try { 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 bcac77b9d..e7d202d4f 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -257,7 +257,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public void run() { loading.setVisibility(View.GONE); enterRoomLeaveHandler.post(enterRoomLeaveRunnable); - ToastUtil.show(mContext.getString(R.string.net_error) + " :500" );//异常下播,等待加载时间过了后弹出 + } + }; + final Runnable loadTimeoutRunnableGone = new Runnable() { + @Override + public void run() { + loading.setVisibility(View.GONE); + enterRoomLeaveHandler.post(enterRoomLeaveRunnable); + ToastUtil.show(mContext.getString(R.string.net_error) + " :500");//异常下播,等待加载时间过了后弹出 } }; @@ -297,6 +304,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground(); frameAnimation.start(); liveHandler.removeCallbacks(loadRunnableGone); + liveHandler.removeCallbacks(loadTimeoutRunnableGone); if (mLivePlayViewHolder == null) { mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1); mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager()); @@ -310,6 +318,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onPlayer() { liveHandler.postDelayed(loadRunnableGone, 350); + liveHandler.removeCallbacks(loadTimeoutRunnableGone); } }); mLiveRoomViewHolder.subscribeActivityLifeCycle(); @@ -595,7 +604,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } else if (!pkInfo.getString("end_pk_time").equals("0")) { if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.pkHandler = true; - mLiveRoomViewHolder.pkUid=pkUid; + mLiveRoomViewHolder.pkUid = pkUid; mLiveRoomViewHolder.initPkRank(null); } if (mLivePlayViewHolder != null) { @@ -660,7 +669,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel)); } } - liveHandler.postDelayed(loadRunnableGone, 15_000); + liveHandler.postDelayed(loadTimeoutRunnableGone, 15_000); if (TextUtils.equals(data.getEnterRoomInfo().getIsconnection(), "1")) { //通知心愿单位置换地方 EventBus.getDefault().post(new LiveAudienceEvent() diff --git a/main/src/main/AndroidManifest.xml b/main/src/main/AndroidManifest.xml index 5048ed398..fef1e28bc 100644 --- a/main/src/main/AndroidManifest.xml +++ b/main/src/main/AndroidManifest.xml @@ -147,6 +147,15 @@ + + + \ No newline at end of file diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index e4785c2ed..ede574312 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -26,6 +26,7 @@ import android.view.Window; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; import android.widget.ImageView; +import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; @@ -93,6 +94,7 @@ import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.VersionUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.APKUpdateCustomPopup; import com.yunbao.common.views.AbsMainViewHolder; import com.yunbao.common.views.floatingview.APPEasyFloat; @@ -191,6 +193,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene private FloatBannerView floatBanner; private boolean isfloatBannernet = true, isFirst = true; + private View floatRedPacket; + @Override protected int getLayoutId() { @@ -236,6 +240,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene rt_main_tab = (RelativeLayout) findViewById(R.id.rt_main_tab); v_table_redpoint = findViewById(R.id.v_table_redpoint); v_table_redpoint_me = (View) findViewById(R.id.v_table_redpoint_me); + floatRedPacket = findViewById(R.id.red_packet); + initRedPacket(); Display mDisplay = getWindowManager().getDefaultDisplay(); Height = mDisplay.getHeight(); @@ -485,12 +491,14 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene initAnchorRecommendBanner(); } else if (index == 2) { floatBanner.setVisibility(View.GONE); + floatRedPacket.setVisibility(View.GONE); findViewById(R.id.banner_click).setVisibility(View.GONE); isfloatBannernet = false; if (mainMessageViewHolder != null) mainMessageViewHolder.onResume(); } else { floatBanner.setVisibility(View.GONE); + floatRedPacket.setVisibility(View.GONE); findViewById(R.id.banner_click).setVisibility(View.GONE); isfloatBannernet = false; } @@ -561,6 +569,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene if (!isfloatBannernet) return; MainNetManager.get(mContext) .anchorRecommend("10", new com.yunbao.common.http.base.HttpCallback() { + @SuppressLint("SetTextI18n") @Override public void onSuccess(AnchorRecommendModel data) { if (isFinishing()) return; @@ -572,6 +581,14 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene floatBanner.setVisibility(View.GONE); findViewById(R.id.banner_click).setVisibility(View.GONE); } + if (data.getShowRedPacket() == 0) { + floatRedPacket.setVisibility(View.GONE); + } else { + floatRedPacket.setVisibility(View.VISIBLE); + ((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setMax(data.getRedPacketTotal()); + ((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setProgress(data.getRedPacketNum()); + ((TextView) floatRedPacket.findViewById(R.id.progressText)).setText(data.getRedPacketNum() + "/" + data.getRedPacketTotal()); + } } @@ -832,9 +849,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene //获取指导员引导逻辑 NoviceInstructorManager.get(mContext).getNoviceInstructor(); NoviceInstructorManager.get(mContext).checktHomeZdyPop(); - if (!isFirst) { - initAnchorRecommendBanner(); - } + initAnchorRecommendBanner(); } /** @@ -1232,6 +1247,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } else { isfloatBannernet = false; floatBanner.setVisibility(View.GONE); + floatRedPacket.setVisibility(View.GONE); findViewById(R.id.banner_click).setVisibility(View.GONE); } } @@ -1374,4 +1390,15 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } } + private void initRedPacket() { + ImageView title = floatRedPacket.findViewById(R.id.title); + if (WordUtil.isNewZh()) { + title.setImageResource(R.mipmap.icon_red_packet_float_text_zh); + } else { + title.setImageResource(R.mipmap.icon_red_packet_float_text_en); + } + floatRedPacket.setOnClickListener(v -> { + mainHomeViewHolder.setCurPosition(3); + }); + } } diff --git a/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java b/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java index 2d85ea59b..f2029490b 100644 --- a/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java @@ -65,6 +65,10 @@ public class MyWalletActivity extends AbsActivity { GoogleBillingUtilNew.getInstance().initGooglePay(mContext); vp_content = (ViewPager) findViewById(R.id.vp_content); TextView rView = (TextView) findViewById(R.id.rView); + findViewById(R.id.redPacketMain).setVisibility(View.VISIBLE); + findViewById(R.id.redPacketMain).setOnClickListener(v -> { + RouteUtil.forwardRedPacketList(); + }); rView.setOnClickListener(v -> { LoadingDialog loadingDialog = new LoadingDialog(); loadingDialog.show(getSupportFragmentManager(), "LoadingDialog"); diff --git a/main/src/main/java/com/yunbao/main/activity/RedPacketInfoActivity.java b/main/src/main/java/com/yunbao/main/activity/RedPacketInfoActivity.java new file mode 100644 index 000000000..68271b00e --- /dev/null +++ b/main/src/main/java/com/yunbao/main/activity/RedPacketInfoActivity.java @@ -0,0 +1,82 @@ +package com.yunbao.main.activity; + +import android.annotation.SuppressLint; +import android.content.Intent; +import android.graphics.Color; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.bean.RedPacketListBean; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.main.R; + +@Route(path = RouteUtil.PATH_RED_PACKET_INFO) +public class RedPacketInfoActivity extends AbsActivity implements View.OnClickListener { + private RedPacketListBean bean; + private ImageView icon; + private ImageView gold; + private TextView title; + private TextView money; + private TextView status; + private TextView info; + private TextView time; + private TextView model; + private TextView backAccountText; + + @Override + protected int getLayoutId() { + return R.layout.activity_red_packet_info; + } + + @SuppressLint("SetTextI18n") + @Override + protected void main() { + super.main(); + bean = (RedPacketListBean) getIntent().getSerializableExtra("bean"); + icon = findViewById(R.id.icon); + title = findViewById(R.id.title); + money = findViewById(R.id.money); + status = findViewById(R.id.red_packet_status); + info = findViewById(R.id.red_packet_info); + time = findViewById(R.id.red_packet_timer); + model = findViewById(R.id.red_packet_model); + gold = findViewById(R.id.gold_icon); + backAccountText = findViewById(R.id.backAccountText); + findViewById(R.id.btn_back).setOnClickListener(this); + info.setOnClickListener(this); + + title.setText(bean.getLiveNicename()); + time.setText(bean.getCreateTime()); + + money.setText("-" + bean.getAmountDiamond()); + money.setTextColor(Color.parseColor("#000000")); + icon.setImageResource(R.mipmap.diamond); + + if (bean.getCurrentStatus() == RedPacketListBean.RED_PACKET_CURRENT_STATUS_SUCCESS) { + status.setText(R.string.red_packet_info_status_success); + } else { + status.setText(R.string.red_packet_info_status_timeout); + } + if (bean.getAmountRefund() == 0) { + gold.setVisibility(View.GONE); + backAccountText.setText(R.string.red_packet_info_residue_none); + } else { + gold.setVisibility(View.VISIBLE); + backAccountText.setText(mContext.getString(R.string.red_packet_info_residue_back) + " +" + bean.getAmountRefund()); + } + } + + @Override + public void onClick(View v) { + int id = v.getId(); + if (id == R.id.red_packet_info) { + RouteUtil.forwardRedPacketUser(bean.getId()); + } else if (id == R.id.btn_back) { + finish(); + } + } +} diff --git a/main/src/main/java/com/yunbao/main/activity/RedPacketListActivity.java b/main/src/main/java/com/yunbao/main/activity/RedPacketListActivity.java new file mode 100644 index 000000000..36338fd3e --- /dev/null +++ b/main/src/main/java/com/yunbao/main/activity/RedPacketListActivity.java @@ -0,0 +1,55 @@ +package com.yunbao.main.activity; + +import android.widget.TextView; + +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.bean.RedPacketListBean; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.main.R; +import com.yunbao.main.adapter.RedPacketListRecyclerAdapter; + +import java.util.List; + +@Route(path = RouteUtil.PATH_RED_PACKET_LIST) +public class RedPacketListActivity extends AbsActivity { + private RecyclerView recyclerView; + private RedPacketListRecyclerAdapter adapter; + + @Override + protected int getLayoutId() { + return R.layout.activity_red_packet; + } + + @Override + public void main() { + super.main(); + ((TextView) findViewById(R.id.titleView)).setText(mContext.getString(R.string.red_packet_list_title)); + recyclerView = findViewById(R.id.recyclerView); + + adapter = new RedPacketListRecyclerAdapter(this); + recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); + recyclerView.setAdapter(adapter); + initData(); + } + + private void initData() { + LiveNetManager.get(mContext) + .getRedPacketList(new HttpCallback>() { + @Override + public void onSuccess(List data) { + adapter.setList(data); + } + + @Override + public void onError(String error) { + + } + }); + } +} diff --git a/main/src/main/java/com/yunbao/main/activity/RedPacketUsersActivity.java b/main/src/main/java/com/yunbao/main/activity/RedPacketUsersActivity.java new file mode 100644 index 000000000..083a4f309 --- /dev/null +++ b/main/src/main/java/com/yunbao/main/activity/RedPacketUsersActivity.java @@ -0,0 +1,88 @@ +package com.yunbao.main.activity; + +import android.annotation.SuppressLint; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.makeramen.roundedimageview.RoundedImageView; +import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.bean.RedPacketDetailsBean; +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.RouteUtil; +import com.yunbao.main.R; +import com.yunbao.main.adapter.RedPacketUserRecyclerAdapter; + +@Route(path = RouteUtil.PATH_RED_PACKET_USER) +public class RedPacketUsersActivity extends AbsActivity implements View.OnClickListener{ + private RecyclerView recyclerView; + private RedPacketUserRecyclerAdapter adapter; + private int redPacketId; + + private RoundedImageView avatar; + private TextView title; + private TextView money; + private ImageView icon; + private TextView open; + + + @Override + protected int getLayoutId() { + return R.layout.activity_red_packet_users; + } + + @Override + protected void main() { + super.main(); + findViewById(R.id.btn_back).setOnClickListener(this); + recyclerView = findViewById(R.id.recyclerView); + avatar = findViewById(R.id.avatar); + title = findViewById(R.id.title); + money = findViewById(R.id.money); + icon = findViewById(R.id.avatar); + open = findViewById(R.id.open_packet); + redPacketId=getIntent().getIntExtra("id",0); + adapter = new RedPacketUserRecyclerAdapter(this); + recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); + recyclerView.setAdapter(adapter); + initData(); + } + + @Override + public void onClick(View v) { + int id=v.getId(); + if(id==R.id.btn_back){ + finish(); + } + } + private void initData() { + LiveNetManager.get(mContext) + .getRedPacketUserList(redPacketId, new HttpCallback() { + @Override + public void onSuccess(RedPacketDetailsBean data) { + setData(data); + adapter.setList(data.getDetails()); + } + + @Override + public void onError(String error) { + + } + }); + + } + @SuppressLint("SetTextI18n") + private void setData(RedPacketDetailsBean bean){ + ImgLoader.display(mContext,bean.getAvatarThumb(),avatar); + title.setText(bean.getNiceName()); + money.setText(bean.getMoney()+""); + open.setText(mContext.getString(R.string.red_packet_user_tips)+" "+bean.getAlready()+"/"+bean.getQuantity()); + + } +} diff --git a/main/src/main/java/com/yunbao/main/adapter/MainHomeRemFollLiveAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainHomeRemFollLiveAdapter.java index 461ec6c9f..5a6110abf 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainHomeRemFollLiveAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainHomeRemFollLiveAdapter.java @@ -79,9 +79,11 @@ public class MainHomeRemFollLiveAdapter extends RefreshAdapter { ImageView dr_pk_ico; View views; ImageView bgs; + private View redPacket; public Vh(View itemView) { super(itemView); + redPacket = itemView.findViewById(R.id.red_packet); live_info_view = (LinearLayout) itemView.findViewById(R.id.live_info_view); mCover = (ImageView) itemView.findViewById(R.id.cover); mName = (TextView) itemView.findViewById(R.id.name); @@ -220,6 +222,11 @@ public class MainHomeRemFollLiveAdapter extends RefreshAdapter { if (bean.getIs_week() != null && bean.getIs_week().equals("1")) { views.setVisibility(View.GONE); } + if (bean.getRedPacketStatus() == 1) { + redPacket.setVisibility(View.VISIBLE); + } else { + redPacket.setVisibility(View.GONE); + } } } diff --git a/main/src/main/java/com/yunbao/main/adapter/RedPacketListRecyclerAdapter.java b/main/src/main/java/com/yunbao/main/adapter/RedPacketListRecyclerAdapter.java new file mode 100644 index 000000000..3dfa1bc92 --- /dev/null +++ b/main/src/main/java/com/yunbao/main/adapter/RedPacketListRecyclerAdapter.java @@ -0,0 +1,77 @@ +package com.yunbao.main.adapter; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.graphics.Color; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.bean.RedPacketListBean; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.main.R; + +import java.util.ArrayList; +import java.util.List; + +public class RedPacketListRecyclerAdapter extends RecyclerView.Adapter { + private List list; + private Context mContext; + + public RedPacketListRecyclerAdapter(Context mContext) { + this.mContext = mContext; + this.list=new ArrayList<>(); + } + + public void setList(List list) { + this.list = list; + notifyDataSetChanged(); + } + + @NonNull + @Override + public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new ItemViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_red_packet, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) { + holder.setData(list.get(position)); + } + + @Override + public int getItemCount() { + return list.size(); + } + + public class ItemViewHolder extends RecyclerView.ViewHolder { + private TextView title, timer, money; + private ImageView icon; + + public ItemViewHolder(@NonNull View itemView) { + super(itemView); + title = itemView.findViewById(R.id.title); + timer = itemView.findViewById(R.id.time); + money = itemView.findViewById(R.id.money); + icon = itemView.findViewById(R.id.icon); + itemView.setOnClickListener(v -> { + RouteUtil.forwardRedPacketInfo((RedPacketListBean) itemView.getTag()); + }); + } + + @SuppressLint("SetTextI18n") + private void setData(RedPacketListBean bean) { + title.setText(bean.getLiveNicename()+"|"+bean.getId()); + timer.setText(bean.getCreateTime()); + money.setText("-" + bean.getAmountDiamond()); + money.setTextColor(Color.parseColor("#000000")); + icon.setImageResource(R.mipmap.diamond); + itemView.setTag(bean); + } + } +} diff --git a/main/src/main/java/com/yunbao/main/adapter/RedPacketUserRecyclerAdapter.java b/main/src/main/java/com/yunbao/main/adapter/RedPacketUserRecyclerAdapter.java new file mode 100644 index 000000000..ddd7b1dbf --- /dev/null +++ b/main/src/main/java/com/yunbao/main/adapter/RedPacketUserRecyclerAdapter.java @@ -0,0 +1,74 @@ +package com.yunbao.main.adapter; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.makeramen.roundedimageview.RoundedImageView; +import com.yunbao.common.bean.RedPacketDetailsBean; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.main.R; + +import java.util.ArrayList; +import java.util.List; + +public class RedPacketUserRecyclerAdapter extends RecyclerView.Adapter { + private List list; + private Context mContext; + + public RedPacketUserRecyclerAdapter(Context mContext) { + this.mContext = mContext; + list = new ArrayList<>(); + } + + public void setList(List list) { + if (list != null) { + this.list = list; + } + notifyDataSetChanged(); + } + + @NonNull + @Override + public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new ItemViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_user_red_packet, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) { + holder.setData(list.get(position)); + } + + @Override + public int getItemCount() { + return list.size(); + } + + public class ItemViewHolder extends RecyclerView.ViewHolder { + private TextView title, timer, money; + private RoundedImageView icon; + + public ItemViewHolder(@NonNull View itemView) { + super(itemView); + title = itemView.findViewById(R.id.title); + timer = itemView.findViewById(R.id.time); + money = itemView.findViewById(R.id.money); + icon = itemView.findViewById(R.id.avatar); + } + + @SuppressLint("SetTextI18n") + private void setData(RedPacketDetailsBean.Detail bean) { + title.setText(bean.getNiceName()); + timer.setText(bean.getTime()); + money.setText(bean.getMoney()+""); + ImgLoader.display(mContext,bean.getAvatarThumb(),icon); + itemView.setTag(bean); + } + } +} diff --git a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java index 5283180ca..0dd121ac5 100644 --- a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java +++ b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java @@ -159,6 +159,13 @@ public class MainHttpUtil { .execute(callback); } + /** + * 首页红包专区 + */ + public static void getRedPacket(int p, HttpCallback callback) { + HttpClient.getInstance().get("Home.getRedPacket", MainHttpConsts.GET_RANDOM) + .execute(callback); + } /** * 首页 diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeLiveItemViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeLiveItemViewHolder.java index 740648c33..d852d4bec 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeLiveItemViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeLiveItemViewHolder.java @@ -32,6 +32,7 @@ public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder { private ImageView mCover, liveType, mLiveIco, mType, pkico, drPkIco, pkAvatar, viewBg; private ImageView bgs; private View views; + private View redPacket; private TextView mLiveState, mTitle, mName, mNum; public MainHomeLiveItemViewHolder(@NonNull View itemView) { @@ -40,6 +41,7 @@ public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder { itemView.findViewById(R.id.live_info_view).setVisibility(View.VISIBLE); itemView.findViewById(R.id.lt_week_list).setVisibility(View.GONE); mCover = itemView.findViewById(R.id.cover); + redPacket = itemView.findViewById(R.id.red_packet); bgs = itemView.findViewById(R.id.bgs); liveType = itemView.findViewById(R.id.live_type); views = itemView.findViewById(R.id.views); @@ -147,6 +149,11 @@ public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder { } else { viewBg.setVisibility(View.GONE); } + if (bean.getRedPacketStatus() == 1) { + redPacket.setVisibility(View.VISIBLE); + } else { + redPacket.setVisibility(View.GONE); + } RxView.clicks(itemView) .throttleFirst(2, TimeUnit.SECONDS) // 才发送 2s内第1次点击按钮的事件 .subscribe(new Observer() { diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeLiveWeekItemViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeLiveWeekItemViewHolder.java index 7c00a8cb9..237223194 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeLiveWeekItemViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeLiveWeekItemViewHolder.java @@ -46,6 +46,7 @@ public class MainHomeLiveWeekItemViewHolder extends RecyclerView.ViewHolder { private List weekList = new ArrayList<>(); //轮询周星榜的下标 private int index = 0; + private View redPacket; public MainHomeLiveWeekItemViewHolder(@NonNull View itemView) { super(itemView); @@ -53,6 +54,7 @@ public class MainHomeLiveWeekItemViewHolder extends RecyclerView.ViewHolder { itemView.findViewById(R.id.live_info_view).setVisibility(View.GONE); itemView.findViewById(R.id.lt_week_list).setVisibility(View.VISIBLE); imgWeekHead = itemView.findViewById(R.id.img_week_head); + redPacket=itemView.findViewById(R.id.red_packet); weekSvga = (SVGAImageView) itemView.findViewById(R.id.week_svga); viewflipperBanner = itemView.findViewById(R.id.viewflipper_banner); imgWeekHead.setVisibility(View.GONE); @@ -119,6 +121,11 @@ public class MainHomeLiveWeekItemViewHolder extends RecyclerView.ViewHolder { } bannerHandler.removeCallbacks(mFlipRunnable); bannerHandler.postDelayed(mFlipRunnable, delayMillis); + if (bean.getRedPacketStatus() == 1) { + redPacket.setVisibility(View.VISIBLE); + } else { + redPacket.setVisibility(View.GONE); + } RxView.clicks(itemView) .throttleFirst(2, TimeUnit.SECONDS) // 才发送 2s内第1次点击按钮的事件 .subscribe(new Observer() { diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeRedPacketLiveViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeRedPacketLiveViewHolder.java new file mode 100644 index 000000000..a8bad6643 --- /dev/null +++ b/main/src/main/java/com/yunbao/main/views/MainHomeRedPacketLiveViewHolder.java @@ -0,0 +1,178 @@ +package com.yunbao.main.views; + +import android.content.Context; +import android.view.ViewGroup; + +import androidx.recyclerview.widget.GridLayoutManager; + +import com.alibaba.fastjson.JSON; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.Constants; +import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.common.bean.AnchorRecommendModel; +import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.custom.CommonRefreshView; +import com.yunbao.common.custom.ItemDecoration; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.main.R; +import com.yunbao.main.activity.MainActivity; +import com.yunbao.main.activity.WeekWebViewActivity; +import com.yunbao.main.adapter.MainHomeRemFollLiveAdapter; +import com.yunbao.main.http.MainHttpConsts; +import com.yunbao.main.http.MainHttpUtil; + +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 首页红包专区 + */ +public class MainHomeRedPacketLiveViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener { + private CommonRefreshView mRefreshView; + private MainHomeRemFollLiveAdapter mAdapter; + + public MainHomeRedPacketLiveViewHolder(Context context, ViewGroup parentView) { + super(context, parentView); + + } + + @Override + protected int getLayoutId() { + return R.layout.view_main_home_live_recom; + } + + public static int pp; + + //显示顶部商城tab时,显示底部tabGroup + @Subscribe(threadMode = ThreadMode.MAIN) + public void onUpdata(String str) { + if ("Updata".equals(str)) { + if (mRefreshView != null) { + mRefreshView.showRefreshBar(); + mRefreshView.mRecyclerView.scrollToPosition(0); + } + }else if ("blacklist".equals(str)) { + if (mRefreshView != null) { + mRefreshView.showRefreshBar(); + } + } + } + + @Override + public void init() { + + mRefreshView = (CommonRefreshView) findViewById(R.id.refreshView); + mRefreshView.setEmptyLayoutId(R.layout.view_no_data_live); + EventBus.getDefault().register(this); + GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 2, GridLayoutManager.VERTICAL, false); + mRefreshView.setLayoutManager(gridLayoutManager); + ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 5, 0); + decoration.setOnlySetItemOffsetsButNoDraw(true); + mRefreshView.setItemDecoration(decoration); + mRefreshView.setRecyclerViewAdapter(mAdapter); + mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() { + @Override + public RefreshAdapter getAdapter() { + if (mAdapter == null) { + mAdapter = new MainHomeRemFollLiveAdapter(mContext, MainActivity.Height); + mAdapter.setOnItemClickListener(MainHomeRedPacketLiveViewHolder.this); + } + return mAdapter; + } + + @Override + public void loadData(int p, HttpCallback callback) { + pp = p; + MainHttpUtil.getRedPacket(p, callback); + } + + @Override + public List processData(String[] info) { + if(pp == 1){ + return JSON.parseArray(Arrays.toString(info), LiveBean.class); + }else{ + return null; + } + } + + @Override + public void onRefreshSuccess(List list, int count) { + EventBus.getDefault().post(new AnchorRecommendModel()); + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { + + } + + @Override + public void onLoadMoreFailure() { + + } + }); + + mRefreshView.initData(); + + + } + + + + + + @Override + public void onItemClick(LiveBean bean, int position) { + if ("1".equals(bean.getIslive())) { + Map map = bean.getParams(); + if(map==null){ + map=new HashMap<>(); + } + map.put("redPacket","true"); + bean.setParams(map); + watchLive(bean, Constants.LIVE_HOME, position); + }else if(bean.getIs_week()!=null&&bean.getIs_week().equals("1")){ + String url = CommonAppConfig.HOST + bean.getUrl()+"?a=1"; + WeekWebViewActivity.forward(mContext, url, true); + } else { + RouteUtil.forwardUserHome(mContext, bean.getUid(),0); + } + } + + @Override + public void loadData() { +// if (mRefreshView != null) { +// mRefreshView.initData(); +// } + } + + @Override + public void release() { + MainHttpUtil.cancel(MainHttpConsts.GET_RANDOM); + + } + + @Override + public void onDestroy() { + super.onDestroy(); + release(); + } + + @Override + public void onResume() { + super.onResume(); + + } +} diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java index fcfa2000a..f04befa48 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java @@ -1,13 +1,15 @@ package com.yunbao.main.views; import android.content.Context; +import android.content.Intent; +import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; import com.yunbao.common.glide.ImgLoader; -import com.yunbao.common.utils.WordUtil; import com.yunbao.main.R; +import com.yunbao.main.activity.RedPacketListActivity; /** * Created by cxf on 2018/9/22. @@ -18,6 +20,7 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder { private MainHomeFollLiveViewHolder mainHomeFollLiveViewHolder; private MainHomeLiveViewHolder mainHomeLiveViewHolder; private MainHomeRecomLiveViewHolder mainHomeRecomLiveViewHolder; + private MainHomeRedPacketLiveViewHolder mainHomeRedPacketLiveViewHolder; private ImageView img_trophy; @@ -40,6 +43,9 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder { + } + public void setCurPosition(int position){ + mViewPager.setCurrentItem(position); } @Override @@ -64,6 +70,9 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder { } else if (position == 2) { mainHomeRecomLiveViewHolder = new MainHomeRecomLiveViewHolder(mContext, parent); vh = mainHomeRecomLiveViewHolder; + } else if (position == 3) { + mainHomeRedPacketLiveViewHolder = new MainHomeRedPacketLiveViewHolder(mContext, parent); + vh = mainHomeRedPacketLiveViewHolder; } if (vh == null) { @@ -81,7 +90,7 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder { @Override protected int getPageCount() { - return 3; + return 4; } @Override @@ -90,6 +99,7 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder { mContext.getString(R.string.follow), mContext.getString(R.string.hot), mContext.getString(R.string.recomment), + mContext.getString(R.string.main_tabs_red_packet), }; } diff --git a/main/src/main/res/drawable/bg_float_red_packet.xml b/main/src/main/res/drawable/bg_float_red_packet.xml new file mode 100644 index 000000000..5470ff1b1 --- /dev/null +++ b/main/src/main/res/drawable/bg_float_red_packet.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/layout/activity_red_packet.xml b/main/src/main/res/layout/activity_red_packet.xml new file mode 100644 index 000000000..b2430f744 --- /dev/null +++ b/main/src/main/res/layout/activity_red_packet.xml @@ -0,0 +1,38 @@ + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/layout/activity_red_packet_info.xml b/main/src/main/res/layout/activity_red_packet_info.xml new file mode 100644 index 000000000..8c397a9cc --- /dev/null +++ b/main/src/main/res/layout/activity_red_packet_info.xml @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/layout/activity_red_packet_users.xml b/main/src/main/res/layout/activity_red_packet_users.xml new file mode 100644 index 000000000..f100b3e63 --- /dev/null +++ b/main/src/main/res/layout/activity_red_packet_users.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/layout/item_main_home_lives.xml b/main/src/main/res/layout/item_main_home_lives.xml index a9649e8ac..3bb1b799c 100644 --- a/main/src/main/res/layout/item_main_home_lives.xml +++ b/main/src/main/res/layout/item_main_home_lives.xml @@ -1,6 +1,7 @@ - - - + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="visible"> - - + android:layout_marginBottom="9dp" + android:paddingLeft="5dp"> - - - - - - + + + android:id="@+id/view_bg" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:scaleType="fitXY" + android:visibility="gone" /> - + android:layout_marginLeft="8dp" + android:layout_marginTop="8dp" + android:gravity="center" /> - + - + + + + + + + + + + + + + + + + + + + + + + + + + android:id="@+id/pk_ico" + android:layout_width="20dp" + android:layout_height="20dp" + android:layout_alignParentRight="true" + android:layout_alignParentBottom="true" + android:layout_marginRight="33dp" + android:layout_marginBottom="60dp" + android:src="@mipmap/live_pk" /> - - - - - - - - - - - - - - - - - + - + - + - - - + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> - + android:layout_marginBottom="9dp" + android:paddingLeft="5dp"> - + + + - + - - - + android:layout_alignParentBottom="true" + android:layout_marginLeft="10dp" + android:layout_marginRight="10dp" + android:orientation="vertical"> - + android:layout_marginLeft="6dp" + android:layout_marginBottom="12dp"> - + - - - + - + + + - + + + + + + + diff --git a/main/src/main/res/layout/view_float_red_packet.xml b/main/src/main/res/layout/view_float_red_packet.xml new file mode 100644 index 000000000..a9dc3e883 --- /dev/null +++ b/main/src/main/res/layout/view_float_red_packet.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/layout/view_homemain.xml b/main/src/main/res/layout/view_homemain.xml index 175475a58..981e0b6f7 100644 --- a/main/src/main/res/layout/view_homemain.xml +++ b/main/src/main/res/layout/view_homemain.xml @@ -1,5 +1,6 @@ + android:visibility="gone" + tools:visibility="visible" /> + android:visibility="gone" + tools:visibility="visible" /> + +