6.5.4礼物冠名

This commit is contained in:
18401019693 2023-08-03 14:29:04 +08:00
parent 8ed7595aec
commit 986902886a
24 changed files with 899 additions and 5 deletions

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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();
}
});
}
}
}

View File

@ -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();
}

View File

@ -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();
}
/**
* 直播间取消网络请求
*/

View File

@ -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);
}
}

View File

@ -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();
}
});
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#F2D1FF"
android:startColor="#87ACFF" />
<corners android:radius="6dp" />
</shape>

View File

@ -2,13 +2,13 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="false">
<shape>
<gradient android:angle="90" android:endColor="#BBD3FF" android:startColor="#E6EEFF" />
<gradient android:angle="90" android:startColor="#BBD3FF" android:endColor="#E6EEFF" />
<corners android:radius="10dp" />
</shape>
</item>
<item android:state_selected="true">
<shape>
<gradient android:angle="90" android:endColor="#FF7917" android:startColor="#FCD16E" />
<gradient android:angle="90" android:startColor="#FF7917" android:endColor="#FCD16E" />
<corners android:radius="10dp" />
</shape>
</item>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="7dp">
<ImageView
android:id="@+id/achievement_img"
android:layout_width="40dp"
android:layout_height="40dp" />
</LinearLayout>

View File

@ -26,6 +26,7 @@
android:layout_width="50dp"
android:layout_height="20dp"
android:layout_marginTop="6dp"
android:textSize="11sp"
android:background="@drawable/background_codex_item_btn"
android:gravity="center" />
</LinearLayout>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="100dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@mipmap/background_medal_achievement" />
<ImageView
android:id="@+id/achievement_img"
android:layout_width="58dp"
android:layout_height="53dp"
android:layout_gravity="center" />
</FrameLayout>
<TextView
android:id="@+id/gift_wall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:text="@string/gift_wall"
android:textSize="14sp" />
</LinearLayout>

View File

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="315dp"
android:orientation="vertical"
app:cardCornerRadius="10dp"
app:cardElevation="0dp">
<LinearLayout
android:id="@+id/hava_data_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="39dp"
android:text="@string/achievement_details"
android:textColor="#6F43FF"
android:textSize="14sp"
android:textStyle="bold" />
<FrameLayout
android:layout_width="90dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="23dp"
android:background="@mipmap/background_medal_achievement">
<ImageView
android:id="@+id/achievement_img"
android:layout_width="65dp"
android:layout_height="51dp"
android:layout_gravity="center" />
</FrameLayout>
<TextView
android:id="@+id/dress_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:text="@string/regular_bubble"
android:textColor="#6F43FF"
android:textSize="14sp" />
<TextView
android:id="@+id/dress_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="15dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="15dp"
android:gravity="center"
android:text="@string/regular_bubble"
android:textColor="#6F43FF"
android:textSize="12sp" />
<TextView
android:id="@+id/gift_details_btn"
android:layout_width="100dp"
android:layout_height="28dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:background="@drawable/background_skip_button"
android:gravity="center"
android:text="@string/aristocrat_determine"
android:textColor="#F16D00"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/hava_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="13dp"
android:text="@string/achievement_details"
android:textColor="#6F43FF"
android:textSize="14sp"
android:textStyle="bold" />
<FrameLayout
android:layout_width="90dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="7dp"
android:background="@mipmap/background_medal_achievement">
<ImageView
android:id="@+id/achievement_img2"
android:layout_width="65dp"
android:layout_height="51dp"
android:layout_gravity="center" />
</FrameLayout>
<TextView
android:id="@+id/dress_name2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:text="@string/regular_bubble"
android:textColor="#6F43FF"
android:textSize="14sp" />
<TextView
android:id="@+id/dress_description2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="15dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="15dp"
android:gravity="center"
android:text="@string/regular_bubble"
android:textColor="#6F43FF"
android:textSize="12sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/achievement_img_list"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="8dp"
android:background="@drawable/background_achievement_details_list"
android:layout_marginTop="6dp"
android:layout_marginEnd="8dp" />
<TextView
android:id="@+id/gift_details_btn2"
android:layout_width="100dp"
android:layout_height="28dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="7dp"
android:background="@drawable/background_skip_button"
android:gravity="center"
android:text="@string/aristocrat_determine"
android:textColor="#F16D00"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1294,5 +1294,7 @@ Limited ride And limited avatar frame</string>
<string name="last_month_winner_hint2">近期點亮</string>
<string name="received_wall">已獲得</string>
<string name="received_wall2">去點亮</string>
<string name="wall_honor">我的荣誉墙</string>
<string name="achievement_details">成就詳情</string>
</resources>

View File

