房间心愿单:心愿单完成特效

This commit is contained in:
huangjian
2022-10-21 15:44:09 +08:00
parent 8167d51fb9
commit b983b3f6a4
11 changed files with 101 additions and 17 deletions

View File

@@ -150,8 +150,8 @@ android {
debug {
buildConfigField "String", "BASE_URL", "\"http://api.uat.lecheng163.com/\""
buildConfigField "String", "BASE_URL_DEBUG", "BASE_URL"
buildConfigField "String", "BASE_URL_STAGING", "\"https://yinyou.api.shengxuanwangluo.com/\""
buildConfigField "String", "BASE_URL_RELEASE", "\"https://yinyou.api.shengxuanwangluo.com/\""
buildConfigField "String", "BASE_URL_STAGING", "BASE_URL"
buildConfigField "String", "BASE_URL_RELEASE", "BASE_URL"
minifyEnabled false
shrinkResources false
signingConfig signingConfigs.v1

Binary file not shown.

View File

@@ -136,6 +136,8 @@ import io.reactivex.disposables.Disposable
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import kotlin.math.max
import kotlin.math.min
/**
@@ -299,8 +301,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
StatisticManager.Instance()
.onEvent(StatisticsProtocol.EVENT_ROOM_POP_SHOW, "房间pop曝光", mapOf("name" to "航海冒险"))
}
initWishListPager()
}
@CallSuper
@@ -512,14 +513,15 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
}
}
private fun initVipPager() {
private fun initWishListPager() {
pagerViewWishList?.let { pagerViewWishList ->
val adapter = object : StaticPagerAdapter() {
var wishGiftList: List<WishItemInfo>? = null
set(value) {
pagerViewWishList.isVisible = !value.isNullOrEmpty()
field = value
}
set(value) {
pagerViewWishList.isVisible = !value.isNullOrEmpty()
field = value
}
override fun getCount(): Int {
return wishGiftList?.size ?: 0
}
@@ -531,11 +533,16 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
wishGiftList?.getOrNull(position)?.let {
rootView.findViewById<ImageView>(R.id.iv_gift).load(it.giftUrl)
rootView.findViewById<TextView>(R.id.tv_gift_name).text = it.giftName
val isComplete = it.actualNum == it.targetNum
val isComplete = it.actualNum >= it.targetNum
rootView.findViewById<TextView>(R.id.tv_progress).text =
SpannableBuilder()
.append(
"${it.actualNum}",
"${
min(
it.actualNum,
it.targetNum
)
}${if (it.actualNum > it.targetNum) "+" else ""}",
ForegroundColorSpan(("#FFC300".toColorInt()))
)
.append(
@@ -575,7 +582,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
open fun updateView() {
// 更新底栏
showBottomViewForDifRole()
initVipPager()
}
/**

View File

@@ -128,10 +128,10 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
.map(this::dealMicMemberFromIMNet)
.flatMap(this::dealMicChatRoomMemberFromIMNet)
.compose(bindUntilEvent(PresenterEvent.DESTROY))
.doOnNext(roomQueueInfoSparseArray -> AudioEngineManager.get().startRtcEngine(AuthModel.get().getCurrentUid(), roomInfo.getAudioSdkType()))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(roomQueueInfoSparseArray -> {
long uid = AuthModel.get().getCurrentUid();
AudioEngineManager.get().startRtcEngine(uid, roomInfo.getAudioSdkType());
if (getMvpView() != null) {
getMvpView().enterRoomSuccess();
}

View File

@@ -5,6 +5,7 @@ import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACK
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ME;
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_FANS_TEAM_JOIN;
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_GIFT_COMPOUND;
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_WISH_LIST;
import static com.mango.core.redpackage.RedPackageTypeKt.ALL_DIAMOND;
import static com.mango.core.redpackage.RedPackageTypeKt.ALL_GIFT;
import static com.mango.core.redpackage.RedPackageTypeKt.ROOM_DIAMOND;
@@ -40,6 +41,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import com.mango.core.im.custom.bean.WishListAttachment;
import com.mango.core.room.wishlist.WishListModel;
import com.netease.nim.uikit.business.uinfo.UserInfoHelper;
import com.netease.nim.uikit.common.ui.span.RadiusBackgroundSpan;
import com.netease.nim.uikit.common.util.log.LogUtil;
@@ -972,6 +975,10 @@ public class MessageView extends FrameLayout {
setLuckyGiftServerNotifyMsg(chatRoomMessage, tvContent);
} else if (first == CUSTOM_MSG_GIFT_COMPOUND) {
setGiftCompoundMsg(chatRoomMessage, tvContent);
} else if (first == CUSTOM_MSG_WISH_LIST) {
if (second == CustomAttachment.CUSTOM_MSG_WISH_LIST_FINISH) {
setWishListComplete(chatRoomMessage, tvContent);
}
} else {
tvContent.setTextColor(Color.WHITE);
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
@@ -1385,12 +1392,29 @@ public class MessageView extends FrameLayout {
tvContent.setBackground(null);
tvContent.setTextColor(Color.WHITE);
tvContent.setPadding(0, 0, 0, 0);
RoomFollowOwnerAttachment2 roomFollowOwnerAttachment = (RoomFollowOwnerAttachment2) chatRoomMessage.getAttachment();
SpannableBuilder append = new SpannableBuilder(tvContent)
.append(mContext.getResources().getDrawable(R.drawable.bg_follow), ScreenUtil.dip2px(228), ScreenUtil.dip2px(34));
tvContent.setText(append.build());
}
/**
* 心愿单完成消息
*
* @param chatRoomMessage
* @param tvContent
*/
private void setWishListComplete(ChatRoomMessage chatRoomMessage, TextView tvContent) {
if (!(chatRoomMessage.getAttachment() instanceof WishListAttachment)) {
return;
}
tvContent.setBackground(null);
tvContent.setTextColor(Color.WHITE);
tvContent.setPadding(0, 0, 0, 0);
SpannableBuilder append = new SpannableBuilder(tvContent)
.append(mContext.getResources().getDrawable(R.drawable.bg_wish_complete_msg), ScreenUtil.dip2px(171), ScreenUtil.dip2px(35));
tvContent.setText(append.build());
}
private void invitePK(RoomPkAttachment attachment, TextView tvContent) {
Map<String, RoomPKInvitedUpMicMember> micMemberMap = attachment.getRoomPKInvitedUpMicMemberMap();
@@ -2839,6 +2863,10 @@ public class MessageView extends FrameLayout {
if (attachment instanceof TarotAttachment) {
account = ((TarotAttachment) attachment).getTarotMsgBean().getUid() + "";
}
} else if (attachment.getFirst() == CustomAttachment.CUSTOM_MSG_WISH_LIST) {
if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_WISH_LIST_FINISH) {
WishListModel.INSTANCE.sendWishListCelebrate().subscribe();
}
}
}
if (TextUtils.isEmpty(account)) return;

View File

@@ -19,6 +19,9 @@ import android.view.animation.AnimationUtils
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import androidx.core.view.isVisible
import androidx.core.view.marginTop
import androidx.core.view.updateLayoutParams
import com.coorchice.library.SuperTextView
import com.netease.nim.uikit.common.util.sys.ScreenUtil
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
@@ -197,6 +200,22 @@ class RoomEffectView @JvmOverloads constructor(
false
)
}
RoomEvent.WISH_LIST_EFFECT -> {
if (!binding.svgaWishList.isAnimating) {
binding.svgaWishList.isVisible = true
binding.svgaWishList.updateLayoutParams<LayoutParams> {
leftMargin =
(Math.random() * (ScreenUtil.screenWidth - ScreenUtil.dip2px(
100f
))).toInt()
topMargin =
(Math.random() * ScreenUtil.dip2px(200f) + ScreenUtil.dip2px(
200f
)).toInt()
}
binding.svgaWishList.startAnimation()
}
}
else -> {}
}
}

