titleBar 相关处理
|
|
@ -31,6 +31,7 @@ import com.remax.visualnovel.ui.chat.setting.model.ChatModelDialog
|
||||||
import com.remax.visualnovel.ui.chat.ui.HoldToTalkDialog
|
import com.remax.visualnovel.ui.chat.ui.HoldToTalkDialog
|
||||||
import com.remax.visualnovel.utils.RecordHelper
|
import com.remax.visualnovel.utils.RecordHelper
|
||||||
import com.remax.visualnovel.utils.StatusBarUtil2
|
import com.remax.visualnovel.utils.StatusBarUtil2
|
||||||
|
import com.remax.visualnovel.utils.StatusBarUtil3
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
@ -50,15 +51,13 @@ class ChatActivity : BaseBindingActivity<ActivityActorChatBinding>() {
|
||||||
override fun initView() {
|
override fun initView() {
|
||||||
/*ARouter.getInstance().inject(this)
|
/*ARouter.getInstance().inject(this)
|
||||||
StatusBarUtils.setStatusBarAndNavBarIsLight(this, false)
|
StatusBarUtils.setStatusBarAndNavBarIsLight(this, false)
|
||||||
StatusBarUtils.setTransparent(this)*/
|
StatusBarUtils.setTransparent(this)
|
||||||
StatusBarUtil2.initImmersive(this, lightStatusBar = true)
|
StatusBarUtil2.initImmersive(this, lightStatusBar = true) */
|
||||||
binding.root.setPadding(binding.root.paddingStart, binding.root.paddingTop + StatusBarUtil2.getStatusBarHeight(this) * 2,
|
StatusBarUtil3.setImmersiveStatusBar(this, true)
|
||||||
binding.root.paddingEnd, 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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
with(binding) {
|
with(binding) {
|
||||||
initInputPanelEvents()
|
initInputPanelEvents()
|
||||||
initCallViewEvents()
|
initCallViewEvents()
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,14 @@ package com.remax.visualnovel.ui.chat
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
import androidx.appcompat.widget.AppCompatEditText
|
||||||
import com.remax.visualnovel.R
|
import com.remax.visualnovel.R
|
||||||
import com.remax.visualnovel.utils.spannablex.utils.dp
|
import com.remax.visualnovel.utils.spannablex.utils.dp
|
||||||
import com.remax.visualnovel.widget.uitoken.view.UITokenEditView
|
import com.remax.visualnovel.widget.uitoken.view.UITokenEditView
|
||||||
|
|
||||||
|
|
||||||
class ChatEditView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
|
class ChatEditView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
|
||||||
: UITokenEditView(context, attrs, defStyleAttr) {
|
: AppCompatEditText(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import com.remax.visualnovel.ui.main.actor.ActorListFragment
|
||||||
import com.remax.visualnovel.ui.main.book.BookListFragment
|
import com.remax.visualnovel.ui.main.book.BookListFragment
|
||||||
import com.remax.visualnovel.ui.main.history.HistoryFragment
|
import com.remax.visualnovel.ui.main.history.HistoryFragment
|
||||||
import com.remax.visualnovel.ui.main.managa.MangaListFragment
|
import com.remax.visualnovel.ui.main.managa.MangaListFragment
|
||||||
|
import com.remax.visualnovel.utils.StatusBarUtil3
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -41,8 +42,9 @@ class MainActivity : BaseBindingActivity<ActivityMainBinding>() {
|
||||||
private val mainViewModel by viewModels<MainViewModel>()
|
private val mainViewModel by viewModels<MainViewModel>()
|
||||||
|
|
||||||
override fun initView() {
|
override fun initView() {
|
||||||
StatusBarUtils.setStatusBarAndNavBarIsLight(this, false)
|
/*StatusBarUtils.setStatusBarAndNavBarIsLight(this, false)
|
||||||
StatusBarUtils.setTransparent(this)
|
StatusBarUtils.setTransparent(this)*/
|
||||||
|
StatusBarUtil3.setImmersiveStatusBar(this, true)
|
||||||
|
|
||||||
onBackPressedDispatcher.addCallback(this) {
|
onBackPressedDispatcher.addCallback(this) {
|
||||||
if (mainViewModel.canBack) {
|
if (mainViewModel.canBack) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.remax.visualnovel.ui.main
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import com.remax.visualnovel.R
|
||||||
|
import com.remax.visualnovel.databinding.ToolbarMainBinding
|
||||||
|
import com.remax.visualnovel.entity.response.ChatSound
|
||||||
|
|
||||||
|
class MainToolbar @JvmOverloads constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet? = null,
|
||||||
|
defStyleAttr: Int = 0
|
||||||
|
) : LinearLayout(context, attrs, defStyleAttr) {
|
||||||
|
private lateinit var items: List<ChatSound>
|
||||||
|
private var mBinding: ToolbarMainBinding
|
||||||
|
|
||||||
|
private lateinit var mEventListener: IEventListener
|
||||||
|
|
||||||
|
|
||||||
|
interface IEventListener {
|
||||||
|
fun onSoundSelected(sound: ChatSound)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
init {
|
||||||
|
mBinding = ToolbarMainBinding.inflate(LayoutInflater.from(context), this, true)
|
||||||
|
with(mBinding) {
|
||||||
|
avatarView.loadImageResourceAvatar(R.mipmap.sex_man_big)
|
||||||
|
tvDiamondLevel.text = "150"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun setEventListener(eventListener: IEventListener) {
|
||||||
|
mEventListener = eventListener
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,7 @@ import com.remax.visualnovel.app.base.BaseBindingFragment
|
||||||
import com.remax.visualnovel.configs.NovelApplication
|
import com.remax.visualnovel.configs.NovelApplication
|
||||||
import com.remax.visualnovel.databinding.FragmentMainActorBinding
|
import com.remax.visualnovel.databinding.FragmentMainActorBinding
|
||||||
import com.remax.visualnovel.utils.Routers
|
import com.remax.visualnovel.utils.Routers
|
||||||
|
import com.remax.visualnovel.utils.StatusBarUtil3
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlin.getValue
|
import kotlin.getValue
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
|
@ -36,17 +37,20 @@ class ActorListFragment : BaseBindingFragment<FragmentMainActorBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUI() {
|
private fun setUI() {
|
||||||
|
with(binding.root) {
|
||||||
|
setPadding(
|
||||||
|
paddingLeft,
|
||||||
|
paddingTop + StatusBarUtil3.getStatusBarHeight(context),
|
||||||
|
paddingRight,
|
||||||
|
paddingBottom
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
initTagLayout()
|
initTagLayout()
|
||||||
initRecyclerView()
|
initRecyclerView()
|
||||||
initTitleView()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initTitleView() {
|
|
||||||
with(binding) {
|
|
||||||
avatarView.loadImageResourceAvatar(R.mipmap.sex_man_big)
|
|
||||||
tvDiamondLevel.text = "150"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initRecyclerView() {
|
private fun initRecyclerView() {
|
||||||
with(binding) {
|
with(binding) {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.dylanc.loadingstateview.BgColorType
|
||||||
import com.remax.visualnovel.app.base.BaseBindingFragment
|
import com.remax.visualnovel.app.base.BaseBindingFragment
|
||||||
import com.remax.visualnovel.databinding.FragmentMainBookBinding
|
import com.remax.visualnovel.databinding.FragmentMainBookBinding
|
||||||
import com.remax.visualnovel.utils.Routers
|
import com.remax.visualnovel.utils.Routers
|
||||||
|
import com.remax.visualnovel.utils.StatusBarUtil3
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlin.getValue
|
import kotlin.getValue
|
||||||
|
|
||||||
|
|
@ -28,8 +29,13 @@ class BookListFragment : BaseBindingFragment<FragmentMainBookBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUI() {
|
private fun setUI() {
|
||||||
with(binding) {
|
with(binding.root) {
|
||||||
|
setPadding(
|
||||||
|
paddingLeft,
|
||||||
|
paddingTop + StatusBarUtil3.getStatusBarHeight(context),
|
||||||
|
paddingRight,
|
||||||
|
paddingBottom
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.dylanc.loadingstateview.BgColorType
|
||||||
import com.remax.visualnovel.app.base.BaseBindingFragment
|
import com.remax.visualnovel.app.base.BaseBindingFragment
|
||||||
import com.remax.visualnovel.databinding.FragmentMainHistoryBinding
|
import com.remax.visualnovel.databinding.FragmentMainHistoryBinding
|
||||||
import com.remax.visualnovel.utils.Routers
|
import com.remax.visualnovel.utils.Routers
|
||||||
|
import com.remax.visualnovel.utils.StatusBarUtil3
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlin.getValue
|
import kotlin.getValue
|
||||||
|
|
||||||
|
|
@ -28,8 +29,13 @@ class HistoryFragment : BaseBindingFragment<FragmentMainHistoryBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUI() {
|
private fun setUI() {
|
||||||
with(binding) {
|
with(binding.root) {
|
||||||
|
setPadding(
|
||||||
|
paddingLeft,
|
||||||
|
paddingTop + StatusBarUtil3.getStatusBarHeight(context),
|
||||||
|
paddingRight,
|
||||||
|
paddingBottom
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.dylanc.loadingstateview.BgColorType
|
||||||
import com.remax.visualnovel.app.base.BaseBindingFragment
|
import com.remax.visualnovel.app.base.BaseBindingFragment
|
||||||
import com.remax.visualnovel.databinding.FragmentMainMangaBinding
|
import com.remax.visualnovel.databinding.FragmentMainMangaBinding
|
||||||
import com.remax.visualnovel.utils.Routers
|
import com.remax.visualnovel.utils.Routers
|
||||||
|
import com.remax.visualnovel.utils.StatusBarUtil3
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlin.getValue
|
import kotlin.getValue
|
||||||
|
|
||||||
|
|
@ -28,8 +29,13 @@ class MangaListFragment : BaseBindingFragment<FragmentMainMangaBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUI() {
|
private fun setUI() {
|
||||||
with(binding) {
|
with(binding.root) {
|
||||||
|
setPadding(
|
||||||
|
paddingLeft,
|
||||||
|
paddingTop + StatusBarUtil3.getStatusBarHeight(context),
|
||||||
|
paddingRight,
|
||||||
|
paddingBottom
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.remax.visualnovel.utils
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.os.Build
|
||||||
|
import android.view.View
|
||||||
|
import android.view.WindowManager
|
||||||
|
import kotlin.apply
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
object StatusBarUtil3 {
|
||||||
|
/**
|
||||||
|
* 设置沉浸式状态栏
|
||||||
|
*/
|
||||||
|
fun setImmersiveStatusBar(activity: Activity, lightStatusBar: Boolean = true) {
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
// 设置状态栏文字颜色
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
var systemUiVisibility = decorView.systemUiVisibility
|
||||||
|
systemUiVisibility = systemUiVisibility or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
|
systemUiVisibility = if (lightStatusBar) {
|
||||||
|
systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||||
|
} else {
|
||||||
|
systemUiVisibility and View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv()
|
||||||
|
}
|
||||||
|
decorView.systemUiVisibility = systemUiVisibility
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取状态栏高度
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,6 @@ package com.remax.visualnovel.widget.toolbar
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
|
@ -10,6 +9,7 @@ import android.widget.ImageView
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import com.remax.visualnovel.R
|
import com.remax.visualnovel.R
|
||||||
|
import com.remax.visualnovel.utils.StatusBarUtil3
|
||||||
import com.remax.visualnovel.widget.uitoken.view.UITokenFrameLayout
|
import com.remax.visualnovel.widget.uitoken.view.UITokenFrameLayout
|
||||||
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
|
||||||
|
|
@ -30,17 +30,24 @@ class CommonToolbar @JvmOverloads constructor(
|
||||||
private var onChildClickListener: ((View) -> Unit)? = null
|
private var onChildClickListener: ((View) -> Unit)? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
LayoutInflater.from(context).inflate(R.layout.common_toolbar_layout, this, true)
|
val rootView = LayoutInflater.from(context).inflate(R.layout.common_toolbar_layout, this, true)
|
||||||
ivBack = findViewById(R.id.iv_left)
|
ivBack = findViewById(R.id.iv_left)
|
||||||
llCenter = findViewById(R.id.ll_center)
|
llCenter = findViewById(R.id.ll_center)
|
||||||
ivTitle = findViewById(R.id.iv_title)
|
ivTitle = findViewById(R.id.iv_title)
|
||||||
llRight = findViewById(R.id.ll_right)
|
llRight = findViewById(R.id.ll_right)
|
||||||
|
|
||||||
|
with(rootView) {
|
||||||
|
setPadding(
|
||||||
|
paddingLeft,
|
||||||
|
paddingTop + StatusBarUtil3.getStatusBarHeight(context),
|
||||||
|
paddingRight,
|
||||||
|
paddingBottom
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
setOnChildClickListener { view ->
|
setOnChildClickListener { view ->
|
||||||
when (view.id) {
|
when (view.id) {
|
||||||
R.id.iv_left -> {
|
R.id.iv_left -> {
|
||||||
// 默认返回按钮处理
|
|
||||||
performBackAction()
|
performBackAction()
|
||||||
}
|
}
|
||||||
// TODO - 其他子view
|
// TODO - 其他子view
|
||||||
|
|
@ -48,32 +55,16 @@ class CommonToolbar @JvmOverloads constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置标题文本
|
|
||||||
*/
|
|
||||||
fun setTitle(text: String) {
|
|
||||||
ivTitle.text = text
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置标题文本
|
|
||||||
*/
|
|
||||||
fun setTitle(resId: Int) {
|
fun setTitle(resId: Int) {
|
||||||
ivTitle.setText(resId)
|
ivTitle.setText(resId)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 向中心区域添加自定义视图
|
|
||||||
*/
|
|
||||||
fun addCenterView(view: View) {
|
fun addCenterView(view: View) {
|
||||||
llCenter.removeAllViews()
|
llCenter.removeAllViews()
|
||||||
llCenter.addView(view)
|
llCenter.addView(view)
|
||||||
setupClickListener(view)
|
setupClickListener(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 向右侧区域添加图标
|
|
||||||
*/
|
|
||||||
fun addRightIcon(@DrawableRes resId: Int, tag: String? = null): ImageView {
|
fun addRightIcon(@DrawableRes resId: Int, tag: String? = null): ImageView {
|
||||||
val imageView = ImageView(context).apply {
|
val imageView = ImageView(context).apply {
|
||||||
setImageResource(resId)
|
setImageResource(resId)
|
||||||
|
|
@ -95,14 +86,14 @@ class CommonToolbar @JvmOverloads constructor(
|
||||||
val imageView = ImageView(context).apply {
|
val imageView = ImageView(context).apply {
|
||||||
setImageResource(resId)
|
setImageResource(resId)
|
||||||
scaleType = ImageView.ScaleType.CENTER_INSIDE
|
scaleType = ImageView.ScaleType.CENTER_INSIDE
|
||||||
|
setOnClickListener {
|
||||||
|
onClick.invoke()
|
||||||
|
}
|
||||||
layoutParams = LinearLayout.LayoutParams(
|
layoutParams = LinearLayout.LayoutParams(
|
||||||
LayoutParams.WRAP_CONTENT,
|
LayoutParams.WRAP_CONTENT,
|
||||||
LayoutParams.WRAP_CONTENT
|
LayoutParams.WRAP_CONTENT
|
||||||
).apply {
|
).apply {
|
||||||
setMargins(16, 0, 16, 0)
|
setMargins(16, 0, 16, 0)
|
||||||
setOnClickListener {
|
|
||||||
onClick.invoke()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.tag = tag
|
this.tag = tag
|
||||||
}
|
}
|
||||||
|
|
@ -110,54 +101,30 @@ class CommonToolbar @JvmOverloads constructor(
|
||||||
setupClickListener(imageView)
|
setupClickListener(imageView)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 向右侧区域添加自定义视图
|
|
||||||
*/
|
|
||||||
fun addRightView(view: View, tag: String? = null) {
|
fun addRightView(view: View, tag: String? = null) {
|
||||||
view.tag = tag
|
view.tag = tag
|
||||||
llRight.addView(view)
|
llRight.addView(view)
|
||||||
setupClickListener(view)
|
setupClickListener(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 清除右侧所有视图
|
|
||||||
*/
|
|
||||||
fun clearRightViews() {
|
fun clearRightViews() {
|
||||||
llRight.removeAllViews()
|
llRight.removeAllViews()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置子视图点击监听器
|
|
||||||
*/
|
|
||||||
fun setOnChildClickListener(listener: (View) -> Unit) {
|
fun setOnChildClickListener(listener: (View) -> Unit) {
|
||||||
this.onChildClickListener = listener
|
this.onChildClickListener = listener
|
||||||
setupClickListeners()
|
setupClickListeners()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
fun setBackVisible(visible: Boolean) {
|
||||||
* 设置返回按钮可见性
|
|
||||||
*/
|
|
||||||
fun setBackButtonVisible(visible: Boolean) {
|
|
||||||
ivBack.visibility = if (visible) View.VISIBLE else View.GONE
|
ivBack.visibility = if (visible) View.VISIBLE else View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
fun setBackIcon(@DrawableRes resId: Int) {
|
||||||
* 设置返回按钮图标
|
|
||||||
*/
|
|
||||||
fun setBackButtonIcon(@DrawableRes resId: Int) {
|
|
||||||
ivBack.setImageResource(resId)
|
ivBack.setImageResource(resId)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// 通过tag查询右侧cotnainer中View
|
||||||
* 设置返回按钮图标
|
|
||||||
*/
|
|
||||||
fun setBackButtonIcon(drawable: Drawable) {
|
|
||||||
ivBack.setImageDrawable(drawable)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取右侧指定tag的视图
|
|
||||||
*/
|
|
||||||
fun findRightViewByTag(tag: String): View? {
|
fun findRightViewByTag(tag: String): View? {
|
||||||
for (i in 0 until llRight.childCount) {
|
for (i in 0 until llRight.childCount) {
|
||||||
val child = llRight.getChildAt(i)
|
val child = llRight.getChildAt(i)
|
||||||
|
|
@ -173,7 +140,6 @@ class CommonToolbar @JvmOverloads constructor(
|
||||||
setupClickListener(llCenter)
|
setupClickListener(llCenter)
|
||||||
setupClickListener(ivTitle)
|
setupClickListener(ivTitle)
|
||||||
|
|
||||||
// 为右侧所有子视图设置监听
|
|
||||||
for (i in 0 until llRight.childCount) {
|
for (i in 0 until llRight.childCount) {
|
||||||
setupClickListener(llRight.getChildAt(i))
|
setupClickListener(llRight.getChildAt(i))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 239 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 254 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
|
@ -4,10 +4,9 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
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:fitsSystemWindows="false"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
android:id="@+id/viewPager2"
|
android:id="@+id/viewPager2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
@ -16,6 +15,7 @@
|
||||||
app:layout_constraintBottom_toTopOf="@+id/bottomLayout"
|
app:layout_constraintBottom_toTopOf="@+id/bottomLayout"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout
|
<com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout
|
||||||
android:id="@+id/bottomLayout"
|
android:id="@+id/bottomLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
||||||
|
|
@ -7,93 +7,11 @@
|
||||||
android:background="@mipmap/bg_level_1_page"
|
android:background="@mipmap/bg_level_1_page"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.remax.visualnovel.ui.main.MainToolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingHorizontal="@dimen/dp_16"
|
/>
|
||||||
android:paddingVertical="@dimen/dp_4"
|
|
||||||
android:layout_marginTop="@dimen/dp_40"
|
|
||||||
>
|
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
>
|
|
||||||
<com.remax.visualnovel.widget.ui.UserAvatarView
|
|
||||||
android:id="@+id/avatarView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:avatarSizeType="M"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
|
||||||
android:id="@+id/tv_diamond_level"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/dp_15"
|
|
||||||
android:background="@drawable/diamond_info_bg"
|
|
||||||
android:paddingVertical="@dimen/dp_6"
|
|
||||||
android:paddingStart="@dimen/dp_6"
|
|
||||||
android:paddingEnd="@dimen/dp_12"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
app:drawableLeftCompat="@mipmap/diamond_3"
|
|
||||||
android:drawablePadding="@dimen/dp_6"
|
|
||||||
android:textSize="@dimen/sp_14"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:radiusToken="@string/radius_pill"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout>
|
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
>
|
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
|
||||||
android:id="@+id/iv_search"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="@dimen/dp_4"
|
|
||||||
android:src="@mipmap/icon_search_on"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
|
||||||
android:id="@+id/iv_sign"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="@dimen/dp_4"
|
|
||||||
android:layout_marginStart="@dimen/dp_10"
|
|
||||||
android:src="@mipmap/icon_sign"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
|
||||||
android:id="@+id/iv_discussion"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="@dimen/dp_4"
|
|
||||||
android:layout_marginStart="@dimen/dp_10"
|
|
||||||
android:src="@mipmap/icon_discussion"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.custom.TagFlowLayout2
|
<com.remax.visualnovel.widget.custom.TagFlowLayout2
|
||||||
android:id="@+id/tagFlowLayout"
|
android:id="@+id/tagFlowLayout"
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,20 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_vertical"
|
android:background="@mipmap/bg_level_1_page"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.remax.visualnovel.ui.main.MainToolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||||
android:id="@+id/tvTitle"
|
android:id="@+id/tvTitle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="100dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_marginStart="@dimen/nav_title_margin"
|
android:layout_marginStart="@dimen/nav_title_margin"
|
||||||
android:layout_marginEnd="@dimen/nav_title_margin"
|
android:layout_marginEnd="@dimen/nav_title_margin"
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,20 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_vertical"
|
android:background="@mipmap/bg_level_1_page"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.remax.visualnovel.ui.main.MainToolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||||
android:id="@+id/tvTitle"
|
android:id="@+id/tvTitle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="100dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_marginStart="@dimen/nav_title_margin"
|
android:layout_marginStart="@dimen/nav_title_margin"
|
||||||
android:layout_marginEnd="@dimen/nav_title_margin"
|
android:layout_marginEnd="@dimen/nav_title_margin"
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,20 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_vertical"
|
android:background="@mipmap/bg_level_1_page"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.remax.visualnovel.ui.main.MainToolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||||
android:id="@+id/tvTitle"
|
android:id="@+id/tvTitle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="100dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_marginStart="@dimen/nav_title_margin"
|
android:layout_marginStart="@dimen/nav_title_margin"
|
||||||
android:layout_marginEnd="@dimen/nav_title_margin"
|
android:layout_marginEnd="@dimen/nav_title_margin"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/title_root"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="@dimen/dp_16"
|
||||||
|
android:paddingVertical="@dimen/dp_4"
|
||||||
|
>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
>
|
||||||
|
<com.remax.visualnovel.widget.ui.UserAvatarView
|
||||||
|
android:id="@+id/avatarView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:avatarSizeType="M"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||||
|
android:id="@+id/tv_diamond_level"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_15"
|
||||||
|
android:background="@drawable/diamond_info_bg"
|
||||||
|
android:paddingVertical="@dimen/dp_6"
|
||||||
|
android:paddingStart="@dimen/dp_6"
|
||||||
|
android:paddingEnd="@dimen/dp_12"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
app:drawableLeftCompat="@mipmap/diamond_3"
|
||||||
|
android:drawablePadding="@dimen/dp_6"
|
||||||
|
android:textSize="@dimen/sp_14"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:radiusToken="@string/radius_pill"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||||
|
android:id="@+id/iv_search"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/dp_4"
|
||||||
|
android:src="@mipmap/icon_search_on"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||||
|
android:id="@+id/iv_sign"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/dp_4"
|
||||||
|
android:layout_marginStart="@dimen/dp_10"
|
||||||
|
android:src="@mipmap/icon_sign"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||||
|
android:id="@+id/iv_discussion"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/dp_4"
|
||||||
|
android:layout_marginStart="@dimen/dp_10"
|
||||||
|
android:src="@mipmap/icon_discussion"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout>
|
||||||
|
</com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout>
|
||||||
|
Before Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 920 B |
|
Before Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 585 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 739 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 552 B |
|
Before Width: | Height: | Size: 913 B |
|
After Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 902 B |
|
After Width: | Height: | Size: 516 B |
|
Before Width: | Height: | Size: 969 B |
|
After Width: | Height: | Size: 426 B |
|
Before Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 658 B |
|
After Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
|
@ -1,17 +0,0 @@
|
||||||
package com.remax.visualnovel
|
|
||||||
|
|
||||||
import org.junit.Test
|
|
||||||
|
|
||||||
import org.junit.Assert.*
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Example local unit test, which will execute on the development machine (host).
|
|
||||||
*
|
|
||||||
* See [testing documentation](http://d.android.com/tools/testing).
|
|
||||||
*/
|
|
||||||
class ExampleUnitTest {
|
|
||||||
@Test
|
|
||||||
fun addition_isCorrect() {
|
|
||||||
assertEquals(4, 2 + 2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||