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:
18401019693 2023-07-03 17:57:35 +08:00
commit 08bc6d554a
50 changed files with 2813 additions and 103 deletions

View File

@ -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";//炸金花

View File

@ -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;
}

View File

@ -357,4 +357,8 @@ public class MsgModel extends BaseModel {
public void setSystem_bubble(String system_bubble) {
this.system_bubble = system_bubble;
}
/**
* 红包
*/
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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
);
}

View File

@ -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();
}
/**
* 直播间取消网络请求
*/

View File

@ -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;
}
}

View File

@ -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"));
}
}

View File

@ -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>

View File

@ -1403,6 +1403,16 @@ public class LiveAudienceActivity extends LiveActivity {
manager.blindBoxAllServerNotify(event.getAllServerNotifyEvent());
}
break;
case RED_PACKET:
if (manager != null) {
manager.redPacketManage(event.getRedPacketModel());
}
break;
case RED_PACKET_SUPER_JACKPOT:
if (manager != null) {
manager.setRedPacketInfoModel(event.getRedPacketInfoModel());
}
break;
}

View File

@ -1644,7 +1644,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
case LIVE_END:
endLive();
break;
case RED_PACKET:
if (manager != null) {
mLiveRoomViewHolder.redPacketManage(event.getRedPacketModel());
}
break;
}
}

View File

