更新界面

This commit is contained in:
HapeLee
2025-08-27 03:04:46 +08:00
parent 6b1d11489f
commit ab98072ec3
8 changed files with 94 additions and 59 deletions
@@ -7,7 +7,6 @@ import android.app.NotificationManager
import android.content.Context
import android.content.pm.ApplicationInfo
import android.content.res.Configuration
import android.os.Build
import com.github.liuyueyi.quick.transfer.constants.TransType
import com.google.android.material.color.DynamicColors
import com.jeremyliao.liveeventbus.LiveEventBus
@@ -165,7 +164,6 @@ class App : Application() {
* 创建通知ID
*/
private fun createNotificationChannels() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
val downloadChannel = NotificationChannel(
channelIdDownload,
getString(R.string.action_download),
@@ -65,6 +65,10 @@ class ReadStyleDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_book_
rvStyle.adapter = styleAdapter
styleAdapter.addFooterView {
ItemReadStyleBinding.inflate(layoutInflater, it, false).apply {
tvStyle.text = ""
cdStyle.cardElevation = 2f.dpToPx()
cdStyle.radius = 32f.dpToPx()
cdStyle.strokeWidth = 0
ivStyle.setImageResource(R.drawable.ic_add)
root.setOnClickListener {
ReadBookConfig.configList.add(ReadBookConfig.Config())
@@ -2,6 +2,7 @@ package io.legato.kazusa.ui.book.read.config
import android.os.Bundle
import android.view.View
import com.google.android.material.chip.Chip
import com.jaredrummler.android.colorpicker.ColorPickerDialog
import io.legato.kazusa.R
import io.legato.kazusa.base.BaseBottomSheetDialogFragment
@@ -51,10 +52,43 @@ class TipConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_tip_config
binding.dsbTitleTop.progress = ReadBookConfig.titleTopSpacing
binding.dsbTitleBottom.progress = ReadBookConfig.titleBottomSpacing
binding.tvHeaderShow.text =
ReadTipConfig.getHeaderModes(requireContext())[ReadTipConfig.headerMode]
binding.tvFooterShow.text =
ReadTipConfig.getFooterModes(requireContext())[ReadTipConfig.footerMode]
val headerModes = ReadTipConfig.getHeaderModes(requireContext())
binding.chipHeaderMode.removeAllViews()
headerModes.forEach { (key, value) ->
val chip = Chip(requireContext()).apply {
id = View.generateViewId()
text = value
isCheckable = true
isClickable = true
tag = key
}
binding.chipHeaderMode.addView(chip)
if (key == ReadTipConfig.headerMode) {
chip.isChecked = true
}
}
val footerModes = ReadTipConfig.getFooterModes(requireContext())
binding.chipFooterMode.removeAllViews()
footerModes.forEach { (key, value) ->
val chip = Chip(requireContext()).apply {
id = View.generateViewId()
text = value
isCheckable = true
isClickable = true
tag = key
}
binding.chipFooterMode.addView(chip)
if (key == ReadTipConfig.footerMode) {
chip.isChecked = true
}
}
ReadTipConfig.run {
tipNames.let { tipNames ->
@@ -114,19 +148,19 @@ class TipConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_tip_config
ReadBookConfig.titleBottomSpacing = it
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 5))
}
llHeaderShow.setOnClickListener {
val headerModes = ReadTipConfig.getHeaderModes(requireContext())
context?.selector(items = headerModes.values.toList()) { _, i ->
ReadTipConfig.headerMode = headerModes.keys.toList()[i]
tvHeaderShow.text = headerModes[ReadTipConfig.headerMode]
chipHeaderMode.setOnCheckedStateChangeListener { group, checkedIds ->
if (checkedIds.isNotEmpty()) {
val selectedChip = group.findViewById<Chip>(checkedIds[0])
val mode = selectedChip.tag as Int
ReadTipConfig.headerMode = mode
postEvent(EventBus.UP_CONFIG, arrayListOf(2))
}
}
llFooterShow.setOnClickListener {
val footerModes = ReadTipConfig.getFooterModes(requireContext())
context?.selector(items = footerModes.values.toList()) { _, i ->
ReadTipConfig.footerMode = footerModes.keys.toList()[i]
tvFooterShow.text = footerModes[ReadTipConfig.footerMode]
chipFooterMode.setOnCheckedStateChangeListener { group, checkedIds ->
if (checkedIds.isNotEmpty()) {
val selectedChip = group.findViewById<Chip>(checkedIds[0])
val mode = selectedChip.tag as Int
ReadTipConfig.footerMode = mode
postEvent(EventBus.UP_CONFIG, arrayListOf(2))
}
}