From 61a9a40292b75f323f5e03835d951e0fa745cf26 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 3 Oct 2021 18:02:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/lib/theme/ATH.kt | 75 ------------------- .../theme/view/ThemeBottomNavigationVIew.kt | 27 +++++++ .../view/{ATECheckBox.kt => ThemeCheckBox.kt} | 2 +- ...{ATEProgressBar.kt => ThemeProgressBar.kt} | 2 +- ...{ATERadioButton.kt => ThemeRadioButton.kt} | 3 +- ...RadioNoButton.kt => ThemeRadioNoButton.kt} | 2 +- .../view/{ATESeekBar.kt => ThemeSeekBar.kt} | 2 +- .../view/{ATESwitch.kt => ThemeSwitch.kt} | 2 +- .../ui/book/arrange/ArrangeBookActivity.kt | 5 +- .../ui/book/read/config/MoreConfigDialog.kt | 5 +- .../book/read/config/ReadAloudConfigDialog.kt | 4 +- .../ui/book/read/config/SpeakEngineDialog.kt | 3 +- .../app/ui/book/search/SearchActivity.kt | 6 +- .../source/debug/BookSourceDebugActivity.kt | 5 +- .../source/edit/BookSourceEditActivity.kt | 4 +- .../book/source/manage/BookSourceActivity.kt | 4 +- .../app/ui/book/toc/BookmarkFragment.kt | 5 +- .../app/ui/config/BackupConfigFragment.kt | 4 +- .../app/ui/config/CoverConfigFragment.kt | 4 +- .../app/ui/config/OtherConfigFragment.kt | 4 +- .../app/ui/config/ThemeConfigFragment.kt | 4 +- .../io/legado/app/ui/main/MainActivity.kt | 6 +- .../bookshelf/style1/BookshelfFragment1.kt | 5 +- .../bookshelf/style1/books/BooksFragment.kt | 9 +-- .../bookshelf/style2/BookshelfFragment2.kt | 4 +- .../app/ui/main/explore/ExploreFragment.kt | 9 +-- .../io/legado/app/ui/main/my/MyFragment.kt | 4 +- .../io/legado/app/ui/main/rss/RssFragment.kt | 4 +- .../app/ui/replace/ReplaceRuleActivity.kt | 4 +- .../app/ui/rss/article/RssArticlesFragment.kt | 5 +- .../source/debug/RssSourceDebugActivity.kt | 5 +- .../rss/source/edit/RssSourceEditActivity.kt | 4 +- .../ui/rss/source/manage/RssSourceActivity.kt | 4 +- .../io/legado/app/utils/ViewExtensions.kt | 26 +++++++ .../main/res/layout/activity_audio_play.xml | 2 +- .../res/layout/activity_book_source_edit.xml | 4 +- app/src/main/res/layout/activity_main.xml | 2 +- .../main/res/layout/activity_replace_edit.xml | 2 +- .../res/layout/activity_rss_source_edit.xml | 8 +- app/src/main/res/layout/dialog_auto_read.xml | 2 +- .../res/layout/dialog_bookshelf_config.xml | 2 +- .../main/res/layout/dialog_custom_group.xml | 2 +- .../res/layout/dialog_progressbar_view.xml | 2 +- app/src/main/res/layout/dialog_read_aloud.xml | 6 +- .../main/res/layout/dialog_read_bg_text.xml | 2 +- .../res/layout/dialog_read_book_style.xml | 10 +-- app/src/main/res/layout/item_arrange_book.xml | 2 +- .../res/layout/item_book_group_manage.xml | 2 +- app/src/main/res/layout/item_book_source.xml | 6 +- app/src/main/res/layout/item_download.xml | 2 +- app/src/main/res/layout/item_group_select.xml | 2 +- app/src/main/res/layout/item_http_tts.xml | 2 +- app/src/main/res/layout/item_import_book.xml | 2 +- app/src/main/res/layout/item_replace_rule.xml | 4 +- app/src/main/res/layout/item_rss_source.xml | 4 +- .../main/res/layout/item_source_import.xml | 2 +- app/src/main/res/layout/item_toc_regex.xml | 4 +- .../main/res/layout/view_detail_seek_bar.xml | 2 +- app/src/main/res/layout/view_read_menu.xml | 2 +- .../res/layout/view_select_action_bar.xml | 2 +- 60 files changed, 161 insertions(+), 182 deletions(-) create mode 100644 app/src/main/java/io/legado/app/lib/theme/view/ThemeBottomNavigationVIew.kt rename app/src/main/java/io/legado/app/lib/theme/view/{ATECheckBox.kt => ThemeCheckBox.kt} (79%) rename app/src/main/java/io/legado/app/lib/theme/view/{ATEProgressBar.kt => ThemeProgressBar.kt} (79%) rename app/src/main/java/io/legado/app/lib/theme/view/{ATERadioButton.kt => ThemeRadioButton.kt} (78%) rename app/src/main/java/io/legado/app/lib/theme/view/{ATERadioNoButton.kt => ThemeRadioNoButton.kt} (97%) rename app/src/main/java/io/legado/app/lib/theme/view/{ATESeekBar.kt => ThemeSeekBar.kt} (80%) rename app/src/main/java/io/legado/app/lib/theme/view/{ATESwitch.kt => ThemeSwitch.kt} (80%) diff --git a/app/src/main/java/io/legado/app/lib/theme/ATH.kt b/app/src/main/java/io/legado/app/lib/theme/ATH.kt index af30c14d3..cd8558798 100644 --- a/app/src/main/java/io/legado/app/lib/theme/ATH.kt +++ b/app/src/main/java/io/legado/app/lib/theme/ATH.kt @@ -1,14 +1,6 @@ package io.legado.app.lib.theme import android.graphics.drawable.GradientDrawable -import android.view.View -import android.widget.EdgeEffect -import android.widget.ScrollView -import androidx.annotation.ColorInt -import androidx.recyclerview.widget.RecyclerView -import androidx.viewpager2.widget.ViewPager2 -import com.google.android.material.bottomnavigation.BottomNavigationView -import io.legado.app.utils.ColorUtils import io.legado.app.utils.dp import splitties.init.appCtx @@ -18,66 +10,6 @@ import splitties.init.appCtx @Suppress("unused", "MemberVisibilityCanBePrivate") object ATH { - fun setEdgeEffectColor(view: RecyclerView?, @ColorInt color: Int) { - view?.edgeEffectFactory = object : RecyclerView.EdgeEffectFactory() { - override fun createEdgeEffect(view: RecyclerView, direction: Int): EdgeEffect { - val edgeEffect = super.createEdgeEffect(view, direction) - edgeEffect.color = color - return edgeEffect - } - } - } - - fun setEdgeEffectColor(viewPager: ViewPager2?, @ColorInt color: Int) { - try { - val clazz = ViewPager2::class.java - for (name in arrayOf("mLeftEdge", "mRightEdge")) { - val field = clazz.getDeclaredField(name) - field.isAccessible = true - val edge = field.get(viewPager) - (edge as EdgeEffect).color = color - } - } catch (ignored: Exception) { - } - } - - fun setEdgeEffectColor(scrollView: ScrollView?, @ColorInt color: Int) { - try { - val clazz = ScrollView::class.java - for (name in arrayOf("mEdgeGlowTop", "mEdgeGlowBottom")) { - val field = clazz.getDeclaredField(name) - field.isAccessible = true - val edge = field.get(scrollView) - (edge as EdgeEffect).color = color - } - } catch (ignored: Exception) { - } - } - - //**************************************************************Directly*************************************************************// - - fun applyBottomNavigationColor(bottomBar: BottomNavigationView) { - bottomBar.apply { - val bgColor = context.bottomBackground - setBackgroundColor(bgColor) - val textIsDark = ColorUtils.isColorLight(bgColor) - val textColor = context.getSecondaryTextColor(textIsDark) - val colorStateList = Selector.colorBuild() - .setDefaultColor(textColor) - .setSelectedColor(ThemeStore.accentColor(context)).create() - itemIconTintList = colorStateList - itemTextColor = colorStateList - } - } - - fun applyEdgeEffectColor(view: View?) { - when (view) { - is RecyclerView -> view.edgeEffectFactory = DEFAULT_EFFECT_FACTORY - is ViewPager2 -> setEdgeEffectColor(view, ThemeStore.primaryColor(view.context)) - is ScrollView -> setEdgeEffectColor(view, ThemeStore.primaryColor(view.context)) - } - } - fun getDialogBackground(): GradientDrawable { val background = GradientDrawable() background.cornerRadius = 3F.dp @@ -85,11 +17,4 @@ object ATH { return background } - private val DEFAULT_EFFECT_FACTORY = object : RecyclerView.EdgeEffectFactory() { - override fun createEdgeEffect(view: RecyclerView, direction: Int): EdgeEffect { - val edgeEffect = super.createEdgeEffect(view, direction) - edgeEffect.color = ThemeStore.primaryColor(view.context) - return edgeEffect - } - } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ThemeBottomNavigationVIew.kt b/app/src/main/java/io/legado/app/lib/theme/view/ThemeBottomNavigationVIew.kt new file mode 100644 index 000000000..6e5c49c58 --- /dev/null +++ b/app/src/main/java/io/legado/app/lib/theme/view/ThemeBottomNavigationVIew.kt @@ -0,0 +1,27 @@ +package io.legado.app.lib.theme.view + +import android.content.Context +import android.util.AttributeSet +import com.google.android.material.bottomnavigation.BottomNavigationView +import io.legado.app.lib.theme.Selector +import io.legado.app.lib.theme.ThemeStore +import io.legado.app.lib.theme.bottomBackground +import io.legado.app.lib.theme.getSecondaryTextColor +import io.legado.app.utils.ColorUtils + +class ThemeBottomNavigationVIew(context: Context, attrs: AttributeSet) : + BottomNavigationView(context, attrs) { + + init { + val bgColor = context.bottomBackground + setBackgroundColor(bgColor) + val textIsDark = ColorUtils.isColorLight(bgColor) + val textColor = context.getSecondaryTextColor(textIsDark) + val colorStateList = Selector.colorBuild() + .setDefaultColor(textColor) + .setSelectedColor(ThemeStore.accentColor(context)).create() + itemIconTintList = colorStateList + itemTextColor = colorStateList + } + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATECheckBox.kt b/app/src/main/java/io/legado/app/lib/theme/view/ThemeCheckBox.kt similarity index 79% rename from app/src/main/java/io/legado/app/lib/theme/view/ATECheckBox.kt rename to app/src/main/java/io/legado/app/lib/theme/view/ThemeCheckBox.kt index 344bfd0a6..fa3daa68e 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATECheckBox.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ThemeCheckBox.kt @@ -9,7 +9,7 @@ import io.legado.app.utils.applyTint /** * @author Aidan Follestad (afollestad) */ -class ATECheckBox(context: Context, attrs: AttributeSet) : AppCompatCheckBox(context, attrs) { +class ThemeCheckBox(context: Context, attrs: AttributeSet) : AppCompatCheckBox(context, attrs) { init { if (!isInEditMode) { diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATEProgressBar.kt b/app/src/main/java/io/legado/app/lib/theme/view/ThemeProgressBar.kt similarity index 79% rename from app/src/main/java/io/legado/app/lib/theme/view/ATEProgressBar.kt rename to app/src/main/java/io/legado/app/lib/theme/view/ThemeProgressBar.kt index db2f8adbe..16772ed8a 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATEProgressBar.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ThemeProgressBar.kt @@ -9,7 +9,7 @@ import io.legado.app.utils.applyTint /** * @author Aidan Follestad (afollestad) */ -class ATEProgressBar(context: Context, attrs: AttributeSet) : ProgressBar(context, attrs) { +class ThemeProgressBar(context: Context, attrs: AttributeSet) : ProgressBar(context, attrs) { init { if (!isInEditMode) { diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATERadioButton.kt b/app/src/main/java/io/legado/app/lib/theme/view/ThemeRadioButton.kt similarity index 78% rename from app/src/main/java/io/legado/app/lib/theme/view/ATERadioButton.kt rename to app/src/main/java/io/legado/app/lib/theme/view/ThemeRadioButton.kt index ff563e63f..3c19ba119 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATERadioButton.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ThemeRadioButton.kt @@ -9,7 +9,8 @@ import io.legado.app.utils.applyTint /** * @author Aidan Follestad (afollestad) */ -class ATERadioButton(context: Context, attrs: AttributeSet) : AppCompatRadioButton(context, attrs) { +class ThemeRadioButton(context: Context, attrs: AttributeSet) : + AppCompatRadioButton(context, attrs) { init { if (!isInEditMode) { diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATERadioNoButton.kt b/app/src/main/java/io/legado/app/lib/theme/view/ThemeRadioNoButton.kt similarity index 97% rename from app/src/main/java/io/legado/app/lib/theme/view/ATERadioNoButton.kt rename to app/src/main/java/io/legado/app/lib/theme/view/ThemeRadioNoButton.kt index 1b6731098..9f46157d5 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATERadioNoButton.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ThemeRadioNoButton.kt @@ -15,7 +15,7 @@ import io.legado.app.utils.getCompatColor /** * @author Aidan Follestad (afollestad) */ -class ATERadioNoButton(context: Context, attrs: AttributeSet) : +class ThemeRadioNoButton(context: Context, attrs: AttributeSet) : AppCompatRadioButton(context, attrs) { private val isBottomBackground: Boolean diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATESeekBar.kt b/app/src/main/java/io/legado/app/lib/theme/view/ThemeSeekBar.kt similarity index 80% rename from app/src/main/java/io/legado/app/lib/theme/view/ATESeekBar.kt rename to app/src/main/java/io/legado/app/lib/theme/view/ThemeSeekBar.kt index 5feb38f0f..1c842a2e7 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATESeekBar.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ThemeSeekBar.kt @@ -9,7 +9,7 @@ import io.legado.app.utils.applyTint /** * @author Aidan Follestad (afollestad) */ -class ATESeekBar(context: Context, attrs: AttributeSet) : AppCompatSeekBar(context, attrs) { +class ThemeSeekBar(context: Context, attrs: AttributeSet) : AppCompatSeekBar(context, attrs) { init { if (!isInEditMode) { diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATESwitch.kt b/app/src/main/java/io/legado/app/lib/theme/view/ThemeSwitch.kt similarity index 80% rename from app/src/main/java/io/legado/app/lib/theme/view/ATESwitch.kt rename to app/src/main/java/io/legado/app/lib/theme/view/ThemeSwitch.kt index 488d2bb33..94b18be5c 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATESwitch.kt +++ b/app/src/main/java/io/legado/app/lib/theme/view/ThemeSwitch.kt @@ -9,7 +9,7 @@ import io.legado.app.utils.applyTint /** * @author Aidan Follestad (afollestad) */ -class ATESwitch(context: Context, attrs: AttributeSet) : SwitchCompat(context, attrs) { +class ThemeSwitch(context: Context, attrs: AttributeSet) : SwitchCompat(context, attrs) { init { if (!isInEditMode) { diff --git a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt index d0b20507c..8b05ec3b2 100644 --- a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt @@ -17,7 +17,7 @@ import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookGroup import io.legado.app.databinding.ActivityArrangeBookBinding import io.legado.app.lib.dialogs.alert -import io.legado.app.lib.theme.ATH +import io.legado.app.lib.theme.primaryColor import io.legado.app.ui.book.group.GroupManageDialog import io.legado.app.ui.book.group.GroupSelectDialog import io.legado.app.ui.widget.SelectActionBar @@ -26,6 +26,7 @@ import io.legado.app.ui.widget.recycler.ItemTouchCallback import io.legado.app.ui.widget.recycler.VerticalDivider import io.legado.app.utils.cnCompare import io.legado.app.utils.getPrefInt +import io.legado.app.utils.setEdgeEffectColor import io.legado.app.utils.showDialogFragment import io.legado.app.utils.viewbindingdelegate.viewBinding import kotlinx.coroutines.Dispatchers.IO @@ -88,7 +89,7 @@ class ArrangeBookActivity : VMBaseActivity(R.layout.fragment_bookmark } private fun initRecyclerView() { - ATH.applyEdgeEffectColor(binding.recyclerView) + binding.recyclerView.setEdgeEffectColor(primaryColor) binding.recyclerView.layoutManager = LinearLayoutManager(requireContext()) binding.recyclerView.addItemDecoration(VerticalDivider(requireContext())) binding.recyclerView.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt index 84fb72258..7e15f212d 100644 --- a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt @@ -26,8 +26,8 @@ import io.legado.app.help.storage.Restore import io.legado.app.lib.dialogs.alert import io.legado.app.lib.permission.Permissions import io.legado.app.lib.permission.PermissionsCompat -import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.accentColor +import io.legado.app.lib.theme.primaryColor import io.legado.app.ui.document.HandleFileContract import io.legado.app.ui.widget.dialog.TextDialog import io.legado.app.utils.* @@ -124,7 +124,7 @@ class BackupConfigFragment : BasePreferenceFragment(), super.onViewCreated(view, savedInstanceState) activity?.setTitle(R.string.backup_restore) preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this) - ATH.applyEdgeEffectColor(listView) + listView.setEdgeEffectColor(primaryColor) setHasOptionsMenu(true) if (!LocalConfig.backupHelpVersionIsLast) { showHelp() diff --git a/app/src/main/java/io/legado/app/ui/config/CoverConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/CoverConfigFragment.kt index 90ccaeaac..a9af38f93 100644 --- a/app/src/main/java/io/legado/app/ui/config/CoverConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/CoverConfigFragment.kt @@ -10,7 +10,7 @@ import io.legado.app.R import io.legado.app.base.BasePreferenceFragment import io.legado.app.constant.PreferKey import io.legado.app.lib.dialogs.selector -import io.legado.app.lib.theme.ATH +import io.legado.app.lib.theme.primaryColor import io.legado.app.model.BookCover import io.legado.app.ui.widget.prefs.SwitchPreference import io.legado.app.utils.* @@ -41,7 +41,7 @@ class CoverConfigFragment : BasePreferenceFragment(), override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) activity?.setTitle(R.string.cover_config) - ATH.applyEdgeEffectColor(listView) + listView.setEdgeEffectColor(primaryColor) setHasOptionsMenu(true) } diff --git a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt index 07182cd7b..abd86176d 100644 --- a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt @@ -18,7 +18,7 @@ import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.help.AppConfig import io.legado.app.help.BookHelp import io.legado.app.lib.dialogs.alert -import io.legado.app.lib.theme.ATH +import io.legado.app.lib.theme.primaryColor import io.legado.app.receiver.SharedReceiverActivity import io.legado.app.service.WebService import io.legado.app.ui.main.MainActivity @@ -50,7 +50,7 @@ class OtherConfigFragment : BasePreferenceFragment(), super.onViewCreated(view, savedInstanceState) activity?.setTitle(R.string.other_setting) preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this) - ATH.applyEdgeEffectColor(listView) + listView.setEdgeEffectColor(primaryColor) } override fun onDestroy() { diff --git a/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt index d2088d9cc..9c5bab4fe 100644 --- a/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt @@ -23,7 +23,7 @@ import io.legado.app.help.LauncherIconHelp import io.legado.app.help.ThemeConfig import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.selector -import io.legado.app.lib.theme.ATH +import io.legado.app.lib.theme.primaryColor import io.legado.app.ui.widget.number.NumberPickerDialog import io.legado.app.ui.widget.prefs.ColorPreference import io.legado.app.ui.widget.seekbar.SeekBarChangeListener @@ -81,7 +81,7 @@ class ThemeConfigFragment : BasePreferenceFragment(), override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) activity?.setTitle(R.string.theme_setting) - ATH.applyEdgeEffectColor(listView) + listView.setEdgeEffectColor(primaryColor) setHasOptionsMenu(true) } diff --git a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt index 1217cd138..df4f7007e 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt @@ -23,8 +23,8 @@ import io.legado.app.help.AppConfig import io.legado.app.help.BookHelp import io.legado.app.help.LocalConfig import io.legado.app.help.storage.Backup -import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.elevation +import io.legado.app.lib.theme.primaryColor import io.legado.app.service.BaseReadAloudService import io.legado.app.ui.main.bookshelf.BaseBookshelfFragment import io.legado.app.ui.main.bookshelf.style1.BookshelfFragment1 @@ -34,6 +34,7 @@ import io.legado.app.ui.main.my.MyFragment import io.legado.app.ui.main.rss.RssFragment import io.legado.app.ui.widget.dialog.TextDialog import io.legado.app.utils.observeEvent +import io.legado.app.utils.setEdgeEffectColor import io.legado.app.utils.showDialogFragment import io.legado.app.utils.toastOnUi import io.legado.app.utils.viewbindingdelegate.viewBinding @@ -56,8 +57,7 @@ class MainActivity : VMBaseActivity(), override fun onActivityCreated(savedInstanceState: Bundle?) { upBottomMenu() binding.apply { - ATH.applyEdgeEffectColor(viewPagerMain) - ATH.applyBottomNavigationColor(bottomNavigationView) + viewPagerMain.setEdgeEffectColor(primaryColor) viewPagerMain.offscreenPageLimit = 3 viewPagerMain.adapter = TabFragmentPageAdapter(supportFragmentManager) viewPagerMain.addOnPageChangeListener(PageChangeCallback()) diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/BookshelfFragment1.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/BookshelfFragment1.kt index b5aa82e91..41af7bf8a 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/BookshelfFragment1.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/BookshelfFragment1.kt @@ -17,13 +17,14 @@ import io.legado.app.data.appDb import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookGroup import io.legado.app.databinding.FragmentBookshelfBinding -import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.accentColor +import io.legado.app.lib.theme.primaryColor import io.legado.app.ui.book.search.SearchActivity import io.legado.app.ui.main.bookshelf.BaseBookshelfFragment import io.legado.app.ui.main.bookshelf.style1.books.BooksFragment import io.legado.app.utils.getPrefInt import io.legado.app.utils.putPrefInt +import io.legado.app.utils.setEdgeEffectColor import io.legado.app.utils.toastOnUi import io.legado.app.utils.viewbindingdelegate.viewBinding import kotlinx.coroutines.flow.collect @@ -62,7 +63,7 @@ class BookshelfFragment1 : BaseBookshelfFragment(R.layout.fragment_bookshelf), get() = bookGroups[tabLayout.selectedTabPosition] private fun initView() { - ATH.applyEdgeEffectColor(binding.viewPagerBookshelf) + binding.viewPagerBookshelf.setEdgeEffectColor(primaryColor) tabLayout.isTabIndicatorFullWidth = false tabLayout.tabMode = TabLayout.MODE_SCROLLABLE tabLayout.setSelectedTabIndicatorColor(requireContext().accentColor) diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksFragment.kt index f1ed5656e..e859b5cdd 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksFragment.kt @@ -18,16 +18,13 @@ import io.legado.app.data.appDb import io.legado.app.data.entities.Book import io.legado.app.databinding.FragmentBooksBinding import io.legado.app.help.AppConfig -import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.accentColor +import io.legado.app.lib.theme.primaryColor import io.legado.app.ui.book.audio.AudioPlayActivity import io.legado.app.ui.book.info.BookInfoActivity import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.main.MainViewModel -import io.legado.app.utils.cnCompare -import io.legado.app.utils.getPrefInt -import io.legado.app.utils.observeEvent -import io.legado.app.utils.startActivity +import io.legado.app.utils.* import io.legado.app.utils.viewbindingdelegate.viewBinding import kotlinx.coroutines.Job import kotlinx.coroutines.flow.collect @@ -65,7 +62,7 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books), } private fun initRecyclerView() { - ATH.applyEdgeEffectColor(binding.rvBookshelf) + binding.rvBookshelf.setEdgeEffectColor(primaryColor) binding.refreshLayout.setColorSchemeColors(accentColor) binding.refreshLayout.setOnRefreshListener { binding.refreshLayout.isRefreshing = false diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt index f7dcb8d12..6b0ce4d1b 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt @@ -18,8 +18,8 @@ import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookGroup import io.legado.app.databinding.FragmentBookshelf1Binding import io.legado.app.help.AppConfig -import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.accentColor +import io.legado.app.lib.theme.primaryColor import io.legado.app.ui.book.audio.AudioPlayActivity import io.legado.app.ui.book.group.GroupEditDialog import io.legado.app.ui.book.info.BookInfoActivity @@ -55,7 +55,7 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1), } private fun initRecyclerView() { - ATH.applyEdgeEffectColor(binding.rvBookshelf) + binding.rvBookshelf.setEdgeEffectColor(primaryColor) binding.refreshLayout.setColorSchemeColors(accentColor) binding.refreshLayout.setOnRefreshListener { binding.refreshLayout.isRefreshing = false diff --git a/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt b/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt index 144efd8d0..65e61300a 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt @@ -19,14 +19,11 @@ import io.legado.app.data.appDb import io.legado.app.data.entities.BookSource import io.legado.app.databinding.FragmentExploreBinding import io.legado.app.help.AppConfig -import io.legado.app.lib.theme.ATH +import io.legado.app.lib.theme.primaryColor import io.legado.app.lib.theme.primaryTextColor import io.legado.app.ui.book.explore.ExploreShowActivity import io.legado.app.ui.book.source.edit.BookSourceEditActivity -import io.legado.app.utils.applyTint -import io.legado.app.utils.cnCompare -import io.legado.app.utils.splitNotBlank -import io.legado.app.utils.startActivity +import io.legado.app.utils.* import io.legado.app.utils.viewbindingdelegate.viewBinding import kotlinx.coroutines.Job import kotlinx.coroutines.flow.collect @@ -87,7 +84,7 @@ class ExploreFragment : VMBaseFragment(R.layout.fragment_explo } private fun initRecyclerView() { - ATH.applyEdgeEffectColor(binding.rvFind) + binding.rvFind.setEdgeEffectColor(primaryColor) binding.rvFind.layoutManager = linearLayoutManager binding.rvFind.adapter = adapter adapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() { diff --git a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt index f92e3fa40..07a91c0bf 100644 --- a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt @@ -14,7 +14,7 @@ import io.legado.app.constant.PreferKey import io.legado.app.databinding.FragmentMyConfigBinding import io.legado.app.help.AppConfig import io.legado.app.help.ThemeConfig -import io.legado.app.lib.theme.ATH +import io.legado.app.lib.theme.primaryColor import io.legado.app.service.WebService import io.legado.app.ui.about.AboutActivity import io.legado.app.ui.about.DonateActivity @@ -89,7 +89,7 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - ATH.applyEdgeEffectColor(listView) + listView.setEdgeEffectColor(primaryColor) } override fun onResume() { diff --git a/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt b/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt index f4150041a..fa6925e12 100644 --- a/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt @@ -14,7 +14,7 @@ import io.legado.app.data.appDb import io.legado.app.data.entities.RssSource import io.legado.app.databinding.FragmentRssBinding import io.legado.app.databinding.ItemRssBinding -import io.legado.app.lib.theme.ATH +import io.legado.app.lib.theme.primaryColor import io.legado.app.lib.theme.primaryTextColor import io.legado.app.ui.rss.article.RssSortActivity import io.legado.app.ui.rss.favorites.RssFavoritesActivity @@ -103,7 +103,7 @@ class RssFragment : VMBaseFragment(R.layout.fragment_rss), } private fun initRecyclerView() { - ATH.applyEdgeEffectColor(binding.recyclerView) + binding.recyclerView.setEdgeEffectColor(primaryColor) binding.recyclerView.adapter = adapter adapter.addHeaderView { ItemRssBinding.inflate(layoutInflater, it, false).apply { diff --git a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt index bd5a45c96..611708aea 100644 --- a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt @@ -23,7 +23,7 @@ import io.legado.app.help.ContentProcessor import io.legado.app.help.DirectLinkUpload import io.legado.app.help.coroutine.Coroutine import io.legado.app.lib.dialogs.alert -import io.legado.app.lib.theme.ATH +import io.legado.app.lib.theme.primaryColor import io.legado.app.lib.theme.primaryTextColor import io.legado.app.ui.association.ImportReplaceRuleDialog import io.legado.app.ui.document.HandleFileContract @@ -121,7 +121,7 @@ class ReplaceRuleActivity : VMBaseActivity(R.layout.frag private fun initView() = binding.run { refreshLayout.setColorSchemeColors(accentColor) - ATH.applyEdgeEffectColor(recyclerView) + recyclerView.setEdgeEffectColor(primaryColor) recyclerView.layoutManager = if (activityViewModel.isGridLayout) { recyclerView.setPadding(8, 0, 8, 0) GridLayoutManager(requireContext(), 2) diff --git a/app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugActivity.kt index 2e1197152..812d536fd 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugActivity.kt @@ -8,10 +8,11 @@ import androidx.activity.viewModels import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.databinding.ActivitySourceDebugBinding -import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.accentColor +import io.legado.app.lib.theme.primaryColor import io.legado.app.ui.widget.dialog.TextDialog import io.legado.app.utils.gone +import io.legado.app.utils.setEdgeEffectColor import io.legado.app.utils.showDialogFragment import io.legado.app.utils.toastOnUi import io.legado.app.utils.viewbindingdelegate.viewBinding @@ -55,7 +56,7 @@ class RssSourceDebugActivity : VMBaseActivity - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/item_book_source.xml b/app/src/main/res/layout/item_book_source.xml index 5108b4085..adc4c5b71 100644 --- a/app/src/main/res/layout/item_book_source.xml +++ b/app/src/main/res/layout/item_book_source.xml @@ -7,7 +7,7 @@ android:background="?android:attr/selectableItemBackground" android:padding="16dp"> - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/view_detail_seek_bar.xml b/app/src/main/res/layout/view_detail_seek_bar.xml index 675268252..1b5adcf89 100644 --- a/app/src/main/res/layout/view_detail_seek_bar.xml +++ b/app/src/main/res/layout/view_detail_seek_bar.xml @@ -24,7 +24,7 @@ android:background="?android:attr/selectableItemBackgroundBorderless" android:tint="@color/primaryText" /> - - -