feat:完成趣味礼物展示
This commit is contained in:
@@ -10,6 +10,7 @@ import android.graphics.drawable.Drawable;
|
||||
import com.nnbc123.app.R;
|
||||
import com.nnbc123.app.vip.VipHelper;
|
||||
import com.nnbc123.core.gift.bean.GiftInfo;
|
||||
import com.nnbc123.core.gift.bean.GiftType;
|
||||
import com.nnbc123.core.gift.bean.SimpleVipInfo;
|
||||
import com.nnbc123.library.bindinglist.BaseItem;
|
||||
|
||||
@@ -90,6 +91,13 @@ public class GiftInfoVm extends BaseItem<GiftInfo> {
|
||||
SimpleVipInfo vipInfo = data.getGiftVipInfo();
|
||||
isLocked = vipInfo != null && VipHelper.getMyVipLevel() < vipInfo.getVipLevel();
|
||||
vipIcon = vipInfo == null ? "" : vipInfo.getVipIcon();
|
||||
if (!isLocked) {
|
||||
if (data.getGiftType() == GiftType.GIFT_TYPE_UNLOCK) {
|
||||
if (!data.isUnlocked()) {
|
||||
isLocked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -0,0 +1,64 @@
|
||||
package com.nnbc123.app.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.cardview.widget.CardView
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.nnbc123.app.R
|
||||
import com.nnbc123.core.gift.bean.GiftInfo
|
||||
import com.nnbc123.core.gift.bean.GiftType
|
||||
import com.nnbc123.core.gift.bean.UnLockBaseGiftInfo
|
||||
import com.nnbc123.core.gift.bean.UnlockItem
|
||||
|
||||
/**
|
||||
* Created by Max on 2024/1/26 17:16
|
||||
* Desc:
|
||||
**/
|
||||
class GIftDialogUnlockPanel : CardView {
|
||||
private var recyclerView: RecyclerView? = null
|
||||
private var adapter: GiftUnLockInfoAdapter = GiftUnLockInfoAdapter(emptyList())
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attrs,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
init {
|
||||
inflate(context, R.layout.gift_dialog_unlock_panel, this)
|
||||
recyclerView = findViewById(R.id.recyclerView)
|
||||
recyclerView?.adapter = adapter
|
||||
}
|
||||
|
||||
fun update(currentGift: GiftInfo?) {
|
||||
if (currentGift == null || currentGift.giftType != GiftType.GIFT_TYPE_UNLOCK) {
|
||||
this.isVisible = false
|
||||
return
|
||||
}
|
||||
val list = ArrayList<UnlockItem>()
|
||||
val baseGift = currentGift.baseGift
|
||||
val childGift = currentGift.unlockGiftList
|
||||
if (baseGift != null) {
|
||||
list.add(UnLockBaseGiftInfo(baseGift))
|
||||
}
|
||||
if (!childGift.isNullOrEmpty()) {
|
||||
list.addAll(childGift)
|
||||
}
|
||||
if (list.isEmpty()) {
|
||||
this.isVisible = false
|
||||
return
|
||||
}
|
||||
this.isVisible = true
|
||||
val index = list.indexOfFirst {
|
||||
it.getGiftData()?.giftId == currentGift.giftId
|
||||
}
|
||||
adapter.selectItemId = currentGift.giftId
|
||||
adapter.setNewData(baseGift, list)
|
||||
if (index >= 0) {
|
||||
recyclerView?.smoothScrollToPosition(index)
|
||||
}
|
||||
}
|
||||
}
|
@@ -52,7 +52,6 @@ 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;
|
||||
@@ -217,8 +216,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
private AppCompatTextView tvNum;
|
||||
private SuperTextView tvPrivilegeGive;
|
||||
private Group groupPrivilege;
|
||||
private RecyclerView rvLock;
|
||||
private View layoutLock;
|
||||
private GIftDialogUnlockPanel panelUnLock;
|
||||
|
||||
private int mPrivilegePosition = 0;
|
||||
|
||||
@@ -425,6 +423,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
ivDrawGiftRemoveLast = findViewById(R.id.iv_draw_gift_remove_last);
|
||||
ivDrawGiftRemoveAll = findViewById(R.id.iv_draw_gift_remove_all);
|
||||
ivDrawGiftClose = findViewById(R.id.iv_draw_gift_close);
|
||||
panelUnLock = findViewById(R.id.panel_unlock);
|
||||
ivDrawGiftClose.setOnClickListener(this);
|
||||
ivDrawGiftRemoveLast.setOnClickListener(this);
|
||||
ivDrawGiftRemoveAll.setOnClickListener(this);
|
||||
@@ -436,7 +435,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
List<GiftTab> tabInfoList = new ArrayList<>();
|
||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_NORMAL, "普通", "普通"));
|
||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_INTEREST, "趣味", "趣味", true));
|
||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_LUCKY, "幸运", "幸运"));
|
||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_NOBLE, "贵族", "贵族"));
|
||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_WEEK, "星座礼物", "星座礼物"));
|
||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_SING_ROOM, "人气", "人气"));
|
||||
@@ -459,15 +457,13 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
.subscribe(integer -> {
|
||||
updateGiftView(integer);
|
||||
//福袋礼物有定时更新逻辑,每次点击都需要刷新福袋礼物信息
|
||||
if (integer == GiftIndicator.TYPE_LUCKY) {
|
||||
if (integer == GiftIndicator.TYPE_INTEREST) {
|
||||
reloadData(false);
|
||||
}
|
||||
});
|
||||
|
||||
if (isInRoom) {
|
||||
giftIndicator.showPosition(GiftIndicator.TYPE_LUCKY);
|
||||
} else {
|
||||
giftIndicator.hidePosition(GiftIndicator.TYPE_LUCKY);
|
||||
giftIndicator.hidePosition(GiftIndicator.TYPE_DRAW_GIFT);
|
||||
llTabType.setVisibility(View.GONE);
|
||||
lineTabType.setVisibility(View.GONE);
|
||||
@@ -526,16 +522,15 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
case GiftType.GIFT_TYPE_NORMAL:
|
||||
indicatorType = GiftIndicator.TYPE_NORMAL;
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_LUCKY:
|
||||
indicatorType = GiftIndicator.TYPE_LUCKY;
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_VIP:
|
||||
indicatorType = GiftIndicator.TYPE_NOBLE;
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_WEEK_STAR:
|
||||
indicatorType = GiftIndicator.TYPE_WEEK;
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_INTEREST:
|
||||
case GiftType.GIFT_TYPE_UNLOCK:
|
||||
case GiftType.GIFT_TYPE_LUCKY:
|
||||
case GiftType.GIFT_TYPE_DRESS_UP:
|
||||
indicatorType = GiftIndicator.TYPE_INTEREST;
|
||||
break;
|
||||
}
|
||||
@@ -695,8 +690,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
currentGiftInfoList = nobleGiftInfos;
|
||||
} else if (position == GiftIndicator.TYPE_NORMAL) {
|
||||
currentGiftInfoList = getNormalGiftInfos();
|
||||
} else if (position == GiftIndicator.TYPE_LUCKY) {
|
||||
currentGiftInfoList = getLuckyGiftInfos();
|
||||
} else if (position == GiftIndicator.TYPE_WEEK) {
|
||||
currentGiftInfoList = getWeekStarGiftInfos();
|
||||
} else if (position == GiftIndicator.TYPE_DRAW_GIFT) {
|
||||
@@ -705,6 +698,8 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
currentGiftInfoList = getSingleRoomGiftInfos();
|
||||
} else if (position == GiftIndicator.TYPE_PENALTY) {
|
||||
currentGiftInfoList = getPenaltyGiftInfos();
|
||||
} else if (position == GiftIndicator.TYPE_INTEREST) {
|
||||
currentGiftInfoList = getInterestGiftInfos();
|
||||
}
|
||||
//是否背包礼物
|
||||
final boolean isKnap = (position == GiftIndicator.TYPE_KNAP);
|
||||
@@ -761,7 +756,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
} else if (isKnap) {
|
||||
giftIndicator.getBackpackValueView().setVisibility(View.VISIBLE);
|
||||
showEmptyView();
|
||||
} else if (position == GiftIndicator.TYPE_LUCKY ||
|
||||
} else if (position == GiftIndicator.TYPE_INTEREST ||
|
||||
position == GiftIndicator.TYPE_WEEK ||
|
||||
position == GiftIndicator.TYPE_DRAW_GIFT ||
|
||||
position == GiftIndicator.TYPE_SING_ROOM ||
|
||||
@@ -830,6 +825,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
updateWeekStarDesc();
|
||||
isShowDrawGiftModel = false;
|
||||
updateDrawGift();
|
||||
updateUnLockTips();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -883,8 +879,8 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
privilegeView.setAdapter(baseQuickAdapter);
|
||||
}
|
||||
|
||||
private void updateLockTips() {
|
||||
|
||||
private void updateUnLockTips() {
|
||||
panelUnLock.update(currentGiftInfo);
|
||||
}
|
||||
|
||||
private void updateLuckyBagIntro() {
|
||||
@@ -1192,6 +1188,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
updateWeekStarDesc();
|
||||
isShowDrawGiftModel = true;
|
||||
updateDrawGift();
|
||||
updateUnLockTips();
|
||||
});
|
||||
container.addView(recyclerView);
|
||||
return recyclerView;
|
||||
@@ -1247,12 +1244,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
GiftType.GIFT_TYPE_WEEK_STAR);
|
||||
}
|
||||
|
||||
private List<GiftInfo> getLuckyGiftInfos() {
|
||||
return GiftModel.get().getGiftInfosByType(
|
||||
String.valueOf(AvRoomDataManager.get().getRoomUid()),
|
||||
GiftType.GIFT_TYPE_LUCKY);
|
||||
}
|
||||
|
||||
private List<GiftInfo> getDrawGiftInfos() {
|
||||
return GiftModel.get().getGiftInfosByType(
|
||||
String.valueOf(AvRoomDataManager.get().getRoomUid()),
|
||||
@@ -1271,6 +1262,12 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
GiftType.GIFT_TYPE_PENALTY);
|
||||
}
|
||||
|
||||
private List<GiftInfo> getInterestGiftInfos() {
|
||||
return GiftModel.get().getGiftInfosByType(
|
||||
String.valueOf(AvRoomDataManager.get().getRoomUid()),
|
||||
GiftType.GIFT_TYPE_INTEREST);
|
||||
}
|
||||
|
||||
private List<GiftInfo> getNobleGiftInfos() {
|
||||
return GiftModel.get().getGiftInfoList(GiftType.GIFT_TYPE_VIP);
|
||||
}
|
||||
@@ -1521,7 +1518,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
tvTabInteraction.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||
giftIndicator.hidePosition(GiftIndicator.TYPE_DRAW_GIFT);
|
||||
giftIndicator.hidePosition(GiftIndicator.TYPE_PENALTY);
|
||||
giftIndicator.showPosition(GiftIndicator.TYPE_LUCKY);
|
||||
giftIndicator.showPosition(GiftIndicator.TYPE_NOBLE);
|
||||
giftIndicator.showPosition(GiftIndicator.TYPE_WEEK);
|
||||
giftIndicator.showPosition(GiftIndicator.TYPE_NORMAL);
|
||||
@@ -1550,7 +1546,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
|
||||
giftIndicator.showPosition(GiftIndicator.TYPE_DRAW_GIFT);
|
||||
giftIndicator.showPosition(GiftIndicator.TYPE_PENALTY);
|
||||
giftIndicator.hidePosition(GiftIndicator.TYPE_LUCKY);
|
||||
giftIndicator.hidePosition(GiftIndicator.TYPE_NOBLE);
|
||||
giftIndicator.hidePosition(GiftIndicator.TYPE_WEEK);
|
||||
giftIndicator.hidePosition(GiftIndicator.TYPE_NORMAL);
|
||||
@@ -1578,7 +1573,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
int currentType = giftIndicator.getCurrrentType();
|
||||
switch (currentType) {
|
||||
case GiftIndicator.TYPE_NORMAL:
|
||||
case GiftIndicator.TYPE_LUCKY:
|
||||
case GiftIndicator.TYPE_NOBLE:
|
||||
case GiftIndicator.TYPE_WEEK:
|
||||
case GiftIndicator.TYPE_INTEREST:
|
||||
|
@@ -1,21 +0,0 @@
|
||||
package com.nnbc123.app.ui.widget
|
||||
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||
import com.nnbc123.app.R
|
||||
|
||||
/**
|
||||
* Created by Max on 2024/1/25 19:41
|
||||
* Desc:
|
||||
**/
|
||||
class GiftLockInfoAdapter :
|
||||
BaseMultiItemQuickAdapter<MultiItemEntity, BaseViewHolder>(emptyList()) {
|
||||
init {
|
||||
addItemType(0, R.layout.gift_dialog_lock_item_basics)
|
||||
addItemType(1, R.layout.gift_dialog_lock_item_child)
|
||||
}
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: MultiItemEntity?) {
|
||||
}
|
||||
}
|
@@ -0,0 +1,100 @@
|
||||
package com.nnbc123.app.ui.widget
|
||||
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.isVisible
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.chuhai.utils.ktx.getColorById
|
||||
import com.chuhai.utils.spannable.SpannableTextBuilder
|
||||
import com.nnbc123.app.R
|
||||
import com.nnbc123.app.ui.utils.load
|
||||
import com.nnbc123.core.gift.bean.GiftInfo
|
||||
import com.nnbc123.core.gift.bean.UnLockGiftInfo
|
||||
import com.nnbc123.core.gift.bean.UnlockItem
|
||||
|
||||
/**
|
||||
* Created by Max on 2024/1/25 19:41
|
||||
* Desc:
|
||||
**/
|
||||
class GiftUnLockInfoAdapter(list: List<UnlockItem>) :
|
||||
BaseMultiItemQuickAdapter<UnlockItem, BaseViewHolder>(list) {
|
||||
|
||||
var selectItemId: Int = -1
|
||||
|
||||
private var baseGiftName: String? = null
|
||||
|
||||
init {
|
||||
addItemType(UnlockItem.ITEM_TYPE_BASE, R.layout.gift_dialog_lock_item_basics)
|
||||
addItemType(UnlockItem.ITEM_TYPE_CHILD, R.layout.gift_dialog_lock_item_child)
|
||||
}
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: UnlockItem?) {
|
||||
val giftInfo = item?.getGiftData()
|
||||
when (item?.itemType) {
|
||||
UnlockItem.ITEM_TYPE_BASE -> {
|
||||
if (giftInfo?.giftId == selectItemId) {
|
||||
helper.setBackgroundRes(
|
||||
R.id.layout_root,
|
||||
R.drawable.gift_dialog_bg_lock_item_selected
|
||||
)
|
||||
} else {
|
||||
helper.setBackgroundRes(R.id.layout_root, R.drawable.shape_14ffffff_4dp)
|
||||
}
|
||||
helper.getView<ImageView>(R.id.iv_cover).load(giftInfo?.giftUrl)
|
||||
helper.setText(R.id.tv_name, giftInfo?.giftName ?: "")
|
||||
helper.setText(R.id.tv_amount, giftInfo?.goldPrice?.toString() ?: "")
|
||||
}
|
||||
|
||||
UnlockItem.ITEM_TYPE_CHILD -> {
|
||||
if (giftInfo?.giftId == selectItemId) {
|
||||
helper.setBackgroundRes(
|
||||
R.id.layout_root,
|
||||
R.drawable.gift_dialog_bg_lock_item_selected
|
||||
)
|
||||
} else {
|
||||
helper.setBackgroundRes(R.id.layout_root, R.drawable.shape_14ffffff_4dp)
|
||||
}
|
||||
var unlockItem: UnLockGiftInfo? = null
|
||||
if (item is UnLockGiftInfo) {
|
||||
unlockItem = item
|
||||
}
|
||||
val total = unlockItem?.condition ?: 0
|
||||
val progress = (unlockItem?.process ?: 0).coerceAtMost(total)
|
||||
helper.getView<ImageView>(R.id.iv_cover).load(giftInfo?.giftUrl)
|
||||
val nameView = helper.getView<TextView>(R.id.tv_name)
|
||||
SpannableTextBuilder(nameView)
|
||||
.appendText("送出")
|
||||
.appendText(
|
||||
" ${total}个 ",
|
||||
textColor = nameView.context.getColorById(R.color.color_FFDA24)
|
||||
)
|
||||
.appendText("${baseGiftName ?: ""}可解锁").apply()
|
||||
val progressBar = helper.getView<ProgressBar>(R.id.progress_bar)
|
||||
progressBar.max = total
|
||||
progressBar.progress = progress
|
||||
helper.setText(R.id.tv_count, "$progress/$total")
|
||||
val lockIconView = helper.getView<View>(R.id.iv_lock)
|
||||
val alpha: Float
|
||||
if (unlockItem?.unlocked == true) {
|
||||
alpha = 1f
|
||||
lockIconView.isVisible = false
|
||||
} else {
|
||||
alpha = 0.5f
|
||||
lockIconView.isVisible = true
|
||||
}
|
||||
helper.setAlpha(R.id.tv_name, alpha)
|
||||
helper.setAlpha(R.id.iv_cover, alpha)
|
||||
helper.setAlpha(R.id.tv_count, alpha)
|
||||
helper.setAlpha(R.id.progress_bar, alpha)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setNewData(baseGiftInfo: GiftInfo?, data: MutableList<UnlockItem>?) {
|
||||
this.baseGiftName = baseGiftInfo?.giftName
|
||||
super.setNewData(data)
|
||||
}
|
||||
}
|
@@ -7,6 +7,6 @@
|
||||
<corners android:radius="4dp" />
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:width="0.5dp"
|
||||
android:color="#FFDA24" />
|
||||
</shape>
|
@@ -6,8 +6,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/layout_lock"
|
||||
<com.nnbc123.app.ui.widget.GIftDialogUnlockPanel
|
||||
android:id="@+id/panel_unlock"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginHorizontal="6dp"
|
||||
@@ -20,25 +20,7 @@
|
||||
app:layout_constraintBottom_toTopOf="@id/ll_dialog_bottom_gift"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:visibility="visible">
|
||||
|
||||
<com.github.mmin18.widget.RealtimeBlurView
|
||||
android:id="@+id/blur_view_lock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:realtimeBlurRadius="25dp"
|
||||
app:realtimeDownsampleFactor="4"
|
||||
app:realtimeOverlayColor="#e0161722" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView_lock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_lucky_desc"
|
||||
|
@@ -2,10 +2,13 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/layout_root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="2dp"
|
||||
android:background="@drawable/shape_14ffffff_4dp"
|
||||
android:paddingHorizontal="3dp"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingEnd="8dp"
|
||||
tools:background="@color/black">
|
||||
|
||||
<ImageView
|
||||
|
@@ -2,10 +2,13 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/layout_root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="2dp"
|
||||
android:background="@drawable/shape_14ffffff_4dp"
|
||||
android:paddingHorizontal="3dp"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingEnd="8dp"
|
||||
tools:background="@color/black">
|
||||
|
||||
<ImageView
|
||||
@@ -18,6 +21,20 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/default_cover" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_lock"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_marginStart="1dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/gift_dialog_ic_lock"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/default_cover"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
|
26
app/src/main/res/layout/gift_dialog_unlock_panel.xml
Normal file
26
app/src/main/res/layout/gift_dialog_unlock_panel.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:parentTag="androidx.cardview.widget.CardView">
|
||||
|
||||
<com.github.mmin18.widget.RealtimeBlurView
|
||||
android:id="@+id/blur_view_unlock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:realtimeBlurRadius="25dp"
|
||||
app:realtimeDownsampleFactor="4"
|
||||
app:realtimeOverlayColor="#e0161722" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginHorizontal="4dp"
|
||||
android:orientation="horizontal"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||
|
||||
</merge>
|
@@ -39,6 +39,17 @@
|
||||
android:layout_marginTop="7dp"
|
||||
android:alpha="@{item.isLocked?0.5f:1f}" />
|
||||
|
||||
<ImageView
|
||||
nomalUrl="@{item.data().giftTag}"
|
||||
android:alpha="@{item.isLocked?0.5f:1f}"
|
||||
android:visibility="@{TextUtils.isEmpty(item.data().giftTag) ? View.GONE : View.VISIBLE}"
|
||||
android:id="@+id/iv_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="12dp"
|
||||
android:layout_alignStart="@id/gift_image"
|
||||
android:layout_alignBottom="@id/gift_image"
|
||||
android:adjustViewBounds="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gift_name"
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -236,6 +236,9 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
case GiftType.GIFT_TYPE_PENALTY:
|
||||
giftInfos = allGiftListInfo.getPenaltyGift();
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_INTEREST:
|
||||
giftInfos = allGiftListInfo.getInterestGift();
|
||||
break;
|
||||
}
|
||||
return giftInfos == null ? new ArrayList<>() : giftInfos;
|
||||
}
|
||||
@@ -616,6 +619,9 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
if (giftInfo == null) {
|
||||
giftInfo = findGiftInfoById(allGiftListInfo.getPenaltyGift(), giftId);
|
||||
}
|
||||
if (giftInfo == null) {
|
||||
giftInfo = findGiftInfoById(allGiftListInfo.getInterestGift(), giftId);
|
||||
}
|
||||
}
|
||||
return giftInfo;
|
||||
}
|
||||
@@ -686,7 +692,7 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
@GET("/gift/listV4")
|
||||
@GET("/gift/listV5")
|
||||
Single<ServiceResult<GiftListInfo>> requestGiftInfos(@Query("roomUid") String roomUid);
|
||||
|
||||
/**
|
||||
|
@@ -2,6 +2,7 @@ package com.nnbc123.core.gift.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by
|
||||
@@ -73,6 +74,42 @@ public class GiftInfo implements Serializable {
|
||||
private SimpleUserInfo firstLevelRankUser;
|
||||
private SimpleUserInfo firstCharmRankUser;
|
||||
private boolean drawGift;
|
||||
private boolean unlocked;
|
||||
private GiftInfo baseGift;
|
||||
private List<UnLockGiftInfo> unlockGiftList;
|
||||
private String giftTag;
|
||||
|
||||
public GiftInfo getBaseGift() {
|
||||
return baseGift;
|
||||
}
|
||||
|
||||
public void setBaseGift(GiftInfo baseGift) {
|
||||
this.baseGift = baseGift;
|
||||
}
|
||||
|
||||
public List<UnLockGiftInfo> getUnlockGiftList() {
|
||||
return unlockGiftList;
|
||||
}
|
||||
|
||||
public void setUnlockGiftList(List<UnLockGiftInfo> unlockGiftList) {
|
||||
this.unlockGiftList = unlockGiftList;
|
||||
}
|
||||
|
||||
public String getGiftTag() {
|
||||
return giftTag;
|
||||
}
|
||||
|
||||
public void setGiftTag(String giftTag) {
|
||||
this.giftTag = giftTag;
|
||||
}
|
||||
|
||||
public boolean isUnlocked() {
|
||||
return unlocked;
|
||||
}
|
||||
|
||||
public void setUnlocked(boolean unlocked) {
|
||||
this.unlocked = unlocked;
|
||||
}
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="delombok">
|
||||
@SuppressWarnings("all")
|
||||
@@ -463,6 +500,7 @@ public class GiftInfo implements Serializable {
|
||||
if (this.isRoomExclude() != other.isRoomExclude()) return false;
|
||||
if (this.getOtherViewType() != other.getOtherViewType()) return false;
|
||||
if (this.isDrawGift() != other.isDrawGift()) return false;
|
||||
if (this.isUnlocked() != other.isUnlocked()) return false;
|
||||
final Object this$giftName = this.getGiftName();
|
||||
final Object other$giftName = other.getGiftName();
|
||||
if (this$giftName == null ? other$giftName != null : !this$giftName.equals(other$giftName)) return false;
|
||||
@@ -499,6 +537,15 @@ public class GiftInfo implements Serializable {
|
||||
final Object this$firstCharmRankUser = this.getFirstCharmRankUser();
|
||||
final Object other$firstCharmRankUser = other.getFirstCharmRankUser();
|
||||
if (this$firstCharmRankUser == null ? other$firstCharmRankUser != null : !this$firstCharmRankUser.equals(other$firstCharmRankUser)) return false;
|
||||
final Object this$baseGift = this.getBaseGift();
|
||||
final Object other$baseGift = other.getBaseGift();
|
||||
if (this$baseGift == null ? other$baseGift != null : !this$baseGift.equals(other$baseGift)) return false;
|
||||
final Object this$unlockGiftList = this.getUnlockGiftList();
|
||||
final Object other$unlockGiftList = other.getUnlockGiftList();
|
||||
if (this$unlockGiftList == null ? other$unlockGiftList != null : !this$unlockGiftList.equals(other$unlockGiftList)) return false;
|
||||
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;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -531,6 +578,7 @@ public class GiftInfo implements Serializable {
|
||||
result = result * PRIME + (this.isRoomExclude() ? 79 : 97);
|
||||
result = result * PRIME + this.getOtherViewType();
|
||||
result = result * PRIME + (this.isDrawGift() ? 79 : 97);
|
||||
result = result * PRIME + (this.isUnlocked() ? 79 : 97);
|
||||
final Object $giftName = this.getGiftName();
|
||||
result = result * PRIME + ($giftName == null ? 43 : $giftName.hashCode());
|
||||
final Object $giftUrl = this.getGiftUrl();
|
||||
@@ -555,6 +603,12 @@ public class GiftInfo implements Serializable {
|
||||
result = result * PRIME + ($firstLevelRankUser == null ? 43 : $firstLevelRankUser.hashCode());
|
||||
final Object $firstCharmRankUser = this.getFirstCharmRankUser();
|
||||
result = result * PRIME + ($firstCharmRankUser == null ? 43 : $firstCharmRankUser.hashCode());
|
||||
final Object $baseGift = this.getBaseGift();
|
||||
result = result * PRIME + ($baseGift == null ? 43 : $baseGift.hashCode());
|
||||
final Object $unlockGiftList = this.getUnlockGiftList();
|
||||
result = result * PRIME + ($unlockGiftList == null ? 43 : $unlockGiftList.hashCode());
|
||||
final Object $giftTag = this.getGiftTag();
|
||||
result = result * PRIME + ($giftTag == null ? 43 : $giftTag.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -16,6 +16,7 @@ public class GiftListInfo implements Serializable {
|
||||
private List<GiftInfo> drawGift;
|
||||
private List<GiftInfo> singlePopularGift;
|
||||
private List<GiftInfo> penaltyGift;
|
||||
private List<GiftInfo> interestGift;
|
||||
private String giftVersion;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="delombok">
|
||||
@@ -113,6 +114,14 @@ public class GiftListInfo implements Serializable {
|
||||
this.giftVersion = giftVersion;
|
||||
}
|
||||
|
||||
public List<GiftInfo> getInterestGift() {
|
||||
return interestGift;
|
||||
}
|
||||
|
||||
public void setInterestGift(List<GiftInfo> interestGift) {
|
||||
this.interestGift = interestGift;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
public boolean equals(final Object o) {
|
||||
@@ -144,6 +153,9 @@ public class GiftListInfo implements Serializable {
|
||||
final Object this$penaltyGift = this.getPenaltyGift();
|
||||
final Object other$penaltyGift = other.getPenaltyGift();
|
||||
if (this$penaltyGift == null ? other$penaltyGift != null : !this$penaltyGift.equals(other$penaltyGift)) return false;
|
||||
final Object this$interestGift = this.getInterestGift();
|
||||
final Object other$interestGift = other.getInterestGift();
|
||||
if (this$interestGift == null ? other$interestGift != null : !this$interestGift.equals(other$interestGift)) return false;
|
||||
final Object this$giftVersion = this.getGiftVersion();
|
||||
final Object other$giftVersion = other.getGiftVersion();
|
||||
if (this$giftVersion == null ? other$giftVersion != null : !this$giftVersion.equals(other$giftVersion)) return false;
|
||||
@@ -176,6 +188,8 @@ public class GiftListInfo implements Serializable {
|
||||
result = result * PRIME + ($singlePopularGift == null ? 43 : $singlePopularGift.hashCode());
|
||||
final Object $penaltyGift = this.getPenaltyGift();
|
||||
result = result * PRIME + ($penaltyGift == null ? 43 : $penaltyGift.hashCode());
|
||||
final Object $interestGift = this.getInterestGift();
|
||||
result = result * PRIME + ($interestGift == null ? 43 : $interestGift.hashCode());
|
||||
final Object $giftVersion = this.getGiftVersion();
|
||||
result = result * PRIME + ($giftVersion == null ? 43 : $giftVersion.hashCode());
|
||||
return result;
|
||||
|
@@ -43,5 +43,17 @@ public class GiftType {
|
||||
|
||||
public static final int GIFT_TYPE_PENALTY = 12;
|
||||
|
||||
public static final int GIFT_TYPE_INTEREST = 14;
|
||||
/**
|
||||
* 礼物类型 -- 解锁礼物
|
||||
*/
|
||||
public static final int GIFT_TYPE_UNLOCK = 16;
|
||||
|
||||
/**
|
||||
* 礼物类型 -- 装扮礼物
|
||||
*/
|
||||
public static final int GIFT_TYPE_DRESS_UP = 17;
|
||||
|
||||
// 趣味礼物(本地自定义维护的)
|
||||
@Deprecated()
|
||||
public static final int GIFT_TYPE_INTEREST = 1000;
|
||||
}
|
||||
|
@@ -0,0 +1,15 @@
|
||||
package com.nnbc123.core.gift.bean
|
||||
|
||||
/**
|
||||
* Created by Max on 2024/1/26 17:09
|
||||
* Desc:
|
||||
**/
|
||||
data class UnLockBaseGiftInfo(val giftInfo: GiftInfo) : UnlockItem {
|
||||
override fun getGiftData(): GiftInfo? {
|
||||
return giftInfo
|
||||
}
|
||||
|
||||
override fun getItemType(): Int {
|
||||
return UnlockItem.ITEM_TYPE_BASE
|
||||
}
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package com.nnbc123.core.gift.bean
|
||||
|
||||
|
||||
/**
|
||||
* Created by Max on 2024/1/26 15:36
|
||||
* Desc:可解锁礼物
|
||||
**/
|
||||
data class UnLockGiftInfo(
|
||||
val targetGift: GiftInfo? = null,
|
||||
val condition: Int? = null,
|
||||
val process: Int? = null,
|
||||
val unlocked: Boolean? = null
|
||||
) : UnlockItem {
|
||||
override fun getGiftData(): GiftInfo? {
|
||||
return targetGift
|
||||
}
|
||||
|
||||
override fun getItemType(): Int {
|
||||
return UnlockItem.ITEM_TYPE_CHILD
|
||||
}
|
||||
|
||||
|
||||
}
|
16
core/src/main/java/com/nnbc123/core/gift/bean/UnlockItem.kt
Normal file
16
core/src/main/java/com/nnbc123/core/gift/bean/UnlockItem.kt
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.nnbc123.core.gift.bean
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||
|
||||
/**
|
||||
* Created by Max on 2024/1/26 17:06
|
||||
* Desc:
|
||||
**/
|
||||
interface UnlockItem : MultiItemEntity {
|
||||
companion object {
|
||||
const val ITEM_TYPE_BASE = 0
|
||||
const val ITEM_TYPE_CHILD = 1
|
||||
}
|
||||
|
||||
fun getGiftData(): GiftInfo?
|
||||
}
|
Reference in New Issue
Block a user