神龙列表接口对接,神龙送财活动参加接口对接,ui更新

This commit is contained in:
18401019693 2024-03-14 18:21:55 +08:00
parent 1981fb553a
commit cf34e73d32
7 changed files with 100 additions and 15 deletions

View File

@ -1,5 +1,7 @@
package com.yunbao.common.adapter; package com.yunbao.common.adapter;
import android.os.CountDownTimer;
import android.util.SparseArray;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -16,9 +18,17 @@ import java.util.List;
public class DragonSendMoneyListAdapter extends RecyclerView.Adapter { public class DragonSendMoneyListAdapter extends RecyclerView.Adapter {
RecyclerView send_money_list; RecyclerView send_money_list;
boolean isAnchor;
SparseArray<CountDownTimer> countDownMap;
public DragonSendMoneyListAdapter setAnchor(boolean anchor) {
isAnchor = anchor;
return this;
}
public DragonSendMoneyListAdapter(RecyclerView send_money_list) { public DragonSendMoneyListAdapter(RecyclerView send_money_list) {
this.send_money_list = send_money_list; this.send_money_list = send_money_list;
countDownMap = new SparseArray<>();
} }
List<sendMoneyLongListModel> moneyLongListModels = new ArrayList<>(); List<sendMoneyLongListModel> moneyLongListModels = new ArrayList<>();
@ -47,7 +57,16 @@ public class DragonSendMoneyListAdapter extends RecyclerView.Adapter {
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
DragonSendMoneyListViewHolder sendMoneyListViewHolder = (DragonSendMoneyListViewHolder) holder; DragonSendMoneyListViewHolder sendMoneyListViewHolder = (DragonSendMoneyListViewHolder) holder;
sendMoneyListViewHolder.setData(moneyLongListModels.get(position), callBack); // sendMoneyLongListModel model = moneyLongListModels.get(position);
// long mPkTimeCount2 = Long.parseLong(model.getCountdown());
// long time = mPkTimeCount2 * 1000;
// if (sendMoneyListViewHolder.countDownTimer != null) {
// sendMoneyListViewHolder.countDownTimer.cancel();
// }
// if (time > 0) {
//
// }
sendMoneyListViewHolder.setData(moneyLongListModels.get(position), callBack, isAnchor);
} }

View File

@ -13,6 +13,7 @@ public class SendMoneyLongModel extends BaseModel {
* "liveuid": "98889", * "liveuid": "98889",
* "add_time": 1710318757, * "add_time": 1710318757,
* "gold_num": "5000" * "gold_num": "5000"
* "countdown": 300 // 倒计时
* } * }
*/ */
@ -32,6 +33,17 @@ public class SendMoneyLongModel extends BaseModel {
private String addTime; private String addTime;
@SerializedName("gold_num") @SerializedName("gold_num")
private String goldNum; private String goldNum;
@SerializedName("countdown")
private String countdown;
public String getCountdown() {
return countdown;
}
public SendMoneyLongModel setCountdown(String countdown) {
this.countdown = countdown;
return this;
}
public String getMethod() { public String getMethod() {
return method; return method;

View File

@ -1,5 +1,6 @@
package com.yunbao.common.views; package com.yunbao.common.views;
import android.os.CountDownTimer;
import android.os.Handler; import android.os.Handler;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
@ -25,6 +26,7 @@ public class DragonSendMoneyListViewHolder extends RecyclerView.ViewHolder {
TextView send_benefits; TextView send_benefits;
LinearLayout button_participate; LinearLayout button_participate;
long mPkTimeCount2; long mPkTimeCount2;
public CountDownTimer countDownTimer;
public DragonSendMoneyListViewHolder(@NonNull View itemView) { public DragonSendMoneyListViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
@ -37,11 +39,12 @@ public class DragonSendMoneyListViewHolder extends RecyclerView.ViewHolder {
send_benefits = itemView.findViewById(R.id.send_benefits); send_benefits = itemView.findViewById(R.id.send_benefits);
} }
public void setData(sendMoneyLongListModel model, DragonSendMoneyListClicksCallBack callBack) { public void setData(sendMoneyLongListModel model, DragonSendMoneyListClicksCallBack callBack,boolean isAnchor) {
ImgLoader.display(itemView.getContext(), model.getUserAvatar(), live_avatar); ImgLoader.display(itemView.getContext(), model.getUserAvatar(), live_avatar);
user_nicename.setText(String.valueOf(model.getUserNicename())); user_nicename.setText(String.valueOf(model.getUserNicename()));
gold_num.setText(String.valueOf(model.getGoldNum())); gold_num.setText(String.valueOf(model.getGoldNum()));
if (TextUtils.equals("0", model.getParticipate())) {
if (TextUtils.equals("0", model.getParticipate()) && !isAnchor) {
participate.setVisibility(View.VISIBLE); participate.setVisibility(View.VISIBLE);
send_benefits_time.setVisibility(View.GONE); send_benefits_time.setVisibility(View.GONE);
send_benefits.setVisibility(View.GONE); send_benefits.setVisibility(View.GONE);
@ -54,15 +57,15 @@ public class DragonSendMoneyListViewHolder extends RecyclerView.ViewHolder {
} }
if (send_benefits_time.getVisibility() == View.VISIBLE) { if (send_benefits_time.getVisibility() == View.VISIBLE) {
handler.removeCallbacks(runnable); handler.removeCallbacks(runnable);
mPkTimeCount2 = Long.parseLong(model.getCountdown());
String s1 = StringUtil.getDurationText(mPkTimeCount2 * 1000); String s1 = StringUtil.getDurationText(mPkTimeCount2 * 1000);
send_benefits_time.setText(s1); send_benefits_time.setText(s1);
mPkTimeCount2 = Long.parseLong(model.getCountdown());
handler.postDelayed(runnable, 1000); handler.postDelayed(runnable, 1000);
} }
ViewClicksAntiShake.clicksAntiShake(button_participate, new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(button_participate, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
if (callBack != null && TextUtils.equals("0", model.getParticipate())) { if (!isAnchor && callBack != null && TextUtils.equals("0", model.getParticipate())) {
callBack.onParticipate(model); callBack.onParticipate(model);
handler.removeCallbacks(runnable); handler.removeCallbacks(runnable);
} }

View File

@ -48,6 +48,7 @@ import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.LiveUserGiftBean;
import com.yunbao.common.bean.MicUserBean; import com.yunbao.common.bean.MicUserBean;
import com.yunbao.common.bean.SendMoneyLongModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.NotCancelableDialog; import com.yunbao.common.dialog.NotCancelableDialog;
import com.yunbao.common.event.GiftWallIlluminateEvent; import com.yunbao.common.event.GiftWallIlluminateEvent;
@ -1709,6 +1710,14 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
liveInputDialogFragment.setArguments(liveInputBundle); liveInputDialogFragment.setArguments(liveInputBundle);
liveInputDialogFragment.show(getSupportFragmentManager(), "LiveInputDialogFragment"); liveInputDialogFragment.show(getSupportFragmentManager(), "LiveInputDialogFragment");
break; break;
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onSendMoneyLongModel(SendMoneyLongModel sendMoneyLongModel) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.onSendMoneyLongModel(sendMoneyLongModel);
} }
} }

View File

@ -26,11 +26,13 @@ public class DragonSendMoneyListPopup extends AbsDialogPopupWindow {
String mLiveUid; String mLiveUid;
DragonSendMoneyListAdapter dragonSendMoneyListAdapter; DragonSendMoneyListAdapter dragonSendMoneyListAdapter;
RecyclerView send_money_list; RecyclerView send_money_list;
boolean isAnchor;
public DragonSendMoneyListPopup(@NonNull Context context, String liveUid) { public DragonSendMoneyListPopup(@NonNull Context context, String liveUid, boolean isAnchor) {
super(context); super(context);
activity = (FragmentActivity) context; activity = (FragmentActivity) context;
mLiveUid = liveUid; mLiveUid = liveUid;
this.isAnchor = isAnchor;
} }
@Override @Override
@ -52,7 +54,7 @@ public class DragonSendMoneyListPopup extends AbsDialogPopupWindow {
dragonSendMoneyListAdapter = new DragonSendMoneyListAdapter(send_money_list); dragonSendMoneyListAdapter = new DragonSendMoneyListAdapter(send_money_list);
send_money_list.setAdapter(dragonSendMoneyListAdapter); send_money_list.setAdapter(dragonSendMoneyListAdapter);
dragonSendMoneyListAdapter.setAnchor(isAnchor);
dragonSendMoneyListAdapter.setCallBack(new DragonSendMoneyListViewHolder.DragonSendMoneyListClicksCallBack() { dragonSendMoneyListAdapter.setCallBack(new DragonSendMoneyListViewHolder.DragonSendMoneyListClicksCallBack() {
@Override @Override
public void onParticipate(sendMoneyLongListModel moneyLongListModel) { public void onParticipate(sendMoneyLongListModel moneyLongListModel) {

View File

@ -165,7 +165,6 @@ import com.yunbao.live.custom.RightGradual;
import com.yunbao.live.dialog.DragonSendMoneyListPopup; import com.yunbao.live.dialog.DragonSendMoneyListPopup;
import com.yunbao.live.dialog.DragonSendsMoneyPopup; import com.yunbao.live.dialog.DragonSendsMoneyPopup;
import com.yunbao.live.dialog.GiftWallDialog; import com.yunbao.live.dialog.GiftWallDialog;
import com.yunbao.live.dialog.GuardUpgradePopup;
import com.yunbao.live.dialog.LiveContactDetailsSendGiftDialog; import com.yunbao.live.dialog.LiveContactDetailsSendGiftDialog;
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment; import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
import com.yunbao.live.dialog.LiveFansMedalDialogFragment; import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
@ -1594,10 +1593,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
combo_layout.setVisibility(View.GONE); combo_layout.setVisibility(View.GONE);
dragonImmediateParticipation = (LinearLayout) findViewById(R.id.dragon_immediate_participation); dragonImmediateParticipation = (LinearLayout) findViewById(R.id.dragon_immediate_participation);
dragonImmediateParticipationTime = (LinearLayout) findViewById(R.id.dragon_immediate_participation_time);
participation_time = (TextView) findViewById(R.id.participation_time);
ViewClicksAntiShake.clicksAntiShake(dragonImmediateParticipation, new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(dragonImmediateParticipation, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
new DragonSendMoneyListPopup(mContext, mLiveUid).showDialog(); new DragonSendMoneyListPopup(mContext, mLiveUid, false).showDialog();
// new XPopup.Builder(mContext)
// .asCustom(new GuardUpgradePopup(mContext, mLiveUid))
// .show();
}
});
ViewClicksAntiShake.clicksAntiShake(dragonImmediateParticipationTime, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new DragonSendMoneyListPopup(mContext, mLiveUid, true).showDialog();
// new XPopup.Builder(mContext) // new XPopup.Builder(mContext)
// .asCustom(new GuardUpgradePopup(mContext, mLiveUid)) // .asCustom(new GuardUpgradePopup(mContext, mLiveUid))
// .show(); // .show();
@ -1606,9 +1616,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// dragonImmediateParticipation.setVisibility(View.GONE); // dragonImmediateParticipation.setVisibility(View.GONE);
} }
private LinearLayout dragonImmediateParticipation; private LinearLayout dragonImmediateParticipation, dragonImmediateParticipationTime;
private FrameLayout redPacket; private FrameLayout redPacket;
private TextView redPacketCountdown, redSchedule, openRedPacket; private TextView redPacketCountdown, redSchedule, openRedPacket, participation_time;
private LinearLayout redPacketQueue; private LinearLayout redPacketQueue;
private int redTimeCountdown = 0; private int redTimeCountdown = 0;
private RedPacketModel mRedPacketModel; private RedPacketModel mRedPacketModel;
@ -3150,12 +3160,41 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
gift_svga.setVisibility(View.VISIBLE); gift_svga.setVisibility(View.VISIBLE);
} }
} }
public void onSendMoneyLongModel(SendMoneyLongModel sendMoneyLongModel) { public void onSendMoneyLongModel(SendMoneyLongModel sendMoneyLongModel) {
if (mLiveUid.contains(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()))) {
sendMoneyTime = Long.parseLong(sendMoneyLongModel.getCountdown());
participation_time.removeCallbacks(sendMoneyRunnable);
dragonImmediateParticipationTime.setVisibility(View.VISIBLE);
String s1 = StringUtil.getDurationText(sendMoneyTime * 1000);
participation_time.setText(s1);
participation_time.post(sendMoneyRunnable);
} else {
dragonImmediateParticipation.setVisibility(View.VISIBLE); dragonImmediateParticipation.setVisibility(View.VISIBLE);
} }
}
private long sendMoneyTime;
Runnable sendMoneyRunnable = new Runnable() {
@Override
public void run() {
sendMoneyTime--;
if (sendMoneyTime > 0) {
String s1 = StringUtil.getDurationText(sendMoneyTime * 1000);
participation_time.setText(s1);
participation_time.postDelayed(sendMoneyRunnable, 1000);
} else {
participation_time.removeCallbacks(sendMoneyRunnable);
}
}
};
public void onSendMoneyLong() { public void onSendMoneyLong() {
dragonImmediateParticipation.setVisibility(View.VISIBLE); dragonImmediateParticipation.setVisibility(View.VISIBLE);
} }
/** /**
* 设置礼物墙和周星榜 * 设置礼物墙和周星榜
*/ */

View File

@ -2589,6 +2589,7 @@
android:src="@mipmap/icon_live_dragon_money" /> android:src="@mipmap/icon_live_dragon_money" />
<TextView <TextView
android:id="@+id/participation_time"
android:layout_width="45dp" android:layout_width="45dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="-5dp" android:layout_marginTop="-5dp"