pull/2368/head
kunfei 2 years ago
parent 63d61a6ffe
commit b1dd1f8002
  1. 26
      app/src/main/java/io/legado/app/lib/theme/MaterialValueHelper.kt
  2. 9
      app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt
  3. 17
      app/src/main/java/io/legado/app/ui/book/read/SearchMenu.kt
  4. 9
      app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt
  5. 11
      app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt
  6. 5
      app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt
  7. 5
      app/src/main/java/io/legado/app/ui/widget/DetailSeekBar.kt
  8. 7
      app/src/main/java/io/legado/app/ui/widget/SelectActionBar.kt

@ -19,37 +19,27 @@ import io.legado.app.utils.dpToPx
@ColorInt
fun Context.getPrimaryTextColor(dark: Boolean): Int {
return if (dark) {
ContextCompat.getColor(this, androidx.appcompat.R.color.primary_text_default_material_light)
} else ContextCompat.getColor(
this,
androidx.appcompat.R.color.primary_text_default_material_dark
)
ContextCompat.getColor(this, R.color.md_light_primary_text)
} else {
ContextCompat.getColor(this, R.color.md_dark_primary_text)
}
}
@ColorInt
fun Context.getSecondaryTextColor(dark: Boolean): Int {
return if (dark) {
ContextCompat.getColor(
this,
androidx.appcompat.R.color.secondary_text_default_material_light
)
ContextCompat.getColor(this, R.color.md_light_secondary)
} else {
ContextCompat.getColor(
this,
androidx.appcompat.R.color.secondary_text_default_material_dark
)
ContextCompat.getColor(this, R.color.md_dark_primary_text)
}
}
@ColorInt
fun Context.getPrimaryDisabledTextColor(dark: Boolean): Int {
return if (dark) {
ContextCompat.getColor(
this,
androidx.appcompat.R.color.primary_text_disabled_material_light
)
ContextCompat.getColor(this, R.color.md_light_disabled)
} else {
ContextCompat.getColor(this, androidx.appcompat.R.color.primary_text_disabled_material_dark)
ContextCompat.getColor(this, R.color.md_dark_disabled)
}
}

