expandSelectView组件
This commit is contained in:
parent
7948a130a8
commit
39095b9762
|
|
@ -197,6 +197,8 @@
|
||||||
"border.divider": "$glo.border.half",
|
"border.divider": "$glo.border.half",
|
||||||
"border.s": "$glo.border.1",
|
"border.s": "$glo.border.1",
|
||||||
"border.m": "$glo.border.2",
|
"border.m": "$glo.border.2",
|
||||||
"border.l": "$glo.border.4"
|
"border.l": "$glo.border.4",
|
||||||
|
|
||||||
|
"color.chat.setting.item.bg": "$glo.color.chat.setting.item.bg"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ package com.remax.visualnovel.ui.chat
|
||||||
import android.graphics.Point
|
import android.graphics.Point
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.core.view.GravityCompat
|
import androidx.core.view.GravityCompat
|
||||||
import androidx.core.view.marginTop
|
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
|
@ -18,14 +17,12 @@ import com.remax.visualnovel.utils.Routers
|
||||||
import com.remax.visualnovel.utils.StatusBarUtils
|
import com.remax.visualnovel.utils.StatusBarUtils
|
||||||
import com.pengxr.modular.eventbus.generated.events.EventDefineOfUserEvents
|
import com.pengxr.modular.eventbus.generated.events.EventDefineOfUserEvents
|
||||||
import com.remax.visualnovel.R
|
import com.remax.visualnovel.R
|
||||||
import com.remax.visualnovel.databinding.ActivityActorChat2Binding
|
|
||||||
import com.remax.visualnovel.databinding.ActivityActorChatBinding
|
import com.remax.visualnovel.databinding.ActivityActorChatBinding
|
||||||
import com.remax.visualnovel.entity.request.ChatSetting
|
import com.remax.visualnovel.entity.request.ChatSetting
|
||||||
import com.remax.visualnovel.event.model.OnLoginEvent
|
import com.remax.visualnovel.event.model.OnLoginEvent
|
||||||
import com.remax.visualnovel.extension.countDownCoroutines
|
import com.remax.visualnovel.extension.countDownCoroutines
|
||||||
import com.remax.visualnovel.extension.launchAndLoadingCollect
|
import com.remax.visualnovel.extension.launchAndLoadingCollect
|
||||||
import com.remax.visualnovel.extension.launchWithRequest
|
import com.remax.visualnovel.extension.launchWithRequest
|
||||||
import com.remax.visualnovel.extension.setMargin
|
|
||||||
import com.remax.visualnovel.extension.toast
|
import com.remax.visualnovel.extension.toast
|
||||||
import com.remax.visualnovel.manager.nim.NimManager
|
import com.remax.visualnovel.manager.nim.NimManager
|
||||||
import com.remax.visualnovel.ui.chat.setting.model.ChatModelDialog
|
import com.remax.visualnovel.ui.chat.setting.model.ChatModelDialog
|
||||||
|
|
@ -39,7 +36,7 @@ import kotlin.getValue
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
@Route(path = Routers.CHAT)
|
@Route(path = Routers.CHAT)
|
||||||
class ChatActivity : BaseBindingActivity<ActivityActorChat2Binding>() {
|
class ChatActivity : BaseBindingActivity<ActivityActorChatBinding>() {
|
||||||
|
|
||||||
private val chatViewModel by viewModels<ChatViewModel>()
|
private val chatViewModel by viewModels<ChatViewModel>()
|
||||||
private val mRecordAssist = RecordAssist()
|
private val mRecordAssist = RecordAssist()
|
||||||
|
|
@ -52,7 +49,7 @@ class ChatActivity : BaseBindingActivity<ActivityActorChat2Binding>() {
|
||||||
|
|
||||||
StatusBarUtils.setStatusBarAndNavBarIsLight(this, false)
|
StatusBarUtils.setStatusBarAndNavBarIsLight(this, false)
|
||||||
StatusBarUtils.setTransparent(this)
|
StatusBarUtils.setTransparent(this)
|
||||||
binding.root.setMargin(topMargin = StatusBarUtils.statusBarHeight)
|
binding.root.setPadding(binding.root.paddingLeft, binding.root.paddingTop + StatusBarUtils.statusBarHeight, binding.root.paddingRight, binding.root.paddingBottom)
|
||||||
binding.toolbar.addRightIcon(R.mipmap.chat_title_setting) {
|
binding.toolbar.addRightIcon(R.mipmap.chat_title_setting) {
|
||||||
binding.drawerMenu.openDrawer(GravityCompat.END)
|
binding.drawerMenu.openDrawer(GravityCompat.END)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,11 @@ class ChatSettingView @JvmOverloads constructor(
|
||||||
defStyleAttr: Int = 0
|
defStyleAttr: Int = 0
|
||||||
) : LinearLayout(context, attrs, defStyleAttr) {
|
) : LinearLayout(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
private lateinit var mBinding: LayoutChatMenuViewBinding
|
private var mBinding = LayoutChatMenuViewBinding.inflate(LayoutInflater.from(context), this, true)
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
mBinding = LayoutChatMenuViewBinding.inflate(LayoutInflater.from(context))
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.base_toolbar_layout, this, true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,216 @@
|
||||||
|
package com.remax.visualnovel.ui.chat.ui.expandableSelector
|
||||||
|
|
||||||
|
import android.animation.Animator
|
||||||
|
import android.animation.AnimatorListenerAdapter
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
|
import android.animation.ValueAnimator
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.GradientDrawable
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.animation.AccelerateDecelerateInterpolator
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.remax.visualnovel.R
|
||||||
|
import com.remax.visualnovel.databinding.LayoutExpandSelectViewBinding
|
||||||
|
|
||||||
|
|
||||||
|
class ExpandSelectView @JvmOverloads constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet? = null,
|
||||||
|
defStyleAttr: Int = 0
|
||||||
|
) : LinearLayout(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
|
private lateinit var mBinding: LayoutExpandSelectViewBinding
|
||||||
|
|
||||||
|
private var isExpanded = false
|
||||||
|
private var animationDuration = 300
|
||||||
|
private var items: List<SelectorItem> = emptyList()
|
||||||
|
private var itemSelectedListener: OnItemSelectedListener? = null
|
||||||
|
|
||||||
|
init {
|
||||||
|
initView(context, attrs)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initView(context: Context, attrs: AttributeSet?) {
|
||||||
|
mBinding = LayoutExpandSelectViewBinding.inflate(LayoutInflater.from(context))
|
||||||
|
setupAttributes(attrs)
|
||||||
|
setupClickListeners()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupAttributes(attrs: AttributeSet?) {
|
||||||
|
attrs?.let {
|
||||||
|
val typedArray = context.obtainStyledAttributes(it, R.styleable.ExpandableSelector)
|
||||||
|
val title = typedArray.getString(R.styleable.ExpandableSelector_titleText)
|
||||||
|
title?.let { mBinding.titleText.text = it }
|
||||||
|
animationDuration = typedArray.getInt(R.styleable.ExpandableSelector_animationDuration, 300)
|
||||||
|
typedArray.recycle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupClickListeners() {
|
||||||
|
mBinding.titleLayout.setOnClickListener { toggle() }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun setTitleIcon(resId: Int) {
|
||||||
|
mBinding.icon.setImageResource(resId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setTitleText(title: String) {
|
||||||
|
mBinding.titleText.text = title
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setPopItems(newItems: List<SelectorItem>) {
|
||||||
|
items = newItems
|
||||||
|
updateItemsView()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun updateItemsView() {
|
||||||
|
mBinding.itemsContainer.removeAllViews()
|
||||||
|
|
||||||
|
items.forEachIndexed { index, item ->
|
||||||
|
val itemView = createItemView(item, index)
|
||||||
|
mBinding.itemsContainer.addView(itemView)
|
||||||
|
|
||||||
|
if (index < items.size - 1) {
|
||||||
|
addDivider()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createItemView(item: SelectorItem, position: Int): View {
|
||||||
|
val itemView = LayoutInflater.from(context)
|
||||||
|
.inflate(R.layout.layout_expand_view_item, mBinding.itemsContainer, false)
|
||||||
|
|
||||||
|
val colorIndicator = itemView.findViewById<View>(R.id.colorIndicator)
|
||||||
|
val itemName = itemView.findViewById<TextView>(R.id.itemName)
|
||||||
|
val itemDesc = itemView.findViewById<TextView>(R.id.itemDesc)
|
||||||
|
val pointsInfo = itemView.findViewById<TextView>(R.id.pointsInfo)
|
||||||
|
val recommendedTag = itemView.findViewById<TextView>(R.id.recommendedTag)
|
||||||
|
val selectedDot = itemView.findViewById<View>(R.id.selectedDot)
|
||||||
|
|
||||||
|
// 设置颜色指示器
|
||||||
|
(colorIndicator.background as? GradientDrawable)?.setColor(item.color)
|
||||||
|
|
||||||
|
itemName.text = item.name
|
||||||
|
itemDesc.text = item.description
|
||||||
|
pointsInfo.text = item.pointsInfo
|
||||||
|
|
||||||
|
// 显示推荐标签
|
||||||
|
recommendedTag.visibility = if (item.isRecommended) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
|
// 显示选中圆点
|
||||||
|
selectedDot.visibility = if (item.isSelected) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
|
// 设置点击事件
|
||||||
|
itemView.setOnClickListener {
|
||||||
|
selectItem(position)
|
||||||
|
itemSelectedListener?.onItemSelected(position, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemView
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addDivider() {
|
||||||
|
val divider = View(context).apply {
|
||||||
|
layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, 1).apply {
|
||||||
|
setBackgroundColor(Color.parseColor("#EEEEEE"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mBinding.itemsContainer.addView(divider)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun selectItem(position: Int) {
|
||||||
|
items.forEachIndexed { index, item ->
|
||||||
|
item.isSelected = index == position
|
||||||
|
}
|
||||||
|
updateItemsView()
|
||||||
|
|
||||||
|
if (position in items.indices) {
|
||||||
|
mBinding.titleText.text = items[position].name
|
||||||
|
}
|
||||||
|
|
||||||
|
collapse()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun toggle() {
|
||||||
|
if (isExpanded) collapse() else expand()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun expand() {
|
||||||
|
if (isExpanded) return
|
||||||
|
|
||||||
|
isExpanded = true
|
||||||
|
mBinding.itemsContainer.visibility = View.VISIBLE
|
||||||
|
animateArrow(0f, 180f)
|
||||||
|
// param height anim
|
||||||
|
val animator = ValueAnimator.ofInt(0, getItemsHeight())
|
||||||
|
animator.duration = animationDuration.toLong()
|
||||||
|
animator.interpolator = AccelerateDecelerateInterpolator()
|
||||||
|
animator.addUpdateListener { animation ->
|
||||||
|
val value = animation.animatedValue as Int
|
||||||
|
val params = mBinding.itemsContainer.layoutParams
|
||||||
|
params.height = value
|
||||||
|
mBinding.itemsContainer.layoutParams = params
|
||||||
|
}
|
||||||
|
animator.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun collapse() {
|
||||||
|
if (!isExpanded) return
|
||||||
|
|
||||||
|
isExpanded = false
|
||||||
|
animateArrow(180f, 0f)
|
||||||
|
// param height anim
|
||||||
|
val animator = ValueAnimator.ofInt(getItemsHeight(), 0)
|
||||||
|
animator.duration = animationDuration.toLong()
|
||||||
|
animator.interpolator = AccelerateDecelerateInterpolator()
|
||||||
|
animator.addUpdateListener { animation ->
|
||||||
|
val value = animation.animatedValue as Int
|
||||||
|
val params = mBinding.itemsContainer.layoutParams
|
||||||
|
params.height = value
|
||||||
|
mBinding.itemsContainer.layoutParams = params
|
||||||
|
}
|
||||||
|
animator.addListener(object : AnimatorListenerAdapter() {
|
||||||
|
override fun onAnimationEnd(animation: Animator) {
|
||||||
|
mBinding.itemsContainer.visibility = View.GONE
|
||||||
|
}
|
||||||
|
})
|
||||||
|
animator.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun animateArrow(from: Float, to: Float) {
|
||||||
|
val rotation = ObjectAnimator.ofFloat(mBinding.arrow, "rotation", from, to)
|
||||||
|
rotation.duration = animationDuration.toLong()
|
||||||
|
rotation.interpolator = AccelerateDecelerateInterpolator()
|
||||||
|
rotation.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getItemsHeight(): Int {
|
||||||
|
var height = 0
|
||||||
|
for (i in 0 until mBinding.itemsContainer.childCount) {
|
||||||
|
val child = mBinding.itemsContainer.getChildAt(i)
|
||||||
|
child.measure(
|
||||||
|
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
||||||
|
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)
|
||||||
|
)
|
||||||
|
height += child.measuredHeight
|
||||||
|
}
|
||||||
|
return height
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnItemSelectedListener(listener: OnItemSelectedListener) {
|
||||||
|
this.itemSelectedListener = listener
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OnItemSelectedListener {
|
||||||
|
fun onItemSelected(position: Int, item: SelectorItem)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.remax.visualnovel.ui.chat.ui.expandableSelector
|
||||||
|
|
||||||
|
data class SelectorItem(
|
||||||
|
val name: String,
|
||||||
|
val description: String = "",
|
||||||
|
val pointsInfo: String = "",
|
||||||
|
val color: Int,
|
||||||
|
val isRecommended: Boolean = false,
|
||||||
|
var isSelected: Boolean = false
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
package com.remax.visualnovel.utils
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.os.Build
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.WindowManager
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
import androidx.annotation.ColorInt
|
||||||
|
import androidx.core.graphics.ColorUtils
|
||||||
|
|
||||||
|
|
||||||
|
object StatusBarUtil2 {
|
||||||
|
|
||||||
|
// 初始化沉浸式状态栏
|
||||||
|
fun initImmersive(activity: Activity, lightStatusBar: Boolean = false) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
activity.window.apply {
|
||||||
|
clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||||
|
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||||
|
statusBarColor = Color.TRANSPARENT
|
||||||
|
decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
|
}
|
||||||
|
setLightStatusBar(activity, lightStatusBar)
|
||||||
|
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
|
activity.window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置状态栏图标颜色
|
||||||
|
fun setLightStatusBar(activity: Activity, light: Boolean) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
val decorView = activity.window.decorView
|
||||||
|
var flags = decorView.systemUiVisibility
|
||||||
|
flags = if (light) {
|
||||||
|
flags or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||||
|
} else {
|
||||||
|
flags and View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv()
|
||||||
|
}
|
||||||
|
decorView.systemUiVisibility = flags
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取状态栏高度
|
||||||
|
fun getStatusBarHeight(context: Context): Int {
|
||||||
|
var result = 0
|
||||||
|
val resourceId = context.resources.getIdentifier("status_bar_height", "dimen", "android")
|
||||||
|
if (resourceId > 0) {
|
||||||
|
result = context.resources.getDimensionPixelSize(resourceId)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
// 适配带状态栏高度的padding
|
||||||
|
fun View.addStatusBarPadding() {
|
||||||
|
setPadding(
|
||||||
|
paddingLeft,
|
||||||
|
paddingTop + getStatusBarHeight(context),
|
||||||
|
paddingRight,
|
||||||
|
paddingBottom
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置状态栏颜色(带透明度)
|
||||||
|
fun setStatusBarColor(activity: Activity, @ColorInt color: Int, alpha: Int = 0) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
activity.window.statusBarColor = if (alpha > 0) {
|
||||||
|
ColorUtils.setAlphaComponent(color, alpha)
|
||||||
|
} else {
|
||||||
|
color
|
||||||
|
}
|
||||||
|
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
|
activity.window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||||
|
val statusBarView = View(activity).apply {
|
||||||
|
setBackgroundColor(
|
||||||
|
if (alpha > 0) {
|
||||||
|
ColorUtils.setAlphaComponent(color, alpha)
|
||||||
|
} else {
|
||||||
|
color
|
||||||
|
}
|
||||||
|
)
|
||||||
|
layoutParams = FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
getStatusBarHeight(activity)
|
||||||
|
).apply {
|
||||||
|
gravity = Gravity.TOP
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(activity.window.decorView as ViewGroup).addView(statusBarView)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,14 +8,13 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import com.remax.visualnovel.R
|
import com.remax.visualnovel.R
|
||||||
import com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
import com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||||
import com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout
|
import com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout
|
||||||
import com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
import com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||||
|
|
||||||
class BaseToolbar @JvmOverloads constructor(
|
class CommonToolbar @JvmOverloads constructor(
|
||||||
context: Context,
|
context: Context,
|
||||||
attrs: AttributeSet? = null,
|
attrs: AttributeSet? = null,
|
||||||
defStyleAttr: Int = 0
|
defStyleAttr: Int = 0
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="#4285F4"/>
|
||||||
|
<size android:width="8dp" android:height="8dp"/>
|
||||||
|
</shape>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="#FF6B35"/>
|
||||||
|
<size android:width="12dp" android:height="12dp"/>
|
||||||
|
</shape>
|
||||||
|
|
@ -1,49 +1,69 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.drawerlayout.widget.DrawerLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/drawer_menu"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent" >
|
||||||
android:background="@mipmap/bg_level_1_page"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ImageView
|
<!-- 页面内容 -->
|
||||||
android:id="@+id/iv_actor_bg"
|
<com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout
|
||||||
|
android:id="@+id/content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:scaleType="centerCrop"
|
android:background="@mipmap/splash_bg" >
|
||||||
android:src="@mipmap/splash_bg"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
<com.remax.visualnovel.widget.toolbar.CommonToolbar
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/toolbar"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:gravity="center"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="@dimen/sp_18"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:padding="@dimen/dp_10"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:text="Chat"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
/>
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:layout_width="match_parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/toolbar"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
>
|
||||||
|
|
||||||
app:backgroundColorToken="@string/color_surface_element_normal"
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
app:radiusToken="@string/radius_pill"
|
android:layout_width="match_parent"
|
||||||
app:strokeColorToken="@string/color_surface_top_normal"
|
android:layout_height="0dp"
|
||||||
app:strokeWidthToken="@string/border_divider"
|
android:layout_marginBottom="-55dp"
|
||||||
app:textColorToken="@string/color_txt_secondary_press"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
/>
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/input_panel"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.ui.chat.InputPanel
|
||||||
|
android:id="@+id/input_panel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
/>
|
||||||
|
</com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout>
|
||||||
|
</com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout>
|
||||||
|
|
||||||
|
|
||||||
<com.remax.visualnovel.ui.chat.InputPanel
|
<!-- 右侧抽屉菜单View -->
|
||||||
android:id="@+id/input_panel"
|
<com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="240dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="end"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:orientation="vertical">
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<com.remax.visualnovel.ui.chat.ui.ChatSettingView
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:id="@+id/setting_view"
|
||||||
/>
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
/>
|
||||||
|
</com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.drawerlayout.widget.DrawerLayout>
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.drawerlayout.widget.DrawerLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/drawer_menu"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:fitsSystemWindows="true" >
|
|
||||||
|
|
||||||
<!-- 页面内容 -->
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@mipmap/bg_level_1_page"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.toolbar.BaseToolbar
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
/>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/toolbar"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_actor_bg"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@mipmap/splash_bg"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<com.remax.visualnovel.ui.chat.InputPanel
|
|
||||||
android:id="@+id/input_panel"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- drawer 菜单view -->
|
|
||||||
<!-- 右侧抽屉菜单 -->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="240dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="end"
|
|
||||||
android:background="#FFFFFF"
|
|
||||||
android:orientation="vertical">
|
|
||||||
<com.remax.visualnovel.ui.chat.ui.ChatSettingView
|
|
||||||
android:id="@+id/setting_view"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.drawerlayout.widget.DrawerLayout>
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_marginTop="10dp" >
|
android:layout_marginTop="10dp" >
|
||||||
<include
|
<include
|
||||||
android:id="@+id/chatBubble"
|
android:id="@+id/short_text_model"
|
||||||
layout="@layout/include_setting_item"
|
layout="@layout/include_setting_item"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/titleLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:background="?attr/selectableItemBackground">
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||||
|
android:id="@+id/icon"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_centerVertical="true" />
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||||
|
android:id="@+id/titleText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toEndOf="@id/icon"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="#333333"
|
||||||
|
android:textStyle="normal"/>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||||
|
android:id="@+id/arrow"
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:src="@mipmap/setting_arrow_right"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout
|
||||||
|
android:id="@+id/itemsContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginTop="@dimen/dp_2"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="72dp"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:paddingTop="12dp"
|
||||||
|
android:paddingBottom="12dp">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/colorIndicator"
|
||||||
|
android:layout_width="12dp"
|
||||||
|
android:layout_height="12dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:background="@drawable/circle_shape"/>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||||
|
android:id="@+id/itemName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toEndOf="@id/colorIndicator"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="#333333"/>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||||
|
android:id="@+id/itemDesc"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toEndOf="@id/colorIndicator"
|
||||||
|
android:layout_below="@id/itemName"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textColor="#666666"/>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||||
|
android:id="@+id/pointsInfo"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textColor="#666666"
|
||||||
|
android:gravity="end"/>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||||
|
android:id="@+id/recommendedTag"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_above="@id/pointsInfo"
|
||||||
|
android:textSize="@dimen/sp_10"
|
||||||
|
android:textColor="#FF6B35"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/selectedDot"
|
||||||
|
android:layout_width="8dp"
|
||||||
|
android:layout_height="8dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:background="@drawable/circle_selected"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
</com.remax.visualnovel.widget.uitoken.view.UITokenRelativeLayout>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- all normal components theme -->
|
||||||
|
<style name="AppImmersiveTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="android:windowTranslucentStatus">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</resources>
|
||||||
|
|
@ -1423,17 +1423,6 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- new added -->
|
<!-- new added -->
|
||||||
<!--<declare-styleable name="TagFlowLayout2">
|
|
||||||
<attr name="tag_horizontal_spacing" format="dimension" />
|
|
||||||
<attr name="tag_vertical_spacing" format="dimension" />
|
|
||||||
<attr name="tag_text_size" format="dimension" />
|
|
||||||
<attr name="tag_text_color" format="color" />
|
|
||||||
<attr name="tag_background" format="reference" />
|
|
||||||
<attr name="tag_max_lines" format="integer" />
|
|
||||||
<attr name="expand_indicator_drawable" format="reference" />
|
|
||||||
<attr name="collapse_indicator_drawable" format="reference" />
|
|
||||||
</declare-styleable>-->
|
|
||||||
|
|
||||||
<declare-styleable name="TagFlowLayout2">
|
<declare-styleable name="TagFlowLayout2">
|
||||||
<attr name="tag_horizontal_spacing" format="dimension" />
|
<attr name="tag_horizontal_spacing" format="dimension" />
|
||||||
<attr name="tag_vertical_spacing" format="dimension" />
|
<attr name="tag_vertical_spacing" format="dimension" />
|
||||||
|
|
@ -1446,6 +1435,18 @@
|
||||||
<attr name="tag_each_line_max_num" format="integer" />
|
<attr name="tag_each_line_max_num" format="integer" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
|
<declare-styleable name="ExpandableSelector">
|
||||||
|
<attr name="titleText" format="string"/>
|
||||||
|
<attr name="titleTextSize" format="dimension"/>
|
||||||
|
<attr name="titleTextColor" format="color"/>
|
||||||
|
<attr name="itemTextSize" format="dimension"/>
|
||||||
|
<attr name="itemTextColor" format="color"/>
|
||||||
|
<attr name="itemDescTextSize" format="dimension"/>
|
||||||
|
<attr name="itemDescTextColor" format="color"/>
|
||||||
|
<attr name="animationDuration" format="integer"/>
|
||||||
|
<attr name="backgroundColor" format="color"/>
|
||||||
|
<attr name="dividerColor" format="color"/>
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,8 @@
|
||||||
<color name="gray6">#ff666666</color>
|
<color name="gray6">#ff666666</color>
|
||||||
<color name="grayf6">#fff6f6f6</color>
|
<color name="grayf6">#fff6f6f6</color>
|
||||||
|
|
||||||
|
<!-- chat settings -->
|
||||||
|
<color name="glo_color_chat_setting_item_bg">#fff6f6f6</color>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
<item name="colorPrimaryDark">@color/glo_color_grey_100</item>
|
<item name="colorPrimaryDark">@color/glo_color_grey_100</item>
|
||||||
<item name="colorAccent">@color/glo_color_magenta_50</item>
|
<item name="colorAccent">@color/glo_color_magenta_50</item>
|
||||||
<item name="android:windowLightStatusBar">true</item>
|
<item name="android:windowLightStatusBar">true</item>
|
||||||
|
<item name="android:statusBarColor">@color/transparent</item>
|
||||||
|
<item name="android:windowTranslucentStatus">true</item>
|
||||||
<!-- 应付一下android15 16要重新适配导航栏和状态栏 -->
|
<!-- 应付一下android15 16要重新适配导航栏和状态栏 -->
|
||||||
<item name="android:windowOptOutEdgeToEdgeEnforcement" tools:targetApi="35">true</item>
|
<item name="android:windowOptOutEdgeToEdgeEnforcement" tools:targetApi="35">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -241,10 +243,19 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<style name="AppTheme.Launcher" parent="AppTheme">
|
<!-- new added -->
|
||||||
|
<style name="AppTheme.Launcher" parent="AppImmersiveTheme">
|
||||||
<item name="android:windowBackground">@android:color/transparent</item>
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
<item name="android:windowIsTranslucent">true</item>
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
<item name="android:windowDisablePreview">true</item>
|
<item name="android:windowDisablePreview">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- all normal components theme -->
|
||||||
|
<style name="AppImmersiveTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="android:windowTranslucentStatus">false</item>
|
||||||
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
|
<item name="android:windowLightStatusBar">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -200,4 +200,9 @@
|
||||||
<string name="border_s" translatable="false">border.s</string> <!-- $glo.radius.1 -->
|
<string name="border_s" translatable="false">border.s</string> <!-- $glo.radius.1 -->
|
||||||
<string name="border_m" translatable="false">border.m</string> <!-- $glo.radius.2 -->
|
<string name="border_m" translatable="false">border.m</string> <!-- $glo.radius.2 -->
|
||||||
<string name="border_l" translatable="false">border.l</string> <!-- $glo.radius.4 -->
|
<string name="border_l" translatable="false">border.l</string> <!-- $glo.radius.4 -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- new added -->
|
||||||
|
<string name="color_chat_setting_item_bg" translatable="false">color.chat.setting.item.bg</string>
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Reference in New Issue