diff --git a/common/src/main/java/com/yunbao/common/adapter/AchievementDetailsAdapter.java b/common/src/main/java/com/yunbao/common/adapter/AchievementDetailsAdapter.java new file mode 100644 index 000000000..79cebed8e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/AchievementDetailsAdapter.java @@ -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 dressInfo = new ArrayList<>(); + + public AchievementDetailsAdapter(List 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(); + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/MedalAchievementAdapter.java b/common/src/main/java/com/yunbao/common/adapter/MedalAchievementAdapter.java new file mode 100644 index 000000000..e0b43c9df --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/MedalAchievementAdapter.java @@ -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 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 mGiftWall) { + + medalData.clear(); + medalData.addAll(mGiftWall); + notifyDataSetChanged(); + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/MedalAchievementModel.java b/common/src/main/java/com/yunbao/common/bean/MedalAchievementModel.java new file mode 100644 index 000000000..9a6fb6ea5 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/MedalAchievementModel.java @@ -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 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 getMedalData() { + return medalData; + } + + public MedalAchievementModel setMedalData(List medalData) { + this.medalData = medalData; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/UserMedalListModel.java b/common/src/main/java/com/yunbao/common/bean/UserMedalListModel.java new file mode 100644 index 000000000..13b783833 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/UserMedalListModel.java @@ -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 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 getDressInfo() { + return dressInfo; + } + + public UserMedalListModel setDressInfo(List dressInfo) { + this.dressInfo = dressInfo; + return this; + } + + public String getDisplaySrc() { + return displaySrc; + } + + public UserMedalListModel setDisplaySrc(String displaySrc) { + this.displaySrc = displaySrc; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/UserMedalModel.java b/common/src/main/java/com/yunbao/common/bean/UserMedalModel.java new file mode 100644 index 000000000..4ac5dde3e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/UserMedalModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/AchievementDetailsPopup.java b/common/src/main/java/com/yunbao/common/dialog/AchievementDetailsPopup.java new file mode 100644 index 000000000..2c7fc07a3 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/AchievementDetailsPopup.java @@ -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(); + } + }); + } + + } +} diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 904534dd3..12b2a56cf 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -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>> getGiftGuideHistory( @Query("liveuid") String liveUid ); + @GET("/api/public/?service=Gift.getUserMedalList") + Observable> getUserMedalList(); + @GET("/api/public/?service=Gift.getLiveMedalList") + Observable> getLiveMedalList(); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index c727f5adc..d51ef37be 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -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 callback) { + API.get().pdLiveApi(mContext) + .getUserMedalList() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void getLiveMedalList(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getLiveMedalList() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/views/AchievementDetailsViewHolder.java b/common/src/main/java/com/yunbao/common/views/AchievementDetailsViewHolder.java new file mode 100644 index 000000000..05c44f939 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/AchievementDetailsViewHolder.java @@ -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); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/MedalAchievementViewHolder.java b/common/src/main/java/com/yunbao/common/views/MedalAchievementViewHolder.java new file mode 100644 index 000000000..6c45a011c --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/MedalAchievementViewHolder.java @@ -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(); + } + }); + } +} diff --git a/common/src/main/res/drawable/background_achievement_details_list.xml b/common/src/main/res/drawable/background_achievement_details_list.xml new file mode 100644 index 000000000..a803f914b --- /dev/null +++ b/common/src/main/res/drawable/background_achievement_details_list.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/background_codex_item_btn.xml b/common/src/main/res/drawable/background_codex_item_btn.xml index 0682d347a..9769f0609 100644 --- a/common/src/main/res/drawable/background_codex_item_btn.xml +++ b/common/src/main/res/drawable/background_codex_item_btn.xml @@ -2,13 +2,13 @@ - + - + diff --git a/common/src/main/res/layout/item_achievement_details.xml b/common/src/main/res/layout/item_achievement_details.xml new file mode 100644 index 000000000..cb19261f7 --- /dev/null +++ b/common/src/main/res/layout/item_achievement_details.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/item_codex_item.xml b/common/src/main/res/layout/item_codex_item.xml index 27e0f6b88..9b24732aa 100644 --- a/common/src/main/res/layout/item_codex_item.xml +++ b/common/src/main/res/layout/item_codex_item.xml @@ -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" /> \ No newline at end of file diff --git a/common/src/main/res/layout/item_medal_achievement.xml b/common/src/main/res/layout/item_medal_achievement.xml new file mode 100644 index 000000000..6f25b39d9 --- /dev/null +++ b/common/src/main/res/layout/item_medal_achievement.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/popup_achievement_details.xml b/common/src/main/res/layout/popup_achievement_details.xml new file mode 100644 index 000000000..9a706886d --- /dev/null +++ b/common/src/main/res/layout/popup_achievement_details.xml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-xxhdpi/background_medal_achievement.png b/common/src/main/res/mipmap-xxhdpi/background_medal_achievement.png new file mode 100644 index 000000000..67933e568 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/background_medal_achievement.png differ diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 98c080b77..fae547a7f 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1294,5 +1294,7 @@ Limited ride And limited avatar frame 近期點亮 已獲得 去點亮 + 我的荣誉墙 + 成就詳情 diff --git a/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java b/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java index a5f06e276..5703cab6e 100644 --- a/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java @@ -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 tabView = new ArrayList<>(); private String mStream, mAnchorName, mLiveUid, mAvatarUrl; private int isAttention = 0;//是否关注 0=没关注, + private boolean isLive;//是否正在直播 @Override public void onActivityCreated(Bundle savedInstanceState) { @@ -135,7 +136,16 @@ public class GiftWallDialog extends AbsDialogFragment { public void onViewClicks() { new XPopup.Builder(getContext()) .enableDrag(false) - .asCustom(new CodexDialog(getContext(), mStream, mLiveUid,false)) + .asCustom(new CodexDialog(getContext(), mStream, mLiveUid, false)) + .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(); } }); @@ -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(); diff --git a/live/src/main/java/com/yunbao/live/dialog/MedalAchievementPopup.java b/live/src/main/java/com/yunbao/live/dialog/MedalAchievementPopup.java new file mode 100644 index 000000000..e14abf8a3 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/MedalAchievementPopup.java @@ -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() { + @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() { + @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); + } +} diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index b4086d48e..39db6a2b5 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -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); diff --git a/live/src/main/res/drawable/background_medal_achievement.xml b/live/src/main/res/drawable/background_medal_achievement.xml new file mode 100644 index 000000000..75f3d9478 --- /dev/null +++ b/live/src/main/res/drawable/background_medal_achievement.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_gift_wall.xml b/live/src/main/res/layout/dialog_live_gift_wall.xml index 1e9c28dee..5ae28e0f1 100644 --- a/live/src/main/res/layout/dialog_live_gift_wall.xml +++ b/live/src/main/res/layout/dialog_live_gift_wall.xml @@ -58,6 +58,7 @@ android:textSize="16sp" /> + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file