优化主题

pull/310/head
gedoor 4 years ago
parent 0cbdc5d401
commit 957f40ff68
  1. 3
      app/src/main/java/io/legado/app/lib/theme/view/ATESwitch.kt
  2. 29
      app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt
  3. 10
      app/src/main/res/layout/dialog_read_aloud.xml

@ -12,7 +12,10 @@ import io.legado.app.lib.theme.accentColor
class ATESwitch(context: Context, attrs: AttributeSet) : SwitchCompat(context, attrs) {
init {
if (!isInEditMode) {
ATH.setTint(this, context.accentColor)
}
}
}

@ -12,10 +12,12 @@ import io.legado.app.base.BaseDialogFragment
import io.legado.app.constant.EventBus
import io.legado.app.help.AppConfig
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.help.ReadAloud
import io.legado.app.service.help.ReadBook
import io.legado.app.ui.book.read.Help
import io.legado.app.utils.ColorUtils
import io.legado.app.utils.getPrefBoolean
import io.legado.app.utils.observeEvent
import io.legado.app.utils.putPrefBoolean
@ -53,7 +55,28 @@ class ReadAloudDialog : BaseDialogFragment() {
}
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_pre.setTextColor(textColor)
tv_next.setTextColor(textColor)
iv_play_prev.setColorFilter(textColor)
iv_play_pause.setColorFilter(textColor)
iv_play_next.setColorFilter(textColor)
iv_stop.setColorFilter(textColor)
iv_timer.setColorFilter(textColor)
tv_timer.setTextColor(textColor)
tv_tts_speed.setTextColor(textColor)
iv_catalog.setColorFilter(textColor)
tv_catalog.setTextColor(textColor)
iv_main_menu.setColorFilter(textColor)
tv_main_menu.setTextColor(textColor)
iv_to_backstage.setColorFilter(textColor)
tv_to_backstage.setTextColor(textColor)
iv_setting.setColorFilter(textColor)
tv_setting.setTextColor(textColor)
cb_tts_follow_sys.setTextColor(textColor)
initOnChange()
initData()
initEvent()
@ -121,6 +144,10 @@ class ReadAloudDialog : BaseDialogFragment() {
} else {
iv_play_pause.setImageResource(R.drawable.ic_play_24dp)
}
val bg = requireContext().bottomBackground
val isLight = ColorUtils.isColorLight(bg)
val textColor = requireContext().getPrimaryTextColor(isLight)
iv_play_pause.setColorFilter(textColor)
}
private fun upTimerText(timeMinute: Int) {

@ -121,6 +121,7 @@
android:padding="6dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_timer"
android:layout_width="30dp"
android:layout_height="30dp"
android:tooltipText="@string/set_timer"
@ -158,6 +159,7 @@
android:padding="8dp">
<TextView
android:id="@+id/tv_tts_speed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -207,6 +209,7 @@
android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_catalog"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
@ -216,6 +219,7 @@
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/tv_catalog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
@ -243,6 +247,7 @@
android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_main_menu"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
@ -252,6 +257,7 @@
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/tv_main_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
@ -279,6 +285,7 @@
android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_to_backstage"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
@ -288,6 +295,7 @@
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/tv_to_backstage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
@ -315,6 +323,7 @@
android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_setting"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
@ -324,6 +333,7 @@
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/tv_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

Loading…
Cancel
Save