红包中奖列表

This commit is contained in:
18401019693 2023-07-03 17:48:02 +08:00
parent 58508ca0ae
commit 895a1c6951
7 changed files with 109 additions and 30 deletions

View File

@ -788,4 +788,13 @@ public interface PDLiveApi {
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

@ -1692,6 +1692,28 @@ public class LiveNetManager {
}).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

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

@ -1404,24 +1404,59 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
};
//主播倒计时调用接口
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);
redTimeCountdown = redPacketModel.getCountdown() - 180;
mCountdown = redPacketModel.getCountdown();
redTimeCountdown = mCountdown - 180;
redPacketCountdown.setText(String.format(mContext.getString(R.string.red_packet_countdown), TimeUtils.getTime(redTimeCountdown)));
timeHandler.postDelayed(timeRunnable, 1000);
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();
}
@ -1429,6 +1464,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
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
@ -1446,7 +1483,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
.asCustom(new ResultRendPacketPopup(mContext, false, data.setRedPacketId(redPacketModel.getRedPacketId()), false))
.show();
}
if (TextUtils.equals(data.getConditions(), "1")) {
follow();
}
}
@Override
@ -1457,6 +1496,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
.show();
}
});
}
}
});
@ -1568,6 +1609,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
*/
public void resetView() {
timeHandler.removeCallbacks(timeRunnable);
anchorTimeHandler.removeCallbacks(anchorTimeRunnable);
resetViewGone();
visibility = false;
pkUidTmp = "";
@ -3681,6 +3723,7 @@ 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

@ -25,6 +25,6 @@ public class RedPacketLuckUserViewHolder extends RecyclerView.ViewHolder {
public void showData(RedPacketGiftModel redPacketGiftModel) {
ImgLoader.displayAvatar(itemView.getContext(), redPacketGiftModel.getGifticon(), giftImage);
giftName.setText(redPacketGiftModel.getUserNicename());
giftNumber.setText(redPacketGiftModel.getGiftNum());
giftNumber.setText(redPacketGiftModel.getNeedcoin());
}
}

View File

@ -716,7 +716,8 @@
android:layout_height="wrap_content"
android:layout_below="@+id/live_rank_pk"
android:layout_marginStart="12dp"
android:layout_marginTop="15dp" />
android:layout_marginTop="15dp"
android:visibility="gone" />
<FrameLayout
android:id="@+id/btn_prize_pool_level"
@ -746,7 +747,7 @@
android:translationX="-48dp" />
</FrameLayout>
<!--接收-->
<!--接收-->
<FrameLayout
android:id="@+id/ft_hot_add"
android:layout_width="81dp"

View File

@ -27,7 +27,7 @@
<TextView
android:id="@+id/gift_number"
android:layout_width="30dp"
android:layout_width="40dp"
android:gravity="end"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"