更新界面
This commit is contained in:
@@ -7,7 +7,6 @@ import android.app.NotificationManager
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.ApplicationInfo
|
import android.content.pm.ApplicationInfo
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.Build
|
|
||||||
import com.github.liuyueyi.quick.transfer.constants.TransType
|
import com.github.liuyueyi.quick.transfer.constants.TransType
|
||||||
import com.google.android.material.color.DynamicColors
|
import com.google.android.material.color.DynamicColors
|
||||||
import com.jeremyliao.liveeventbus.LiveEventBus
|
import com.jeremyliao.liveeventbus.LiveEventBus
|
||||||
@@ -165,7 +164,6 @@ class App : Application() {
|
|||||||
* 创建通知ID
|
* 创建通知ID
|
||||||
*/
|
*/
|
||||||
private fun createNotificationChannels() {
|
private fun createNotificationChannels() {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
|
|
||||||
val downloadChannel = NotificationChannel(
|
val downloadChannel = NotificationChannel(
|
||||||
channelIdDownload,
|
channelIdDownload,
|
||||||
getString(R.string.action_download),
|
getString(R.string.action_download),
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ class ReadStyleDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_book_
|
|||||||
rvStyle.adapter = styleAdapter
|
rvStyle.adapter = styleAdapter
|
||||||
styleAdapter.addFooterView {
|
styleAdapter.addFooterView {
|
||||||
ItemReadStyleBinding.inflate(layoutInflater, it, false).apply {
|
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)
|
ivStyle.setImageResource(R.drawable.ic_add)
|
||||||
root.setOnClickListener {
|
root.setOnClickListener {
|
||||||
ReadBookConfig.configList.add(ReadBookConfig.Config())
|
ReadBookConfig.configList.add(ReadBookConfig.Config())
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.legato.kazusa.ui.book.read.config
|
|||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import com.google.android.material.chip.Chip
|
||||||
import com.jaredrummler.android.colorpicker.ColorPickerDialog
|
import com.jaredrummler.android.colorpicker.ColorPickerDialog
|
||||||
import io.legato.kazusa.R
|
import io.legato.kazusa.R
|
||||||
import io.legato.kazusa.base.BaseBottomSheetDialogFragment
|
import io.legato.kazusa.base.BaseBottomSheetDialogFragment
|
||||||
@@ -51,10 +52,43 @@ class TipConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_tip_config
|
|||||||
binding.dsbTitleTop.progress = ReadBookConfig.titleTopSpacing
|
binding.dsbTitleTop.progress = ReadBookConfig.titleTopSpacing
|
||||||
binding.dsbTitleBottom.progress = ReadBookConfig.titleBottomSpacing
|
binding.dsbTitleBottom.progress = ReadBookConfig.titleBottomSpacing
|
||||||
|
|
||||||
binding.tvHeaderShow.text =
|
val headerModes = ReadTipConfig.getHeaderModes(requireContext())
|
||||||
ReadTipConfig.getHeaderModes(requireContext())[ReadTipConfig.headerMode]
|
binding.chipHeaderMode.removeAllViews()
|
||||||
binding.tvFooterShow.text =
|
|
||||||
ReadTipConfig.getFooterModes(requireContext())[ReadTipConfig.footerMode]
|
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 {
|
ReadTipConfig.run {
|
||||||
tipNames.let { tipNames ->
|
tipNames.let { tipNames ->
|
||||||
@@ -114,19 +148,19 @@ class TipConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_tip_config
|
|||||||
ReadBookConfig.titleBottomSpacing = it
|
ReadBookConfig.titleBottomSpacing = it
|
||||||
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 5))
|
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 5))
|
||||||
}
|
}
|
||||||
llHeaderShow.setOnClickListener {
|
chipHeaderMode.setOnCheckedStateChangeListener { group, checkedIds ->
|
||||||
val headerModes = ReadTipConfig.getHeaderModes(requireContext())
|
if (checkedIds.isNotEmpty()) {
|
||||||
context?.selector(items = headerModes.values.toList()) { _, i ->
|
val selectedChip = group.findViewById<Chip>(checkedIds[0])
|
||||||
ReadTipConfig.headerMode = headerModes.keys.toList()[i]
|
val mode = selectedChip.tag as Int
|
||||||
tvHeaderShow.text = headerModes[ReadTipConfig.headerMode]
|
ReadTipConfig.headerMode = mode
|
||||||
postEvent(EventBus.UP_CONFIG, arrayListOf(2))
|
postEvent(EventBus.UP_CONFIG, arrayListOf(2))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
llFooterShow.setOnClickListener {
|
chipFooterMode.setOnCheckedStateChangeListener { group, checkedIds ->
|
||||||
val footerModes = ReadTipConfig.getFooterModes(requireContext())
|
if (checkedIds.isNotEmpty()) {
|
||||||
context?.selector(items = footerModes.values.toList()) { _, i ->
|
val selectedChip = group.findViewById<Chip>(checkedIds[0])
|
||||||
ReadTipConfig.footerMode = footerModes.keys.toList()[i]
|
val mode = selectedChip.tag as Int
|
||||||
tvFooterShow.text = footerModes[ReadTipConfig.footerMode]
|
ReadTipConfig.footerMode = mode
|
||||||
postEvent(EventBus.UP_CONFIG, arrayListOf(2))
|
postEvent(EventBus.UP_CONFIG, arrayListOf(2))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,26 +53,29 @@
|
|||||||
android:id="@+id/rb_title_mode1"
|
android:id="@+id/rb_title_mode1"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:checkable="true"
|
||||||
android:text="@string/title_left" />
|
android:text="@string/title_left" />
|
||||||
|
|
||||||
<com.google.android.material.chip.Chip
|
<com.google.android.material.chip.Chip
|
||||||
android:id="@+id/rb_title_mode2"
|
android:id="@+id/rb_title_mode2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:checkable="true"
|
||||||
android:text="@string/title_center" />
|
android:text="@string/title_center" />
|
||||||
|
|
||||||
<com.google.android.material.chip.Chip
|
<com.google.android.material.chip.Chip
|
||||||
android:id="@+id/rb_title_mode3"
|
android:id="@+id/rb_title_mode3"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:checkable="true"
|
||||||
android:text="@string/title_hide" />
|
android:text="@string/title_hide" />
|
||||||
|
|
||||||
|
|
||||||
</com.google.android.material.chip.ChipGroup>
|
</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:id="@+id/dsb_title_size"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:max="10"
|
app:max="10"
|
||||||
app:title="@string/title_font_size" />
|
app:title="@string/title_font_size" />
|
||||||
@@ -81,6 +84,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<io.legato.kazusa.ui.widget.SimpleCounterView
|
<io.legato.kazusa.ui.widget.SimpleCounterView
|
||||||
android:id="@+id/dsb_title_top"
|
android:id="@+id/dsb_title_top"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -118,20 +122,16 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingVertical="4dp"
|
android:paddingVertical="4dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"
|
android:orientation="vertical"
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry">
|
tools:ignore="RtlHardcoded,RtlSymmetry">
|
||||||
|
|
||||||
<TextView
|
<com.google.android.material.chip.ChipGroup
|
||||||
android:layout_width="0dp"
|
android:id="@+id/chip_header_mode"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:gravity="center_vertical"
|
||||||
android:text="@string/show_hide" />
|
app:selectionRequired="true"
|
||||||
|
app:singleSelection="true" />
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_header_show"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
tools:text="@string/show_hide" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -218,20 +218,15 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingVertical="4dp"
|
android:paddingVertical="4dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"
|
android:orientation="vertical"
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry">
|
tools:ignore="RtlHardcoded,RtlSymmetry">
|
||||||
|
|
||||||
<TextView
|
<com.google.android.material.chip.ChipGroup
|
||||||
android:layout_width="0dp"
|
android:id="@+id/chip_footer_mode"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
app:selectionRequired="true"
|
||||||
android:text="@string/show_hide" />
|
app:singleSelection="true" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_footer_show"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
tools:text="@string/show_hide" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_style"
|
android:id="@+id/iv_style"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingHorizontal="16dp"
|
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:paddingBottom="4dp">
|
android:paddingBottom="4dp">
|
||||||
|
|
||||||
@@ -20,7 +20,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="seek"
|
android:text="@string/text"
|
||||||
|
android:textSize="12sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
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/search_view"
|
android:id="@+id/search_view"
|
||||||
android:background="@drawable/bg_searchview"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
|
|||||||
@@ -7,16 +7,15 @@
|
|||||||
android:id="@+id/layout_root"
|
android:id="@+id/layout_root"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="vertical">
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingVertical="8dp">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvSeekTitle"
|
android:id="@+id/tvSeekTitle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_marginVertical="8dp"
|
||||||
android:paddingEnd="8dp"
|
android:maxWidth="48sp"
|
||||||
|
android:maxLines="2"
|
||||||
android:text="@string/text"
|
android:text="@string/text"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
@@ -26,20 +25,23 @@
|
|||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
app:strokeWidth="0dp"
|
app:strokeWidth="0dp"
|
||||||
app:cardCornerRadius="24dp"
|
app:cardCornerRadius="24dp"
|
||||||
app:cardBackgroundColor="?attr/colorSurfaceVariant">
|
app:cardBackgroundColor="?attr/colorSurfaceVariant">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="112dp"
|
android:layout_width="136dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/iv_seek_reduce"
|
android:id="@+id/iv_seek_reduce"
|
||||||
android:layout_width="40dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="42dp"
|
||||||
|
android:elevation="4dp"
|
||||||
|
app:iconSize="18dp"
|
||||||
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
|
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
|
||||||
android:elevation="2dp"
|
|
||||||
app:backgroundTint="?attr/colorSurfaceContainer"
|
app:backgroundTint="?attr/colorSurfaceContainer"
|
||||||
android:contentDescription="@string/reduce"
|
android:contentDescription="@string/reduce"
|
||||||
app:icon="@drawable/ic_reduce"
|
app:icon="@drawable/ic_reduce"
|
||||||
@@ -52,14 +54,17 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/text"
|
android:text="@string/text"
|
||||||
android:textSize="12sp" />
|
android:textColor="?attr/colorSecondary"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/iv_seek_plus"
|
android:id="@+id/iv_seek_plus"
|
||||||
android:layout_width="40dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
|
android:elevation="4dp"
|
||||||
|
app:iconSize="18dp"
|
||||||
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
|
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
|
||||||
android:elevation="2dp"
|
|
||||||
app:backgroundTint="?attr/colorSurfaceContainer"
|
app:backgroundTint="?attr/colorSurfaceContainer"
|
||||||
android:contentDescription="@string/plus"
|
android:contentDescription="@string/plus"
|
||||||
app:icon="@drawable/ic_add"
|
app:icon="@drawable/ic_add"
|
||||||
@@ -67,8 +72,5 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</merge>
|
</merge>
|
||||||
|
|||||||
Reference in New Issue
Block a user