diff --git a/common/src/main/java/com/yunbao/common/bean/GiftGuideModel.java b/common/src/main/java/com/yunbao/common/bean/GiftGuideModel.java new file mode 100644 index 000000000..c2484cfd5 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GiftGuideModel.java @@ -0,0 +1,119 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class GiftGuideModel extends BaseModel { + + @SerializedName("guide_name") + private String guideName; + @SerializedName("illuminate_count") + private int illuminateCount; + @SerializedName("already_font") + private String alreadyFont; + @SerializedName("without_font") + private String withoutFont; + @SerializedName("number") + private String number; + @SerializedName("illuminate_total") + private int illuminateTotal; + @SerializedName("week_number") + private String weekNumber; + @SerializedName("guide_name_img_path") + private String guideNameImgPath; + @SerializedName("guide_background_picture_path") + private String guideBackgroundPicturePath; + @SerializedName("gift_data") + private List giftData; + + public String getAlreadyFont() { + return alreadyFont; + } + + public GiftGuideModel setAlreadyFont(String alreadyFont) { + this.alreadyFont = alreadyFont; + return this; + } + + public String getWithoutFont() { + return withoutFont; + } + + public GiftGuideModel setWithoutFont(String withoutFont) { + this.withoutFont = withoutFont; + return this; + } + + public String getNumber() { + return number; + } + + public GiftGuideModel setNumber(String number) { + this.number = number; + return this; + } + + public int getIlluminateTotal() { + return illuminateTotal; + } + + public GiftGuideModel setIlluminateTotal(int illuminateTotal) { + this.illuminateTotal = illuminateTotal; + return this; + } + + public String getWeekNumber() { + return weekNumber; + } + + public GiftGuideModel setWeekNumber(String weekNumber) { + this.weekNumber = weekNumber; + return this; + } + + public String getGuideNameImgPath() { + return guideNameImgPath; + } + + public GiftGuideModel setGuideNameImgPath(String guideNameImgPath) { + this.guideNameImgPath = guideNameImgPath; + return this; + } + + public String getGuideBackgroundPicturePath() { + return guideBackgroundPicturePath; + } + + public GiftGuideModel setGuideBackgroundPicturePath(String guideBackgroundPicturePath) { + this.guideBackgroundPicturePath = guideBackgroundPicturePath; + return this; + } + + public String getGuideName() { + return guideName; + } + + public GiftGuideModel setGuideName(String guideName) { + this.guideName = guideName; + return this; + } + + public int getIlluminateCount() { + return illuminateCount; + } + + public GiftGuideModel setIlluminateCount(int illuminateCount) { + this.illuminateCount = illuminateCount; + return this; + } + + public List getGiftData() { + return giftData; + } + + public GiftGuideModel setGiftData(List giftData) { + this.giftData = giftData; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GiftWallModel.java b/common/src/main/java/com/yunbao/common/bean/GiftWallModel.java index 38484a554..ac4dc6841 100644 --- a/common/src/main/java/com/yunbao/common/bean/GiftWallModel.java +++ b/common/src/main/java/com/yunbao/common/bean/GiftWallModel.java @@ -70,6 +70,29 @@ public class GiftWallModel extends BaseModel { @SerializedName("naming_coin_max") private String namingCoinMax; + @SerializedName("illuminate_status") + private int illuminateStatus; + @SerializedName("font_color") + private String fontColor; + + public String getFontColor() { + return fontColor; + } + + public GiftWallModel setFontColor(String fontColor) { + this.fontColor = fontColor; + return this; + } + + public int getIlluminateStatus() { + return illuminateStatus; + } + + public GiftWallModel setIlluminateStatus(int illuminateStatus) { + this.illuminateStatus = illuminateStatus; + return this; + } + public String getNamingCoinMax() { return namingCoinMax; } diff --git a/common/src/main/java/com/yunbao/common/event/CodexEvent.java b/common/src/main/java/com/yunbao/common/event/CodexEvent.java new file mode 100644 index 000000000..09c6e9d00 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/CodexEvent.java @@ -0,0 +1,6 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class CodexEvent extends BaseModel { +} diff --git a/live/src/main/java/com/yunbao/live/event/LiveGiftDialogEvent.java b/common/src/main/java/com/yunbao/common/event/LiveGiftDialogEvent.java similarity index 53% rename from live/src/main/java/com/yunbao/live/event/LiveGiftDialogEvent.java rename to common/src/main/java/com/yunbao/common/event/LiveGiftDialogEvent.java index cd0a65171..5c6c76e48 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveGiftDialogEvent.java +++ b/common/src/main/java/com/yunbao/common/event/LiveGiftDialogEvent.java @@ -1,4 +1,4 @@ -package com.yunbao.live.event; +package com.yunbao.common.event; public class LiveGiftDialogEvent { } 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 54573f999..904534dd3 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -13,6 +13,7 @@ import com.yunbao.common.bean.DiscountsModel; import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.FaceBookUpModel; import com.yunbao.common.bean.GiftAlreadyWallModel; +import com.yunbao.common.bean.GiftGuideModel; import com.yunbao.common.bean.GiftWallGiftDetail; import com.yunbao.common.bean.GiftWallModel; import com.yunbao.common.bean.HourRank; @@ -873,5 +874,19 @@ public interface PDLiveApi { */ @GET("/api/public/?service=Gift.lastMonthGiftNaming") Observable>> lastMonthGiftNaming(); + /** + * 礼物墙上月冠名 + * + * @return + */ + @GET("/api/public/?service=Gift.getGiftGuide") + Observable>> getGiftGuide( + @Query("liveuid") String liveUid + ); + + @GET("/api/public/?service=Gift.getGiftGuideHistory") + Observable>> getGiftGuideHistory( + @Query("liveuid") String liveUid + ); } 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 6ee8b6508..c727f5adc 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 @@ -14,6 +14,7 @@ import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.DiscountsModel; import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.GiftAlreadyWallModel; +import com.yunbao.common.bean.GiftGuideModel; import com.yunbao.common.bean.GiftWallGiftDetail; import com.yunbao.common.bean.GiftWallModel; import com.yunbao.common.bean.HttpCallbackModel; @@ -1909,6 +1910,50 @@ public class LiveNetManager { }).isDisposed(); } + public void getGiftGuide(String liveUid, HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .getGiftGuide(liveUid) + .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 getGiftGuideHistory(String liveUid, HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .getGiftGuideHistory(liveUid) + .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/res/drawable/background_codex_item_btn.xml b/common/src/main/res/drawable/background_codex_item_btn.xml new file mode 100644 index 000000000..0682d347a --- /dev/null +++ b/common/src/main/res/drawable/background_codex_item_btn.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/background_codex_top.xml b/common/src/main/res/drawable/background_codex_top.xml new file mode 100644 index 000000000..96109f515 --- /dev/null +++ b/common/src/main/res/drawable/background_codex_top.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/background_dialog_live_codex.xml b/common/src/main/res/drawable/background_dialog_live_codex.xml new file mode 100644 index 000000000..cc001c397 --- /dev/null +++ b/common/src/main/res/drawable/background_dialog_live_codex.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_live_codex.xml b/common/src/main/res/layout/dialog_live_codex.xml new file mode 100644 index 000000000..9bc06cce4 --- /dev/null +++ b/common/src/main/res/layout/dialog_live_codex.xml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/item_codex.xml b/common/src/main/res/layout/item_codex.xml new file mode 100644 index 000000000..4e975281f --- /dev/null +++ b/common/src/main/res/layout/item_codex.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + \ 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 new file mode 100644 index 000000000..27e0f6b88 --- /dev/null +++ b/common/src/main/res/layout/item_codex_item.xml @@ -0,0 +1,31 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/mipmap-xxxhdpi/icon_regular_black.png b/common/src/main/res/mipmap-xxhdpi/icon_regular_black.png similarity index 100% rename from live/src/main/res/mipmap-xxxhdpi/icon_regular_black.png rename to common/src/main/res/mipmap-xxhdpi/icon_regular_black.png diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 60af067da..98c080b77 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1291,5 +1291,8 @@ Limited ride And limited avatar frame 本月得主 上月得主 上月奪得最終禮物冠名權用戶將獲得該禮物一個月專屬冠名皮膚 + 近期點亮 + 已獲得 + 去點亮 diff --git a/live/src/main/java/com/yunbao/live/adapter/CodexAdapter.java b/live/src/main/java/com/yunbao/live/adapter/CodexAdapter.java new file mode 100644 index 000000000..3c87cc947 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/CodexAdapter.java @@ -0,0 +1,47 @@ +package com.yunbao.live.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.GiftGuideModel; +import com.yunbao.live.views.CodexViewHolder; + +import java.util.ArrayList; +import java.util.List; + +public class CodexAdapter extends RecyclerView.Adapter { + private List giftGuideModels = new ArrayList<>(); + private boolean history; + private String mStream, mLiveUid; + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_codex, parent, false); + return new CodexViewHolder(herdView); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + CodexViewHolder codexViewHolder = (CodexViewHolder) holder; + codexViewHolder.showData(giftGuideModels.get(position), history,mStream,mLiveUid); + } + + @Override + public int getItemCount() { + return giftGuideModels.size(); + } + + public void addAllData(List mGiftWall, boolean history, String mStream, String mLiveUid) { + this.history = history; + this.mStream = mStream; + this.mLiveUid = mLiveUid; + giftGuideModels.clear(); + giftGuideModels.addAll(mGiftWall); + notifyDataSetChanged(); + } +} diff --git a/live/src/main/java/com/yunbao/live/adapter/CodexItemAdapter.java b/live/src/main/java/com/yunbao/live/adapter/CodexItemAdapter.java new file mode 100644 index 000000000..5913f3b3b --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/CodexItemAdapter.java @@ -0,0 +1,43 @@ +package com.yunbao.live.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.GiftWallModel; +import com.yunbao.live.views.CodexItemViewHolder; + +import java.util.ArrayList; +import java.util.List; + +public class CodexItemAdapter extends RecyclerView.Adapter { + private List giftData = new ArrayList<>(); + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_codex_item, parent, false); + return new CodexItemViewHolder(herdView); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + CodexItemViewHolder codexItemViewHolder = (CodexItemViewHolder) holder; + codexItemViewHolder.showData(giftData.get(position)); + } + + @Override + public int getItemCount() { + return giftData.size(); + } + + public void addAllData(List mGiftWall) { + giftData.clear(); + giftData.addAll(mGiftWall); + notifyDataSetChanged(); + } +} diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java index 777d7714b..3817726cf 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java @@ -35,7 +35,7 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; import com.yunbao.live.custom.GiftMarkView; import com.yunbao.live.dialog.SendRendPacketPopup; -import com.yunbao.live.event.LiveGiftDialogEvent; +import com.yunbao.common.event.LiveGiftDialogEvent; import java.io.File; import java.util.List; diff --git a/live/src/main/java/com/yunbao/live/dialog/CodexDialog.java b/live/src/main/java/com/yunbao/live/dialog/CodexDialog.java new file mode 100644 index 000000000..a0e192154 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/CodexDialog.java @@ -0,0 +1,114 @@ +package com.yunbao.live.dialog; + +import android.content.Context; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.lxj.xpopup.core.BottomPopupView; +import com.yunbao.common.bean.GiftGuideModel; +import com.yunbao.common.event.CodexEvent; +import com.yunbao.common.event.LiveGiftDialogEvent; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.live.R; +import com.yunbao.live.adapter.CodexAdapter; + +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; + +import java.util.List; + +public class CodexDialog extends BottomPopupView { + private String mStream, mLiveUid; + private RecyclerView liveCodex; + private CodexAdapter codexAdapter; + private boolean history; + + public CodexDialog(@NonNull Context context, String mStream, String mLiveUid, boolean history) { + super(context); + this.mLiveUid = mLiveUid; + this.mStream = mStream; + this.history = history; + } + + // 返回自定义弹窗的布局 + @Override + protected int getImplLayoutId() { + return R.layout.dialog_live_codex; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + Bus.getOn(this); + initView(); + initDate(); + } + + private void initDate() { + if (history) { + LiveNetManager.get(getContext()). + getGiftGuideHistory(mLiveUid, new HttpCallback>() { + @Override + public void onSuccess(List data) { + codexAdapter.addAllData(data,history,mStream,mLiveUid); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } else { + LiveNetManager.get(getContext()). + getGiftGuide(mLiveUid, new HttpCallback>() { + @Override + public void onSuccess(List data) { + codexAdapter.addAllData(data,history,mStream,mLiveUid); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + + } + + private void initView() { + liveCodex = findViewById(R.id.live_codex); + codexAdapter = new CodexAdapter(); + liveCodex.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); + liveCodex.setAdapter(codexAdapter); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.close_btn), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + } + }); + } + + @Override + protected void onDismiss() { + Bus.getOff(this); + + super.onDismiss(); + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onCodexEvent(CodexEvent event) { + + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onLiveGiftDialogEvent(LiveGiftDialogEvent event) { + dismiss(); + } +} 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 6e518a59d..a5f06e276 100644 --- a/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java @@ -18,7 +18,6 @@ import com.yunbao.common.Constants; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.event.GiftWallItemEvent; import com.yunbao.common.fragment.AllServiceChampionFragment; -import com.yunbao.live.views.GiftAlreadyWallFragment; import com.yunbao.common.fragment.GiftWithoutWallFragment; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpUtil; @@ -29,7 +28,8 @@ 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.live.event.LiveGiftDialogEvent; +import com.yunbao.common.event.LiveGiftDialogEvent; +import com.yunbao.live.views.GiftAlreadyWallFragment; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -130,6 +130,15 @@ public class GiftWallDialog extends AbsDialogFragment { .show(); } }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.codex_layout), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + new XPopup.Builder(getContext()) + .enableDrag(false) + .asCustom(new CodexDialog(getContext(), mStream, mLiveUid,false)) + .show(); + } + }); } private void initDate() { diff --git a/live/src/main/java/com/yunbao/live/dialog/GiftWallItemPopup.java b/live/src/main/java/com/yunbao/live/dialog/GiftWallItemPopup.java index bec97cd32..2f2a138e2 100644 --- a/live/src/main/java/com/yunbao/live/dialog/GiftWallItemPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/GiftWallItemPopup.java @@ -19,7 +19,7 @@ import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.event.LiveAudienceEvent; -import com.yunbao.live.event.LiveGiftDialogEvent; +import com.yunbao.common.event.LiveGiftDialogEvent; public class GiftWallItemPopup extends CenterPopupView { private CardView layout; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java index fd3fd30e3..ead655723 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java @@ -80,7 +80,7 @@ import com.yunbao.live.bean.GiftTopBean; import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.custom.GiftViewPager; import com.yunbao.live.event.LiveAudienceEvent; -import com.yunbao.live.event.LiveGiftDialogEvent; +import com.yunbao.common.event.LiveGiftDialogEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.utils.ToolsButton; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java index 04302b225..06d7054d1 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java @@ -74,7 +74,7 @@ import com.yunbao.live.bean.GiftTopBean; import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.event.GiftTitleEvent; import com.yunbao.live.event.LiveAudienceEvent; -import com.yunbao.live.event.LiveGiftDialogEvent; +import com.yunbao.common.event.LiveGiftDialogEvent; import com.yunbao.live.event.LiveGiftItemEvent; import com.yunbao.live.event.LiveParcelItemRefreshEvent; import com.yunbao.live.http.LiveHttpUtil; diff --git a/live/src/main/java/com/yunbao/live/views/CodexItemViewHolder.java b/live/src/main/java/com/yunbao/live/views/CodexItemViewHolder.java new file mode 100644 index 000000000..07c4227d4 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/views/CodexItemViewHolder.java @@ -0,0 +1,55 @@ +package com.yunbao.live.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.yunbao.common.R; +import com.yunbao.common.bean.GiftWallModel; +import com.yunbao.common.event.LiveGiftDialogEvent; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.live.event.LiveAudienceEvent; + +public class CodexItemViewHolder extends RecyclerView.ViewHolder { + private ImageView giftImg; + private TextView giftName, giftWall; + + public CodexItemViewHolder(@NonNull View itemView) { + super(itemView); + giftImg = itemView.findViewById(R.id.gift_img); + giftName = itemView.findViewById(R.id.gift_name); + giftWall = itemView.findViewById(R.id.gift_wall); + } + + public void showData(GiftWallModel giftWallModel) { + ImgLoader.display(itemView.getContext(), giftWallModel.getGifticon(), giftImg); + giftName.setText(giftWallModel.getGiftname()); + giftName.setTextColor(Color.parseColor(giftWallModel.getFontColor())); + giftWall.setSelected(TextUtils.equals(String.valueOf(giftWallModel.getIlluminateStatus()), "1")); + if (TextUtils.equals(String.valueOf(giftWallModel.getIlluminateStatus()), "1")) { + giftWall.setText(itemView.getContext().getString(R.string.received_wall2)); + giftWall.setTextColor(Color.parseColor("#FFFFFF")); + ViewClicksAntiShake.clicksAntiShake(giftWall, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + Bus.get().post(new LiveGiftDialogEvent()); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP) + .setmWishGiftId(giftWallModel.getId()) + .setmLiveUid("") + .setmStream("")); + } + }); + } else { + giftWall.setText(itemView.getContext().getString(R.string.received_wall)); + giftWall.setTextColor(Color.parseColor("#49669F")); + } + } +} diff --git a/live/src/main/java/com/yunbao/live/views/CodexViewHolder.java b/live/src/main/java/com/yunbao/live/views/CodexViewHolder.java new file mode 100644 index 000000000..cc5f42643 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/views/CodexViewHolder.java @@ -0,0 +1,68 @@ +package com.yunbao.live.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.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.R; +import com.yunbao.common.bean.GiftGuideModel; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.live.adapter.CodexItemAdapter; +import com.yunbao.live.dialog.CodexDialog; + +public class CodexViewHolder extends RecyclerView.ViewHolder { + private ImageView codexLayout, titleIcon; + private TextView titleName, weekNumber, weekNumber2; + private RecyclerView giftList; + private CodexItemAdapter codexItemAdapter; + + public CodexViewHolder(@NonNull View itemView) { + super(itemView); + codexLayout = itemView.findViewById(R.id.codex_layout); + titleIcon = itemView.findViewById(R.id.title_icon); + titleName = itemView.findViewById(R.id.title_name); + weekNumber = itemView.findViewById(R.id.week_number); + weekNumber2 = itemView.findViewById(R.id.week_number2); + giftList = itemView.findViewById(R.id.gift_list); + codexItemAdapter = new CodexItemAdapter(); + giftList.setLayoutManager(new LinearLayoutManager(itemView.getContext(), LinearLayoutManager.HORIZONTAL, false)); + giftList.setAdapter(codexItemAdapter); + } + + public void showData(GiftGuideModel giftGuideModel, boolean history, String mStream, String mLiveUid) { + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append(giftGuideModel.getIlluminateCount()) + .append("/") + .append(giftGuideModel.getIlluminateTotal()); + ImgLoader.display(itemView.getContext(), giftGuideModel.getGuideBackgroundPicturePath(), codexLayout); + ImgLoader.display(itemView.getContext(), giftGuideModel.getGuideNameImgPath(), titleIcon); + titleName.setText(stringBuffer.toString()); + titleName.setTextColor(Color.parseColor(giftGuideModel.getNumber())); + weekNumber.setText(giftGuideModel.getWeekNumber()); + weekNumber.setVisibility(TextUtils.isEmpty(giftGuideModel.getWeekNumber()) ? View.GONE : View.VISIBLE); + if (history) { + weekNumber2.setVisibility(View.GONE); + } else { + weekNumber2.setVisibility(TextUtils.isEmpty(giftGuideModel.getWeekNumber()) ? View.GONE : View.VISIBLE); + } + + codexItemAdapter.addAllData(giftGuideModel.getGiftData()); + ViewClicksAntiShake.clicksAntiShake(weekNumber2, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + new XPopup.Builder(itemView.getContext()) + .enableDrag(false) + .asCustom(new CodexDialog(itemView.getContext(), mStream, mLiveUid,true)) + .show(); + } + }); + } +} diff --git a/live/src/main/java/com/yunbao/live/views/FrameGiftViewHolder.java b/live/src/main/java/com/yunbao/live/views/FrameGiftViewHolder.java index 709767b88..d89aa8c62 100644 --- a/live/src/main/java/com/yunbao/live/views/FrameGiftViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/FrameGiftViewHolder.java @@ -28,7 +28,7 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; import com.yunbao.live.dialog.SendRendPacketPopup; -import com.yunbao.live.event.LiveGiftDialogEvent; +import com.yunbao.common.event.LiveGiftDialogEvent; import java.io.File; diff --git a/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java b/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java index ddf30f143..51bce1418 100644 --- a/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java +++ b/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java @@ -19,7 +19,7 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.event.LiveAudienceEvent; -import com.yunbao.live.event.LiveGiftDialogEvent; +import com.yunbao.common.event.LiveGiftDialogEvent; /** * 已点亮礼物墙 diff --git a/live/src/main/java/com/yunbao/live/views/LiveParcelItemViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveParcelItemViewHolder.java index a94d35354..3353538e2 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveParcelItemViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveParcelItemViewHolder.java @@ -26,7 +26,7 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; import com.yunbao.live.dialog.SendRendPacketPopup; -import com.yunbao.live.event.LiveGiftDialogEvent; +import com.yunbao.common.event.LiveGiftDialogEvent; import java.io.File; diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index a8d471f4a..ef87fca35 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -8,7 +8,6 @@ import android.app.Dialog; import android.content.Intent; import android.content.res.Configuration; import android.graphics.drawable.AnimationDrawable; -import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; import android.text.TextUtils; @@ -81,11 +80,10 @@ import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.OpenParametersModel; import com.yunbao.live.dialog.BlowkissDialog; -import com.yunbao.live.dialog.GiftWallDialog; import com.yunbao.live.dialog.NewUserDialog; import com.yunbao.live.event.LinkMicTxAccEvent; import com.yunbao.live.event.LiveAudienceEvent; -import com.yunbao.live.event.LiveGiftDialogEvent; +import com.yunbao.common.event.LiveGiftDialogEvent; import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; 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 cc3eb7cd0..1e9c28dee 100644 --- a/live/src/main/res/layout/dialog_live_gift_wall.xml +++ b/live/src/main/res/layout/dialog_live_gift_wall.xml @@ -48,6 +48,7 @@ android:background="@mipmap/background_giftwall_tab">