@ -1,13 +1,8 @@
package com.yunbao.live.adapter;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.graphics.Color;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -20,7 +15,10 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.alibaba.fastjson.JSONObject;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.LiveGiftBean;
@ -31,9 +29,10 @@ import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.custom.GiftMarkView;
import com.yunbao.live.dialog.SendRendPacketPopup;
import java.io.File;
import java.util.List;
@ -54,30 +53,32 @@ public class LiveGiftAdapter extends RecyclerView.Adapter<LiveGiftAdapter.Vh> {
private ScaleAnimation mAnimation;
private View mAnimView;
private String mName1, mName2;
boolean isTouch=true;
boolean isTouch = true;
private String mLiveUid;
public void setTouch(boolean touch) {
isTouch = touch;
}
public LiveGiftAdapter(Context context, LayoutInflater inflater, List<LiveGiftBean> list, String coinName) {
public LiveGiftAdapter(Context context, LayoutInflater inflater, List<LiveGiftBean> list, String coinName, String liveUid) {
mContext = context;
mInflater = inflater;
mList = list;
mLiveUid = liveUid;
mCoinName = coinName;
mName1 = CommonAppConfig.getInstance().getCoinName();
mName2 = CommonAppConfig.getInstance().getGoldCoinName();
mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!isTouch){
if (!isTouch) {
return;
}
Object tag = v.getTag();
if (tag != null) {
int position = (int) tag;
LiveGiftBean bean = mList.get(position);
if (!bean.isChecked()) {
if (!bean.isChecked() && bean.getType() != 9999999) {
if (!cancelChecked()) {
if (mActionListener != null) {
mActionListener.onCancel();
@ -196,7 +197,7 @@ public class LiveGiftAdapter extends RecyclerView.Adapter<LiveGiftAdapter.Vh> {
tvRedpoint = (TextView) itemView.findViewById(R.id.tvRedpoint);
mPayico = (ImageView) itemView.findViewById(R.id.pay_ico);
expire = (TextView) itemView.findViewById(R.id.expire);
mRadioButton.setOnClickListener(mOnClickListener);
mLoading = itemView.findViewById(R.id.gift_loading);
mLoadingLayout = itemView.findViewById(R.id.gift_loading_layout);
mLoadingLayout.setOnClickListener(v -> {
@ -208,20 +209,20 @@ public class LiveGiftAdapter extends RecyclerView.Adapter<LiveGiftAdapter.Vh> {
mLoading.startAnimation(animation);
LiveGiftBean bean = mList.get((Integer) v.getTag());
GiftCacheUtil.getInstance().pause();
GiftCacheUtil.getInstance().downloadGiftForId(mContext,bean, new CommonCallback<File>() {
GiftCacheUtil.getInstance().downloadGiftForId(mContext, bean, new CommonCallback<File>() {
@Override
public void callback(File bean) {
if(bean==null){
if (bean == null) {
ToastUtil.show(mContext.getString(R.string.load_failure_2));
mLoading.setImageResource(R.mipmap.icon_download_gift);
animation.setRepeatCount(0);
animation.setDuration(0);
animation.cancel();
mLoading.setAnimation(animation);
}else {
} else {
mLoadingLayout.setVisibility(View.GONE);
}
GiftCacheUtil.getInstance().restart();
GiftCacheUtil.getInstance().restart();
}
});
});
@ -235,16 +236,33 @@ public class LiveGiftAdapter extends RecyclerView.Adapter<LiveGiftAdapter.Vh> {
}
if (payload == null) {
ImgLoader.display(mContext, bean.getIcon(), mIcon);
bean.setView(mIcon);
mName.setText(bean.getName());
if (bean.getSendType() != null && bean.getSendType().equals("1")) {
// mCoinName = mName2;
mPayico.setImageResource(R.mipmap.gold_coin);
if (bean.getType() == 9999999) {
mPayico.setVisibility(View.GONE);
mPrice.setText(mContext.getString(R.string.build_up_popularity));
mPrice.setTextColor(Color.parseColor("#db8c4a"));
ViewClicksAntiShake.clicksAntiShake(mRadioButton, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new XPopup.Builder(mContext)
.asCustom(new SendRendPacketPopup(mContext,mLiveUid ))
.show();
}
});
} else {
mRadioButton.setOnClickListener(mOnClickListener);
mPrice.setTextColor(Color.parseColor("#c8c8c8"));
mPayico.setVisibility(View.VISIBLE);
bean.setView(mIcon);
if (bean.getSendType() != null && bean.getSendType().equals("1")) {
// mCoinName = mName2;
mPayico.setImageResource(R.mipmap.gold_coin);
} else {
// mCoinName = mName1;
mPayico.setImageResource(R.mipmap.diamond);
mPayico.setImageResource(R.mipmap.diamond);
}
mPrice.setText(bean.getPrice());
}
mPrice.setText(bean.getPrice());
if (IMLoginManager.get(mContext).isNewUserGif() && position == 0 && bean.getTag() != null) {
mPayico.setVisibility(View.GONE);
@ -295,10 +313,11 @@ public class LiveGiftAdapter extends RecyclerView.Adapter<LiveGiftAdapter.Vh> {
}
}
}
mRadioButton.setTag(position);
mRadioButton.doChecked(bean.isChecked());
if (bean.getSwf()!=null&&bean.getSwf().isEmpty()) {
if (bean.getSwf() != null && bean.getSwf().isEmpty()) {
mLoadingLayout.setVisibility(View.GONE);
return;
}

View File

@ -29,9 +29,10 @@ public class LiveGiftPagerAdapter extends PagerAdapter {
private static final int GIFT_COUNT = 8;//每页8个礼物
private int mPage = -1;
private ActionListener mActionListener;
public LiveGiftPagerAdapter(Context context, List<LiveGiftBean> giftList) {
private String mLiveUid;
public LiveGiftPagerAdapter(Context context, List<LiveGiftBean> giftList,String liveUid) {
mContext = context;
mLiveUid = liveUid;
mViewList = new ArrayList<>();
int fromIndex = 0;
int size = giftList.size();
@ -74,7 +75,7 @@ public class LiveGiftPagerAdapter extends PagerAdapter {
bean.setPage(i);
list.add(bean);
}
LiveGiftAdapter adapter = new LiveGiftAdapter(mContext, inflater, list, coinName);
LiveGiftAdapter adapter = new LiveGiftAdapter(mContext, inflater, list, coinName,mLiveUid);
adapter.setActionListener(actionListener);
recyclerView.setAdapter(adapter);
mViewList.add(recyclerView);

View File

@ -0,0 +1,51 @@
package com.yunbao.live.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.RedPacketGiftModel;
import com.yunbao.live.R;
import com.yunbao.live.views.RedPacketGiftViewHolder;
import java.util.ArrayList;
import java.util.List;
public class RedPacketGiftAdapter extends RecyclerView.Adapter {
private List<RedPacketGiftModel> packetGiftModels = new ArrayList<>();
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View redPacketGiftView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_red_packet_gift, parent, false);
return new RedPacketGiftViewHolder(redPacketGiftView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder instanceof RedPacketGiftViewHolder) {
RedPacketGiftViewHolder redPacketGiftViewHolder = (RedPacketGiftViewHolder) holder;
redPacketGiftViewHolder.showData(packetGiftModels.get(position));
}
}
@Override
public int getItemCount() {
return packetGiftModels.size();
}
/**
* 添加数据
*
* @param list
*/
public void addData(List<RedPacketGiftModel> list) {
if (list == null) return;
packetGiftModels.clear();
packetGiftModels.addAll(list);
notifyDataSetChanged();
}
}

View File

@ -0,0 +1,51 @@
package com.yunbao.live.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.RedPacketGiftModel;
import com.yunbao.live.R;
import com.yunbao.live.views.RedPacketLuckUserViewHolder;
import java.util.ArrayList;
import java.util.List;
public class RedPacketLuckUserAdapter extends RecyclerView.Adapter {
private List<RedPacketGiftModel> packetGiftModels = new ArrayList<>();
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View redPacketGiftView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_red_packet_luck_user, parent, false);
return new RedPacketLuckUserViewHolder(redPacketGiftView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder instanceof RedPacketLuckUserViewHolder) {
RedPacketLuckUserViewHolder redPacketGiftViewHolder = (RedPacketLuckUserViewHolder) holder;
redPacketGiftViewHolder.showData(packetGiftModels.get(position));
}
}
@Override
public int getItemCount() {
return packetGiftModels.size();
}
/**
* 添加数据
*
* @param list
*/
public void addData(List<RedPacketGiftModel> list) {
if (list == null) return;
packetGiftModels.clear();
packetGiftModels.addAll(list);
notifyDataSetChanged();
}
}

View File

@ -238,7 +238,7 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene
}
private void showGiftList(List<LiveGiftBean> list) {
mLiveGiftPagerAdapter = new LiveGiftPagerAdapter(mContext, list);
mLiveGiftPagerAdapter = new LiveGiftPagerAdapter(mContext, list,"");
mLiveGiftPagerAdapter.setActionListener(this);
mViewPager.setAdapter(mLiveGiftPagerAdapter);

View File

@ -41,6 +41,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.lxj.xpopup.XPopup;
import com.opensource.svgaplayer.SVGACallback;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
@ -531,7 +532,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
}
}
mGiftList = list;
mLiveGiftPagerAdapter = new LiveGiftPagerAdapter(mContext, list);
mLiveGiftPagerAdapter = new LiveGiftPagerAdapter(mContext, list,mLiveUid);
mLiveGiftPagerAdapter.setActionListener(this);
mViewPager.setAdapter(mLiveGiftPagerAdapter);
@ -569,7 +570,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
private void showWrapList(List<LiveGiftBean> list) {
mWrapList = list;
mLiveWrapPagerAdapter = new LiveGiftPagerAdapter(mContext, list);
mLiveWrapPagerAdapter = new LiveGiftPagerAdapter(mContext, list,mLiveUid);
mLiveWrapPagerAdapter.setActionListener(this);
mVPWrapList.setAdapter(mLiveWrapPagerAdapter);
LayoutInflater inflater = LayoutInflater.from(mContext);
@ -728,8 +729,10 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
}
mBeanFromWish = null;
}
if (bean.getType() != 9999999) {
itemCheckOp(bean);
itemCheckOp(bean);
}
}
private void itemCheckOp(LiveGiftBean bean) {

View File

@ -221,7 +221,7 @@ public class LiveGiftDialogFragment4Wishlist extends AbsDialogFragment implement
}
private void showGiftList(List<LiveGiftBean> list) {
mLiveGiftPagerAdapter = new LiveGiftPagerAdapter(mContext, list);
mLiveGiftPagerAdapter = new LiveGiftPagerAdapter(mContext, list,mLiveUid);
mLiveGiftPagerAdapter.setActionListener(this);
mViewPager.setAdapter(mLiveGiftPagerAdapter);
LayoutInflater inflater = LayoutInflater.from(mContext);

View File

@ -0,0 +1,52 @@
package com.yunbao.live.dialog;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.core.CenterPopupView;
import com.yunbao.common.bean.RedPacketGiftModel;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.adapter.RedPacketLuckUserAdapter;
import java.util.List;
public class LuckUserRedPacketPopup extends CenterPopupView {
private List<RedPacketGiftModel> packetGiftModels;
private RecyclerView userList;
private RedPacketLuckUserAdapter redPacketLuckUserAdapter;
public LuckUserRedPacketPopup(@NonNull Context context, List<RedPacketGiftModel> packetGiftModels) {
super(context);
this.packetGiftModels = packetGiftModels;
}
// 返回自定义弹窗的布局离开
@Override
protected int getImplLayoutId() {
return R.layout.view_red_packet_user_list;
}
// 执行初始化操作比如findView设置点击或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
super.onCreate();
initView();
}
private void initView() {
userList = findViewById(R.id.user_list);
redPacketLuckUserAdapter = new RedPacketLuckUserAdapter();
redPacketLuckUserAdapter.addData(packetGiftModels);
userList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
userList.setAdapter(redPacketLuckUserAdapter);
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.illustrate_close), () -> dismiss());
}
}

View File

@ -0,0 +1,222 @@
package com.yunbao.live.dialog;
import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import android.util.TypedValue;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.CenterPopupView;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.TimeUtils;
import com.yunbao.common.views.weight.CircleProgress;
import com.yunbao.common.views.weight.ClipPathCircleImage;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.adapter.RedPacketGiftAdapter;
public class ReceiveRendPacketPopup extends CenterPopupView {
private CircleProgress circleProgress;
private int time = 10;
private Button redPacketOpen;
private TextView redPacketTimeText, receiveRed, redPacketValue;
private FrameLayout redPacketTimeLayout;
private String mLiveUid, stream, redPacketId, userID;
private ClipPathCircleImage headPortrait;
private RecyclerView redPacketGiftList;
private RedPacketGiftAdapter redPacketGiftAdapter;
private ImageView isAttention;
private RedPacketInfoModel redPacketInfoModel;
private boolean isSuperJackpot;
public ReceiveRendPacketPopup(@NonNull Context context, int time, String mLiveUid, String stream,
String redPacketId, RedPacketInfoModel redPacketInfoModel,
boolean isSuperJackpot) {
super(context);
this.time = time;
this.mLiveUid = mLiveUid;
this.stream = stream;
this.redPacketId = redPacketId;
this.redPacketInfoModel = redPacketInfoModel;
this.isSuperJackpot = isSuperJackpot;
}
// 返回自定义弹窗的布局离开
@Override
protected int getImplLayoutId() {
return R.layout.view_receive_red_packet;
}
// 执行初始化操作比如findView设置点击或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
super.onCreate();
initView();
initData();
}
private void initData() {
ImgLoader.displayAvatar(getContext(), redPacketInfoModel.getAvatar(), headPortrait);
redPacketValue.setText(redPacketInfoModel.getAmountDiamond());
redPacketGiftAdapter.addData(redPacketInfoModel.getPacketGiftModels());
IMLoginModel userInfo = IMLoginManager.get(getContext()).getUserInfo();
if (TextUtils.equals(String.valueOf(userInfo.getId()), redPacketInfoModel.getUid())) {
isAttention.setVisibility(GONE);
} else {
isAttention.setVisibility(TextUtils.equals(redPacketInfoModel.getIsAttention(), "0") ? VISIBLE : GONE);
}
if (isSuperJackpot) {
receiveRed.setText(redPacketInfoModel.getUserNicename());
} else {
receiveRed.setText(String.format(getContext()
.getString(R.string.together_to_achieve_goal),
redPacketInfoModel.getUserNicename()));
}
userID = redPacketInfoModel.getUserId();
}
private Handler timeHandler = new Handler();
private Runnable timeRunnable = new Runnable() {
@Override
public void run() {
if (time > 0) {
circleProgress.setCurrent(time--);
timeHandler.postDelayed(timeRunnable, 1000);
String countdown = TimeUtils.getTime(time);
if (countdown.length() < 4) {
redPacketTimeText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 36);
} else {
redPacketTimeText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 23);
}
redPacketTimeText.setText(countdown);
} else {
redPacketTimeLayout.setVisibility(GONE);
redPacketOpen.setVisibility(VISIBLE);
}
}
};
private void initView() {
circleProgress = findViewById(R.id.circleProgress);
redPacketOpen = findViewById(R.id.red_packet_open);
redPacketTimeText = findViewById(R.id.red_packet_time_text);
redPacketTimeLayout = findViewById(R.id.red_packet_time_layout);
receiveRed = findViewById(R.id.receive_red);
redPacketValue = findViewById(R.id.red_packet_value);
headPortrait = findViewById(R.id.head_portrait);
isAttention = findViewById(R.id.is_attention);
redPacketGiftList = findViewById(R.id.red_packet_gift_list);
redPacketGiftList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
redPacketGiftAdapter = new RedPacketGiftAdapter();
redPacketGiftList.setAdapter(redPacketGiftAdapter);
if (time > 0) {
circleProgress.setMax(time);
circleProgress.setCurrent(time);
String countdown = TimeUtils.getTime(time);
if (countdown.length() < 4) {
redPacketTimeText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 36);
} else {
redPacketTimeText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 23);
}
redPacketTimeText.setText(countdown);
timeHandler.postDelayed(timeRunnable, 1000);
} else {
redPacketTimeLayout.setVisibility(GONE);
redPacketOpen.setVisibility(VISIBLE);
}
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.red_packet_open), () -> {
if (isSuperJackpot) {
LiveNetManager.get(getContext())
.getRedPacketSuperPrize(mLiveUid, redPacketInfoModel.getSuperJackpotId(), new HttpCallback<RedPacketInfoModel>() {
@Override
public void onSuccess(RedPacketInfoModel data) {
dismiss();
new XPopup.Builder(getContext())
.asCustom(new ResultRendPacketPopup(getContext(),
false,
data.setSuperJackpotId(redPacketInfoModel.getSuperJackpotId()),
isSuperJackpot))
.show();
}
@Override
public void onError(String error) {
dismiss();
new XPopup.Builder(getContext())
.asCustom(new ResultRendPacketPopup(getContext(),
true,
null,
isSuperJackpot))
.show();
}
});
} else {
LiveNetManager.get(getContext())
.getRedPacket(mLiveUid, stream, redPacketId, new HttpCallback<RedPacketInfoModel>() {
@Override
public void onSuccess(RedPacketInfoModel data) {
dismiss();
new XPopup.Builder(getContext())
.asCustom(new ResultRendPacketPopup(getContext(),
false,
data.setRedPacketId(redPacketId),
isSuperJackpot))
.show();
}
@Override
public void onError(String error) {
dismiss();
new XPopup.Builder(getContext())
.asCustom(new ResultRendPacketPopup(getContext(),
true,
null,
isSuperJackpot))
.show();
}
});
}
});
ViewClicksAntiShake.clicksAntiShake(isAttention, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
CommonHttpUtil.setAttention(userID, new CommonCallback<Integer>() {
@Override
public void callback(Integer attention) {
if (attention == 1) {
isAttention.setVisibility(GONE);
}
}
});
}
});
}
}

