feat:完成礼物飘窗跳转提示
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
package com.yizhuan.erban.ui.widget.dialog
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.Window
|
||||
import android.view.WindowManager
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import com.chuhai.utils.ktx.singleClick
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||
import com.yizhuan.erban.databinding.AllServiceGiftGoRoomTipsDialogBinding
|
||||
import com.yizhuan.erban.public_chat_hall.activity.PublicChatHallHomeActivity
|
||||
import com.yizhuan.xchat_android_core.initial.InitialModel
|
||||
import com.yizhuan.xchat_android_library.common.util.SPUtils
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil
|
||||
|
||||
/**
|
||||
* Created by Max on 2023/10/30 10:29
|
||||
* Desc:跳转房间提示
|
||||
**/
|
||||
class AllServiceGiftGoRoomTipsDialog(
|
||||
context: Context,
|
||||
private val roomName: String,
|
||||
private val roomId: Long
|
||||
) :
|
||||
BaseDialog(context, R.style.dialog) {
|
||||
|
||||
private var binding: AllServiceGiftGoRoomTipsDialogBinding? = null
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* 是否需要提示前往房间
|
||||
*/
|
||||
fun isNeedTips(): Boolean {
|
||||
return !SPUtils.getBoolean("all_service_gift_go_room_no_tips", false)
|
||||
}
|
||||
|
||||
/**
|
||||
* 忽略提示/不在提示
|
||||
*/
|
||||
private fun ignoreTips() {
|
||||
SPUtils.putBoolean("all_service_gift_go_room_no_tips", true)
|
||||
}
|
||||
}
|
||||
|
||||
private var isCheck: Boolean = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
val inflate =
|
||||
LayoutInflater.from(context)
|
||||
.inflate(R.layout.all_service_gift_go_room_tips_dialog, null)
|
||||
setContentView(inflate.rootView)
|
||||
binding = DataBindingUtil.bind(inflate)
|
||||
|
||||
binding?.tvRoomName?.text = roomName
|
||||
binding?.ivCheckbox?.setOnClickListener {
|
||||
updateCheckbox(!isCheck)
|
||||
}
|
||||
binding?.tvTips?.setOnClickListener {
|
||||
updateCheckbox(!isCheck)
|
||||
}
|
||||
binding?.tvGo?.singleClick {
|
||||
if (isCheck) {
|
||||
ignoreTips()
|
||||
}
|
||||
if (roomId == JavaUtil.str2long(InitialModel.get().publicChatHallUid)) {
|
||||
PublicChatHallHomeActivity.openPublicChatHallPage(context)
|
||||
} else {
|
||||
AVRoomActivity.start(context, roomId)
|
||||
}
|
||||
dismiss()
|
||||
}
|
||||
binding?.tvCancel?.singleClick {
|
||||
dismiss()
|
||||
}
|
||||
updateCheckbox(false)
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
this.window?.attributes?.let {
|
||||
it.width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
it.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
it.gravity = Gravity.CENTER
|
||||
window?.attributes = it
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateCheckbox(isCheck: Boolean) {
|
||||
this.isCheck = isCheck
|
||||
if (isCheck) {
|
||||
binding?.ivCheckbox?.setImageResource(R.drawable.base_ic_checkbox_selected)
|
||||
} else {
|
||||
binding?.ivCheckbox?.setImageResource(R.drawable.base_ic_checkbox_unselected)
|
||||
}
|
||||
}
|
||||
}
|
@@ -10,12 +10,13 @@ import android.view.ViewConfiguration
|
||||
import android.view.Window
|
||||
import android.view.WindowManager
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import com.chuhai.utils.ktx.singleClick
|
||||
import com.chuhai.utils.ktx.toStringRes
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||
import com.yizhuan.erban.databinding.DialogGiftAllServiceLevelBinding
|
||||
import com.yizhuan.erban.databinding.DialogGiftAllServiceLevel2Binding
|
||||
import com.yizhuan.erban.public_chat_hall.activity.PublicChatHallHomeActivity
|
||||
import com.yizhuan.xchat_android_core.initial.InitialModel
|
||||
import com.yizhuan.xchat_android_core.noble.AllServiceGiftProtocol
|
||||
@@ -31,7 +32,7 @@ import java.util.concurrent.TimeUnit
|
||||
class AllServiceGiftLevelDialog : BaseDialog {
|
||||
|
||||
private var data: AllServiceGiftProtocol.DataBean? = null
|
||||
private var binding: DialogGiftAllServiceLevelBinding? = null
|
||||
private var binding: DialogGiftAllServiceLevel2Binding? = null
|
||||
|
||||
private var disposable: Disposable? = null
|
||||
|
||||
@@ -49,7 +50,7 @@ class AllServiceGiftLevelDialog : BaseDialog {
|
||||
super.onCreate(savedInstanceState)
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
val inflate =
|
||||
LayoutInflater.from(context).inflate(R.layout.dialog_gift_all_service_level, null)
|
||||
LayoutInflater.from(context).inflate(R.layout.dialog_gift_all_service_level2, null)
|
||||
setContentView(inflate.rootView)
|
||||
setCancelable(true)
|
||||
setCanceledOnTouchOutside(true)
|
||||
@@ -82,16 +83,20 @@ class AllServiceGiftLevelDialog : BaseDialog {
|
||||
|
||||
private fun init(
|
||||
data: AllServiceGiftProtocol.DataBean,
|
||||
binding: DialogGiftAllServiceLevelBinding
|
||||
binding: DialogGiftAllServiceLevel2Binding
|
||||
) {
|
||||
binding.ivAvatar.singleClick {
|
||||
goRoom(data)
|
||||
}
|
||||
binding.tvRoomGo.singleClick {
|
||||
if (data.roomUid == JavaUtil.str2long(InitialModel.get().publicChatHallUid)) {
|
||||
PublicChatHallHomeActivity.openPublicChatHallPage(context)
|
||||
} else {
|
||||
AVRoomActivity.start(context, data.roomUid)
|
||||
}
|
||||
goRoom(data)
|
||||
}
|
||||
binding.giftBean = data
|
||||
if ((data.giftNum) <= 1) {
|
||||
binding.tvCount.text = ""
|
||||
} else {
|
||||
binding.tvCount.text = "X${data.giftNum}"
|
||||
}
|
||||
binding.tvMessage.text =
|
||||
"${data.sendUserNick}${R.string.layout_dialog_in_app_sharing_confirm_01.toStringRes()}${data.recvUserNick} ${data.giftName}"
|
||||
when (data.levelNum.toIntOrNull()) {
|
||||
@@ -116,6 +121,7 @@ class AllServiceGiftLevelDialog : BaseDialog {
|
||||
setupTextMarquee(binding.tvMessage)
|
||||
disposable = Observable.timer(data.notifyStaySecond.toLong(), TimeUnit.SECONDS)
|
||||
.subscribe { dismiss() }
|
||||
binding.groupRoom.isVisible = data.roomUid != 0L
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,6 +147,20 @@ class AllServiceGiftLevelDialog : BaseDialog {
|
||||
}
|
||||
}
|
||||
|
||||
private fun goRoom(
|
||||
data: AllServiceGiftProtocol.DataBean
|
||||
) {
|
||||
if (AllServiceGiftGoRoomTipsDialog.isNeedTips()) {
|
||||
AllServiceGiftGoRoomTipsDialog(context, data.roomTitle, data.roomUid).show()
|
||||
} else {
|
||||
if (data.roomUid == JavaUtil.str2long(InitialModel.get().publicChatHallUid)) {
|
||||
PublicChatHallHomeActivity.openPublicChatHallPage(context)
|
||||
} else {
|
||||
AVRoomActivity.start(context, data.roomUid)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun dismiss() {
|
||||
super.dismiss()
|
||||
if (disposable?.isDisposed != true) {
|
||||
|
18
app/src/main/res/drawable/base_ic_checkbox_selected.xml
Normal file
18
app/src/main/res/drawable/base_ic_checkbox_selected.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="14dp"
|
||||
android:height="14dp"
|
||||
android:viewportWidth="14"
|
||||
android:viewportHeight="14">
|
||||
<path
|
||||
android:pathData="M7,7m-7,0a7,7 0,1 1,14 0a7,7 0,1 1,-14 0"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#141414"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M3.576,6.612C3.792,6.373 4.161,6.353 4.4,6.569L6.381,8.353L9.867,4.483C10.098,4.226 10.493,4.205 10.75,4.436C11.006,4.667 11.027,5.062 10.796,5.319L6.948,9.592L6.937,9.604C6.932,9.61 6.926,9.617 6.92,9.623C6.705,9.862 6.336,9.882 6.097,9.666L3.619,7.436C3.38,7.22 3.361,6.851 3.576,6.612Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000"/>
|
||||
</vector>
|
12
app/src/main/res/drawable/base_ic_checkbox_unselected.xml
Normal file
12
app/src/main/res/drawable/base_ic_checkbox_unselected.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="14dp"
|
||||
android:height="14dp"
|
||||
android:viewportWidth="14"
|
||||
android:viewportHeight="14">
|
||||
<path
|
||||
android:pathData="M7,7m-6.5,0a6.5,6.5 0,1 1,13 0a6.5,6.5 0,1 1,-13 0"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#B3B3C3"
|
||||
android:fillType="evenOdd"/>
|
||||
</vector>
|
14
app/src/main/res/drawable/base_theme_btn_21.xml
Normal file
14
app/src/main/res/drawable/base_theme_btn_21.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#FF5AECFA"
|
||||
android:centerColor="#FF9DB4FF"
|
||||
android:startColor="#FFCF70FF"
|
||||
android:type="linear"
|
||||
android:useLevel="true" />
|
||||
<corners android:radius="21dp" />
|
||||
|
||||
</shape>
|
7
app/src/main/res/drawable/shape_e6e6f0_21.xml
Normal file
7
app/src/main/res/drawable/shape_e6e6f0_21.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="21dp"/>
|
||||
<solid android:color="#FFE6E6F0"/>
|
||||
</shape>
|
116
app/src/main/res/layout/all_service_gift_go_room_tips_dialog.xml
Normal file
116
app/src/main/res/layout/all_service_gift_go_room_tips_dialog.xml
Normal file
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout>
|
||||
|
||||
<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">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="28dp"
|
||||
android:background="@drawable/shape_white_20dp_round"
|
||||
android:paddingBottom="24dp">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/all_service_gift_room_go_title"
|
||||
android:textColor="@color/color_1F1B4F"
|
||||
android:textSize="18dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_go_tips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/all_service_gift_room_go_tips"
|
||||
android:textColor="@color/color_1F1B4F"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_room_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="@color/color_9168FA"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_go_tips"
|
||||
tools:text="Name" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_checkbox"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_marginTop="13dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/base_ic_checkbox_unselected"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_tips"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_room_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/all_service_gift_room_go_ignore"
|
||||
android:textColor="@color/color_B3B3C3"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_checkbox"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_checkbox"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_checkbox" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginStart="28dp"
|
||||
android:layout_marginTop="19dp"
|
||||
android:layout_marginEnd="7.5dp"
|
||||
android:background="@drawable/shape_e6e6f0_21"
|
||||
android:gravity="center"
|
||||
android:text="@string/all_service_gift_room_go_cancel"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_go"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_checkbox" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_go"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginStart="7.5dp"
|
||||
android:layout_marginEnd="28dp"
|
||||
android:background="@drawable/bg_common_confirm_30"
|
||||
android:gravity="center"
|
||||
android:text="@string/all_service_gift_room_go_go"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_cancel"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_cancel"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_cancel" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
||||
</layout>
|
@@ -115,6 +115,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_count"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_goneMarginEnd="24dp"
|
||||
tools:background="@color/black" />
|
||||
|
||||
<TextView
|
||||
@@ -126,7 +127,6 @@
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:maxWidth="120dp"
|
||||
android:singleLine="true"
|
||||
android:text="@{`X` + giftBean.giftNum}"
|
||||
android:textColor="@color/color_FFE468"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="italic|bold"
|
||||
|
@@ -16,6 +16,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/layout_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/all_service_gift_bg_1"
|
||||
@@ -23,7 +24,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_avatar_frame"
|
||||
android:id="@+id/iv_avatar_bg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_avatar"
|
||||
@@ -58,7 +59,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="13dp"
|
||||
android:layout_marginEnd="4.5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:ellipsize="marquee"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
@@ -79,6 +79,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2.5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="4.5dp"
|
||||
android:includeFontPadding="false"
|
||||
android:singleLine="true"
|
||||
@@ -121,6 +122,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gift"
|
||||
nomalUrl="@{giftBean.giftUrl}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
@@ -153,6 +155,13 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="X10000" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_room"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="tv_room_name,tv_room_go,iv_room"
|
||||
tools:visibility="visible" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
@@ -5143,5 +5143,9 @@
|
||||
<string name="room_album_type_no_need_unlocked_gift_tips">當前無需選擇解鎖禮物</string>
|
||||
<string name="room_album_type_choose_unlocked_gift_tips">選擇解鎖禮物</string>
|
||||
<string name="all_service_gift_room_go">去圍觀</string>
|
||||
|
||||
<string name="all_service_gift_room_go_title">前往圍觀</string>
|
||||
<string name="all_service_gift_room_go_tips">是否離開當前房間前往</string>
|
||||
<string name="all_service_gift_room_go_ignore">下次不再出現此提示</string>
|
||||
<string name="all_service_gift_room_go_cancel">留在這</string>
|
||||
<string name="all_service_gift_room_go_go">立即前往</string>
|
||||
</resources>
|
Reference in New Issue
Block a user