feat:完成装扮礼物banner展示逻辑

This commit is contained in:
Max
2024-01-29 14:47:59 +08:00
parent 44ad80c708
commit a01a362506
4 changed files with 80 additions and 2 deletions

View File

@@ -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,

View File

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

View File

@@ -6,6 +6,20 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<ImageView
android:id="@+id/iv_dress_up_banner"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginHorizontal="6dp"
android:layout_marginBottom="5dp"
android:scaleType="centerCrop"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/ll_dialog_bottom_gift"
app:layout_constraintDimensionRatio="363:44"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible" />
<com.nnbc123.app.ui.widget.GIftDialogUnlockPanel
android:id="@+id/panel_unlock"
android:layout_width="0dp"

View File

@@ -78,6 +78,8 @@ public class GiftInfo implements Serializable {
private GiftInfo baseGift;
private List<UnLockGiftInfo> 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;
}
//<editor-fold defaultstate="collapsed" desc="delombok">
@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;
}