View File

@ -0,0 +1,137 @@
package com.yunbao.live.dialog;
import android.content.Context;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.CenterPopupView;
import com.yunbao.common.bean.RedPacketGiftModel;
import com.yunbao.common.bean.RedPacketInfoModel;
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.Bus;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.event.LiveAudienceEvent;
import java.util.List;
public class ResultRendPacketPopup extends CenterPopupView {
private boolean noData;
private RedPacketInfoModel redPacketInfoModel;
private boolean isSuperJackpot;
public ResultRendPacketPopup(@NonNull Context context,
boolean noData,
RedPacketInfoModel redPacketInfoModel,
boolean isSuperJackpot) {
super(context);
this.redPacketInfoModel = redPacketInfoModel;
this.noData = noData;
this.isSuperJackpot = isSuperJackpot;
}
// 返回自定义弹窗的布局离开
@Override
protected int getImplLayoutId() {
if (noData) {
return R.layout.view_no_red_packet;
} else {
return R.layout.view_result_red_packet;
}
}
// 执行初始化操作比如findView设置点击或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
super.onCreate();
initView();
}
private void initView() {
if (noData) {
} else {
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.illustrate_close), () -> dismiss());
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.anchor_his_heart), () -> {
dismiss();
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP));
});
LinearLayout goldenLayout = findViewById(R.id.golden_layout);
TextView goldenName = findViewById(R.id.golden_name);
LinearLayout giftLayout = findViewById(R.id.gift_layout);
TextView giftTitle = findViewById(R.id.gift_title);
ImageView giftImage = findViewById(R.id.gift_image);
ImageView goldenIconBeans = findViewById(R.id.golden_icon_beans);
if (redPacketInfoModel.getGiftModels() != null) {
if (redPacketInfoModel.getGiftModels().size() > 1) {
goldenLayout.setVisibility(VISIBLE);
giftLayout.setVisibility(VISIBLE);
giftTitle.setText(redPacketInfoModel.getGiftModels().get(0).getGiftname());
ImgLoader.displayAvatar(getContext(), redPacketInfoModel.getGiftModels().get(0).getGifticon(), giftImage);
ImgLoader.displayAvatar(getContext(), redPacketInfoModel.getGiftModels().get(1).getGifticon(), goldenIconBeans);
goldenName.setText(redPacketInfoModel.getGiftModels().get(1).getGiftname());
} else {
if (redPacketInfoModel.getGiftModels().size() > 0) {
ImgLoader.displayAvatar(getContext(), redPacketInfoModel.getGiftModels().get(0).getGifticon(), goldenIconBeans);
goldenName.setText(redPacketInfoModel.getGiftModels().get(0).getGiftname());
}
goldenLayout.setVisibility(VISIBLE);
giftLayout.setVisibility(GONE);
}
}
}
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.view_lucky_viewers), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (redPacketInfoModel != null) {
if (isSuperJackpot) {
LiveNetManager.get(getContext()).
getRedPacketSuperPrizeReceive(redPacketInfoModel.getSuperJackpotId(),
new HttpCallback<List<RedPacketGiftModel>>() {
@Override
public void onSuccess(List<RedPacketGiftModel> data) {
new XPopup.Builder(getContext())
.asCustom(new LuckUserRedPacketPopup(getContext(), data))
.show();
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
} else {
LiveNetManager.get(getContext()).
getRedPacketReceive(redPacketInfoModel.getRedPacketId(),
new HttpCallback<List<RedPacketGiftModel>>() {
@Override
public void onSuccess(List<RedPacketGiftModel> data) {
new XPopup.Builder(getContext())
.asCustom(new LuckUserRedPacketPopup(getContext(), data))
.show();
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
}
}
}
});
}
}

View File

@ -0,0 +1,222 @@
package com.yunbao.live.dialog;
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
import android.content.Context;
import android.graphics.Color;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.alibaba.android.arouter.launcher.ARouter;
import com.lxj.xpopup.core.CenterPopupView;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
public class SendRendPacketPopup extends CenterPopupView {
private Button thereIsNo, followingAnchor;
private TextView redEnvelopeRill, totalConsumptionOfDrill;
private TextView rill, total;
private FrameLayout redPacketIllustrate;
private ImageView iconInstructions, illustrateClose;
private String mLiveID, conditions = "0";
public SendRendPacketPopup(@NonNull Context context, String liveID) {
super(context);
mLiveID = liveID;
}
// 返回自定义弹窗的布局离开
@Override
protected int getImplLayoutId() {
return R.layout.view_send_red_packet;
}
// 执行初始化操作比如findView设置点击或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
super.onCreate();
initView();
}
private void initView() {
thereIsNo = findViewById(R.id.there_is_no);
followingAnchor = findViewById(R.id.following_anchor);
redEnvelopeRill = findViewById(R.id.red_envelope_rill);
totalConsumptionOfDrill = findViewById(R.id.total_consumption_of_drill);
redPacketIllustrate = findViewById(R.id.red_packet_illustrate);
illustrateClose = findViewById(R.id.illustrate_close);
iconInstructions = findViewById(R.id.icon_instructions);
rill = findViewById(R.id.rill);
total = findViewById(R.id.total);
selectText(thereIsNo, true);
selectText(followingAnchor, false);
ViewClicksAntiShake.clicksAntiShake(thereIsNo, () -> {
selectText(thereIsNo, true);
selectText(followingAnchor, false);
conditions = "0";
});
ViewClicksAntiShake.clicksAntiShake(followingAnchor, () -> {
selectText(thereIsNo, false);
selectText(followingAnchor, true);
conditions = "1";
});
redEnvelopeRill.setText(String.format(getContext().getString(R.string.red_envelope_rill), "0"));
totalConsumptionOfDrill.setText(String.format(getContext().getString(R.string.total_consumption_of_drill), "0"));
rill.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
String number = s.toString();
String rillNumber = total.getText().toString();
int totalInt = 0;
try {
totalInt = Integer.parseInt(rillNumber);
} catch (NumberFormatException e) {
totalInt = 0;
}
if (TextUtils.isEmpty(number)) {
redEnvelopeRill.setText(String.format(getContext().getString(R.string.red_envelope_rill), "0"));
totalConsumptionOfDrill.setText(String.format(getContext().getString(R.string.total_consumption_of_drill), "0"));
} else {
int numberInt = Integer.parseInt(number);
if (numberInt >= 200 && numberInt <= 10000) {
totalConsumptionOfDrill.setText(String.format(getContext().getString(R.string.total_consumption_of_drill), String.valueOf((totalInt * numberInt))));
redEnvelopeRill.setText(String.format(getContext().getString(R.string.red_envelope_rill), s.toString()));
} else {
ToastUtil.show(String.format(getContext().getString(R.string.range_range_is), "200~10000"));
}
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
total.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
String number = s.toString();
String rillNumber = rill.getText().toString();
int rillInt = 0;
try {
rillInt = Integer.parseInt(rillNumber);
} catch (NumberFormatException e) {
rillInt = 0;
}
if (TextUtils.isEmpty(number)) {
totalConsumptionOfDrill.setText(String.format(getContext().getString(R.string.total_consumption_of_drill), "0"));
} else {
int numberInt = Integer.parseInt(number);
if (numberInt >= 1 && numberInt <= 100) {
totalConsumptionOfDrill.setText(String.format(getContext().getString(R.string.total_consumption_of_drill), String.valueOf((rillInt * numberInt))));
} else {
ToastUtil.show(String.format(getContext().getString(R.string.range_range_is), "1~100"));
}
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
//红包初始数量
rill.setText("200");
total.setText("10");
ViewClicksAntiShake.clicksAntiShake(iconInstructions, () -> redPacketIllustrate.setVisibility(VISIBLE));
ViewClicksAntiShake.clicksAntiShake(illustrateClose, () -> redPacketIllustrate.setVisibility(GONE));
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.top_up_now), () -> {
//我们的
ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation();
});
//创建红包
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.red_pack_send), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
String rillNumber = rill.getText().toString();
String number = total.getText().toString();
int rillInt = 0;
try {
rillInt = Integer.parseInt(rillNumber);
} catch (NumberFormatException e) {
rillInt = 0;
}
int totalInt = 0;
try {
totalInt = Integer.parseInt(number);
} catch (NumberFormatException e) {
totalInt = 0;
}
boolean totalTrue = false;
boolean rillTrue = false;
if (totalInt >= 1 && totalInt <= 100) {
totalTrue = true;
} else {
ToastUtil.show(String.format(getContext().getString(R.string.range_range_is), "1~100"));
}
if (rillInt >= 200 && rillInt <= 10000) {
rillTrue = true;
} else {
ToastUtil.show(String.format(getContext().getString(R.string.range_range_is), "200~10000"));
}
if (totalTrue && rillTrue) {
LiveNetManager.get(getContext())
.createRedPacket(mLiveID,
rillNumber,
number,
conditions, new HttpCallback<String>() {
@Override
public void onSuccess(String data) {
dismiss();
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
}
}
});
}
private void selectText(TextView textView, boolean select) {
textView.setSelected(select);
if (select) {
textView.setTextColor(Color.parseColor("#E12801"));
} else {
textView.setTextColor(Color.parseColor("#FDD04A"));
}
}
}

