贵族特权:贵族小喇叭
This commit is contained in:
@@ -26,6 +26,7 @@ import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.ui.widget.marqueeview.Utils;
|
||||
import com.yizhuan.erban.ui.widget.recyclerview.decoration.ColorDecoration;
|
||||
import com.yizhuan.erban.ui.widget.recyclerview.layoutmanager.FullyGridLayoutManager;
|
||||
import com.yizhuan.erban.vip.VipBroadcastDialog;
|
||||
import com.yizhuan.tutu.room_chat.activity.RoomInviteFansActivity;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
@@ -114,6 +115,7 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
addInviteFansOptAdapter();
|
||||
addSuperAdminAction(optAdapter);
|
||||
addSendBroadcastAction(optAdapter);
|
||||
addVipSendBroadcastAction(optAdapter);
|
||||
rvOPtList.setAdapter(optAdapter);
|
||||
}
|
||||
|
||||
@@ -529,6 +531,20 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 超管管理
|
||||
*/
|
||||
private void addVipSendBroadcastAction(OptAdapter optAdapter) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
optAdapter.addData(new OptAction(R.drawable.icon_room_vip_send_broadcast,
|
||||
"房间小喇叭",
|
||||
() -> VipBroadcastDialog.newInstance().show(context)
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
|
@@ -0,0 +1,94 @@
|
||||
package com.yizhuan.erban.vip
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.yizhuan.erban.base.BaseActivity
|
||||
import com.yizhuan.erban.base.BaseDialog
|
||||
import com.yizhuan.erban.databinding.DialogVipBroadcastBinding
|
||||
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class VipBroadcastDialog : BaseDialog<DialogVipBroadcastBinding>() {
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(): VipBroadcastDialog {
|
||||
val args = Bundle()
|
||||
val fragment = VipBroadcastDialog()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private val viewModel: VipViewModel by viewModels()
|
||||
private var disposable: Disposable? = null
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun init() {
|
||||
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
|
||||
binding.ivSend.setOnClickListener {
|
||||
if (binding.editContent.text.isNullOrBlank()) {
|
||||
"请输入喇叭内容".toast()
|
||||
} else {
|
||||
viewModel.sendVipBroadcast(binding.editContent.text.toString())
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.sendBroadcastLiveData.observe(viewLifecycleOwner) {
|
||||
if (it == true) {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
}
|
||||
|
||||
if (activity != null && activity is BaseActivity) {
|
||||
val manager = (activity as BaseActivity).dialogManager
|
||||
viewModel.loadingLiveData.observe(viewLifecycleOwner) {
|
||||
if (it == true) {
|
||||
manager.showProgressDialog(activity)
|
||||
} else {
|
||||
manager.dismissDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.getVipBroadcastInfo()
|
||||
viewModel.vipBroadcastInfoLiveData.observe(viewLifecycleOwner) { beanResult ->
|
||||
if (beanResult.isSuccess) {
|
||||
beanResult.data?.let {
|
||||
binding.clRoot.isVisible = true
|
||||
binding.tvSendLimit.text = "剩余次数${it.remainCount}/${it.totalCount}"
|
||||
disposable?.dispose()
|
||||
disposable = Observable.interval(0, 1, TimeUnit.SECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { _ ->
|
||||
val remainTime =
|
||||
(CurrentTimeUtils.getCurrentTime() - it.lastSendTime) / 1000
|
||||
if (remainTime > 60) {
|
||||
binding.tvSendTip.text = "发布后,1分钟内不可使用小喇叭~"
|
||||
binding.ivSend.isEnabled = true
|
||||
disposable?.dispose()
|
||||
} else {
|
||||
binding.ivSend.isEnabled = false
|
||||
binding.tvSendTip.text = "${60 - remainTime}后可再次使用喇叭喊话~"
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (beanResult.code == 8710) {
|
||||
(requireActivity() as BaseActivity).dialogManager.showOkDialog(beanResult.message)
|
||||
} else {
|
||||
beanResult.message.toast()
|
||||
}
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
75
app/src/main/java/com/yizhuan/erban/vip/VipBroadcastView.kt
Normal file
75
app/src/main/java/com/yizhuan/erban/vip/VipBroadcastView.kt
Normal file
@@ -0,0 +1,75 @@
|
||||
package com.yizhuan.erban.vip
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.Observer
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
||||
import com.yizhuan.erban.databinding.LayoutVipBroadcastViewBinding
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.VipMessageAttachment
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
import com.yizhuan.xchat_android_core.room.anotherroompk.ShowUserInfoDialogEvent
|
||||
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
|
||||
import com.yizhuan.xchat_android_library.rxbus.RxBus
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class VipBroadcastView @JvmOverloads constructor(
|
||||
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
) : FrameLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
private val binding = LayoutVipBroadcastViewBinding.inflate(LayoutInflater.from(context))
|
||||
private val observer = Observer<ChatRoomMessage> { addMessage(it) }
|
||||
private val messages: MutableList<ChatRoomMessage> by lazy { ArrayList() }
|
||||
private var disposable: Disposable? = null
|
||||
|
||||
init {
|
||||
addView(binding.root, LayoutParams(ScreenUtil.dip2px(268f), ScreenUtil.dip2px(32f)))
|
||||
binding.llRoot.setOnClickListener {
|
||||
RxBus.get().post(ShowUserInfoDialogEvent(binding.llRoot.tag as String))
|
||||
}
|
||||
AvRoomDataManager.get().vipBroadcastLiveData.observeForever(observer)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
AvRoomDataManager.get().vipBroadcastLiveData.removeObserver(observer)
|
||||
disposable?.dispose()
|
||||
}
|
||||
|
||||
private fun addMessage(chatRoomMessage: ChatRoomMessage) {
|
||||
messages.add(chatRoomMessage)
|
||||
isVisible = true
|
||||
if (disposable == null || messages.size == 1) {
|
||||
disposable = Observable.interval(0, 5, TimeUnit.SECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnDispose { isGone = true }
|
||||
.takeWhile { messages.size > 0 }
|
||||
.subscribe {
|
||||
showMessage(messages.removeAt(0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun showMessage(chatRoomMessage: ChatRoomMessage?) {
|
||||
val attachment = chatRoomMessage?.attachment as? VipMessageAttachment ?: return
|
||||
attachment.vipMessageInfo?.let {
|
||||
ImageLoadUtils.loadAvatar(it.avatar, binding.ivAvatar)
|
||||
ImageLoadUtils.loadImage(context, it.vipIcon, binding.ivVipIcon)
|
||||
binding.tvNick.text = it.nick.subAndReplaceDot(7) + ":"
|
||||
binding.tvContent.text = it.content
|
||||
binding.llRoot.tag = it.uid.toString()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -3,9 +3,12 @@ package com.yizhuan.erban.vip
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.yizhuan.erban.base.BaseViewModel
|
||||
import com.yizhuan.xchat_android_core.bean.response.BeanResult
|
||||
import com.yizhuan.xchat_android_core.user.UserModel
|
||||
import com.yizhuan.xchat_android_core.utils.net.ServerException
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
import com.yizhuan.xchat_android_core.vip.VipAuthInfo
|
||||
import com.yizhuan.xchat_android_core.vip.VipBroadcastInfo
|
||||
import com.yizhuan.xchat_android_core.vip.VipInfo
|
||||
import com.yizhuan.xchat_android_core.vip.VipModel
|
||||
|
||||
@@ -33,6 +36,12 @@ class VipViewModel : BaseViewModel() {
|
||||
private val _saveOriginDisguiseResult = MutableLiveData<Boolean>()
|
||||
val saveOriginDisguiseResult = _saveOriginDisguiseResult
|
||||
|
||||
private val _sendBroadcastLiveData = MutableLiveData<Boolean>()
|
||||
val sendBroadcastLiveData: LiveData<Boolean> = _sendBroadcastLiveData
|
||||
|
||||
private val _vipBroadcastInfoLiveData = MutableLiveData<BeanResult<VipBroadcastInfo>>()
|
||||
val vipBroadcastInfoLiveData: LiveData<BeanResult<VipBroadcastInfo>> = _vipBroadcastInfoLiveData
|
||||
|
||||
fun getVipPageInfo() {
|
||||
_loadingLiveData.value = true
|
||||
safeLaunch(
|
||||
@@ -93,6 +102,36 @@ class VipViewModel : BaseViewModel() {
|
||||
)
|
||||
}
|
||||
|
||||
fun getVipBroadcastInfo() {
|
||||
_loadingLiveData.value = true
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_loadingLiveData.value = false
|
||||
_vipBroadcastInfoLiveData.value = BeanResult.failed(it)
|
||||
},
|
||||
block = {
|
||||
_loadingLiveData.value = false
|
||||
_vipBroadcastInfoLiveData.value = BeanResult.success(VipModel.getVipBroadcastInfo())
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun sendVipBroadcast(content: String) {
|
||||
_loadingLiveData.value = true
|
||||
safeLaunch(
|
||||
onError = {
|
||||
it.message.toast()
|
||||
_loadingLiveData.value = false
|
||||
_sendBroadcastLiveData.value = false
|
||||
},
|
||||
block = {
|
||||
VipModel.sendVipBroadcast(content)
|
||||
_loadingLiveData.value = false
|
||||
_sendBroadcastLiveData.value = true
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun onItemSelect(position: Int) {
|
||||
_currVipInfoLiveData.value = vipInfosLiveData.value?.getOrNull(position)
|
||||
_pageLiveData.value = position
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/bg_vip_broadcast_content.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_vip_broadcast_content.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-xhdpi/bg_vip_broadcast_message.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_vip_broadcast_message.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_vip_broadcast_send.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_vip_broadcast_send.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
app/src/main/res/drawable-xhdpi/icon_room_vip_send_broadcast.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/icon_room_vip_send_broadcast.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
113
app/src/main/res/layout/dialog_vip_broadcast.xml
Normal file
113
app/src/main/res/layout/dialog_vip_broadcast.xml
Normal file
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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="wrap_content"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_root"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="286dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/bg_vip_dialog"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="房间小喇叭"
|
||||
android:textColor="#ffffe3af"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_send_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="25dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="消息内容"
|
||||
android:textColor="#ffffe3af"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_send_limit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="剩余次数100/100)"
|
||||
android:textColor="#ffbc9e66"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBaseline_toBaselineOf="@id/tv_send_text"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_send_text"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_send_text" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="252dp"
|
||||
android:layout_height="82dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/bg_vip_broadcast_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_send_text">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:gravity="start"
|
||||
android:hint="输入内容最多20个字哦~"
|
||||
android:maxLength="20"
|
||||
android:padding="10dp"
|
||||
android:textColor="#FFFFE3AF"
|
||||
android:textColorHint="#FF8B7245"
|
||||
android:textSize="12sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginEnd="14dp"
|
||||
android:src="@drawable/ic_vip_dialog_close"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_send"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:src="@drawable/ic_vip_broadcast_send"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_send_tip"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_send_tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text="发布后,1分钟内不可使用小喇叭~"
|
||||
android:textColor="#ffbc9e66"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
59
app/src/main/res/layout/layout_vip_broadcast_view.xml
Normal file
59
app/src/main/res/layout/layout_vip_broadcast_view.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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="268dp"
|
||||
android:layout_height="32dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_root"
|
||||
android:layout_width="268dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/bg_vip_broadcast_message"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:cborder_color="@color/white"
|
||||
app:cborder_width="1px" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_vip_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginStart="4dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2dp"
|
||||
android:textColor="#ffffe3af"
|
||||
android:textSize="12sp"
|
||||
tools:text="用户昵称用户:" />
|
||||
|
||||
<com.yizhuan.erban.avroom.widget.FixRoomTitleTextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:layout_weight="1"
|
||||
android:drawablePadding="5dp"
|
||||
android:ellipsize="marquee"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:gravity="center_vertical"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
tools:text="和你一起分享" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
@@ -160,12 +160,21 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/fl_speedy_message"
|
||||
android:layout_below="@id/micro_view"
|
||||
android:layout_below="@id/vip_broadcast_view"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:layout_marginEnd="90dp"
|
||||
android:layout_marginBottom="@dimen/dp_10" />
|
||||
|
||||
<com.yizhuan.erban.vip.VipBroadcastView
|
||||
android:id="@+id/vip_broadcast_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/micro_view"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.coorchice.library.SuperTextView
|
||||
android:id="@+id/tv_dating_next"
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -119,6 +119,14 @@
|
||||
android:layout_marginEnd="90dp"
|
||||
android:layout_marginBottom="@dimen/dp_10" />
|
||||
|
||||
<com.yizhuan.erban.vip.VipBroadcastView
|
||||
android:id="@+id/vip_broadcast_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/message_view"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.yizhuan.erban.ui.widget.rollviewpager.RollPagerView
|
||||
android:id="@+id/activity_img"
|
||||
|
@@ -53,8 +53,8 @@
|
||||
android:id="@+id/tv_single_room_gift_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_alignTop="@id/contribute_list"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_toEndOf="@id/contribute_list"
|
||||
android:background="@drawable/shape_bg_of_mic_charm_single_anchor"
|
||||
android:drawableEnd="@drawable/icon_gift_value"
|
||||
@@ -131,12 +131,21 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/fl_speedy_message"
|
||||
android:layout_below="@id/micro_view"
|
||||
android:layout_below="@id/message_view"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginEnd="90dp"
|
||||
android:layout_marginBottom="@dimen/dp_10" />
|
||||
|
||||
<com.yizhuan.erban.vip.VipBroadcastView
|
||||
android:id="@+id/vip_broadcast_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/micro_view"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.yizhuan.erban.ui.widget.rollviewpager.RollPagerView
|
||||
android:id="@+id/activity_img"
|
||||
android:layout_width="65dp"
|
||||
|
@@ -285,6 +285,7 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_GIFT;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_NOTICE;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_ROOM_BROADCAST;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_ROOM_OPEN;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_ROOM_UPGRADE;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_ROOM_ALL_UPGRADE;
|
||||
@@ -1338,12 +1339,13 @@ public final class IMNetEaseManager {
|
||||
second == CUSTOM_MSG_VIP_ROOM_ALL_UPGRADE ||
|
||||
second == CUSTOM_MSG_VIP_ROOM_OPEN) {
|
||||
addMessages(msg);
|
||||
}else if (second == CUSTOM_MSG_VIP_ROOM_BROADCAST){
|
||||
AvRoomDataManager.get().vipBroadcastLiveData.postValue(msg);
|
||||
}
|
||||
break;
|
||||
case ANCHOR_ROOM_AUDIENCE_UPMIC:
|
||||
if(AvRoomDataManager.get().isRoomOwner()) {
|
||||
msg.setAttachment(attachment);
|
||||
noticeRoomEvent(msg, RoomEvent.REQUEST_UP_MIC);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@@ -0,0 +1,33 @@
|
||||
package com.yizhuan.xchat_android_core.bean.response
|
||||
|
||||
import com.yizhuan.xchat_android_core.utils.net.ServerException
|
||||
|
||||
data class BeanResult<T>(
|
||||
val isSuccess: Boolean,
|
||||
val code: Int = 0,
|
||||
val message: String? = null,
|
||||
val data: T? = null
|
||||
) {
|
||||
companion object {
|
||||
|
||||
fun <T> success(data: T?): BeanResult<T> {
|
||||
return BeanResult(true, 0, "", data)
|
||||
}
|
||||
|
||||
fun <T> failed(code: Int, message: String?): BeanResult<T> {
|
||||
return BeanResult(false, code, message, null)
|
||||
}
|
||||
|
||||
fun <T> failed(throwable: Throwable): BeanResult<T> {
|
||||
return if (throwable is ServerException) {
|
||||
failed(throwable.code, throwable.message)
|
||||
} else {
|
||||
failed(-1, "网络异常,请检查你的网络再试!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -417,6 +417,7 @@ public class CustomAttachment implements MsgAttachment {
|
||||
public static final int CUSTOM_MSG_VIP_ROOM_OPEN = 851; // 开通贵族房内消息
|
||||
public static final int CUSTOM_MSG_VIP_ROOM_UPGRADE = 853; // 贵族升级房内消息
|
||||
public static final int CUSTOM_MSG_VIP_ROOM_ALL_UPGRADE = 856; // 贵族升级全服房间公屏通知消息
|
||||
public static final int CUSTOM_MSG_VIP_ROOM_BROADCAST = 857; // 贵族小喇叭消息
|
||||
|
||||
public static final int CUSTOM_MSG_VIP_SELF_OPEN = 852; // 开通贵族成功系统消息
|
||||
public static final int CUSTOM_MSG_VIP_SELF_UPGRADE = 854; // 贵族升级系统消息
|
||||
|
@@ -82,6 +82,8 @@ public final class AvRoomDataManager {
|
||||
@NonNull
|
||||
public final List<ChatRoomMember> roomSuperAdminList = new ArrayList<>();
|
||||
public final MutableLiveData<RoomPkBean> roomPkLiveData = new MutableLiveData<>();
|
||||
@NonNull
|
||||
public final MutableLiveData<ChatRoomMessage> vipBroadcastLiveData = new MutableLiveData<>();
|
||||
@Nullable
|
||||
public RoomInfo mCurrentRoomInfo;
|
||||
public BoxSwitchVo mBoxSwitchVo;
|
||||
|
@@ -0,0 +1,9 @@
|
||||
package com.yizhuan.xchat_android_core.vip
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
data class VipBroadcastInfo(
|
||||
val lastSendTime: Long = 0L,
|
||||
val remainCount: Int = 0,
|
||||
val totalCount: Int = 0,
|
||||
) : Serializable
|
@@ -12,4 +12,6 @@ public class VipMessageInfo {
|
||||
private String preVipName;
|
||||
private long roomUid;
|
||||
private String floatPic;
|
||||
private String content;
|
||||
private String vipIcon;
|
||||
}
|
@@ -2,9 +2,11 @@ package com.yizhuan.xchat_android_core.vip
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
import com.yizhuan.xchat_android_core.utils.net.launchRequest
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Query
|
||||
|
||||
object VipModel : BaseModel() {
|
||||
|
||||
@@ -15,11 +17,21 @@ object VipModel : BaseModel() {
|
||||
api.getVipPageInfo()
|
||||
}
|
||||
|
||||
suspend fun saveOriginDisguise():Any? =
|
||||
suspend fun saveOriginDisguise(): Any? =
|
||||
launchRequest {
|
||||
api.saveOriginDisguise()
|
||||
}
|
||||
|
||||
suspend fun getVipBroadcastInfo(): VipBroadcastInfo? =
|
||||
launchRequest {
|
||||
api.getVipBroadcastInfo(AvRoomDataManager.get().roomUid)
|
||||
}
|
||||
|
||||
suspend fun sendVipBroadcast(content: String): String? =
|
||||
launchRequest {
|
||||
api.sendVipBroadcast(content, AvRoomDataManager.get().roomUid)
|
||||
}
|
||||
|
||||
|
||||
private interface Api {
|
||||
|
||||
@@ -38,6 +50,26 @@ object VipModel : BaseModel() {
|
||||
|
||||
@GET("/vip/recoveryDress")
|
||||
suspend fun saveOriginDisguise(): ServiceResult<Any>
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户贵族房间小喇叭信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/vip/getUserVipRoomHorn")
|
||||
suspend fun getVipBroadcastInfo(@Query("roomUid") roomUid: Long): ServiceResult<VipBroadcastInfo>
|
||||
|
||||
/**
|
||||
* 发送贵族房内小喇叭
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/vip/sendRoomHorn")
|
||||
suspend fun sendVipBroadcast(
|
||||
@Query("content") content: String,
|
||||
@Query("roomUid") roomUid: Long
|
||||
): ServiceResult<String>
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user