优化主题

pull/310/head
gedoor 4 years ago
parent 9be6b37917
commit 0cbdc5d401
  1. 24
      app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt
  2. 5
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  3. 14
      app/src/main/res/layout/dialog_auto_read.xml

@ -11,9 +11,11 @@ import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.help.ReadBookConfig import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.theme.bottomBackground import io.legado.app.lib.theme.bottomBackground
import io.legado.app.lib.theme.getPrimaryTextColor
import io.legado.app.service.BaseReadAloudService import io.legado.app.service.BaseReadAloudService
import io.legado.app.service.help.ReadAloud import io.legado.app.service.help.ReadAloud
import io.legado.app.ui.book.read.Help import io.legado.app.ui.book.read.Help
import io.legado.app.utils.ColorUtils
import kotlinx.android.synthetic.main.dialog_auto_read.* import kotlinx.android.synthetic.main.dialog_auto_read.*
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
@ -48,20 +50,36 @@ class AutoReadDialog : BaseDialogFragment() {
} }
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
root_view.setBackgroundColor(requireContext().bottomBackground) val bg = requireContext().bottomBackground
val isLight = ColorUtils.isColorLight(bg)
val textColor = requireContext().getPrimaryTextColor(isLight)
root_view.setBackgroundColor(bg)
tv_read_speed_title.setTextColor(textColor)
tv_read_speed.setTextColor(textColor)
iv_catalog.setColorFilter(textColor)
tv_catalog.setTextColor(textColor)
iv_main_menu.setColorFilter(textColor)
tv_main_menu.setTextColor(textColor)
iv_auto_page_stop.setColorFilter(textColor)
tv_auto_page_stop.setTextColor(textColor)
iv_setting.setColorFilter(textColor)
tv_setting.setTextColor(textColor)
initOnChange() initOnChange()
initData() initData()
initEvent() initEvent()
} }
private fun initData() { private fun initData() {
seek_auto_read.progress = val speed = if (ReadBookConfig.autoReadSpeed < 10) 10 else ReadBookConfig.autoReadSpeed
if (ReadBookConfig.autoReadSpeed < 10) 10 else ReadBookConfig.autoReadSpeed tv_read_speed.text = String.format("%ds", speed)
seek_auto_read.progress = speed
} }
private fun initOnChange() { private fun initOnChange() {
seek_auto_read.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { seek_auto_read.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
val speed = if (progress < 10) 10 else progress
tv_read_speed.text = String.format("%ds", speed)
} }
override fun onStartTrackingTouch(seekBar: SeekBar) = Unit override fun onStartTrackingTouch(seekBar: SeekBar) = Unit

@ -74,12 +74,13 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
} }
private fun initView() { private fun initView() {
val isLight = ColorUtils.isColorLight(requireContext().bottomBackground) val bg = requireContext().bottomBackground
val isLight = ColorUtils.isColorLight(bg)
val textColor = requireContext().getPrimaryTextColor(isLight) val textColor = requireContext().getPrimaryTextColor(isLight)
tv_page_anim.setTextColor(textColor) tv_page_anim.setTextColor(textColor)
tv_bg_ts.setTextColor(textColor) tv_bg_ts.setTextColor(textColor)
tv_share_layout.setTextColor(textColor) tv_share_layout.setTextColor(textColor)
root_view.setBackgroundColor(requireContext().bottomBackground) root_view.setBackgroundColor(bg)
dsb_text_size.valueFormat = { dsb_text_size.valueFormat = {
(it + 5).toString() (it + 5).toString()
} }

@ -26,6 +26,7 @@
android:padding="8dp"> android:padding="8dp">
<TextView <TextView
android:id="@+id/tv_read_speed_title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
@ -34,6 +35,11 @@
android:textColor="@color/primaryText" android:textColor="@color/primaryText"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView
android:id="@+id/tv_read_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
<io.legado.app.lib.theme.view.ATESeekBar <io.legado.app.lib.theme.view.ATESeekBar
@ -68,6 +74,7 @@
android:paddingBottom="7dp"> android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_catalog"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
@ -77,6 +84,7 @@
tools:ignore="NestedWeights" /> tools:ignore="NestedWeights" />
<TextView <TextView
android:id="@+id/tv_catalog"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
@ -104,6 +112,7 @@
android:paddingBottom="7dp"> android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_main_menu"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
@ -113,6 +122,7 @@
tools:ignore="NestedWeights" /> tools:ignore="NestedWeights" />
<TextView <TextView
android:id="@+id/tv_main_menu"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
@ -140,6 +150,7 @@
android:paddingBottom="7dp"> android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_auto_page_stop"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
@ -149,6 +160,7 @@
tools:ignore="NestedWeights" /> tools:ignore="NestedWeights" />
<TextView <TextView
android:id="@+id/tv_auto_page_stop"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
@ -176,6 +188,7 @@
android:paddingBottom="7dp"> android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_setting"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
@ -185,6 +198,7 @@
tools:ignore="NestedWeights" /> tools:ignore="NestedWeights" />
<TextView <TextView
android:id="@+id/tv_setting"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"

Loading…
Cancel
Save