View File

@ -7,6 +7,8 @@ import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.bean.RedPacketModel;
import com.yunbao.common.bean.WishModel;
import com.yunbao.common.bean.XydCompleteModel;
import com.yunbao.common.event.AllServerNotifyEvent;
@ -43,6 +45,26 @@ public class LiveAudienceEvent extends BaseModel {
private XydCompleteModel xydCompleteModel;
private LiveReceiveGiftBean liveReceiveGiftBean;
private AllServerNotifyEvent allServerNotifyEvent;
private RedPacketModel redPacketModel;
private RedPacketInfoModel redPacketInfoModel;
public RedPacketInfoModel getRedPacketInfoModel() {
return redPacketInfoModel;
}
public LiveAudienceEvent setRedPacketInfoModel(RedPacketInfoModel redPacketInfoModel) {
this.redPacketInfoModel = redPacketInfoModel;
return this;
}
public RedPacketModel getRedPacketModel() {
return redPacketModel;
}
public LiveAudienceEvent setRedPacketModel(RedPacketModel redPacketModel) {
this.redPacketModel = redPacketModel;
return this;
}
public AllServerNotifyEvent getAllServerNotifyEvent() {
return allServerNotifyEvent;
@ -356,7 +378,9 @@ public class LiveAudienceEvent extends BaseModel {
VOTE_CREATE(65, "创建投票"),
VOTE_UPDATE(66, "更新投票"),
VOTE_END(67, "投票结束"),
BLIND_BOX(68, "盲盒全服通知");
BLIND_BOX(68, "盲盒全服通知"),
RED_PACKET(69, "RedPacket"),
RED_PACKET_SUPER_JACKPOT(70, "超级红包");
private int type;
private String name;

View File

@ -7,10 +7,8 @@ import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
@ -30,6 +28,8 @@ import com.yunbao.common.bean.LinkMicUserBean;
import com.yunbao.common.bean.LiveUserGiftBean;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.PkRankBean;
import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.bean.RedPacketModel;
import com.yunbao.common.bean.SocketModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.bean.WishModel;
@ -42,7 +42,6 @@ import com.yunbao.common.http.HttpClient;
import com.yunbao.common.manager.IMRTCManager;
import com.yunbao.common.manager.RandomPkManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
@ -69,8 +68,6 @@ import org.greenrobot.eventbus.EventBus;
import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
import cn.rongcloud.rtc.base.RTCErrorCode;
@ -676,6 +673,7 @@ public class SocketRyClient {
);
break;
case Constants.LIVE_PK_END:
mListener.onEndPk(map.getLong("uid"),
map.getLong("pkuid"),
map.getLong("uid_score"),
@ -683,7 +681,18 @@ public class SocketRyClient {
JSONObject.parseObject(map.getJSONObject("ct").getJSONObject("pk_top_users").toJSONString(), LivePKUserListBean.class)
);
break;
case Constants.RED_PACKET:
RedPacketModel redPacketModel = GsonUtils.fromJson(map.toString(), RedPacketModel.class);
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.RED_PACKET)
.setRedPacketModel(redPacketModel));
break;
case Constants.RED_PACKET_SUPER_JACKPOT:
RedPacketInfoModel redPacketInfoModel = GsonUtils.fromJson(map.toString(), RedPacketInfoModel.class);
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.RED_PACKET_SUPER_JACKPOT)
.setRedPacketInfoModel(redPacketInfoModel));
break;
}
}
@ -1002,7 +1011,7 @@ public class SocketRyClient {
// 玩家自己送礼物
private void sendGiftInSameRoom(JSONObject map) {
String ctJson = map.getString("ct");
SendBlindGiftEvent sendBlindGiftEvent = JSON.parseObject(ctJson, SendBlindGiftEvent.class);
SendBlindGiftEvent sendBlindGiftEvent = JSON.parseObject(ctJson, SendBlindGiftEvent.class);
LiveReceiveGiftBean receiveGiftBean = JSON.parseObject(map.getString("ct"), LiveReceiveGiftBean.class);
sendBlindGiftEvent.setUserNiceName(map.getString("uname"));
receiveGiftBean.setAvatar(map.getString("uhead") + "");

View File

@ -50,6 +50,7 @@ import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.lxj.xpopup.XPopup;
import com.makeramen.roundedimageview.RoundedImageView;
import com.ms.banner.Banner;
import com.ms.banner.BannerConfig;
@ -82,6 +83,8 @@ import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.NewPeopleTaskModel;
import com.yunbao.common.bean.PkRankBean;
import com.yunbao.common.bean.RankHourModel;
import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.bean.RedPacketModel;
import com.yunbao.common.bean.RewardAllModel;
import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.TaskModel;
@ -112,6 +115,7 @@ import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.TimeUtils;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.formatBigNum;
import com.yunbao.common.views.AbsViewHolder;
@ -151,6 +155,8 @@ import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog;
import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
import com.yunbao.live.dialog.ReceiveRendPacketPopup;
import com.yunbao.live.dialog.ResultRendPacketPopup;
import com.yunbao.live.event.LiveAnchorEvent;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.event.LiveRoomChangeEvent;
@ -1104,54 +1110,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mChatRecyclerView.setHasFixedSize(true);
LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
layoutManager.setOrientation(RecyclerView.VERTICAL);
// layoutManager.setReverseLayout(true);
layoutManager.setStackFromEnd(true);
mChatRecyclerView.setLayoutManager(layoutManager);
mChatRecyclerView.addItemDecoration(new TopGradual());
mChatRecyclerView.setItemViewCacheSize(10);
// mChatRecyclerView.setItemAnimator(new SimpleItemAnimator() {
// @Override
// public boolean animateRemove(RecyclerView.ViewHolder holder) {
// return false;
// }
//
// @Override
// public boolean animateAdd(RecyclerView.ViewHolder holder) {
// Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.live_chat_msg_in);
// holder.itemView.startAnimation(animation);
// return false;
// }
//
// @Override
// public boolean animateMove(RecyclerView.ViewHolder holder, int fromX, int fromY, int toX, int toY) {
// return false;
// }
//
// @Override
// public boolean animateChange(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder, int fromLeft, int fromTop, int toLeft, int toTop) {
// return false;
// }
//
// @Override
// public void runPendingAnimations() {
//
// }
//
// @Override
// public void endAnimation(@NonNull RecyclerView.ViewHolder item) {
//
// }
//
// @Override
// public void endAnimations() {
//
// }
//
// @Override
// public boolean isRunning() {
// return false;
// }
// });
mLiveChatAdapter = new LiveChatAdapter(mContext);
mChatRecyclerView.setAdapter(mLiveChatAdapter);
mLiveChatAdapter.setOnItemClickListener(new OnItemClickListener<LiveChatBean>() {
@ -1319,6 +1281,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
avatar_r1 = (RoundedImageView) findViewById(R.id.avatar_r1);
avatar_r2 = (RoundedImageView) findViewById(R.id.avatar_r2);
avatar_r3 = (RoundedImageView) findViewById(R.id.avatar_r3);
redPacket = (FrameLayout) findViewById(R.id.red_packet);
redPacketCountdown = (TextView) findViewById(R.id.red_packet_countdown);
redSchedule = (TextView) findViewById(R.id.red_schedule);
redPacketQueue = (LinearLayout) findViewById(R.id.red_packet_queue);
openRedPacket = (TextView) findViewById(R.id.open_red_packet);
lt_pk_line = (RelativeLayout) findViewById(R.id.lt_pk_line);
clickAvatar();
@ -1407,6 +1374,143 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
new LoadDian9TuUtil().loadDian9TuAssets2(mContext, liveWksLayout, "rectangle_new.png", 1);
new LoadDian9TuUtil().loadDian9TuAssets2(mContext, wishListLayout2, "rectangle_new.png", 1);
}
private FrameLayout redPacket;
private TextView redPacketCountdown, redSchedule, openRedPacket;
private LinearLayout redPacketQueue;
private int redTimeCountdown = 0;
private RedPacketModel mRedPacketModel;
private Handler timeHandler = new Handler();
private Runnable timeRunnable = new Runnable() {
@Override
public void run() {
if (redTimeCountdown > 0) {
redTimeCountdown = redTimeCountdown - 1;
timeHandler.postDelayed(timeRunnable, 1000);
redPacketCountdown.setText(String.format(mContext.getString(R.string.red_packet_countdown), TimeUtils.getTime(redTimeCountdown)));
} else {
timeHandler.removeCallbacks(timeRunnable);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(mRedPacketModel.getRedPacketCount())
.append("/")
.append(mRedPacketModel.getRedPacketQuantity());
redSchedule.setText(stringBuffer.toString());
openRedPacket.setText(String.format(mContext.getString(R.string.open_red_packet), mRedPacketModel.getRedPacketRemain() + ""));
redPacketCountdown.setVisibility(View.GONE);
redPacketQueue.setVisibility(View.VISIBLE);
}
}
};
//主播倒计时调用接口
private Handler anchorTimeHandler = new Handler();
private int mCountdown;
private Runnable anchorTimeRunnable = new Runnable() {
@Override
public void run() {
if (mCountdown > 0) {
mCountdown = mCountdown - 1;
anchorTimeHandler.postDelayed(anchorTimeRunnable, 1000);
Log.e("主播倒计时", String.format(mContext.getString(R.string.red_packet_countdown), TimeUtils.getTime(mCountdown)));
} else {
redPacket.setVisibility(View.GONE);
anchorTimeHandler.removeCallbacks(anchorTimeRunnable);
LiveNetManager.get(mContext).
endRedPacket(mLiveUid, mRedPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback<String>() {
@Override
public void onSuccess(String data) {
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
}
}
};
/**
* 红包相关处理
*/
public void redPacketManage(RedPacketModel redPacketModel) {
anchorTimeHandler.removeCallbacks(anchorTimeRunnable);
timeHandler.removeCallbacks(timeRunnable);
mRedPacketModel = redPacketModel;
if (redPacketModel.getIsShow() == 1) {
redPacket.setVisibility(View.VISIBLE);
if (redPacketModel.getCountdown() > 180) {
redPacketQueue.setVisibility(View.GONE);
redPacketCountdown.setVisibility(View.VISIBLE);
mCountdown = redPacketModel.getCountdown();
redTimeCountdown = mCountdown - 180;
redPacketCountdown.setText(String.format(mContext.getString(R.string.red_packet_countdown), TimeUtils.getTime(redTimeCountdown)));
timeHandler.post(timeRunnable);
} else {
redPacketQueue.setVisibility(View.VISIBLE);
redPacketCountdown.setVisibility(View.GONE);
}
if (IMLoginManager.get(mContext).getUserInfo().anchorUserType() && mContext instanceof LiveRyAnchorActivity) {
anchorTimeHandler.removeCallbacks(anchorTimeRunnable);
anchorTimeHandler.post(anchorTimeRunnable);
}
} else {
hindeRedPacket();
}
//测试点开红包
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.red_packet), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (!(mContext instanceof LiveRyAnchorActivity)) {
LiveNetManager.get(mContext)
.redPacketInfo(mLiveUid, redPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback<RedPacketInfoModel>() {
@Override
public void onSuccess(RedPacketInfoModel data) {
if (TextUtils.equals(data.getReceiveStatus(), "0")) {
new XPopup.Builder(mContext)
.asCustom(new ReceiveRendPacketPopup(mContext, redTimeCountdown, mLiveUid, mStream, redPacketModel.getRedPacketId(), data, false))
.show();
} else if (TextUtils.equals(data.getReceiveStatus(), "1")) {
new XPopup.Builder(mContext)
.asCustom(new ResultRendPacketPopup(mContext, true, null, false))
.show();
} else {
new XPopup.Builder(mContext)
.asCustom(new ResultRendPacketPopup(mContext, false, data.setRedPacketId(redPacketModel.getRedPacketId()), false))
.show();
}
if (TextUtils.equals(data.getConditions(), "1")) {
follow();
}
}
@Override
public void onError(String error) {
ToastUtil.show(error);
new XPopup.Builder(mContext)
.asCustom(new ResultRendPacketPopup(mContext, true, null, false))
.show();
}
});
}
}
});
}
public void hindeRedPacket() {
redPacket.setVisibility(View.GONE);
}
public void setRedPacketInfoModel(RedPacketInfoModel redPacket) {
new XPopup.Builder(mContext)
.asCustom(new ReceiveRendPacketPopup(mContext, 0, mLiveUid, mStream, redPacket.getRedPacketId(), redPacket, true))
.show();
}
/**
@ -1504,6 +1608,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 重置数据
*/
public void resetView() {
timeHandler.removeCallbacks(timeRunnable);
anchorTimeHandler.removeCallbacks(anchorTimeRunnable);
resetViewGone();
visibility = false;
pkUidTmp = "";
@ -3512,6 +3618,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void showPrizePoolLevel(String level) {
}
/**
* 获取是否有热度卡加成
*/
@ -3615,6 +3722,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
public void clearData() {
timeHandler.removeCallbacks(timeRunnable);
anchorTimeHandler.removeCallbacks(anchorTimeRunnable);
LiveHttpUtil.cancel(LiveHttpConsts.GET_USER_LIST);
LiveHttpUtil.cancel(LiveHttpConsts.TIME_CHARGE);
CommonHttpUtil.cancel(CommonHttpConsts.SET_ATTENTION);

View File

@ -39,6 +39,8 @@ import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveRoomActivityModel;
import com.yunbao.common.bean.LiveUserGiftBean;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.bean.RedPacketModel;
import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.bean.WishModel;
@ -676,6 +678,18 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_PK_ING));
}
if (data.getEnterRoomInfo().getRedPacketModel() != null) {
mLiveRoomViewHolder.redPacketManage(data.getEnterRoomInfo().getRedPacketModel());
// mLiveRoomViewHolder.redPacketManage(new RedPacketModel()
// .setIsShow(1)
// .setRedPacketCount(23)
// .setRedPacketQuantity(100)
// .setRedPacketRemain(6)
// .setCountdown(360));
}else {
mLiveRoomViewHolder.hindeRedPacket();
}
}
@Override
@ -2037,4 +2051,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.blindBoxAllServerNotify(event);
}
}
public void redPacketManage(RedPacketModel redPacket) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.redPacketManage(redPacket);
}
}
public void setRedPacketInfoModel(RedPacketInfoModel redPacket) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.setRedPacketInfoModel(redPacket);
}
}
}

