红包中奖列表
This commit is contained in:
parent
5736265388
commit
58508ca0ae
@ -184,6 +184,7 @@ public class Constants {
|
||||
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";//炸金花
|
||||
|
@ -24,15 +24,10 @@ public class RedPacketGiftModel extends BaseModel {
|
||||
private String gifticon;
|
||||
@SerializedName("gift_num")
|
||||
private String giftNum;
|
||||
|
||||
public String getGiftNum() {
|
||||
return "X" +giftNum;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setGiftNum(String giftNum) {
|
||||
this.giftNum = giftNum;
|
||||
return this;
|
||||
}
|
||||
@SerializedName("user_nicename")
|
||||
private String userNicename;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
@ -53,7 +48,7 @@ public class RedPacketGiftModel extends BaseModel {
|
||||
}
|
||||
|
||||
public String getNeedcoin() {
|
||||
return "X" + needcoin;
|
||||
return needcoin;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setNeedcoin(String needcoin) {
|
||||
@ -69,4 +64,31 @@ public class RedPacketGiftModel extends BaseModel {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,43 @@ public class RedPacketInfoModel extends BaseModel {
|
||||
//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;
|
||||
|
@ -25,6 +25,8 @@ public class RedPacketModel extends BaseModel {
|
||||
@SerializedName("conditions")
|
||||
private int conditions;
|
||||
|
||||
|
||||
|
||||
public int getIsShow() {
|
||||
return isShow;
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.RedPacketGiftModel;
|
||||
import com.yunbao.common.bean.RedPacketInfoModel;
|
||||
import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
@ -753,7 +754,6 @@ public interface PDLiveApi {
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取盲盒礼物当前数据
|
||||
*/
|
||||
@ -763,4 +763,29 @@ public interface PDLiveApi {
|
||||
@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
|
||||
);
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.RedPacketGiftModel;
|
||||
import com.yunbao.common.bean.RedPacketInfoModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
@ -1609,9 +1610,9 @@ public class LiveNetManager {
|
||||
* @param liveUid 直播间id
|
||||
* @param redPacketId 红包id
|
||||
*/
|
||||
public void getRedPacket(String liveUid,String stream, String redPacketId, HttpCallback<RedPacketInfoModel> callback) {
|
||||
public void getRedPacket(String liveUid, String stream, String redPacketId, HttpCallback<RedPacketInfoModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getRedPacket(liveUid, stream,redPacketId)
|
||||
.getRedPacket(liveUid, stream, redPacketId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(redPacketInfoModelResponseModel -> {
|
||||
@ -1625,6 +1626,72 @@ public class LiveNetManager {
|
||||
}).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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
@ -1228,4 +1228,5 @@ Limited ride And limited avatar frame</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>
|
||||
|
@ -1387,6 +1387,11 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
manager.redPacketManage(event.getRedPacketModel());
|
||||
}
|
||||
break;
|
||||
case RED_PACKET_SUPER_JACKPOT:
|
||||
if (manager != null) {
|
||||
manager.setRedPacketInfoModel(event.getRedPacketInfoModel());
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
@ -36,16 +36,17 @@ public class ReceiveRendPacketPopup extends CenterPopupView {
|
||||
private Button redPacketOpen;
|
||||
private TextView redPacketTimeText, receiveRed, redPacketValue;
|
||||
private FrameLayout redPacketTimeLayout;
|
||||
private String mLiveUid,stream, redPacketId, userID;
|
||||
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) {
|
||||
public ReceiveRendPacketPopup(@NonNull Context context, int time, String mLiveUid, String stream,
|
||||
String redPacketId, RedPacketInfoModel redPacketInfoModel,
|
||||
boolean isSuperJackpot) {
|
||||
|
||||
super(context);
|
||||
this.time = time;
|
||||
@ -53,6 +54,7 @@ public class ReceiveRendPacketPopup extends CenterPopupView {
|
||||
this.stream = stream;
|
||||
this.redPacketId = redPacketId;
|
||||
this.redPacketInfoModel = redPacketInfoModel;
|
||||
this.isSuperJackpot = isSuperJackpot;
|
||||
|
||||
}
|
||||
|
||||
@ -71,10 +73,8 @@ public class ReceiveRendPacketPopup extends CenterPopupView {
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
|
||||
ImgLoader.displayAvatar(getContext(), redPacketInfoModel.getAvatar(), headPortrait);
|
||||
receiveRed.setText(String.format(getContext()
|
||||
.getString(R.string.together_to_achieve_goal),
|
||||
redPacketInfoModel.getUserNicename()));
|
||||
redPacketValue.setText(redPacketInfoModel.getAmountDiamond());
|
||||
redPacketGiftAdapter.addData(redPacketInfoModel.getPacketGiftModels());
|
||||
IMLoginModel userInfo = IMLoginManager.get(getContext()).getUserInfo();
|
||||
@ -83,6 +83,13 @@ public class ReceiveRendPacketPopup extends CenterPopupView {
|
||||
} 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();
|
||||
}
|
||||
@ -141,24 +148,58 @@ public class ReceiveRendPacketPopup extends CenterPopupView {
|
||||
}
|
||||
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.red_packet_open), () -> {
|
||||
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))
|
||||
.show();
|
||||
}
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
dismiss();
|
||||
new XPopup.Builder(getContext())
|
||||
.asCustom(new ResultRendPacketPopup(getContext(), true, null))
|
||||
.show();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(isAttention, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
|
@ -7,23 +7,35 @@ 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) {
|
||||
public ResultRendPacketPopup(@NonNull Context context,
|
||||
boolean noData,
|
||||
RedPacketInfoModel redPacketInfoModel,
|
||||
boolean isSuperJackpot) {
|
||||
super(context);
|
||||
this.redPacketInfoModel = redPacketInfoModel;
|
||||
this.noData = noData;
|
||||
this.isSuperJackpot = isSuperJackpot;
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局离开
|
||||
@ -82,7 +94,42 @@ public class ResultRendPacketPopup extends CenterPopupView {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ 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;
|
||||
@ -45,6 +46,16 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
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;
|
||||
@ -368,7 +379,8 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
VOTE_UPDATE(66, "更新投票"),
|
||||
VOTE_END(67, "投票结束"),
|
||||
BLIND_BOX(68, "盲盒全服通知"),
|
||||
RED_PACKET(69, "RedPacket");
|
||||
RED_PACKET(69, "RedPacket"),
|
||||
RED_PACKET_SUPER_JACKPOT(70, "超级红包");
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
@ -28,6 +28,7 @@ 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;
|
||||
@ -686,6 +687,12 @@ public class SocketRyClient {
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1391,6 +1391,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
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("/")
|
||||
@ -1434,15 +1435,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
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))
|
||||
.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))
|
||||
.asCustom(new ResultRendPacketPopup(mContext, true, null, false))
|
||||
.show();
|
||||
} else {
|
||||
new XPopup.Builder(mContext)
|
||||
.asCustom(new ResultRendPacketPopup(mContext, false, data))
|
||||
.asCustom(new ResultRendPacketPopup(mContext, false, data.setRedPacketId(redPacketModel.getRedPacketId()), false))
|
||||
.show();
|
||||
}
|
||||
|
||||
@ -1452,7 +1453,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
new XPopup.Builder(mContext)
|
||||
.asCustom(new ResultRendPacketPopup(mContext, true, null))
|
||||
.asCustom(new ResultRendPacketPopup(mContext, true, null, false))
|
||||
.show();
|
||||
}
|
||||
});
|
||||
@ -1465,6 +1466,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏女神说
|
||||
*/
|
||||
@ -1560,6 +1567,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
* 重置数据
|
||||
*/
|
||||
public void resetView() {
|
||||
timeHandler.removeCallbacks(timeRunnable);
|
||||
resetViewGone();
|
||||
visibility = false;
|
||||
pkUidTmp = "";
|
||||
@ -3672,6 +3680,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
}
|
||||
|
||||
public void clearData() {
|
||||
timeHandler.removeCallbacks(timeRunnable);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.GET_USER_LIST);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.TIME_CHARGE);
|
||||
CommonHttpUtil.cancel(CommonHttpConsts.SET_ATTENTION);
|
||||
|
@ -39,6 +39,7 @@ 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;
|
||||
@ -2040,4 +2041,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveRoomViewHolder.redPacketManage(redPacket);
|
||||
}
|
||||
}
|
||||
public void setRedPacketInfoModel(RedPacketInfoModel redPacket) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.setRedPacketInfoModel(redPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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.getGiftNum());
|
||||
}
|
||||
}
|
38
live/src/main/res/layout/view_red_packet_luck_user.xml
Normal file
38
live/src/main/res/layout/view_red_packet_luck_user.xml
Normal 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="30dp"
|
||||
android:gravity="end"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:textColor ="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
39
live/src/main/res/layout/view_red_packet_user_list.xml
Normal file
39
live/src/main/res/layout/view_red_packet_user_list.xml
Normal 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>
|
Loading…
Reference in New Issue
Block a user