红包中奖列表
This commit is contained in:
parent
58508ca0ae
commit
895a1c6951
@ -788,4 +788,13 @@ public interface PDLiveApi {
|
|||||||
Observable<ResponseModel<List<RedPacketGiftModel>>> getRedPacketSuperPrizeReceive(
|
Observable<ResponseModel<List<RedPacketGiftModel>>> getRedPacketSuperPrizeReceive(
|
||||||
@Query("super_jackpot_id") String superJackpotId
|
@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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -1692,6 +1692,28 @@ public class LiveNetManager {
|
|||||||
}).isDisposed();
|
}).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();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 直播间取消网络请求
|
* 直播间取消网络请求
|
||||||
*/
|
*/
|
||||||
|
@ -1644,7 +1644,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
case LIVE_END:
|
case LIVE_END:
|
||||||
endLive();
|
endLive();
|
||||||
break;
|
break;
|
||||||
|
case RED_PACKET:
|
||||||
|
if (manager != null) {
|
||||||
|
mLiveRoomViewHolder.redPacketManage(event.getRedPacketModel());
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
public void redPacketManage(RedPacketModel redPacketModel) {
|
||||||
|
anchorTimeHandler.removeCallbacks(anchorTimeRunnable);
|
||||||
|
timeHandler.removeCallbacks(timeRunnable);
|
||||||
mRedPacketModel = redPacketModel;
|
mRedPacketModel = redPacketModel;
|
||||||
if (redPacketModel.getIsShow() == 1) {
|
if (redPacketModel.getIsShow() == 1) {
|
||||||
redPacket.setVisibility(View.VISIBLE);
|
redPacket.setVisibility(View.VISIBLE);
|
||||||
if (redPacketModel.getCountdown() > 180) {
|
if (redPacketModel.getCountdown() > 180) {
|
||||||
redPacketQueue.setVisibility(View.GONE);
|
redPacketQueue.setVisibility(View.GONE);
|
||||||
redPacketCountdown.setVisibility(View.VISIBLE);
|
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)));
|
redPacketCountdown.setText(String.format(mContext.getString(R.string.red_packet_countdown), TimeUtils.getTime(redTimeCountdown)));
|
||||||
timeHandler.postDelayed(timeRunnable, 1000);
|
timeHandler.post(timeRunnable);
|
||||||
} else {
|
} else {
|
||||||
redPacketQueue.setVisibility(View.VISIBLE);
|
redPacketQueue.setVisibility(View.VISIBLE);
|
||||||
redPacketCountdown.setVisibility(View.GONE);
|
redPacketCountdown.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
if (IMLoginManager.get(mContext).getUserInfo().anchorUserType() && mContext instanceof LiveRyAnchorActivity) {
|
||||||
|
anchorTimeHandler.removeCallbacks(anchorTimeRunnable);
|
||||||
|
anchorTimeHandler.post(anchorTimeRunnable);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
hindeRedPacket();
|
hindeRedPacket();
|
||||||
}
|
}
|
||||||
@ -1429,34 +1464,40 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.red_packet), new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.red_packet), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
LiveNetManager.get(mContext)
|
|
||||||
.redPacketInfo(mLiveUid, redPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback<RedPacketInfoModel>() {
|
if (!(mContext instanceof LiveRyAnchorActivity)) {
|
||||||
@Override
|
LiveNetManager.get(mContext)
|
||||||
public void onSuccess(RedPacketInfoModel data) {
|
.redPacketInfo(mLiveUid, redPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback<RedPacketInfoModel>() {
|
||||||
if (TextUtils.equals(data.getReceiveStatus(), "0")) {
|
@Override
|
||||||
new XPopup.Builder(mContext)
|
public void onSuccess(RedPacketInfoModel data) {
|
||||||
.asCustom(new ReceiveRendPacketPopup(mContext, redTimeCountdown, mLiveUid, mStream, redPacketModel.getRedPacketId(), data, false))
|
if (TextUtils.equals(data.getReceiveStatus(), "0")) {
|
||||||
.show();
|
new XPopup.Builder(mContext)
|
||||||
} else if (TextUtils.equals(data.getReceiveStatus(), "1")) {
|
.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)
|
new XPopup.Builder(mContext)
|
||||||
.asCustom(new ResultRendPacketPopup(mContext, true, null, false))
|
.asCustom(new ResultRendPacketPopup(mContext, true, null, false))
|
||||||
.show();
|
.show();
|
||||||
} else {
|
|
||||||
new XPopup.Builder(mContext)
|
|
||||||
.asCustom(new ResultRendPacketPopup(mContext, false, data.setRedPacketId(redPacketModel.getRedPacketId()), false))
|
|
||||||
.show();
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(String error) {
|
|
||||||
ToastUtil.show(error);
|
|
||||||
new XPopup.Builder(mContext)
|
|
||||||
.asCustom(new ResultRendPacketPopup(mContext, true, null, false))
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1568,6 +1609,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
*/
|
*/
|
||||||
public void resetView() {
|
public void resetView() {
|
||||||
timeHandler.removeCallbacks(timeRunnable);
|
timeHandler.removeCallbacks(timeRunnable);
|
||||||
|
anchorTimeHandler.removeCallbacks(anchorTimeRunnable);
|
||||||
resetViewGone();
|
resetViewGone();
|
||||||
visibility = false;
|
visibility = false;
|
||||||
pkUidTmp = "";
|
pkUidTmp = "";
|
||||||
@ -3681,6 +3723,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
|
|
||||||
public void clearData() {
|
public void clearData() {
|
||||||
timeHandler.removeCallbacks(timeRunnable);
|
timeHandler.removeCallbacks(timeRunnable);
|
||||||
|
anchorTimeHandler.removeCallbacks(anchorTimeRunnable);
|
||||||
LiveHttpUtil.cancel(LiveHttpConsts.GET_USER_LIST);
|
LiveHttpUtil.cancel(LiveHttpConsts.GET_USER_LIST);
|
||||||
LiveHttpUtil.cancel(LiveHttpConsts.TIME_CHARGE);
|
LiveHttpUtil.cancel(LiveHttpConsts.TIME_CHARGE);
|
||||||
CommonHttpUtil.cancel(CommonHttpConsts.SET_ATTENTION);
|
CommonHttpUtil.cancel(CommonHttpConsts.SET_ATTENTION);
|
||||||
|
@ -25,6 +25,6 @@ public class RedPacketLuckUserViewHolder extends RecyclerView.ViewHolder {
|
|||||||
public void showData(RedPacketGiftModel redPacketGiftModel) {
|
public void showData(RedPacketGiftModel redPacketGiftModel) {
|
||||||
ImgLoader.displayAvatar(itemView.getContext(), redPacketGiftModel.getGifticon(), giftImage);
|
ImgLoader.displayAvatar(itemView.getContext(), redPacketGiftModel.getGifticon(), giftImage);
|
||||||
giftName.setText(redPacketGiftModel.getUserNicename());
|
giftName.setText(redPacketGiftModel.getUserNicename());
|
||||||
giftNumber.setText(redPacketGiftModel.getGiftNum());
|
giftNumber.setText(redPacketGiftModel.getNeedcoin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -716,7 +716,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/live_rank_pk"
|
android:layout_below="@+id/live_rank_pk"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:layout_marginTop="15dp" />
|
android:layout_marginTop="15dp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/btn_prize_pool_level"
|
android:id="@+id/btn_prize_pool_level"
|
||||||
@ -746,7 +747,7 @@
|
|||||||
android:translationX="-48dp" />
|
android:translationX="-48dp" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
<!--接收-->
|
<!--接收-->
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/ft_hot_add"
|
android:id="@+id/ft_hot_add"
|
||||||
android:layout_width="81dp"
|
android:layout_width="81dp"
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/gift_number"
|
android:id="@+id/gift_number"
|
||||||
android:layout_width="30dp"
|
android:layout_width="40dp"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
|
Loading…
Reference in New Issue
Block a user