Merge remote-tracking branch 'origin/dev_red_packet'
# Conflicts: # common/src/main/java/com/yunbao/common/http/PDLiveApi.java # common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java # common/src/main/res/values/strings.xml
This commit is contained in:
@@ -179,10 +179,12 @@ public class Constants {
|
||||
public static final String CUSTOM_FULL_SERVICE_NOTIFY = "customFullServiceNotify";//全服通知
|
||||
public static final String XYD_COMPLETE = "XydComplete";//心愿单完成通知
|
||||
public static final String WISH_LIST_PROGRESS = "wishListProgress";//心愿单进度通知
|
||||
public static final String LIVE_VOTE_CREATE="createVote";
|
||||
public static final String LIVE_VOTE_UPDATE="updateVote";
|
||||
public static final String LIVE_VOTE_END="endVote";
|
||||
public static final String LIVE_PK_END="endPK";//结束PK,以这个PK获取到的参数为准
|
||||
public static final String LIVE_VOTE_CREATE = "createVote";
|
||||
public static final String LIVE_VOTE_UPDATE = "updateVote";
|
||||
public static final String LIVE_VOTE_END = "endVote";
|
||||
public static final String LIVE_PK_END = "endPK";//结束PK,以这个PK获取到的参数为准
|
||||
public static final String RED_PACKET = "RedPacket";//红包通知
|
||||
public static final String RED_PACKET_SUPER_JACKPOT = "RedPacketSuperJackpot";//超级红包通知
|
||||
|
||||
//游戏socket
|
||||
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花
|
||||
|
||||
@@ -103,9 +103,20 @@ public class EnterRoomInfoModel extends BaseModel {
|
||||
@SerializedName("anchor_goodnum")
|
||||
private String anchorGoodnum;
|
||||
@SerializedName("jackpot_level")
|
||||
private String jackpotLevel="-1";
|
||||
private String jackpotLevel = "-1";
|
||||
@SerializedName("live_vote")
|
||||
private LiveRoomVoteModel voteModel;
|
||||
@SerializedName("red_packet")
|
||||
private RedPacketModel redPacketModel;
|
||||
|
||||
public RedPacketModel getRedPacketModel() {
|
||||
return redPacketModel;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setRedPacketModel(RedPacketModel redPacketModel) {
|
||||
this.redPacketModel = redPacketModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getJackpotLevel() {
|
||||
|
||||
@@ -486,8 +497,8 @@ public class EnterRoomInfoModel extends BaseModel {
|
||||
}
|
||||
|
||||
public String getIsconnection() {
|
||||
if(StringUtil.isEmpty(isconnection)){
|
||||
isconnection="0";
|
||||
if (StringUtil.isEmpty(isconnection)) {
|
||||
isconnection = "0";
|
||||
}
|
||||
return isconnection;
|
||||
}
|
||||
@@ -498,8 +509,8 @@ public class EnterRoomInfoModel extends BaseModel {
|
||||
}
|
||||
|
||||
public String getIsleave() {
|
||||
if(StringUtil.isEmpty(isleave)){
|
||||
isleave="0";
|
||||
if (StringUtil.isEmpty(isleave)) {
|
||||
isleave = "0";
|
||||
}
|
||||
return isleave;
|
||||
}
|
||||
|
||||
@@ -357,4 +357,8 @@ public class MsgModel extends BaseModel {
|
||||
public void setSystem_bubble(String system_bubble) {
|
||||
this.system_bubble = system_bubble;
|
||||
}
|
||||
|
||||
/**
|
||||
* 红包
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 红包随机礼物
|
||||
*/
|
||||
public class RedPacketGiftModel extends BaseModel {
|
||||
/**
|
||||
* {
|
||||
* "id": 210,
|
||||
* "giftname": "玫瑰",
|
||||
* "needcoin": 20,
|
||||
* "gifticon": "https://downs.yaoulive.com/603f25d9aa969.png"
|
||||
* }
|
||||
*/
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("giftname")
|
||||
private String giftname;
|
||||
@SerializedName("needcoin")
|
||||
private String needcoin;
|
||||
@SerializedName("gifticon")
|
||||
private String gifticon;
|
||||
@SerializedName("gift_num")
|
||||
private String giftNum;
|
||||
@SerializedName("user_nicename")
|
||||
private String userNicename;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGiftname() {
|
||||
return giftname;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setGiftname(String giftname) {
|
||||
this.giftname = giftname;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNeedcoin() {
|
||||
return needcoin;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setNeedcoin(String needcoin) {
|
||||
this.needcoin = needcoin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGifticon() {
|
||||
return gifticon;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setGifticon(String gifticon) {
|
||||
this.gifticon = gifticon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGiftNum() {
|
||||
return giftNum;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setGiftNum(String giftNum) {
|
||||
this.giftNum = giftNum;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserNicename() {
|
||||
return userNicename;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setUserNicename(String userNicename) {
|
||||
this.userNicename = userNicename;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 红包信息
|
||||
*/
|
||||
public class RedPacketInfoModel extends BaseModel {
|
||||
|
||||
@SerializedName("liveuid")
|
||||
private String liveuid;
|
||||
@SerializedName("uid")
|
||||
private String uid;
|
||||
@SerializedName("amount_diamond")
|
||||
private String amountDiamond;
|
||||
@SerializedName("red_packet_money")
|
||||
private String redPacketMoney;
|
||||
@SerializedName("red_packet_quantity")
|
||||
private String redPacketQuantity;
|
||||
@SerializedName("conditions")
|
||||
private String conditions;
|
||||
@SerializedName("create_time")
|
||||
private String createTime;
|
||||
@SerializedName("start_time")
|
||||
private String startTime;
|
||||
@SerializedName("end_time")
|
||||
private String endTime;
|
||||
@SerializedName("user_id")
|
||||
private String userId;
|
||||
@SerializedName("user_nicename")
|
||||
private String userNicename;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
@SerializedName("avatar_thumb")
|
||||
private String avatarThumb;
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("user_exists")
|
||||
private String userExists;
|
||||
@SerializedName("is_attention")
|
||||
private String isAttention;
|
||||
//0.未领取到 1.领取但是没抢过东西 2.已经领抢到东西
|
||||
@SerializedName("receive_status")
|
||||
private String receiveStatus;
|
||||
//超级红包ID
|
||||
@SerializedName("super_jackpot_id")
|
||||
private String superJackpotId;
|
||||
|
||||
public String getSuperJackpotId() {
|
||||
return superJackpotId;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setSuperJackpotId(String superJackpotId) {
|
||||
this.superJackpotId = superJackpotId;
|
||||
return this;
|
||||
}
|
||||
|
||||
//是否超级红包
|
||||
private boolean isSuperJackpot = false;
|
||||
|
||||
public boolean isSuperJackpot() {
|
||||
return isSuperJackpot;
|
||||
}
|
||||
|
||||
//红包id
|
||||
@SerializedName("red_packet_id")
|
||||
private String redPacketId;
|
||||
|
||||
public String getRedPacketId() {
|
||||
return redPacketId;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setRedPacketId(String redPacketId) {
|
||||
this.redPacketId = redPacketId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setSuperJackpot(boolean superJackpot) {
|
||||
isSuperJackpot = superJackpot;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsAttention() {
|
||||
return isAttention;
|
||||
}
|
||||
|
||||
|
||||
public RedPacketInfoModel setIsAttention(String isAttention) {
|
||||
this.isAttention = isAttention;
|
||||
return this;
|
||||
}
|
||||
|
||||
@SerializedName("user_golden_bean")
|
||||
private String userGoldenBean;
|
||||
|
||||
@SerializedName("red_packet_gift")
|
||||
private List<RedPacketGiftModel> packetGiftModels;
|
||||
@SerializedName("gift")
|
||||
private List<RedPacketGiftModel> giftModels;
|
||||
|
||||
public String getReceiveStatus() {
|
||||
return receiveStatus;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setReceiveStatus(String receiveStatus) {
|
||||
this.receiveStatus = receiveStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<RedPacketGiftModel> getGiftModels() {
|
||||
return giftModels;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setGiftModels(List<RedPacketGiftModel> giftModels) {
|
||||
this.giftModels = giftModels;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<RedPacketGiftModel> getPacketGiftModels() {
|
||||
return packetGiftModels;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setPacketGiftModels(List<RedPacketGiftModel> packetGiftModels) {
|
||||
this.packetGiftModels = packetGiftModels;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLiveuid() {
|
||||
return liveuid;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setLiveuid(String liveuid) {
|
||||
this.liveuid = liveuid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setUid(String uid) {
|
||||
this.uid = uid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAmountDiamond() {
|
||||
return amountDiamond;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setAmountDiamond(String amountDiamond) {
|
||||
this.amountDiamond = amountDiamond;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRedPacketMoney() {
|
||||
return redPacketMoney;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setRedPacketMoney(String redPacketMoney) {
|
||||
this.redPacketMoney = redPacketMoney;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRedPacketQuantity() {
|
||||
return redPacketQuantity;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setRedPacketQuantity(String redPacketQuantity) {
|
||||
this.redPacketQuantity = redPacketQuantity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getConditions() {
|
||||
return conditions;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setConditions(String conditions) {
|
||||
this.conditions = conditions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserNicename() {
|
||||
return userNicename;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setUserNicename(String userNicename) {
|
||||
this.userNicename = userNicename;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatarThumb() {
|
||||
return avatarThumb;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setAvatarThumb(String avatarThumb) {
|
||||
this.avatarThumb = avatarThumb;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserExists() {
|
||||
return userExists;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setUserExists(String userExists) {
|
||||
this.userExists = userExists;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserGoldenBean() {
|
||||
return userGoldenBean;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setUserGoldenBean(String userGoldenBean) {
|
||||
this.userGoldenBean = userGoldenBean;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class RedPacketModel extends BaseModel {
|
||||
//是否展示
|
||||
@SerializedName("is_show")
|
||||
private int isShow;
|
||||
//正在进行的红包数量
|
||||
@SerializedName("red_packet_count")
|
||||
private int redPacketCount;
|
||||
//正在进行的红包总数量
|
||||
@SerializedName("red_packet_quantity")
|
||||
private int redPacketQuantity;
|
||||
//当前红包剩余数量
|
||||
@SerializedName("red_packet_remain")
|
||||
private int redPacketRemain;
|
||||
//红包倒计时
|
||||
@SerializedName("countdown")
|
||||
private int countdown;
|
||||
//红包id
|
||||
@SerializedName("red_packet_id")
|
||||
private String redPacketId;
|
||||
//红包领取条件
|
||||
@SerializedName("conditions")
|
||||
private int conditions;
|
||||
|
||||
|
||||
|
||||
public int getIsShow() {
|
||||
return isShow;
|
||||
}
|
||||
|
||||
public RedPacketModel setIsShow(int isShow) {
|
||||
this.isShow = isShow;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRedPacketCount() {
|
||||
return redPacketCount;
|
||||
}
|
||||
|
||||
public RedPacketModel setRedPacketCount(int redPacketCount) {
|
||||
this.redPacketCount = redPacketCount;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRedPacketQuantity() {
|
||||
return redPacketQuantity;
|
||||
}
|
||||
|
||||
public RedPacketModel setRedPacketQuantity(int redPacketQuantity) {
|
||||
this.redPacketQuantity = redPacketQuantity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRedPacketRemain() {
|
||||
return redPacketRemain;
|
||||
}
|
||||
|
||||
public RedPacketModel setRedPacketRemain(int redPacketRemain) {
|
||||
this.redPacketRemain = redPacketRemain;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getCountdown() {
|
||||
return countdown;
|
||||
}
|
||||
|
||||
public RedPacketModel setCountdown(int countdown) {
|
||||
this.countdown = countdown;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRedPacketId() {
|
||||
return redPacketId;
|
||||
}
|
||||
|
||||
public RedPacketModel setRedPacketId(String redPacketId) {
|
||||
this.redPacketId = redPacketId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getConditions() {
|
||||
return conditions;
|
||||
}
|
||||
|
||||
public RedPacketModel setConditions(int conditions) {
|
||||
this.conditions = conditions;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,8 @@ 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.RedPacketGiftModel;
|
||||
import com.yunbao.common.bean.RedPacketInfoModel;
|
||||
import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
@@ -753,4 +755,69 @@ public interface PDLiveApi {
|
||||
@GET("/api/public/?service=Home.getRedPacket")
|
||||
Observable<ResponseModel<List<AnchorRecommendItemModel>>> getRedPacket();
|
||||
|
||||
|
||||
/**
|
||||
* 获取盲盒礼物当前数据
|
||||
*/
|
||||
@GET("/api/public/?service=Live.createRedPacket")
|
||||
Observable<ResponseModel<Object>> createRedPacket(
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("red_packet_money") String redPacketMoney,
|
||||
@Query("red_packet_quantity") String redPacketQuantity,
|
||||
@Query("conditions") String conditions
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取盲盒礼物当前数据
|
||||
*/
|
||||
@GET("/api/public/?service=Live.redPacketInfo")
|
||||
Observable<ResponseModel<RedPacketInfoModel>> redPacketInfo(
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("red_packet_id") String redPacketId
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* 获取盲盒礼物当前数据
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getRedPacket")
|
||||
Observable<ResponseModel<RedPacketInfoModel>> getRedPacket(
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("stream") String stream,
|
||||
@Query("red_packet_id") String redPacketId
|
||||
);
|
||||
|
||||
/**
|
||||
* 超级红包打开接口
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getRedPacketSuperPrize")
|
||||
Observable<ResponseModel<RedPacketInfoModel>> getRedPacketSuperPrize(
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("super_jackpot_id") String superJackpotId
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取普通红包的领取记录
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getRedPacketReceive")
|
||||
Observable<ResponseModel<List<RedPacketGiftModel>>> getRedPacketReceive(
|
||||
@Query("red_packet_id") String redPacketId
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取普通红包的领取记录
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getRedPacketSuperPrizeReceive")
|
||||
Observable<ResponseModel<List<RedPacketGiftModel>>> getRedPacketSuperPrizeReceive(
|
||||
@Query("super_jackpot_id") String superJackpotId
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取普通红包的领取记录
|
||||
*/
|
||||
@GET("/api/public/?service=Live.endRedPacket")
|
||||
Observable<ResponseModel<Object>> endRedPacket(
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("red_packet_id") String redPacketId
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ 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.RedPacketGiftModel;
|
||||
import com.yunbao.common.bean.RedPacketInfoModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.UserAreaBean;
|
||||
@@ -1600,6 +1602,169 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建红包
|
||||
*
|
||||
* @param liveUid 直播间id
|
||||
* @param redPacketMoney 红包金额
|
||||
* @param redPacketQuantity 红包数量
|
||||
* @param conditions 红包领取条件 0.无 1.关注主播
|
||||
*/
|
||||
public void createRedPacket(String liveUid, String redPacketMoney, String redPacketQuantity, String conditions, HttpCallback<String> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.createRedPacket(liveUid, redPacketMoney, redPacketQuantity, conditions)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<Object>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<Object> objectResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(objectResponseModel.getData().getMsg());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 红包信息
|
||||
*
|
||||
* @param liveUid 直播间id
|
||||
* @param redPacketId 红包id
|
||||
*/
|
||||
public void redPacketInfo(String liveUid, String redPacketId, HttpCallback<RedPacketInfoModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.redPacketInfo(liveUid, redPacketId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(redPacketInfoModelResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(redPacketInfoModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}, throwable -> {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取红包
|
||||
*
|
||||
* @param liveUid 直播间id
|
||||
* @param redPacketId 红包id
|
||||
*/
|
||||
public void getRedPacket(String liveUid, String stream, String redPacketId, HttpCallback<RedPacketInfoModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getRedPacket(liveUid, stream, redPacketId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(redPacketInfoModelResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(redPacketInfoModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}, throwable -> {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getRedPacketSuperPrize(String liveUid, String superJackpotId, HttpCallback<RedPacketInfoModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getRedPacketSuperPrize(liveUid, superJackpotId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<RedPacketInfoModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<RedPacketInfoModel> redPacketInfoModelResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(redPacketInfoModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getRedPacketReceive(String redPacketId, HttpCallback<List<RedPacketGiftModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getRedPacketReceive(redPacketId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<RedPacketGiftModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<RedPacketGiftModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getRedPacketSuperPrizeReceive(String redPacketId, HttpCallback<List<RedPacketGiftModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getRedPacketSuperPrizeReceive(redPacketId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<RedPacketGiftModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<RedPacketGiftModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void endRedPacket(String liveUid,String redPacketId, HttpCallback<String> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.endRedPacket(liveUid, redPacketId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<Object>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<Object> objectResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess("");
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,7 @@ package com.yunbao.common.utils;
|
||||
public class TimeUtils {
|
||||
/**
|
||||
* 毫秒转秒
|
||||
*
|
||||
* @param duration 毫秒数
|
||||
* @return
|
||||
*/
|
||||
@@ -17,4 +18,53 @@ public class TimeUtils {
|
||||
toSecond = ((minute * 60) + second);
|
||||
return toSecond;
|
||||
}
|
||||
|
||||
//根据秒数转化为时分秒 00:00:00
|
||||
public static String getTime(int second) {
|
||||
if (second < 10) {
|
||||
return "" + second;
|
||||
}
|
||||
if (second < 60) {
|
||||
return "" + second;
|
||||
}
|
||||
if (second < 3600) {
|
||||
int minute = second / 60;
|
||||
second = second - minute * 60;
|
||||
if (minute < 10) {
|
||||
if (second < 10) {
|
||||
return "0" + minute + ":0" + second;
|
||||
}
|
||||
return "0" + minute + ":" + second;
|
||||
}
|
||||
if (second < 10) {
|
||||
return minute + ":0" + second;
|
||||
}
|
||||
return minute + ":" + second;
|
||||
}
|
||||
int hour = second / 3600;
|
||||
int minute = (second - hour * 3600) / 60;
|
||||
second = second - hour * 3600 - minute * 60;
|
||||
if (hour < 10) {
|
||||
if (minute < 10) {
|
||||
if (second < 10) {
|
||||
return "0" + hour + ":0" + minute + ":0" + second;
|
||||
}
|
||||
return "0" + hour + ":0" + minute + ":" + second;
|
||||
}
|
||||
if (second < 10) {
|
||||
return "0" + hour + minute + ":0" + second;
|
||||
}
|
||||
return "0" + hour + minute + ":" + second;
|
||||
}
|
||||
if (minute < 10) {
|
||||
if (second < 10) {
|
||||
return hour + ":0" + minute + ":0" + second;
|
||||
}
|
||||
return hour + ":0" + minute + ":" + second;
|
||||
}
|
||||
if (second < 10) {
|
||||
return hour + minute + ":0" + second;
|
||||
}
|
||||
return hour + minute + ":" + second;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.yunbao.common.views.weight;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
public class CircleProgress extends View {
|
||||
private Paint mPaint;
|
||||
private RectF mRectF;
|
||||
private int mCurrent = 1, mMax = 100;
|
||||
//圆弧(也可以说是圆环)的宽度
|
||||
private float mArcWidth =8;
|
||||
//控件的宽度
|
||||
private float mWidth;
|
||||
|
||||
public CircleProgress(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public CircleProgress(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public CircleProgress(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mPaint = new Paint();
|
||||
mPaint.setAntiAlias(true);
|
||||
mRectF = new RectF();
|
||||
}
|
||||
|
||||
public void setCurrent(int mCurrent) {
|
||||
this.mCurrent = mCurrent;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setMax(int mMax) {
|
||||
this.mMax = mMax;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
//getMeasuredWidth获取的是view的原始大小,也就是xml中配置或者代码中设置的大小
|
||||
//getWidth获取的是view最终显示的大小,这个大小不一定等于原始大小
|
||||
mWidth = getMeasuredWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
mPaint.setStyle(Paint.Style.STROKE);
|
||||
//设置圆弧的宽度(圆环的宽度)
|
||||
mPaint.setStrokeWidth(mArcWidth);
|
||||
mPaint.setColor(Color.parseColor("#FF98A2"));
|
||||
//大圆的半径
|
||||
float bigCircleRadius = mWidth / 2;
|
||||
//小圆的半径
|
||||
float smallCircleRadius = bigCircleRadius - mArcWidth;
|
||||
//绘制小圆
|
||||
canvas.drawCircle(bigCircleRadius, bigCircleRadius, smallCircleRadius, mPaint);
|
||||
mPaint.setColor(Color.parseColor("#FFF7CD"));
|
||||
mRectF.set(mArcWidth, mArcWidth, mWidth - mArcWidth, mWidth - mArcWidth);
|
||||
//绘制圆弧
|
||||
canvas.drawArc(mRectF, -90, mCurrent * 360 / mMax, false, mPaint);
|
||||
setBackgroundColor(Color.parseColor("#FD2D48"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1213,4 +1213,38 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="red_packet_info_residue_back">Return to account</string>
|
||||
<string name="red_packet_user_tips2">Popularity Red packet</string>
|
||||
<string name="main_tabs_red_packet">Red packets</string>
|
||||
<string name="save_popular_red_packets">攢人氣紅包</string>
|
||||
<string name="amount">金額</string>
|
||||
<string name="drill">鑚</string>
|
||||
<string name="conditions">條件</string>
|
||||
<string name="there_is_no">無</string>
|
||||
<string name="following_anchor">關注主播</string>
|
||||
<string name="red_envelope_rill">紅包%s鑚/個</string>
|
||||
<string name="total_consumption_of_drill">共計消耗%s鑚</string>
|
||||
<string name="top_up_now">去充值></string>
|
||||
<string name="range_range_is">范围区间为[%s]</string>
|
||||
<string name="red_packet_value">价值</string>
|
||||
<string name="red_packet_open">開</string>
|
||||
<string name="randomly_available">隨機可得</string>
|
||||
<string name="build_up_popularity">攢人氣</string>
|
||||
<string name="send_red_packet_illustrate1">1.在直播間發紅包有什麽好處?</string>
|
||||
<string name="send_red_packet_illustrate2">有紅包的直播間會給新增熱度,吸引更多用戶觀看直播</string>
|
||||
<string name="send_red_packet_illustrate3">2.紅包發給誰?</string>
|
||||
<string name="send_red_packet_illustrate4">紅包發出后,直播間所有用戶都可搶,包括自己</string>
|
||||
<string name="send_red_packet_illustrate5">3.紅包怎麽發?</string>
|
||||
<string name="send_red_packet_illustrate6">紅包同爲禮物,20%鑽石獎勵給主播,剩餘70%的鑽石會以【1鑽石=1金豆】的比列兌換成金豆塞進紅包内給直播間觀看領取,剩餘10%隨機包成鑽石禮物包進紅包裹,另平臺設有紅包目標任務,每連成一個目標,平臺將獎勵目標紅包 數總價值的2%開設超級獎池供所有目標用戶抽取</string>
|
||||
<string name="send_red_packet_illustrate7">4.未被領取的紅包如何處理?</string>
|
||||
<string name="send_red_packet_illustrate8">紅包打開后未被領取,以及主播下播后未打開的紅包,會退回您的賬戶</string>
|
||||
<string name="send_red_packet_illustrate9">5.搶到的紅包能幹嘛?</string>
|
||||
<string name="send_red_packet_illustrate10">搶到紅包所得金豆可用於平臺一切金豆行爲,不轉增,不可體現</string>
|
||||
<string name="congratulations_on_getting_the_red_envelope">恭喜搶到紅包</string>
|
||||
<string name="cred_envelope_obtained">獲得%s</string>
|
||||
<string name="view_lucky_viewers">查看幸運觀衆></string>
|
||||
<string name="anchor_his_heart">贈送主播禮物表達心意</string>
|
||||
<string name="red_packet_countdown">倒計時:%s</string>
|
||||
<string name="open_red_packet">待開紅包:%s</string>
|
||||
<string name="together_to_achieve_goal">來自%s的獎勵,齊心協力連成目標</string>
|
||||
<string name="red_too_bad">很遺憾</string>
|
||||
<string name="red_too_bad2">與紅包擦肩而過</string>
|
||||
<string name="check_out_your_luck">查看大家手氣</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user