@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.PorterDuff
import android.graphics.drawable.GradientDrawable
import android.util.AttributeSet
import android.view.Gravity
@ -188,13 +189,13 @@ class ReadMenu @JvmOverloads constructor(
fabNightTheme.setColorFilter(textColor)
tvPre.setTextColor(textColor)
tvNext.setTextColor(textColor)
ivCatalog.setColorFilter(textColor)
ivCatalog.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
tvCatalog.setTextColor(textColor)
ivReadAloud.setColorFilter(textColor)
ivReadAloud.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
tvReadAloud.setTextColor(textColor)
ivFont.setColorFilter(textColor)
ivFont.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
tvFont.setTextColor(textColor)
ivSetting.setColorFilter(textColor)
ivSetting.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
tvSetting.setTextColor(textColor)
vwBg.setOnClickListener(null)
llBrightness.setOnClickListener(null)

@ -3,6 +3,7 @@ package io.legado.app.ui.book.read
import android.annotation.SuppressLint
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.PorterDuff
import android.util.AttributeSet
import android.view.Gravity
import android.view.LayoutInflater
@ -70,19 +71,17 @@ class SearchMenu @JvmOverloads constructor(
tvCurrentSearchInfo.setTextColor(bottomBackgroundList)
llBottomBg.setBackgroundColor(bgColor)
fabLeft.backgroundTintList = bottomBackgroundList
fabLeft.setColorFilter(textColor)
fabLeft.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
fabRight.backgroundTintList = bottomBackgroundList
fabRight.setColorFilter(textColor)
fabRight.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
tvMainMenu.setTextColor(textColor)
tvSearchResults.setTextColor(textColor)
tvSearchExit.setTextColor(textColor)
//tvSetting.setTextColor(textColor)
ivMainMenu.setColorFilter(textColor)
ivSearchResults.setColorFilter(textColor)
ivSearchExit.setColorFilter(textColor)
//ivSetting.setColorFilter(textColor)
ivSearchContentUp.setColorFilter(textColor)
ivSearchContentDown.setColorFilter(textColor)
ivMainMenu.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
ivSearchResults.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
ivSearchExit.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
ivSearchContentUp.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
ivSearchContentDown.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
tvCurrentSearchInfo.setTextColor(textColor)
}

@ -1,6 +1,7 @@
package io.legado.app.ui.book.read.config
import android.content.DialogInterface
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.Gravity
import android.view.View
@ -55,13 +56,13 @@ class AutoReadDialog : BaseDialogFragment(R.layout.dialog_auto_read) {
root.setBackgroundColor(bg)
tvReadSpeedTitle.setTextColor(textColor)
tvReadSpeed.setTextColor(textColor)
ivCatalog.setColorFilter(textColor)
ivCatalog.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
tvCatalog.setTextColor(textColor)
ivMainMenu.setColorFilter(textColor)
ivMainMenu.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
tvMainMenu.setTextColor(textColor)
ivAutoPageStop.setColorFilter(textColor)
ivAutoPageStop.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
tvAutoPageStop.setTextColor(textColor)
ivSetting.setColorFilter(textColor)
ivSetting.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
tvSetting.setTextColor(textColor)
initOnChange()
initData()

@ -3,6 +3,7 @@ package io.legado.app.ui.book.read.config
import android.annotation.SuppressLint
import android.content.DialogInterface
import android.graphics.Color
import android.graphics.PorterDuff
import android.net.Uri
import android.os.Bundle
import android.view.Gravity
@ -105,12 +106,12 @@ class BgTextConfigDialog : BaseDialogFragment(R.layout.dialog_read_bg_text) {
rootView.setBackgroundColor(bg)
tvNameTitle.setTextColor(primaryTextColor)
tvName.setTextColor(secondaryTextColor)
ivEdit.setColorFilter(secondaryTextColor)
ivEdit.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN)
tvRestore.setTextColor(primaryTextColor)
swDarkStatusIcon.setTextColor(primaryTextColor)
ivImport.setColorFilter(primaryTextColor)
ivExport.setColorFilter(primaryTextColor)
ivDelete.setColorFilter(primaryTextColor)
ivImport.setColorFilter(primaryTextColor, PorterDuff.Mode.SRC_IN)
ivExport.setColorFilter(primaryTextColor, PorterDuff.Mode.SRC_IN)
ivDelete.setColorFilter(primaryTextColor, PorterDuff.Mode.SRC_IN)
tvBgAlpha.setTextColor(primaryTextColor)
tvBgImage.setTextColor(primaryTextColor)
recyclerView.adapter = adapter
@ -119,7 +120,7 @@ class BgTextConfigDialog : BaseDialogFragment(R.layout.dialog_read_bg_text) {
tvName.setTextColor(secondaryTextColor)
tvName.text = getString(R.string.select_image)
ivBg.setImageResource(R.drawable.ic_image)
ivBg.setColorFilter(primaryTextColor)
ivBg.setColorFilter(primaryTextColor, PorterDuff.Mode.SRC_IN)
root.setOnClickListener {
selectBgImage.launch()
}

@ -3,6 +3,7 @@ package io.legado.app.ui.book.toc
import android.annotation.SuppressLint
import android.app.Activity.RESULT_OK
import android.content.Intent
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.View
import androidx.fragment.app.activityViewModels
@ -44,8 +45,8 @@ class ChapterListFragment : VMBaseFragment<TocViewModel>(R.layout.fragment_chapt
val btc = requireContext().getPrimaryTextColor(ColorUtils.isColorLight(bbg))
llChapterBaseInfo.setBackgroundColor(bbg)
tvCurrentChapterInfo.setTextColor(btc)
ivChapterTop.setColorFilter(btc)
ivChapterBottom.setColorFilter(btc)
ivChapterTop.setColorFilter(btc, PorterDuff.Mode.SRC_IN)
ivChapterBottom.setColorFilter(btc, PorterDuff.Mode.SRC_IN)
initRecyclerView()
initView()
viewModel.bookData.observe(this@ChapterListFragment) {

@ -1,6 +1,7 @@
package io.legado.app.ui.widget
import android.content.Context
import android.graphics.PorterDuff
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
@ -47,8 +48,8 @@ class DetailSeekBar @JvmOverloads constructor(
val isLight = ColorUtils.isColorLight(context.bottomBackground)
val textColor = context.getPrimaryTextColor(isLight)
binding.tvSeekTitle.setTextColor(textColor)
binding.ivSeekPlus.setColorFilter(textColor)
binding.ivSeekReduce.setColorFilter(textColor)
binding.ivSeekPlus.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
binding.ivSeekReduce.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
binding.tvSeekValue.setTextColor(textColor)
}
binding.ivSeekPlus.setOnClickListener {

@ -1,6 +1,7 @@
package io.legado.app.ui.widget
import android.content.Context
import android.graphics.PorterDuff
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.Menu
@ -35,7 +36,7 @@ class SelectActionBar @JvmOverloads constructor(
elevation = context.elevation
binding.cbSelectedAll.setTextColor(primaryTextColor)
TintHelper.setTint(binding.cbSelectedAll, context.accentColor, !bgIsLight)
binding.ivMenuMore.setColorFilter(disabledColor)
binding.ivMenuMore.setColorFilter(disabledColor, PorterDuff.Mode.SRC_IN)
binding.cbSelectedAll.setOnCheckedChangeListener { buttonView, isChecked ->
if (buttonView.isPressed) {
callBack?.selectAll(isChecked)
@ -101,9 +102,9 @@ class SelectActionBar @JvmOverloads constructor(
btnSelectActionMain.isEnabled = isClickable
btnSelectActionMain.isClickable = isClickable
if (isClickable) {
ivMenuMore.setColorFilter(primaryTextColor)
ivMenuMore.setColorFilter(primaryTextColor, PorterDuff.Mode.SRC_IN)
} else {
ivMenuMore.setColorFilter(disabledColor)
ivMenuMore.setColorFilter(disabledColor, PorterDuff.Mode.SRC_IN)
}
ivMenuMore.isEnabled = isClickable
ivMenuMore.isClickable = isClickable

Loading…
Cancel
Save