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

This commit is contained in:
18401019693
2024-03-14 16:39:04 +08:00
parent 3b6d586b58
commit 1981fb553a
21 changed files with 730 additions and 4 deletions

View File

@@ -0,0 +1,64 @@
package com.yunbao.common.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.sendMoneyLongListModel;
import com.yunbao.common.views.DragonSendMoneyListViewHolder;
import java.util.ArrayList;
import java.util.List;
public class DragonSendMoneyListAdapter extends RecyclerView.Adapter {
RecyclerView send_money_list;
public DragonSendMoneyListAdapter(RecyclerView send_money_list) {
this.send_money_list = send_money_list;
}
List<sendMoneyLongListModel> moneyLongListModels = new ArrayList<>();
DragonSendMoneyListViewHolder.DragonSendMoneyListClicksCallBack callBack;
public void setCallBack(DragonSendMoneyListViewHolder.DragonSendMoneyListClicksCallBack callBack) {
this.callBack = callBack;
}
public void setMoneyLongListModels(List<sendMoneyLongListModel> models) {
moneyLongListModels.clear();
moneyLongListModels.addAll(models);
notifyDataSetChanged();
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View goodGiftsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_dragon_send_money_list, parent, false);
return new DragonSendMoneyListViewHolder(goodGiftsView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
DragonSendMoneyListViewHolder sendMoneyListViewHolder = (DragonSendMoneyListViewHolder) holder;
sendMoneyListViewHolder.setData(moneyLongListModels.get(position), callBack);
}
@Override
public int getItemCount() {
return moneyLongListModels.size();
}
@Override
public int getItemViewType(int position) {
return super.getItemViewType(position);
}
}

View File

