神龙送财结束Im结束调用接口,神龙列表倒计时修改

This commit is contained in:
18401019693 2024-03-18 10:24:05 +08:00
parent cf34e73d32
commit ddc9bc344e
12 changed files with 161 additions and 27 deletions

View File

@ -26,6 +26,10 @@ public class DragonSendMoneyListAdapter extends RecyclerView.Adapter {
return this;
}
public List<sendMoneyLongListModel> getMoneyLongListModels() {
return moneyLongListModels;
}
public DragonSendMoneyListAdapter(RecyclerView send_money_list) {
this.send_money_list = send_money_list;
countDownMap = new SparseArray<>();

View File

@ -14,6 +14,7 @@ public class SendMoneyLongModel extends BaseModel {
* "add_time": 1710318757,
* "gold_num": "5000"
* "countdown": 300 // 倒计时
* "send_money_long_key": "1710384258446",
* }
*/
@ -35,6 +36,17 @@ public class SendMoneyLongModel extends BaseModel {
private String goldNum;
@SerializedName("countdown")
private String countdown;
@SerializedName("send_money_long_key")
private String sendMoneyLongKey;
public String getSendMoneyLongKey() {
return sendMoneyLongKey;
}
public SendMoneyLongModel setSendMoneyLongKey(String sendMoneyLongKey) {
this.sendMoneyLongKey = sendMoneyLongKey;
return this;
}
public String getCountdown() {
return countdown;

View File

@ -0,0 +1,6 @@
package com.yunbao.common.event;
import com.yunbao.common.bean.BaseModel;
public class SendMoneyLongEndEvent extends BaseModel {
}

View File

@ -62,6 +62,7 @@ import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.bean.RedPacketListBean;
import com.yunbao.common.bean.RoomMicStatusModel;
import com.yunbao.common.bean.SearchModel;
import com.yunbao.common.bean.SendMoneyLongModel;
import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.SlideInBannerModel;
import com.yunbao.common.bean.StarChallengeStatusModel;
@ -1183,4 +1184,6 @@ public interface PDLiveApi {
@GET("/api/public/?service=Guard.participateMoneyLong")
Observable<ResponseModel<String>> participateMoneyLong(@Query("liveuid") String liveUid, @Query("send_money_long_key") String sendMoneyLongKey);
@GET("/api/public/?service=Guard.endSendMoneyLong")
Observable<ResponseModel<SendMoneyLongModel>> endSendMoneyLong(@Query("liveuid") String liveUid, @Query("send_money_long_key") String sendMoneyLongKey);
}

View File

@ -59,6 +59,7 @@ import com.yunbao.common.bean.RedPacketGiftModel;
import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.bean.RedPacketListBean;
import com.yunbao.common.bean.RoomMicStatusModel;
import com.yunbao.common.bean.SendMoneyLongModel;
import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.SudGameUserModel;
@ -3054,6 +3055,30 @@ public class LiveNetManager {
}
public void endSendMoneyLong(String liveUid, String sendMoneyLongKey, HttpCallback<SendMoneyLongModel> callback) {
API.get().pdLiveApi(mContext)
.endSendMoneyLong(liveUid, sendMoneyLongKey)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<SendMoneyLongModel>>() {
@Override
public void accept(ResponseModel<SendMoneyLongModel> stringResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(stringResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
throwable.printStackTrace();
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
public void sendMoneyLongList(String liveUid, HttpCallback<List<sendMoneyLongListModel>> callback) {
API.get().pdLiveApi(mContext)
.sendMoneyLongList(liveUid)

View File

@ -56,39 +56,39 @@ public class DragonSendMoneyListViewHolder extends RecyclerView.ViewHolder {
button_participate.setBackgroundResource(R.mipmap.icon_send_benefits);
}
if (send_benefits_time.getVisibility() == View.VISIBLE) {
handler.removeCallbacks(runnable);
// handler.removeCallbacks(runnable);
mPkTimeCount2 = Long.parseLong(model.getCountdown());
String s1 = StringUtil.getDurationText(mPkTimeCount2 * 1000);
send_benefits_time.setText(s1);
handler.postDelayed(runnable, 1000);
// handler.postDelayed(runnable, 1000);
}
ViewClicksAntiShake.clicksAntiShake(button_participate, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (!isAnchor && callBack != null && TextUtils.equals("0", model.getParticipate())) {
callBack.onParticipate(model);
handler.removeCallbacks(runnable);
// handler.removeCallbacks(runnable);
}
}
});
}
Handler handler = new Handler();
Runnable runnable = new Runnable() {
@Override
public void run() {
mPkTimeCount2--;
if (mPkTimeCount2 > 0) {
String s1 = StringUtil.getDurationText(mPkTimeCount2 * 1000);
send_benefits_time.setText(s1);
handler.postDelayed(runnable, 1000);
} else {
handler.removeCallbacks(runnable);
}
}
};
// Handler handler = new Handler();
// Runnable runnable = new Runnable() {
// @Override
// public void run() {
// mPkTimeCount2--;
// if (mPkTimeCount2 > 0) {
// String s1 = StringUtil.getDurationText(mPkTimeCount2 * 1000);
// send_benefits_time.setText(s1);
// handler.postDelayed(runnable, 1000);
// } else {
// handler.removeCallbacks(runnable);
// }
//
// }
// };
public interface DragonSendMoneyListClicksCallBack {
void onParticipate(sendMoneyLongListModel moneyLongListModel);

View File

@ -73,6 +73,7 @@ import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent;
import com.yunbao.common.event.QuickGiftingEvent;
import com.yunbao.common.event.SendMoneyLongEndEvent;
import com.yunbao.common.event.ShowHideEvent;
import com.yunbao.common.event.SlideEvent;
import com.yunbao.common.glide.ImgLoader;
@ -1940,6 +1941,16 @@ public class LiveAudienceActivity extends LiveActivity {
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onSendMoneyLongEndEvent(SendMoneyLongEndEvent sendMoneyLongModel) {
Log.e("DateRemindModel", sendMoneyLongModel.toString());
if (manager != null) {
manager.onSendMoneyLongEndEvent(sendMoneyLongModel);
}
}
/**

View File

@ -55,6 +55,7 @@ import com.yunbao.common.event.GiftWallIlluminateEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.LoginInvalidEvent;
import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.common.event.SendMoneyLongEndEvent;
import com.yunbao.common.event.ShowHideEvent;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
@ -1721,6 +1722,16 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onSendMoneyLongEndEvent(SendMoneyLongEndEvent sendMoneyLongModel) {
Log.e("DateRemindModel", sendMoneyLongModel.toString());
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.onSendMoneyLongEndEvent(sendMoneyLongModel);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void GiftWallIlluminateEvent(GiftWallIlluminateEvent event) {
if (mLiveRoomViewHolder != null) {

View File

@ -7,6 +7,7 @@ import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.flyjingfish.gradienttextviewlib.GradientTextView;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.adapter.DragonSendMoneyListAdapter;
import com.yunbao.common.bean.sendMoneyLongListModel;
@ -19,6 +20,7 @@ import com.yunbao.common.views.DragonSendMoneyListViewHolder;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import java.util.ArrayList;
import java.util.List;
public class DragonSendMoneyListPopup extends AbsDialogPopupWindow {
@ -27,6 +29,7 @@ public class DragonSendMoneyListPopup extends AbsDialogPopupWindow {
DragonSendMoneyListAdapter dragonSendMoneyListAdapter;
RecyclerView send_money_list;
boolean isAnchor;
GradientTextView title;
public DragonSendMoneyListPopup(@NonNull Context context, String liveUid, boolean isAnchor) {
super(context);
@ -49,6 +52,7 @@ public class DragonSendMoneyListPopup extends AbsDialogPopupWindow {
protected void onCreate() {
super.onCreate();
send_money_list = findViewById(R.id.send_money_list);
title = findViewById(R.id.title);
send_money_list.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
dragonSendMoneyListAdapter = new DragonSendMoneyListAdapter(send_money_list);
@ -91,6 +95,8 @@ public class DragonSendMoneyListPopup extends AbsDialogPopupWindow {
public void onSuccess(List<sendMoneyLongListModel> data) {
dragonSendMoneyListAdapter.setMoneyLongListModels(data);
send_money_list.getRecycledViewPool().setMaxRecycledViews(0, data.size());
title.removeCallbacks(refreshRunnable);
title.postDelayed(refreshRunnable, 1000);
}
@Override
@ -112,5 +118,25 @@ public class DragonSendMoneyListPopup extends AbsDialogPopupWindow {
dismiss();
}
});
}
Runnable refreshRunnable = new Runnable() {
@Override
public void run() {
List<sendMoneyLongListModel> moneyLongListModels = dragonSendMoneyListAdapter.getMoneyLongListModels();
List<sendMoneyLongListModel> models = new ArrayList<>();
for (sendMoneyLongListModel listModel : moneyLongListModels) {
String countdown = listModel.getCountdown();
long countdownNumber = Long.parseLong(countdown);
countdownNumber = countdownNumber - 1;
if (countdownNumber > 0) {
listModel.setCountdown(String.valueOf(countdownNumber));
models.add(listModel);
}
}
dragonSendMoneyListAdapter.setMoneyLongListModels(models);
title.postDelayed(refreshRunnable, 1000);
}
};
}

View File

@ -42,6 +42,7 @@ import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.common.event.GiftWallIlluminateEvent;
import com.yunbao.common.event.QuickGiftingEvent;
import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.common.event.SendMoneyLongEndEvent;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.manager.IMRTCManager;
@ -691,7 +692,7 @@ public class SocketRyClient {
.setLiveReceiveGiftBean(JSON.parseObject(map.toString(), LiveReceiveGiftBean.class)));
break;
case "GuardSpecialEffect":
LiveReceiveGiftBean giftBean= JSON.parseObject(map.toString(), LiveReceiveGiftBean.class);
LiveReceiveGiftBean giftBean = JSON.parseObject(map.toString(), LiveReceiveGiftBean.class);
giftBean.setMedal_name(map.getString("medal_name"));
EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GuardSpecialEffect)
@ -804,9 +805,12 @@ public class SocketRyClient {
Bus.get().post(maturityDateRemindModel);
break;
case "SendMoneyLong":
SendMoneyLongModel sendMoneyLongModel = GsonUtils.fromJson(map.toString(), SendMoneyLongModel.class);
SendMoneyLongModel sendMoneyLongModel = GsonUtils.fromJson(map.toString(), SendMoneyLongModel.class);
Bus.get().post(sendMoneyLongModel);
break;
case "SendMoneyLongEnd":
Bus.get().post(new SendMoneyLongEndEvent());
break;
}
}

View File

@ -103,6 +103,7 @@ import com.yunbao.common.event.AnchorInfoEvent;
import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.SendMoneyLongEndEvent;
import com.yunbao.common.event.SlideEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.API;
@ -633,12 +634,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
liveReceiveGiftBean.setGiftId(liveReceiveGiftBean.getGiftName());
mLiveGiftAnimPresenter.showGifGift(liveReceiveGiftBean);
// if (TextUtils.equals(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()), liveReceiveGiftBean.getUid())
// && TextUtils.equals(liveReceiveGiftBean.getGuard_type(), "3")) {
new XPopup.Builder(mContext)
.asCustom(new DragonSendsMoneyPopup(mContext, mLiveUid))
.show();
// }
if (TextUtils.equals(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()), liveReceiveGiftBean.getUid())
&& TextUtils.equals(liveReceiveGiftBean.getGuard_type(), "3")) {
new XPopup.Builder(mContext)
.asCustom(new DragonSendsMoneyPopup(mContext, mLiveUid))
.show();
}
}
@ -3161,9 +3162,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
}
SendMoneyLongModel mSendMoneyLongModel;
public void onSendMoneyLongModel(SendMoneyLongModel sendMoneyLongModel) {
if (mLiveUid.contains(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()))) {
mSendMoneyLongModel = sendMoneyLongModel;
sendMoneyTime = Long.parseLong(sendMoneyLongModel.getCountdown());
participation_time.removeCallbacks(sendMoneyRunnable);
dragonImmediateParticipationTime.setVisibility(View.VISIBLE);
@ -3176,6 +3180,14 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
public void onSendMoneyLongEndEvent(SendMoneyLongEndEvent moneyLongEndEvent) {
if (mLiveUid.contains(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()))) {
dragonImmediateParticipationTime.setVisibility(View.GONE);
} else {
dragonImmediateParticipation.setVisibility(View.GONE);
}
}
private long sendMoneyTime;
Runnable sendMoneyRunnable = new Runnable() {
@Override
@ -3187,6 +3199,19 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
participation_time.postDelayed(sendMoneyRunnable, 1000);
} else {
participation_time.removeCallbacks(sendMoneyRunnable);
LiveNetManager.get(mContext)
.endSendMoneyLong(mLiveUid, mSendMoneyLongModel.getSendMoneyLongKey(),
new com.yunbao.common.http.base.HttpCallback<SendMoneyLongModel>() {
@Override
public void onSuccess(SendMoneyLongModel data) {
}
@Override
public void onError(String error) {
}
});
}
}
};

View File

@ -58,6 +58,7 @@ import com.yunbao.common.event.LiveGiftDialogEvent;
import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.common.event.SendMoneyLongEndEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
@ -763,7 +764,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
}
mLiveAudienceViewHolder.upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete());
if (!TextUtils.isEmpty(data.getModel().getSendMoneyLongKey())){
if (!TextUtils.isEmpty(data.getModel().getSendMoneyLongKey())) {
mLiveRoomViewHolder.onSendMoneyLong();
}
@ -2214,4 +2215,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.onSendMoneyLongModel(sendMoneyLongModel);
}
}
public void onSendMoneyLongEndEvent(SendMoneyLongEndEvent moneyLongEndEvent) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.onSendMoneyLongEndEvent(moneyLongEndEvent);
}
}
}