View File

@@ -78,7 +78,7 @@ class WishListPanelDialog : BaseDialog<DialogWishListPanelBinding>() {
if (it.isSuccess && !it.data.isNullOrEmpty()) {
it.data?.let { gifts ->
binding.tvTitle.text =
"今日心愿礼物(${gifts.filter { info -> info.actualNum == info.targetNum }.size}/${gifts.size})"
"今日心愿礼物(${gifts.filter { info -> info.actualNum >= info.targetNum }.size}/${gifts.size})"
}
} else {
binding.tvTitle.text = "今日心愿礼物"

View File

@@ -11,6 +11,7 @@ import com.mango.core.room.wishlist.WishItemInfo
import com.mango.moshen.R
import com.mango.moshen.ui.utils.load
import com.mango.moshen.utils.SpannableBuilder
import kotlin.math.min
class WishListPanelGiftAdapter :
@@ -27,12 +28,17 @@ class WishListPanelGiftAdapter :
progressBar.max = item.targetNum
progressBar.progress = item.actualNum
val isComplete = item.actualNum == item.targetNum
val isComplete = item.actualNum >= item.targetNum
helper.setGone(R.id.iv_complete, isComplete)
helper.getView<TextView>(R.id.tv_progress).text =
SpannableBuilder()
.append(
"${item.actualNum}",
"${
min(
item.actualNum,
item.targetNum
)
}${if (item.actualNum > item.targetNum) "+" else ""}",
ForegroundColorSpan((if (isComplete) "#E991B8" else "#FFA0C3").toColorInt())
)
.append(

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -38,6 +38,17 @@
android:visibility="gone"
app:autoPlay="true" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga_wish_list"
android:layout_width="105dp"
android:layout_height="92dp"
android:visibility="gone"
app:autoPlay="false"
app:fillMode="Clear"
app:loopCount="1"
app:clearsAfterDetached="true"
app:source="svga/wish_list.svga" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_notify"
android:layout_width="match_parent"

View File

@@ -5,6 +5,7 @@ import com.mango.core.bean.response.ServiceResult
import com.mango.core.gift.bean.SimpleUserInfo
import com.mango.core.manager.AvRoomDataManager
import com.mango.core.utils.net.handleBeanData
import com.mango.core.utils.net.handleStringData
import com.mango.core.utils.net.io2main
import com.mango.core.utils.net.launchRequest
import com.mango.xchat_android_library.net.rxnet.RxNet
@@ -74,6 +75,11 @@ object WishListModel : BaseModel() {
)
}
fun sendWishListCelebrate(): Single<String> =
api.sendWishListCelebrate(AvRoomDataManager.get().roomUid.toString())
.io2main()
.handleStringData()
private interface Api {
@@ -155,6 +161,14 @@ object WishListModel : BaseModel() {
@GET("/wishGift/listWishGiftHistory")
suspend fun getWisHistoryList(@Query("roomUid") roomUid: String): ServiceResult<List<WishHistoryInfo>>
/**
* 获取房间心愿礼物列表
*
* @return
*/
@GET("/wishGift/sendCelebrate")
fun sendWishListCelebrate(@Query("roomUid") roomUid: String): Single<ServiceResult<String>>
}
}