From 92d6012e9f4a17d2a637d071b6acec5260a497f3 Mon Sep 17 00:00:00 2001 From: Modificator Date: Fri, 22 May 2020 23:34:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=20E-Ink=20=E5=BC=80=E5=85=B3?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E6=95=B4=E4=B8=BB=E9=A2=98=20=E9=BB=91?= =?UTF-8?q?=E7=99=BD=E3=80=81A=20=E5=B1=8F=E9=BB=91=E5=BA=95=E6=A0=8F?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=EF=BC=8C=E4=B9=A6=E6=9E=B6=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 ++ .../main/java/io/legado/app/constant/PreferKey.kt | 1 + .../io/legado/app/ui/config/ThemeConfigFragment.kt | 4 +++- .../app/ui/main/bookshelf/books/BooksFragment.kt | 2 ++ .../java/io/legado/app/ui/main/my/MyFragment.kt | 3 +++ app/src/main/res/layout/fragment_books.xml | 2 +- app/src/main/res/xml/pref_main.xml | 14 +++++++------- 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ec6d22bdb..24cbf4510 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -193,6 +193,8 @@ dependencies { //转换繁体 implementation 'com.hankcs:hanlp:portable-1.7.7' + //E-Ink + implementation 'fadeapp.widgets:scrollless-recyclerView:1.0.2' } apply plugin: 'com.google.gms.google-services' diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt index 8913956d3..175180a33 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -43,4 +43,5 @@ object PreferKey { const val readStyleSelect = "readStyleSelect" const val systemTypefaces = "system_typefaces" const val readBodyToLh = "readBodyToLh" + const val einkMode = "isEInkMode" } \ No newline at end of file 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 770b1830a..6416040c3 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 @@ -156,18 +156,20 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar putPrefInt("colorPrimary", getCompatColor(R.color.white)) putPrefInt("colorAccent", getCompatColor(R.color.black)) putPrefInt("colorBackground", getCompatColor(R.color.white)) + putPrefInt("colorBottomBackground", getCompatColor(R.color.white)) AppConfig.isNightTheme = false } 4 -> { putPrefInt("colorPrimaryNight", getCompatColor(R.color.black)) putPrefInt( "colorAccentNight", - getCompatColor(R.color.md_grey_600) + getCompatColor(R.color.md_grey_500) ) putPrefInt( "colorBackgroundNight", getCompatColor(R.color.black) ) + putPrefInt("colorBottomBackgroundNight", getCompatColor(R.color.black)) AppConfig.isNightTheme = true } } diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt index ab8984752..29a8e1d9a 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt @@ -16,6 +16,7 @@ import io.legado.app.constant.BookType import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey import io.legado.app.data.entities.Book +import io.legado.app.help.AppConfig import io.legado.app.help.IntentDataHelp import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.accentColor @@ -76,6 +77,7 @@ class BooksFragment : BaseFragment(R.layout.fragment_books), rv_bookshelf.layoutManager = GridLayoutManager(context, bookshelfLayout + 2) booksAdapter = BooksAdapterGrid(requireContext(), this) } + rv_bookshelf.isEnableScroll = !AppConfig.isEInkMode rv_bookshelf.adapter = booksAdapter booksAdapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() { override fun onItemRangeInserted(positionStart: Int, itemCount: Int) { 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 88bb95afe..dab9eb544 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 @@ -121,6 +121,9 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config), FileChooserDialog. } } "recordLog" -> LogUtils.upLevel() + PreferKey.einkMode -> { + postEvent(EventBus.RECREATE, "") + } } } diff --git a/app/src/main/res/layout/fragment_books.xml b/app/src/main/res/layout/fragment_books.xml index 30f8ce74c..e049610e2 100644 --- a/app/src/main/res/layout/fragment_books.xml +++ b/app/src/main/res/layout/fragment_books.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - diff --git a/app/src/main/res/xml/pref_main.xml b/app/src/main/res/xml/pref_main.xml index e25834b5f..72a02e97a 100644 --- a/app/src/main/res/xml/pref_main.xml +++ b/app/src/main/res/xml/pref_main.xml @@ -30,13 +30,13 @@ android:icon="@drawable/ic_cfg_theme" app:iconSpaceReserved="false" /> - +