@@ -43,6 +43,17 @@ public class EnterRoomNewModel extends BaseModel {
private int quickGiftRemainingQuantity;//剩余的小PD礼物数量
@SerializedName("if_viewing_duration_complete")
private int ifViewingDurationComplete;//通过观看时间获取小PD礼物的次数
@SerializedName("sendMoneyLongStatus")
private SendMoneyLongStatusModel model;
public SendMoneyLongStatusModel getModel() {
return model;
}
public EnterRoomNewModel setModel(SendMoneyLongStatusModel model) {
this.model = model;
return this;
}
public int getQuickGiftRemainingQuantity() {
return quickGiftRemainingQuantity;

View File

@@ -29,7 +29,7 @@ public class SendMoneyLongModel extends BaseModel {
@SerializedName("liveuid")
private String liveuid;
@SerializedName("add_time")
private int addTime;
private String addTime;
@SerializedName("gold_num")
private String goldNum;
@@ -81,11 +81,11 @@ public class SendMoneyLongModel extends BaseModel {
this.liveuid = liveuid;
}
public int getAddTime() {
public String getAddTime() {
return addTime;
}
public void setAddTime(int addTime) {
public void setAddTime(String addTime) {
this.addTime = addTime;
}

View File

@@ -0,0 +1,154 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
public class SendMoneyLongStatusModel extends BaseModel {
/**
* "sendMoneyLongStatus": { // 未查询到数据时为空数组
* "liveuid": "98889", // 主播ID
* "uid": "98888", // 发起用户ID
* "addtime": "1710384258446", // 开始时间 毫秒时间戳
* "gold_num": "5000", // 金豆数量
* "user_nicename": "周末暴打小朋友", // 用户昵称
* "user_avatar": "https://downs.yaoulive.com/mannine.png", // 用户头像链接
* "countdown": 300 // 倒计时
* "start_status": false,
* "start_time": "",
* "send_money_long_key": "1710397575473",
* "participate": 0,
* "add_time": "1710397575473"
* }
*/
@SerializedName("liveuid")
private String liveuid;
@SerializedName("uid")
private String uid;
@SerializedName("addtime")
private String addtime;
@SerializedName("gold_num")
private String goldNum;
@SerializedName("user_nicename")
private String userNicename;
@SerializedName("user_avatar")
private String userAvatar;
@SerializedName("countdown")
private String countdown;
@SerializedName("start_status")
private String startStatus;
@SerializedName("start_time")
private String startTime;
@SerializedName("send_money_long_key")
private String sendMoneyLongKey;
@SerializedName("participate")
private String participate;
@SerializedName("add_time")
private String addTime;
public String getLiveuid() {
return liveuid;
}
public SendMoneyLongStatusModel setLiveuid(String liveuid) {
this.liveuid = liveuid;
return this;
}
public String getUid() {
return uid;
}
public SendMoneyLongStatusModel setUid(String uid) {
this.uid = uid;
return this;
}
public String getAddtime() {
return addtime;
}
public SendMoneyLongStatusModel setAddtime(String addtime) {
this.addtime = addtime;
return this;
}
public String getGoldNum() {
return goldNum;
}
public SendMoneyLongStatusModel setGoldNum(String goldNum) {
this.goldNum = goldNum;
return this;
}
public String getUserNicename() {
return userNicename;
}
public SendMoneyLongStatusModel setUserNicename(String userNicename) {
this.userNicename = userNicename;
return this;
}
public String getUserAvatar() {
return userAvatar;
}
public SendMoneyLongStatusModel setUserAvatar(String userAvatar) {
this.userAvatar = userAvatar;
return this;
}
public String getCountdown() {
return countdown;
}
public SendMoneyLongStatusModel setCountdown(String countdown) {
this.countdown = countdown;
return this;
}
public String getStartStatus() {
return startStatus;
}
public SendMoneyLongStatusModel setStartStatus(String startStatus) {
this.startStatus = startStatus;
return this;
}
public String getStartTime() {
return startTime;
}
public SendMoneyLongStatusModel setStartTime(String startTime) {
this.startTime = startTime;
return this;
}
public String getSendMoneyLongKey() {
return sendMoneyLongKey;
}
public SendMoneyLongStatusModel setSendMoneyLongKey(String sendMoneyLongKey) {
this.sendMoneyLongKey = sendMoneyLongKey;
return this;
}
public String getParticipate() {
return participate;
}
public SendMoneyLongStatusModel setParticipate(String participate) {
this.participate = participate;
return this;
}
public String getAddTime() {
return addTime;
}
public SendMoneyLongStatusModel setAddTime(String addTime) {
this.addTime = addTime;
return this;
}
}

View File

@@ -0,0 +1,154 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
public class sendMoneyLongListModel extends BaseModel {
/**
* {
* "liveuid": "98889", // 主播ID
* "uid": "98888", // 用户ID
* "addtime": "1710397350011", // 创建时间 毫秒时间戳
* "gold_num": "5000", // 金豆数量
* "user_nicename": "周末暴打小朋友", // 用户昵称
* "user_avatar": "https://downs.yaoulive.com/mannine.png", // 用户头像
* "countdown": 300, // 倒计时
* "start_status": false,
* "start_time": "",
* "send_money_long_key": "1710397485729",
* "participate": 0, // 是否参与活动 0.未参与 1.已参与
* "add_time": "1710397485729"
* }
*/
@SerializedName("liveuid")
private String liveuid;
@SerializedName("uid")
private String uid;
@SerializedName("addtime")
private String addtime;
@SerializedName("gold_num")
private String goldNum;
@SerializedName("user_nicename")
private String userNicename;
@SerializedName("user_avatar")
private String userAvatar;
@SerializedName("countdown")
private String countdown;
@SerializedName("start_status")
private boolean startStatus;
@SerializedName("start_time")
private String startTime;
@SerializedName("send_money_long_key")
private String sendMoneyLongKey;
@SerializedName("participate")
private String participate;
@SerializedName("add_time")
private String addTime;
public String getLiveuid() {
return liveuid;
}
public sendMoneyLongListModel setLiveuid(String liveuid) {
this.liveuid = liveuid;
return this;
}
public String getUid() {
return uid;
}
public sendMoneyLongListModel setUid(String uid) {
this.uid = uid;
return this;
}
public String getAddtime() {
return addtime;
}
public sendMoneyLongListModel setAddtime(String addtime) {
this.addtime = addtime;
return this;
}
public String getGoldNum() {
return goldNum;
}
public sendMoneyLongListModel setGoldNum(String goldNum) {
this.goldNum = goldNum;
return this;
}
public String getUserNicename() {
return userNicename;
}
public sendMoneyLongListModel setUserNicename(String userNicename) {
this.userNicename = userNicename;
return this;
}
public String getUserAvatar() {
return userAvatar;
}
public sendMoneyLongListModel setUserAvatar(String userAvatar) {
this.userAvatar = userAvatar;
return this;
}
public String getCountdown() {
return countdown;
}
public sendMoneyLongListModel setCountdown(String countdown) {
this.countdown = countdown;
return this;
}
public boolean isStartStatus() {
return startStatus;
}
public sendMoneyLongListModel setStartStatus(boolean startStatus) {
this.startStatus = startStatus;
return this;
}
public String getStartTime() {
return startTime;
}
public sendMoneyLongListModel setStartTime(String startTime) {
this.startTime = startTime;
return this;
}
public String getSendMoneyLongKey() {
return sendMoneyLongKey;
}
public sendMoneyLongListModel setSendMoneyLongKey(String sendMoneyLongKey) {
this.sendMoneyLongKey = sendMoneyLongKey;
return this;
}
public String getParticipate() {
return participate;
}
public sendMoneyLongListModel setParticipate(String participate) {
this.participate = participate;
return this;
}
public String getAddTime() {
return addTime;
}
public sendMoneyLongListModel setAddTime(String addTime) {
this.addTime = addTime;
return this;
}
}

View File

@@ -73,6 +73,7 @@ import com.yunbao.common.bean.UserAvatarSelectBean;
import com.yunbao.common.bean.VipModel;
import com.yunbao.common.bean.WishListGiftConfModel;
import com.yunbao.common.bean.WishListModel;
import com.yunbao.common.bean.sendMoneyLongListModel;
import com.yunbao.common.event.CheckCurrencyModel;
import java.util.List;
@@ -1176,4 +1177,10 @@ public interface PDLiveApi {
@GET("/api/public/?service=Guard.sendMoneyLong")
Observable<ResponseModel<Object>> sendMoneyLong(@Query("liveuid") String liveUid, @Query("gold_num") String goldNum);
@GET("/api/public/?service=Guard.sendMoneyLongList")
Observable<ResponseModel<List<sendMoneyLongListModel>>> sendMoneyLongList(@Query("liveuid") String liveUid);
@GET("/api/public/?service=Guard.participateMoneyLong")
Observable<ResponseModel<String>> participateMoneyLong(@Query("liveuid") String liveUid, @Query("send_money_long_key") String sendMoneyLongKey);
}

View File

@@ -69,6 +69,7 @@ import com.yunbao.common.bean.UserAvatarSelectBean;
import com.yunbao.common.bean.VipModel;
import com.yunbao.common.bean.WishListGiftConfModel;
import com.yunbao.common.bean.WishListModel;
import com.yunbao.common.bean.sendMoneyLongListModel;
import com.yunbao.common.event.CheckCurrencyModel;
import com.yunbao.common.http.API;
import com.yunbao.common.http.ResponseModel;
@@ -3029,6 +3030,54 @@ public class LiveNetManager {
}
public void participateMoneyLong(String liveUid, String sendMoneyLongKey, HttpCallback<String> callback) {
API.get().pdLiveApi(mContext)
.participateMoneyLong(liveUid, sendMoneyLongKey)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<String>>() {
@Override
public void accept(ResponseModel<String> 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)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<sendMoneyLongListModel>>>() {
@Override
public void accept(ResponseModel<List<sendMoneyLongListModel>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(listResponseModel.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();
}
/**
* 直播间取消网络请求
*/

View File

@@ -0,0 +1,93 @@
package com.yunbao.common.views;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.R;
import com.yunbao.common.bean.sendMoneyLongListModel;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
public class DragonSendMoneyListViewHolder extends RecyclerView.ViewHolder {
RoundedImageView live_avatar;
TextView user_nicename;
TextView gold_num;
TextView participate;
TextView send_benefits_time;
TextView send_benefits;
LinearLayout button_participate;
long mPkTimeCount2;
public DragonSendMoneyListViewHolder(@NonNull View itemView) {
super(itemView);
live_avatar = itemView.findViewById(R.id.live_avatar);
user_nicename = itemView.findViewById(R.id.user_nicename);
gold_num = itemView.findViewById(R.id.gold_num);
button_participate = itemView.findViewById(R.id.button_participate);
participate = itemView.findViewById(R.id.participate);
send_benefits_time = itemView.findViewById(R.id.send_benefits_time);
send_benefits = itemView.findViewById(R.id.send_benefits);
}
public void setData(sendMoneyLongListModel model, DragonSendMoneyListClicksCallBack callBack) {
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())) {
participate.setVisibility(View.VISIBLE);
send_benefits_time.setVisibility(View.GONE);
send_benefits.setVisibility(View.GONE);
button_participate.setBackgroundResource(R.mipmap.icon_participate);
} else {
participate.setVisibility(View.GONE);
send_benefits_time.setVisibility(View.VISIBLE);
send_benefits.setVisibility(View.VISIBLE);
button_participate.setBackgroundResource(R.mipmap.icon_send_benefits);
}
if (send_benefits_time.getVisibility() == View.VISIBLE) {
handler.removeCallbacks(runnable);
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())) {
callBack.onParticipate(model);
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);
}
}