更新界面
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,26 +53,29 @@
|
||||
android:id="@+id/rb_title_mode1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checkable="true"
|
||||
android:text="@string/title_left" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/rb_title_mode2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checkable="true"
|
||||
android:text="@string/title_center" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/rb_title_mode3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checkable="true"
|
||||
android:text="@string/title_hide" />
|
||||
|
||||
|
||||
</com.google.android.material.chip.ChipGroup>
|
||||
|
||||
<io.legato.kazusa.ui.widget.SimpleCounterView
|
||||
<io.legato.kazusa.ui.widget.DetailSeekBar
|
||||
android:id="@+id/dsb_title_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:max="10"
|
||||
app:title="@string/title_font_size" />
|
||||
@@ -81,6 +84,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<io.legato.kazusa.ui.widget.SimpleCounterView
|
||||
android:id="@+id/dsb_title_top"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -118,20 +122,16 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="RtlHardcoded,RtlSymmetry">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:id="@+id/chip_header_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/show_hide" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_header_show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="@string/show_hide" />
|
||||
android:gravity="center_vertical"
|
||||
app:selectionRequired="true"
|
||||
app:singleSelection="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -218,20 +218,15 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="RtlHardcoded,RtlSymmetry">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:id="@+id/chip_footer_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/show_hide" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_footer_show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="@string/show_hide" />
|
||||
app:selectionRequired="true"
|
||||
app:singleSelection="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_style"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingHorizontal="16dp"
|
||||
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="4dp">
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="seek"
|
||||
android:text="@string/text"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/search_view"
|
||||
android:background="@drawable/bg_searchview"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
|
||||
@@ -7,16 +7,15 @@
|
||||
android:id="@+id/layout_root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="8dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSeekTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingEnd="8dp"
|
||||
android:layout_marginVertical="8dp"
|
||||
android:maxWidth="48sp"
|
||||
android:maxLines="2"
|
||||
android:text="@string/text"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
@@ -26,20 +25,23 @@
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:strokeWidth="0dp"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardBackgroundColor="?attr/colorSurfaceVariant">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="112dp"
|
||||
android:layout_width="136dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/iv_seek_reduce"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="42dp"
|
||||
android:elevation="4dp"
|
||||
app:iconSize="18dp"
|
||||
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
|
||||
android:elevation="2dp"
|
||||
app:backgroundTint="?attr/colorSurfaceContainer"
|
||||
android:contentDescription="@string/reduce"
|
||||
app:icon="@drawable/ic_reduce"
|
||||
@@ -52,14 +54,17 @@
|
||||
android:gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/text"
|
||||
android:textSize="12sp" />
|
||||
android:textColor="?attr/colorSecondary"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/iv_seek_plus"
|
||||
android:layout_width="40dp"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="40dp"
|
||||
android:elevation="4dp"
|
||||
app:iconSize="18dp"
|
||||
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
|
||||
android:elevation="2dp"
|
||||
app:backgroundTint="?attr/colorSurfaceContainer"
|
||||
android:contentDescription="@string/plus"
|
||||
app:icon="@drawable/ic_add"
|
||||
@@ -67,8 +72,5 @@
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</merge>
|
||||
|
||||
Reference in New Issue
Block a user