@ -17,6 +17,7 @@ import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.Constants;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.event.GiftWallItemEvent;
import com.yunbao.common.event.LiveGiftDialogEvent;
import com.yunbao.common.fragment.AllServiceChampionFragment;
import com.yunbao.common.fragment.GiftWithoutWallFragment;
import com.yunbao.common.glide.ImgLoader;
@ -28,7 +29,6 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.common.event.LiveGiftDialogEvent;
import com.yunbao.live.views.GiftAlreadyWallFragment;
import org.greenrobot.eventbus.Subscribe;
@ -49,6 +49,7 @@ public class GiftWallDialog extends AbsDialogFragment {
private List<View> tabView = new ArrayList<>();
private String mStream, mAnchorName, mLiveUid, mAvatarUrl;
private int isAttention = 0;//是否关注 0=没关注,
private boolean isLive;//是否正在直播
@Override
public void onActivityCreated(Bundle savedInstanceState) {
@ -139,6 +140,15 @@ public class GiftWallDialog extends AbsDialogFragment {
.show();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.medal_achievement), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new XPopup.Builder(getContext())
.enableDrag(false)
.asCustom(new MedalAchievementPopup(getContext(), isLive))
.show();
}
});
}
private void initDate() {
@ -151,7 +161,7 @@ public class GiftWallDialog extends AbsDialogFragment {
mAnchorName = bundle.getString("mAnchorName");
mAvatarUrl = bundle.getString("mAvatarUrl");
isAttention = bundle.getInt("isAttention");
isLive = bundle.getBoolean("isLive");
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
transaction.replace(R.id.context_layout_gift, GiftAlreadyWallFragment.newInstance(mStream, mLiveUid));
transaction.commit();

View File

@ -0,0 +1,94 @@
package com.yunbao.live.dialog;
import android.content.Context;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.core.BottomPopupView;
import com.yunbao.common.adapter.MedalAchievementAdapter;
import com.yunbao.common.bean.MedalAchievementModel;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
public class MedalAchievementPopup extends BottomPopupView {
private boolean isLive;
private TextView achievementText;
private RecyclerView achievementList;
private MedalAchievementAdapter medalAchievementAdapter;
public MedalAchievementPopup(@NonNull Context context, boolean isLive) {
super(context);
this.isLive = isLive;
}
// 返回自定义弹窗的布局
@Override
protected int getImplLayoutId() {
return R.layout.dialog_medal_achievement;
}
// 执行初始化操作比如findView设置点击或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
super.onCreate();
initView();
initDate();
}
private void initDate() {
if (isLive) {
LiveNetManager.get(getContext())
.getLiveMedalList(new HttpCallback<MedalAchievementModel>() {
@Override
public void onSuccess(MedalAchievementModel data) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(data.getMedalLightNumber())
.append("/")
.append(data.getMedalTotalNumber());
achievementText.setText(stringBuffer.toString());
medalAchievementAdapter.addAllData(data.getMedalData());
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
} else {
LiveNetManager.get(getContext())
.getUserMedalList(new HttpCallback<MedalAchievementModel>() {
@Override
public void onSuccess(MedalAchievementModel data) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(data.getMedalLightNumber())
.append("/")
.append(data.getMedalTotalNumber());
achievementText.setText(stringBuffer.toString());
medalAchievementAdapter.addAllData(data.getMedalData());
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
}
}
private void initView() {
achievementText = findViewById(R.id.achievement_text);
achievementList = findViewById(R.id.achievement_list);
if (isLive) {
achievementList.setLayoutManager(new GridLayoutManager(getContext(), 3, GridLayoutManager.VERTICAL, false));
} else {
achievementList.setLayoutManager(new GridLayoutManager(getContext(), 4, GridLayoutManager.VERTICAL, false));
}
medalAchievementAdapter = new MedalAchievementAdapter();
achievementList.setAdapter(medalAchievementAdapter);
}
}

View File

@ -2666,6 +2666,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
bundle.putString("mAnchorName", mAnchorName);
bundle.putString("mAvatarUrl", mAvatarUrl);
bundle.putInt("isAttention", isAttention);
bundle.putBoolean("isLive", mContext instanceof LiveRyAnchorActivity);
giftWallDialog.setArguments(bundle);
giftWallDialog.show(((AbsActivity) mContext).getSupportFragmentManager(), "GiftWallDialog");
// RouteUtil.forwardGiftWallActivity(mStream,mAnchorName,mLiveUid,mAvatarUrl,isAttention);

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="180"
android:centerColor="#FF9615"
android:endColor="#EB7314"
android:startColor="#FFBD14" />
<corners android:radius="12dp" />
</shape>

View File

@ -58,6 +58,7 @@
android:textSize="16sp" />
<TextView
android:id="@+id/medal_achievement"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="524dp"
android:layout_gravity="bottom"
android:background="@drawable/background_dialog_live_codex"
android:orientation="vertical"
tools:ignore="MissingDefaultResource">
<ImageView
android:id="@+id/close_btn"
android:layout_width="8dp"
android:layout_height="14dp"
android:layout_margin="13dp"
android:src="@mipmap/icon_regular_black" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:background="@drawable/background_medal_achievement">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/gift_wall_entrance8_1"
android:textColor="@color/white"
android:textSize="16sp" />
<TextView
android:id="@+id/achievement_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="9dp"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="15dp"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/wall_honor"
android:textColor="@color/white"
android:textSize="16sp" />
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginTop="1dp"
android:src="@mipmap/icon_right" />
</LinearLayout>
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/achievement_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="14dp"
android:paddingStart="10dp"
android:paddingEnd="10dp" />
</LinearLayout>