神龙列表接口对接,神龙送财活动参加接口对接,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;
import android.os.CountDownTimer;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -16,9 +18,17 @@ import java.util.List;
public class DragonSendMoneyListAdapter extends RecyclerView.Adapter {
RecyclerView send_money_list;
boolean isAnchor;
SparseArray<CountDownTimer> countDownMap;
public DragonSendMoneyListAdapter setAnchor(boolean anchor) {
isAnchor = anchor;
return this;
}
public DragonSendMoneyListAdapter(RecyclerView send_money_list) {
this.send_money_list = send_money_list;
countDownMap = new SparseArray<>();
}
List<sendMoneyLongListModel> moneyLongListModels = new ArrayList<>();
@@ -47,7 +57,16 @@ public class DragonSendMoneyListAdapter extends RecyclerView.Adapter {
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
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",
* "add_time": 1710318757,
* "gold_num": "5000"
* "countdown": 300 // 倒计时
* }
*/
@@ -32,6 +33,17 @@ public class SendMoneyLongModel extends BaseModel {
private String addTime;
@SerializedName("gold_num")
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() {
return method;

View File

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