View File

@ -0,0 +1,27 @@
package com.yunbao.live.views;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.RedPacketGiftModel;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.live.R;
public class RedPacketGiftViewHolder extends RecyclerView.ViewHolder {
private ImageView giftIcon;
private TextView giftName;
public RedPacketGiftViewHolder(@NonNull View itemView) {
super(itemView);
giftIcon = itemView.findViewById(R.id.gift_icon);
giftName = itemView.findViewById(R.id.gift_name);
}
public void showData(RedPacketGiftModel redPacketGiftModel) {
ImgLoader.displayAvatar(itemView.getContext(), redPacketGiftModel.getGifticon(), giftIcon);
giftName.setText(redPacketGiftModel.getGiftNum());
}
}

View File

@ -0,0 +1,30 @@
package com.yunbao.live.views;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.RedPacketGiftModel;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.live.R;
public class RedPacketLuckUserViewHolder extends RecyclerView.ViewHolder {
private ImageView giftImage;
private TextView giftName, giftNumber;
public RedPacketLuckUserViewHolder(@NonNull View itemView) {
super(itemView);
giftImage = itemView.findViewById(R.id.gift_image);
giftName = itemView.findViewById(R.id.gift_name);
giftNumber = itemView.findViewById(R.id.gift_number);
}
public void showData(RedPacketGiftModel redPacketGiftModel) {
ImgLoader.displayAvatar(itemView.getContext(), redPacketGiftModel.getGifticon(), giftImage);
giftName.setText(redPacketGiftModel.getUserNicename());
giftNumber.setText(redPacketGiftModel.getNeedcoin());
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="320dp" />
<stroke
android:width="3dp"
android:color="#FBD16C" />
<solid android:color="#FD2D48" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="23dp" />
<solid android:color="#40FFC0D5" />
</shape>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape android:shape="rectangle">
<corners android:radius="15dp" />
<solid android:color="#FCC438" />
</shape>
</item>
<item android:state_selected="false">
<shape android:shape="rectangle">
<corners android:radius="15dp" />
<stroke android:width="1dp" android:color="#FCC438" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="20dp" />
<gradient
android:angle="90"
android:endColor="#FDCF46"
android:startColor="#FFDB86" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="16dp" />
<solid android:color="#cc000000" />
</shape>

View File

@ -701,14 +701,24 @@
android:layout_width="52dp"
android:layout_height="76dp"
android:layout_below="@+id/live_rank_pk"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="20dp"
android:layout_marginRight="5dp"
android:visibility="gone"
android:layout_marginEnd="5dp"
android:visibility="visible"
app:delay_time="5000"
app:indicator_height="8dp"
app:indicator_width="8dp" />
<include
android:id="@+id/red_packet"
layout="@layout/view_red_packet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/live_rank_pk"
android:layout_marginStart="12dp"
android:layout_marginTop="15dp"
android:visibility="gone" />
<FrameLayout
android:id="@+id/btn_prize_pool_level"
android:layout_width="70dp"
@ -737,7 +747,7 @@
android:translationX="-48dp" />
</FrameLayout>
<!--接收-->
<FrameLayout
android:id="@+id/ft_hot_add"
android:layout_width="81dp"
@ -745,7 +755,7 @@
android:layout_below="@id/live_time"
android:layout_marginLeft="12dp"
android:layout_marginTop="-12dp"
android:visibility="visible">
android:visibility="gone">
<ImageView
android:id="@+id/img_hot_gif"
@ -979,7 +989,7 @@
android:background="@drawable/bg_live_gift_tip"
android:gravity="center|left"
android:orientation="horizontal">
<!--盲盒头条-->
<!--盲盒头条-->
<View
android:id="@+id/super_notice"
android:layout_width="63dp"
@ -1305,13 +1315,13 @@
android:layout_marginBottom="-30dp"
android:background="@color/white"
android:visibility="invisible" />
<include
android:id="@+id/vote_layout"
layout="@layout/sim_live_room_vote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
/>
android:layout_alignParentEnd="true" />
<ImageView
android:id="@+id/icon_pk_top"
@ -2078,7 +2088,6 @@
android:orientation="vertical">
<RelativeLayout
android:id="@+id/mic_view2"
android:layout_width="40dp"
@ -2112,6 +2121,7 @@
android:src="@mipmap/voice" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/mic_view1"
android:layout_width="40dp"
@ -2145,6 +2155,7 @@
android:src="@mipmap/voice" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/mic_view"
android:layout_width="40dp"
@ -2203,8 +2214,8 @@
android:layout_height="76dp"
android:layout_marginTop="20dp"
android:layout_marginRight="5dp"
app:delay_time="5000"
android:visibility="gone"
app:delay_time="5000"
app:indicator_height="8dp"
app:indicator_width="8dp" />

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:background="@mipmap/background_red_packet"
android:backgroundTintMode="src_over">
<!--伤心-->
<ImageView
android:layout_width="74dp"
android:layout_height="106dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="89dp"
android:src="@mipmap/icon_grieved_red_packet" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="80dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="@string/red_too_bad"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/red_too_bad2"
android:textColor="@color/white"
android:textSize="18sp" />
<TextView
android:id="@+id/view_lucky_viewers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="@string/view_lucky_viewers"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
</FrameLayout>

View File

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:background="@mipmap/background_red_packet"
android:backgroundTintMode="src_over">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="171dp"
android:background="@mipmap/icon_ellipse" />
<!--头像-->
<com.yunbao.common.views.weight.ClipPathCircleImage
android:id="@+id/head_portrait"
android:layout_width="59dp"
android:layout_height="59dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:src="@mipmap/hide" />
<ImageView
android:id="@+id/is_attention"
android:layout_width="23dp"
android:layout_height="23dp"
android:layout_below="@id/head_portrait"
android:layout_centerHorizontal="true"
android:layout_marginTop="-17dp"
android:src="@mipmap/ixon_attention" />
<LinearLayout
android:id="@+id/receive_red_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/head_portrait"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/receive_red"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:gravity="center"
android:text="來自小PD的獎勵齊心協力連成目標"
android:textColor="@color/white"
android:textSize="13sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/red_packet_value_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/receive_red"
android:layout_centerHorizontal="true"
android:layout_marginTop="6dp"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/red_packet_value"
android:textColor="@color/white"
android:textSize="12sp" />
<ImageView
android:layout_width="16dp"
android:layout_height="14dp"
android:layout_marginStart="15dp"
android:src="@mipmap/icon_zhuansi" />
<TextView
android:id="@+id/red_packet_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="13160"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/red_packet_open"
android:layout_width="96dp"
android:layout_height="96dp"
android:layout_below="@+id/head_portrait"
android:layout_centerHorizontal="true"
android:layout_marginTop="68dp"
android:background="@drawable/background_open_red_packet"
android:text="@string/red_packet_open"
android:textColor="#FFE9BF"
android:textSize="36sp"
android:textStyle="bold"
android:visibility="invisible" />
<FrameLayout
android:id="@+id/red_packet_time_layout"
android:layout_width="96dp"
android:layout_height="96dp"
android:layout_below="@+id/head_portrait"
android:layout_centerHorizontal="true"
android:layout_marginTop="68dp">
<com.yunbao.common.views.weight.CircleProgress
android:id="@+id/circleProgress"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/red_packet_time_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="00:00"
android:textColor="#FFFFF9"
android:textSize="36sp"
android:textStyle="bold" />
</FrameLayout>
<LinearLayout
android:id="@+id/red_packet_list"
android:layout_width="260dp"
android:layout_height="45dp"
android:layout_below="@id/red_packet_open"
android:layout_centerHorizontal="true"
android:layout_marginTop="26dp"
android:background="@drawable/background_red_packet_list"
android:orientation="horizontal">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/red_packet_gift_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="14dp" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/red_packet_list"
android:layout_centerHorizontal="true"
android:layout_marginTop="27dp"
android:text="@string/randomly_available"
android:textColor="@color/white"
android:textSize="12sp" />
</RelativeLayout>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="46dp"
app:cardBackgroundColor="#70323232"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
<TextView
android:id="@+id/red_packet_countdown"
android:layout_width="58dp"
android:layout_height="16dp"
android:gravity="center_vertical"
android:paddingStart="5dp"
android:text="@string/red_packet_countdown"
android:visibility="gone"
android:textColor="@color/white"
android:textSize="9sp" />
<LinearLayout
android:id="@+id/red_packet_queue"
android:layout_width="68dp"
android:layout_height="27dp"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingStart="6dp"
android:visibility="visible">
<TextView
android:id="@+id/red_schedule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10/200"
android:textColor="@color/white"
android:textSize="9sp" />
<TextView
android:id="@+id/open_red_packet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="待開紅包:4"
android:textColor="@color/white"
android:textSize="9sp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<ImageView
android:layout_width="40dp"
android:layout_height="51dp"
android:src="@mipmap/icon_red_packet" />
</FrameLayout>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical">
<ImageView
android:id="@+id/gift_icon"
android:layout_marginStart="14dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@mipmap/hide" />
<TextView
android:id="@+id/gift_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="3dp"
android:text="dadsad"
android:textColor="@color/white"
android:textSize="14sp" />
</LinearLayout>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/gift_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dadsad"
android:textColor="@color/white"
android:textSize="16sp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end|center_vertical">
<ImageView
android:id="@+id/gift_image"
android:layout_width="20dp"
android:layout_height="20dp" />
<TextView
android:id="@+id/gift_number"
android:layout_width="40dp"
android:gravity="end"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:textColor ="@color/white"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:background="@mipmap/background_red_packet"
android:backgroundTintMode="src_over">
<ImageView
android:id="@+id/illustrate_close"
android:layout_width="19dp"
android:layout_height="19dp"
android:layout_gravity="end"
android:layout_margin="25dp"
android:src="@mipmap/meiyan_icon_close" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="58dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/check_out_your_luck"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/user_list"
android:layout_width="200dp"
android:layout_height="241dp"
android:layout_marginTop="26dp" />
</LinearLayout>
</FrameLayout>

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:background="@mipmap/background_red_packet"
android:backgroundTintMode="src_over">
<ImageView
android:id="@+id/illustrate_close"
android:layout_width="19dp"
android:layout_height="19dp"
android:layout_gravity="end"
android:layout_margin="25dp"
android:src="@mipmap/meiyan_icon_close" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="58dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/congratulations_on_getting_the_red_envelope"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/gift_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="31dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/gift_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="34dp"
android:text="@string/cred_envelope_obtained"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
android:id="@+id/gift_image"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_marginTop="13dp"
android:src="@mipmap/hide" />
</LinearLayout>
<LinearLayout
android:id="@+id/golden_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/golden_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="34dp"
android:text="@string/cred_envelope_obtained"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
android:id="@+id/golden_icon_beans"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_marginTop="13dp"
android:src="@mipmap/icon_beans" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/view_lucky_viewers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:text="@string/view_lucky_viewers"
android:textColor="@color/white"
android:textSize="12sp" />
<Button
android:id="@+id/anchor_his_heart"
android:layout_width="205dp"
android:layout_height="45dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="25dp"
android:layout_marginBottom="34dp"
android:background="@drawable/background_send_red_packet"
android:gravity="center"
android:text="@string/anchor_his_heart"
android:textColor="#8F3B00"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</FrameLayout>

View File

@ -0,0 +1,325 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:background="@mipmap/background_red_packet"
android:backgroundTintMode="src_over">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="45dp"
android:text="@string/save_popular_red_packets"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/icon_instructions"
android:layout_width="19dp"
android:layout_height="19dp"
android:layout_gravity="end"
android:layout_marginTop="28dp"
android:layout_marginEnd="21dp"
android:src="@mipmap/icon_instructions" />
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="43dp"
android:layout_marginTop="97dp"
android:layout_marginEnd="49dp"
app:cardBackgroundColor="#E82936"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:text="@string/amount"
android:textColor="@color/white"
android:textSize="15sp" />
<EditText
android:id="@+id/rill"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@null"
android:gravity="center"
android:inputType="number"
android:text="0"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="@string/drill"
android:textColor="@color/white"
android:textSize="15sp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="43dp"
android:layout_marginTop="149dp"
android:layout_marginEnd="49dp"
app:cardBackgroundColor="#E82936"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:text="@string/count"
android:textColor="@color/white"
android:textSize="15sp" />
<EditText
android:id="@+id/total"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@null"
android:gravity="center"
android:inputType="number"
android:text="0"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="@string/live_send_gift_2"
android:textColor="@color/white"
android:textSize="15sp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="213dp">
<androidx.cardview.widget.CardView
android:layout_width="50dp"
android:layout_height="35dp"
android:layout_marginStart="43dp"
app:cardBackgroundColor="#E82936"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/conditions"
android:textColor="@color/white"
android:textSize="15sp" />
</androidx.cardview.widget.CardView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="15dp"
android:layout_marginEnd="49dp">
<Button
android:id="@+id/there_is_no"
android:layout_width="45dp"
android:layout_height="30dp"
android:background="@drawable/background_red_packet_select"
android:gravity="center"
android:text="@string/there_is_no"
android:textColor="#FDD04A"
android:textSize="13sp" />
<Button
android:id="@+id/following_anchor"
android:layout_width="75dp"
android:layout_height="30dp"
android:layout_gravity="end"
android:background="@drawable/background_red_packet_select"
android:gravity="center"
android:text="@string/following_anchor"
android:textColor="#FDD04A"
android:textSize="12sp" />
</FrameLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="43dp"
android:layout_marginTop="266dp"
android:layout_marginEnd="49dp">
<TextView
android:id="@+id/red_envelope_rill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/red_envelope_rill"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:id="@+id/total_consumption_of_drill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/total_consumption_of_drill"
android:textColor="@color/white"
android:textSize="12sp" />
</FrameLayout>
<TextView
android:id="@+id/red_pack_send"
android:layout_width="160dp"
android:layout_height="40dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="34dp"
android:background="@drawable/background_send_red_packet"
android:gravity="center"
android:text="@string/red_pack_6"
android:textColor="#8F3B00"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/top_up_now"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="13dp"
android:text="@string/top_up_now"
android:textColor="@color/white"
android:textSize="12sp" />
<FrameLayout
android:id="@+id/red_packet_illustrate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_send_red_packet_illustrate"
android:clickable="true"
android:focusable="true"
android:visibility="gone">
<!--结果-->
<LinearLayout
android:layout_width="245dp"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send_red_packet_illustrate1"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send_red_packet_illustrate2"
android:textColor="@color/white"
android:textSize="11sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/send_red_packet_illustrate3"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send_red_packet_illustrate4"
android:textColor="@color/white"
android:textSize="11sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/send_red_packet_illustrate5"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send_red_packet_illustrate6"
android:textColor="@color/white"
android:textSize="11sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/send_red_packet_illustrate7"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send_red_packet_illustrate8"
android:textColor="@color/white"
android:textSize="11sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/send_red_packet_illustrate9"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send_red_packet_illustrate10"
android:textColor="@color/white"
android:textSize="11sp" />
</LinearLayout>
<ImageView
android:id="@+id/illustrate_close"
android:layout_width="19dp"
android:layout_height="19dp"
android:layout_gravity="end"
android:layout_margin="12dp"
android:src="@mipmap/meiyan_icon_close" />
</FrameLayout>
</FrameLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB