diff --git a/app/src/main/java/com/nnbc123/app/ui/utils/ImageLoadUtilsV2.java b/app/src/main/java/com/nnbc123/app/ui/utils/ImageLoadUtilsV2.java index 67375cc8f..20c3ee2ad 100644 --- a/app/src/main/java/com/nnbc123/app/ui/utils/ImageLoadUtilsV2.java +++ b/app/src/main/java/com/nnbc123/app/ui/utils/ImageLoadUtilsV2.java @@ -69,6 +69,15 @@ public class ImageLoadUtilsV2 { isDontAnim, null); } + public static void loadImage(ImageView imageView, String url, int defaultRes, int roundDp) { + if (imageView == null) { + return; + } + loadImage(imageView.getContext(), imageView, url, -1, false, + defaultRes, defaultRes, false, null, + new CenterCrop(), new RoundedCorners(UIUtil.dip2px(imageView.getContext(), roundDp))); + } + public static void loadImage(ImageView imageView, String url, int size, boolean isSquare, int errorId, int placeholderId, diff --git a/app/src/main/java/com/nnbc123/app/ui/widget/GiftDialog.java b/app/src/main/java/com/nnbc123/app/ui/widget/GiftDialog.java index 39bb349bc..c2767c3c2 100644 --- a/app/src/main/java/com/nnbc123/app/ui/widget/GiftDialog.java +++ b/app/src/main/java/com/nnbc123/app/ui/widget/GiftDialog.java @@ -52,6 +52,7 @@ import com.nnbc123.app.common.widget.CircleImageView; import com.nnbc123.app.ui.gift.dialog.GiftInfoVm; import com.nnbc123.app.ui.pay.ChargeDialog; import com.nnbc123.app.ui.utils.ImageLoadUtils; +import com.nnbc123.app.ui.utils.ImageLoadUtilsV2; import com.nnbc123.app.ui.webview.CommonWebViewActivity; import com.nnbc123.app.ui.webview.DialogWebViewActivity; import com.nnbc123.app.ui.widget.dialog.GiftManualQuantityDialog; @@ -75,7 +76,6 @@ import com.nnbc123.core.gift.bean.GiftPrivilegeInfo; import com.nnbc123.core.gift.bean.GiftTab; import com.nnbc123.core.gift.bean.GiftType; import com.nnbc123.core.gift.bean.LuckyBagNoticeInfo; -import com.nnbc123.core.gift.bean.UnLockGiftInfo; import com.nnbc123.core.gift.event.UpdateKnapEvent; import com.nnbc123.core.im.custom.bean.RoomReceivedLuckyGiftAttachment; import com.nnbc123.core.initial.InitialModel; @@ -218,6 +218,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene private SuperTextView tvPrivilegeGive; private Group groupPrivilege; private GIftDialogUnlockPanel unLockPanel; + private ImageView dressUpBannerView; private int mPrivilegePosition = 0; @@ -425,6 +426,8 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene ivDrawGiftRemoveAll = findViewById(R.id.iv_draw_gift_remove_all); ivDrawGiftClose = findViewById(R.id.iv_draw_gift_close); unLockPanel = findViewById(R.id.panel_unlock); + dressUpBannerView = findViewById(R.id.iv_dress_up_banner); + dressUpBannerView.setOnClickListener(this); ivDrawGiftClose.setOnClickListener(this); ivDrawGiftRemoveLast.setOnClickListener(this); ivDrawGiftRemoveAll.setOnClickListener(this); @@ -827,6 +830,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene isShowDrawGiftModel = false; updateDrawGift(); updateUnLockTips(); + updateDressUpTips(); } /** @@ -884,6 +888,20 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene unLockPanel.update(currentGiftInfo); } + private void updateDressUpTips() { + if (currentGiftInfo == null || currentGiftInfo.getGiftType() != GiftType.GIFT_TYPE_DRESS_UP) { + dressUpBannerView.setVisibility(View.GONE); + return; + } + String banner = currentGiftInfo.getBanner(); + if (banner == null || banner.length() == 0) { + dressUpBannerView.setVisibility(View.GONE); + return; + } + dressUpBannerView.setVisibility(View.VISIBLE); + ImageLoadUtilsV2.loadImage(dressUpBannerView, banner, R.drawable.default_banner, 8); + } + private void updateLuckyBagIntro() { if (luckyMsgDisposable != null) luckyMsgDisposable.dispose(); if (currentGiftInfo == null || currentGiftInfo.getGiftType() != GiftType.GIFT_TYPE_LUCKY) { @@ -1193,6 +1211,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene isShowDrawGiftModel = true; updateDrawGift(); updateUnLockTips(); + updateDressUpTips(); }); container.addView(recyclerView); return recyclerView; @@ -1304,6 +1323,14 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene @Override public void onClick(View v) { switch (v.getId()) { + case R.id.iv_dress_up_banner: + if (currentGiftInfo != null) { + String skipUrl = currentGiftInfo.getBannerSkipUrl(); + if (skipUrl != null) { + CommonWebViewActivity.start(context, skipUrl); + } + } + break; case R.id.ll_gold: StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_GIFT_PANEL_TO_RECHARGE, "礼物面板_去充值:" + GIFT_DIALOG_FROM); ChargeDialog.start(getContext()); @@ -1583,7 +1610,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene // 更新本地解锁礼物的数据状态(解锁状态、送出的数量) private void updateUnlockStateSendSuccess(GiftInfo giftInfo, int totalNumber) { - if(giftInfo.getGiftType() != GiftType.GIFT_TYPE_UNLOCK){ + if (giftInfo.getGiftType() != GiftType.GIFT_TYPE_UNLOCK) { return; } GiftInfo baseGift = giftInfo.getBaseGift(); diff --git a/app/src/main/res/layout/dialog_bottom_gift.xml b/app/src/main/res/layout/dialog_bottom_gift.xml index e2f975c9b..76a438738 100644 --- a/app/src/main/res/layout/dialog_bottom_gift.xml +++ b/app/src/main/res/layout/dialog_bottom_gift.xml @@ -6,6 +6,20 @@ android:layout_height="wrap_content" android:layout_gravity="bottom"> + + unlockGiftList; private String giftTag; + private String banner; + private String bannerSkipUrl; public GiftInfo getBaseGift() { return baseGift; @@ -135,6 +137,22 @@ public class GiftInfo implements Serializable { } } + public String getBanner() { + return banner; + } + + public void setBanner(String banner) { + this.banner = banner; + } + + public String getBannerSkipUrl() { + return bannerSkipUrl; + } + + public void setBannerSkipUrl(String bannerSkipUrl) { + this.bannerSkipUrl = bannerSkipUrl; + } + // @SuppressWarnings("all") public GiftInfo() { @@ -570,6 +588,12 @@ public class GiftInfo implements Serializable { final Object this$giftTag = this.getGiftTag(); final Object other$giftTag = other.getGiftTag(); if (this$giftTag == null ? other$giftTag != null : !this$giftTag.equals(other$giftTag)) return false; + final Object this$banner = this.getBanner(); + final Object other$banner = other.getBanner(); + if (this$banner == null ? other$banner != null : !this$banner.equals(other$banner)) return false; + final Object this$bannerSkipUrl = this.getBannerSkipUrl(); + final Object other$bannerSkipUrl = other.getBannerSkipUrl(); + if (this$bannerSkipUrl == null ? other$bannerSkipUrl != null : !this$bannerSkipUrl.equals(other$bannerSkipUrl)) return false; return true; } @@ -633,6 +657,10 @@ public class GiftInfo implements Serializable { result = result * PRIME + ($unlockGiftList == null ? 43 : $unlockGiftList.hashCode()); final Object $giftTag = this.getGiftTag(); result = result * PRIME + ($giftTag == null ? 43 : $giftTag.hashCode()); + final Object $banner = this.getBanner(); + result = result * PRIME + ($banner == null ? 43 : $banner.hashCode()); + final Object $bannerSkipUrl = this.getBannerSkipUrl(); + result = result * PRIME + ($bannerSkipUrl == null ? 43 : $bannerSkipUrl.hashCode()); return result; }