From 6eee7b9ede3fadae7ce4fa6b69d770d843dd0381 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 20 Aug 2024 10:02:38 +0800 Subject: [PATCH] update --- .../GiftWallGiftInfoListItemAdapter.java | 20 ++++- .../yunbao/common/bean/GiftWallInfoBean.java | 30 ++++++++ .../bean/GiftWallMainTab2ClassicInfoBean.java | 6 +- .../common/dialog/GiftWallGiftInfoDialog.java | 75 ++++++++++++++++--- .../GiftWallMainTab2ClassicInfoDialog.java | 14 ++++ .../common/manager/RandomSudGameManager.java | 12 ++- .../common/views/SudGameListViewHolder.java | 4 +- .../res/layout/dialog_gift_wall_gift_info.xml | 33 +++++++- .../item_dialog_gift_wall_gift_info2.xml | 11 ++- .../item_dialog_gift_wall_gift_info2t.xml | 4 +- .../item_dialog_gift_wall_tab2_gift_info.xml | 4 +- common/src/main/res/values-zh/strings.xml | 2 + common/src/main/res/values/strings.xml | 2 + config.gradle | 2 +- 14 files changed, 191 insertions(+), 28 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/adapter/GiftWallGiftInfoListItemAdapter.java b/common/src/main/java/com/yunbao/common/adapter/GiftWallGiftInfoListItemAdapter.java index 42d011e90..a5a510e02 100644 --- a/common/src/main/java/com/yunbao/common/adapter/GiftWallGiftInfoListItemAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/GiftWallGiftInfoListItemAdapter.java @@ -1,6 +1,9 @@ package com.yunbao.common.adapter; +import android.content.Context; import android.graphics.Color; +import android.os.Handler; +import android.os.Looper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -16,6 +19,7 @@ import com.yunbao.common.bean.GiftWallInfoBean; import com.yunbao.common.bean.GiftWallTab2Bean; import com.yunbao.common.dialog.GiftWallMainTab2ClassicInfoDialog; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -34,6 +38,16 @@ public class GiftWallGiftInfoListItemAdapter extends RecyclerView.Adapter onItemClickListener; + + public GiftWallGiftInfoListItemAdapter(Context mContext) { + this.mContext = mContext; + } + + public void setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + } public void setGiftId(int giftId) { this.giftId = giftId; @@ -82,7 +96,7 @@ public class GiftWallGiftInfoListItemAdapter extends RecyclerView.Adapter 0) && data.get(0).getId() != -1) { + if (isStar && (getItemCount() > 0) && data.get(0).getId() != -1 && list_type == 2) { return 1; } return 0; @@ -206,7 +220,9 @@ public class GiftWallGiftInfoListItemAdapter extends RecyclerView.Adapter list) { diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java index 9ab065166..416464f2e 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java @@ -26,6 +26,7 @@ import com.opensource.svgaplayer.SVGAVideoEntity; import com.yunbao.common.R; import com.yunbao.common.adapter.GiftWallGiftInfoListItemAdapter; import com.yunbao.common.bean.GiftWallInfoBean; +import com.yunbao.common.bean.GiftWallTab2Bean; import com.yunbao.common.bean.JsWishBean; import com.yunbao.common.custom.ItemDecoration; import com.yunbao.common.event.ClosePopupDialogEvent; @@ -37,6 +38,7 @@ import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ScreenDimenUtil; +import com.yunbao.common.utils.ViewUtils; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -170,10 +172,25 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { gift_schedule = findViewById(R.id.gift_schedule); titleLayout = findViewById(R.id.list_title); titleLayout2 = findViewById(R.id.list_title2); - adapter = new GiftWallGiftInfoListItemAdapter(); + adapter = new GiftWallGiftInfoListItemAdapter(mContext); adapter.setAnchor(isAnchor); adapter.setLiveRoom(isLiveRoom); adapter.setStar(isStar); + adapter.setOnItemClickListener(new OnItemClickListener() { + @Override + public void onItemClick(GiftWallTab2Bean.Gift bean, int position) { + new GiftWallMainTab2ClassicInfoDialog(mContext, bean, isAnchor) + .setFullWindows(!isLiveRoom) + .setGiftWallGiftInfoDialog(new GiftWallGiftInfoDialog(mContext, giftId, toUserId, isAnchor) + .setFullWindows(isFullWindows) + .setAnchorId(anchorId) + .setTab2Enter(isTab2Enter) + .setLiveRoom(isLiveRoom) + .setStar(isStar)) + .showDialog(); + dismiss(); + } + }); recyclerView.setAdapter(adapter); recyclerView.addItemDecoration(new ItemDecoration(mContext, 0x00000000, 0, 10)); @@ -194,11 +211,13 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { adapter.setList_type(list_type); ((TextView) findViewById(R.id.user_name)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_assistance_user)); ((TextView) findViewById(R.id.tv_rename)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_assistance_star)); + + titleLayout2.setVisibility(View.GONE); + titleLayout.setVisibility(View.VISIBLE); + user_name.setText(IMLoginManager.get(mContext).getUserInfo().getUserNicename()); initData(); }); ViewClicksAntiShake.clicksAntiShake(tab2, () -> { - btn_one.setVisibility(View.VISIBLE); - btn_one_tips.setVisibility(View.VISIBLE); tab2.setBackgroundResource(R.drawable.gift_wall_gift_info_list_btn_up); tab2.setTextColor(Color.parseColor("#31326D")); @@ -207,7 +226,19 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { tab1.setTextColor(Color.parseColor("#FFFFFF")); list_type = 2; adapter.setList_type(list_type); + if (isStar && list_type == 2) { + btn_one.setVisibility(View.GONE); + btn_one_tips.setVisibility(View.GONE); + titleLayout.setVisibility(View.GONE); + titleLayout2.setVisibility(View.VISIBLE); + } else { + btn_one.setVisibility(View.VISIBLE); + btn_one_tips.setVisibility(View.VISIBLE); + titleLayout.setVisibility(View.VISIBLE); + } + initTabText(); + initData(); }); XPopup.Builder builder = new XPopup.Builder(getContext()) @@ -254,7 +285,7 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { mIvBack.setLayoutParams(params); ViewClicksAntiShake.clicksAntiShake(mIvBack, this::dismiss); resetWindows(); - if(isStar){ + if (isStar && list_type == 2) { findViewById(R.id.anchorTips).setVisibility(View.VISIBLE); } } @@ -382,12 +413,32 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { } adapter.setData(giftBean.getData()); time = (WordUtil.isNewZh() ? "榜單結算時間:" : "Settlement time:") + giftBean.getGift_info().getGift_hall_start() + " - " + giftBean.getGift_info().getGift_hall_end(); - ImgLoader.display(mContext, IMLoginManager.get(mContext).getUserInfo().getAvatar(), avatar); - user_name.setText(IMLoginManager.get(mContext).getUserInfo().getUserNicename()); - send_num.setText(String.format(Locale.getDefault(), "%s", giftBean.getGift_info().getUser_gift_hall_send_num())); + + if (isStar && list_type == 2) { + user_name.setText(giftBean.getGift_info().getLive_nicename()); + send_num.setText(String.format(Locale.getDefault(), "%s", giftBean.getGift_info().getGift_hall_send_num())); + ImgLoader.display(mContext, giftBean.getGift_info().getLive_avatar(), avatar); + findViewById(R.id.anchorTips).setVisibility(View.VISIBLE); + ViewUtils.findViewById(this, R.id.textView7, TextView.class).setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_bottom_tips3)); + if (giftBean.getGift_info().getLive_sort() == 0) { + ViewUtils.findViewById(this, R.id.bottom_rank_value, TextView.class).setText(WordUtil.isNewZh() ? "未上榜" : "Not listed"); + } else { + ViewUtils.findViewById(this, R.id.bottom_rank_value, TextView.class).setText(String.valueOf(giftBean.getGift_info().getLive_sort())); + } + findViewById(R.id.bottom_rank_layout).setVisibility(View.VISIBLE); + + } else { + ImgLoader.display(mContext, IMLoginManager.get(mContext).getUserInfo().getAvatar(), avatar); + user_name.setText(IMLoginManager.get(mContext).getUserInfo().getUserNicename()); + send_num.setText(String.format(Locale.getDefault(), "%s", giftBean.getGift_info().getUser_gift_hall_send_num())); + findViewById(R.id.anchorTips).setVisibility(View.GONE); + ViewUtils.findViewById(this, R.id.textView7, TextView.class).setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_bottom_send)); + findViewById(R.id.bottom_rank_layout).setVisibility(View.GONE); + } String tmp = ""; if (giftBean.getGift_info().getIlluminate_status() != 1) {//未點亮 + btn_one.setVisibility(View.VISIBLE); btn_one.setText(R.string.dialog_gift_wall_gfit_info_list_bottom_btn_one_light); tmp = String.format(Locale.getDefault(), "%s", (giftBean.getGift_info().getIlluminate_num() - Integer.parseInt(giftBean.getGift_info().getGift_hall_send_num()))); setTips(tmp); @@ -403,8 +454,13 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { } private void setTips(String tmp) { - if(btn_one.getVisibility()==VISIBLE){ - btn_one_tips.setVisibility(View.VISIBLE); + if (isStar && list_type == 2) { + btn_one.setVisibility(View.GONE); + btn_one_tips.setVisibility(View.GONE); + return; + } + if (btn_one.getVisibility() == VISIBLE) { + btn_one_tips.setVisibility(View.VISIBLE); } btn_one_tips.setText(String.format(Locale.getDefault(), "%s%s%s" , WordUtil.isNewZh() ? "需 " : "Need ", @@ -423,6 +479,7 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { btn_one.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_bottom_btn_one_champion_get)); btn_one_tips.setVisibility(View.GONE); } else { + btn_one.setVisibility(View.VISIBLE); btn_one.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_bottom_btn_one_champion)); setTips(String.valueOf(tmp)); } diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java index d4b0f40c3..ba83ddaaf 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java @@ -68,6 +68,7 @@ public class GiftWallMainTab2ClassicInfoDialog extends AbsDialogPopupWindow { GiftWallTab2Bean.Gift gift; String userName; boolean isAnchor; + GiftWallGiftInfoDialog giftWallGiftInfoDialog; public GiftWallMainTab2ClassicInfoDialog(@NonNull Context context, GiftWallTab2Bean.Gift gift, boolean isAnchor) { super(context); @@ -81,6 +82,19 @@ public class GiftWallMainTab2ClassicInfoDialog extends AbsDialogPopupWindow { return this; } + public GiftWallMainTab2ClassicInfoDialog setGiftWallGiftInfoDialog(GiftWallGiftInfoDialog giftWallGiftInfoDialog) { + this.giftWallGiftInfoDialog = giftWallGiftInfoDialog; + return this; + } + + @Override + protected void onDismiss() { + super.onDismiss(); + if (giftWallGiftInfoDialog != null) { + giftWallGiftInfoDialog.showDialog(); + } + } + @Override public void buildDialog(XPopup.Builder builder) { diff --git a/common/src/main/java/com/yunbao/common/manager/RandomSudGameManager.java b/common/src/main/java/com/yunbao/common/manager/RandomSudGameManager.java index 934352b75..cbdef0e74 100644 --- a/common/src/main/java/com/yunbao/common/manager/RandomSudGameManager.java +++ b/common/src/main/java/com/yunbao/common/manager/RandomSudGameManager.java @@ -153,8 +153,9 @@ public class RandomSudGameManager { ss = new SpannableString(text); ss.setSpan(image, text.indexOf("$"), text.indexOf("$") + 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); builder.setHtmlCode(ss); + }else { + builder.setConfirmString(WordUtil.isNewZh() ? "獲取" : "Obtain"); } - builder.setConfirmString(WordUtil.isNewZh() ? "獲取" : "Obtain"); builder.setSimpleCallbackView(new DialogUitl.SimpleCallbackView() { @Override @@ -165,7 +166,9 @@ public class RandomSudGameManager { @Override public void onConfirmClick(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn) { dialog.dismiss(); - openTicketWeb(mContext); + if(!isAudience){ + openTicketWeb(mContext); + } if (simpleCallback != null) { simpleCallback.onConfirmClick(dialog, ""); } @@ -174,6 +177,9 @@ public class RandomSudGameManager { @Override public void onCancel(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn) { dialog.dismiss(); + if(isAudience){ + openTicketWeb(mContext); + } if (simpleCallback != null) { simpleCallback.onCancelClick(); } @@ -254,7 +260,7 @@ public class RandomSudGameManager { } public void openTicketWeb(Context mContext) { - String url = String.format(Locale.getDefault(), "%sh5/monthlyActivities/20240822/index.html?type=1&uid=%s&token=%s&isZh=%s", + String url = String.format(Locale.getDefault(), "%s/h5/monthlyActivities/20240822/index.html?type=1&uid=%s&token=%s&isZh=%s", CommonAppConfig.HOST, IMLoginManager.get(mContext).getUserInfo().getId(), IMLoginManager.get(mContext).getUserInfo().getToken(), diff --git a/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java index 3a9deada8..14f701982 100644 --- a/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java @@ -136,12 +136,12 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder { RandomSudGameManager.getManager().showNotActivityTicketDialog(itemView.getContext(), true, new DialogUitl.SimpleCallback2() { @Override public void onCancelClick() { - toGame(model, isHome, true); + } @Override public void onConfirmClick(Dialog dialog, String content) { - + toGame(model, isHome, true); } }); return; diff --git a/common/src/main/res/layout/dialog_gift_wall_gift_info.xml b/common/src/main/res/layout/dialog_gift_wall_gift_info.xml index 4ce3b1a96..a94222c4d 100644 --- a/common/src/main/res/layout/dialog_gift_wall_gift_info.xml +++ b/common/src/main/res/layout/dialog_gift_wall_gift_info.xml @@ -334,7 +334,8 @@ android:src="@mipmap/icon_avatar_placeholder" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" + app:layout_constraintTop_toTopOf="@+id/anchorTips" + android:layout_marginTop="6dp" app:riv_oval="true" /> @@ -402,7 +404,7 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" tools:text="@string/dialog_gift_wall_gfit_info_list_bottom_btn_one_champion" - tools:visibility="visible" /> + tools:visibility="gone" />