6.5.4礼物冠名
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
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.UserMedalModel;
|
||||
import com.yunbao.common.views.AchievementDetailsViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AchievementDetailsAdapter extends RecyclerView.Adapter {
|
||||
private List<UserMedalModel> dressInfo = new ArrayList<>();
|
||||
|
||||
public AchievementDetailsAdapter(List<UserMedalModel> dressInfo) {
|
||||
this.dressInfo = dressInfo;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_achievement_details, parent, false);
|
||||
return new AchievementDetailsViewHolder(herdView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
AchievementDetailsViewHolder achievementDetailsViewHolder = (AchievementDetailsViewHolder) holder;
|
||||
achievementDetailsViewHolder.showData(dressInfo.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dressInfo.size();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
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.UserMedalListModel;
|
||||
import com.yunbao.common.views.MedalAchievementViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MedalAchievementAdapter extends RecyclerView.Adapter {
|
||||
private List<UserMedalListModel> medalData = new ArrayList<>();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_medal_achievement, parent, false);
|
||||
return new MedalAchievementViewHolder(herdView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
MedalAchievementViewHolder achievementViewHolder = (MedalAchievementViewHolder) holder;
|
||||
achievementViewHolder.showData(medalData.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return medalData.size();
|
||||
}
|
||||
|
||||
public void addAllData(List<UserMedalListModel> mGiftWall) {
|
||||
|
||||
medalData.clear();
|
||||
medalData.addAll(mGiftWall);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MedalAchievementModel extends BaseModel {
|
||||
|
||||
@SerializedName("medal_total_number")
|
||||
private String medalTotalNumber;
|
||||
@SerializedName("medal_light_number")
|
||||
private String medalLightNumber;
|
||||
@SerializedName("medal_data")
|
||||
private List<UserMedalListModel> medalData;
|
||||
|
||||
public String getMedalTotalNumber() {
|
||||
return medalTotalNumber;
|
||||
}
|
||||
|
||||
public MedalAchievementModel setMedalTotalNumber(String medalTotalNumber) {
|
||||
this.medalTotalNumber = medalTotalNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMedalLightNumber() {
|
||||
return medalLightNumber;
|
||||
}
|
||||
|
||||
public MedalAchievementModel setMedalLightNumber(String medalLightNumber) {
|
||||
this.medalLightNumber = medalLightNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<UserMedalListModel> getMedalData() {
|
||||
return medalData;
|
||||
}
|
||||
|
||||
public MedalAchievementModel setMedalData(List<UserMedalListModel> medalData) {
|
||||
this.medalData = medalData;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UserMedalListModel extends BaseModel {
|
||||
|
||||
@SerializedName("dress_name")
|
||||
private String dressName;
|
||||
@SerializedName("dress_info")
|
||||
private List<UserMedalModel> dressInfo = new ArrayList<>();
|
||||
@SerializedName("display_src")
|
||||
private String displaySrc;
|
||||
@SerializedName("dress_description")
|
||||
private String dressDescription;
|
||||
@SerializedName("display_src_second")
|
||||
private String displaySrcSecond;
|
||||
@SerializedName("dress_status")//1Hd2whd
|
||||
private String dressStatus;
|
||||
|
||||
public String getDressDescription() {
|
||||
return dressDescription;
|
||||
}
|
||||
|
||||
public UserMedalListModel setDressDescription(String dressDescription) {
|
||||
this.dressDescription = dressDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDisplaySrcSecond() {
|
||||
return displaySrcSecond;
|
||||
}
|
||||
|
||||
public UserMedalListModel setDisplaySrcSecond(String displaySrcSecond) {
|
||||
this.displaySrcSecond = displaySrcSecond;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDressStatus() {
|
||||
return dressStatus;
|
||||
}
|
||||
|
||||
public UserMedalListModel setDressStatus(String dressStatus) {
|
||||
this.dressStatus = dressStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDressName() {
|
||||
return dressName;
|
||||
}
|
||||
|
||||
public UserMedalListModel setDressName(String dressName) {
|
||||
this.dressName = dressName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<UserMedalModel> getDressInfo() {
|
||||
return dressInfo;
|
||||
}
|
||||
|
||||
public UserMedalListModel setDressInfo(List<UserMedalModel> dressInfo) {
|
||||
this.dressInfo = dressInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDisplaySrc() {
|
||||
return displaySrc;
|
||||
}
|
||||
|
||||
public UserMedalListModel setDisplaySrc(String displaySrc) {
|
||||
this.displaySrc = displaySrc;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class UserMedalModel extends BaseModel {
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("display_src")
|
||||
private String displaySrc;
|
||||
@SerializedName("dress_name")
|
||||
private String dressName;
|
||||
@SerializedName("dress_description")
|
||||
private String dressDescription;
|
||||
@SerializedName("sort")
|
||||
private String sort;
|
||||
@SerializedName("dress_status")
|
||||
private String dressStatus;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public UserMedalModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDisplaySrc() {
|
||||
return displaySrc;
|
||||
}
|
||||
|
||||
public UserMedalModel setDisplaySrc(String displaySrc) {
|
||||
this.displaySrc = displaySrc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDressName() {
|
||||
return dressName;
|
||||
}
|
||||
|
||||
public UserMedalModel setDressName(String dressName) {
|
||||
this.dressName = dressName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDressDescription() {
|
||||
return dressDescription;
|
||||
}
|
||||
|
||||
public UserMedalModel setDressDescription(String dressDescription) {
|
||||
this.dressDescription = dressDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public UserMedalModel setSort(String sort) {
|
||||
this.sort = sort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDressStatus() {
|
||||
return dressStatus;
|
||||
}
|
||||
|
||||
public UserMedalModel setDressStatus(String dressStatus) {
|
||||
this.dressStatus = dressStatus;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.AchievementDetailsAdapter;
|
||||
import com.yunbao.common.bean.UserMedalListModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class AchievementDetailsPopup extends CenterPopupView {
|
||||
private UserMedalListModel userMedalListModel;
|
||||
private ImageView achievementImg;
|
||||
private TextView dressName, dressDescription;
|
||||
private View havaDataList, havaData;
|
||||
private AchievementDetailsAdapter achievementDetailsAdapter;
|
||||
private RecyclerView achievementImgList;
|
||||
public AchievementDetailsPopup(@NonNull Context context, UserMedalListModel userMedalListModel) {
|
||||
super(context);
|
||||
this.userMedalListModel = userMedalListModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.popup_achievement_details;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
havaDataList = findViewById(R.id.hava_data_list);
|
||||
havaData = findViewById(R.id.hava_data);
|
||||
if (userMedalListModel.getDressInfo().size() > 0) {
|
||||
havaDataList.setVisibility(GONE);
|
||||
havaData.setVisibility(VISIBLE);
|
||||
achievementDetailsAdapter = new AchievementDetailsAdapter(userMedalListModel.getDressInfo());
|
||||
|
||||
achievementImg = findViewById(R.id.achievement_img2);
|
||||
dressName = findViewById(R.id.dress_name2);
|
||||
dressDescription = findViewById(R.id.dress_description2);
|
||||
achievementImgList = findViewById(R.id.achievement_img_list);
|
||||
|
||||
if (TextUtils.equals(userMedalListModel.getDressStatus(), "1")) {
|
||||
ImgLoader.display(getContext(), userMedalListModel.getDisplaySrc(), achievementImg);
|
||||
} else {
|
||||
ImgLoader.display(getContext(), userMedalListModel.getDisplaySrcSecond(), achievementImg);
|
||||
}
|
||||
dressName.setText(userMedalListModel.getDressName());
|
||||
dressDescription.setText(userMedalListModel.getDressDescription());
|
||||
achievementImgList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
achievementImgList.setAdapter(achievementDetailsAdapter);
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.gift_details_btn2), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
havaDataList.setVisibility(VISIBLE);
|
||||
havaData.setVisibility(GONE);
|
||||
|
||||
achievementImg = findViewById(R.id.achievement_img);
|
||||
dressName = findViewById(R.id.dress_name);
|
||||
dressDescription = findViewById(R.id.dress_description);
|
||||
|
||||
if (TextUtils.equals(userMedalListModel.getDressStatus(), "1")) {
|
||||
ImgLoader.display(getContext(), userMedalListModel.getDisplaySrc(), achievementImg);
|
||||
} else {
|
||||
ImgLoader.display(getContext(), userMedalListModel.getDisplaySrcSecond(), achievementImg);
|
||||
}
|
||||
dressName.setText(userMedalListModel.getDressName());
|
||||
dressDescription.setText(userMedalListModel.getDressDescription());
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.gift_details_btn), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import com.yunbao.common.bean.LiveRoomVoteModel;
|
||||
import com.yunbao.common.bean.LiveStetUpStatusModel;
|
||||
import com.yunbao.common.bean.LiveTaskModel;
|
||||
import com.yunbao.common.bean.LiveUserMailBoxModel;
|
||||
import com.yunbao.common.bean.MedalAchievementModel;
|
||||
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||
import com.yunbao.common.bean.NewPeopleInfo;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
@@ -49,6 +50,7 @@ import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.UserAreaBean;
|
||||
import com.yunbao.common.bean.UserMedalListModel;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
import com.yunbao.common.bean.WishListGiftConfModel;
|
||||
import com.yunbao.common.bean.WishListModel;
|
||||
@@ -888,5 +890,9 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<List<GiftGuideModel>>> getGiftGuideHistory(
|
||||
@Query("liveuid") String liveUid
|
||||
);
|
||||
@GET("/api/public/?service=Gift.getUserMedalList")
|
||||
Observable<ResponseModel<MedalAchievementModel>> getUserMedalList();
|
||||
@GET("/api/public/?service=Gift.getLiveMedalList")
|
||||
Observable<ResponseModel<MedalAchievementModel>> getLiveMedalList();
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.yunbao.common.bean.LiveRoomVoteModel;
|
||||
import com.yunbao.common.bean.LiveStetUpStatusModel;
|
||||
import com.yunbao.common.bean.LiveTaskModel;
|
||||
import com.yunbao.common.bean.LiveUserMailBoxModel;
|
||||
import com.yunbao.common.bean.MedalAchievementModel;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
@@ -1954,6 +1955,50 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getUserMedalList(HttpCallback<MedalAchievementModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getUserMedalList()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<MedalAchievementModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<MedalAchievementModel> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getLiveMedalList(HttpCallback<MedalAchievementModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getLiveMedalList()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<MedalAchievementModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<MedalAchievementModel> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.UserMedalModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
|
||||
public class AchievementDetailsViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView achievementImg;
|
||||
public AchievementDetailsViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
achievementImg = itemView.findViewById(R.id.achievement_img);
|
||||
}
|
||||
public void showData(UserMedalModel userMedalModel){
|
||||
ImgLoader.display(itemView.getContext(), userMedalModel.getDisplaySrc(), achievementImg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.UserMedalListModel;
|
||||
import com.yunbao.common.dialog.AchievementDetailsPopup;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class MedalAchievementViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView achievementImg;
|
||||
private TextView giftWall;
|
||||
|
||||
public MedalAchievementViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
achievementImg = itemView.findViewById(R.id.achievement_img);
|
||||
giftWall = itemView.findViewById(R.id.gift_wall);
|
||||
}
|
||||
|
||||
public void showData(UserMedalListModel userMedalListModel) {
|
||||
if (TextUtils.equals(userMedalListModel.getDressStatus(), "1")) {
|
||||
ImgLoader.display(itemView.getContext(), userMedalListModel.getDisplaySrc(), achievementImg);
|
||||
giftWall.setTextColor(Color.parseColor("#6F43FF"));
|
||||
} else {
|
||||
ImgLoader.display(itemView.getContext(), userMedalListModel.getDisplaySrcSecond(), achievementImg);
|
||||
giftWall.setTextColor(Color.parseColor("#53408F"));
|
||||
}
|
||||
giftWall.setText(userMedalListModel.getDressName());
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
new XPopup.Builder(itemView.getContext())
|
||||
.enableDrag(false)
|
||||
.asCustom(new AchievementDetailsPopup(itemView.getContext(), userMedalListModel))
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user