From a96aa109544805db4c9484b22d0593cfb796e20e Mon Sep 17 00:00:00 2001 From: Modificator Date: Sun, 26 Jan 2020 13:43:47 +0800 Subject: [PATCH 1/8] ignore signing without property --- app/build.gradle | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7eac96051..cae1dac53 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,13 +20,15 @@ def gitCommits = Integer.parseInt('git rev-list --count HEAD'.execute([], projec android { compileSdkVersion 29 signingConfigs { - myConfig { - storeFile file(RELEASE_STORE_FILE) - storePassword RELEASE_STORE_PASSWORD - keyAlias RELEASE_KEY_ALIAS - keyPassword RELEASE_KEY_PASSWORD - v1SigningEnabled true - v2SigningEnabled true + if (project.hasProperty("RELEASE_STORE_FILE")) { + myConfig { + storeFile file(RELEASE_STORE_FILE) + storePassword RELEASE_STORE_PASSWORD + keyAlias RELEASE_KEY_ALIAS + keyPassword RELEASE_KEY_PASSWORD + v1SigningEnabled true + v2SigningEnabled true + } } } defaultConfig { @@ -49,12 +51,16 @@ android { } buildTypes { release { - signingConfig signingConfigs.myConfig + if (project.hasProperty("RELEASE_STORE_FILE")) { + signingConfig signingConfigs.myConfig + } minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } debug { - signingConfig signingConfigs.myConfig + if (project.hasProperty("RELEASE_STORE_FILE")) { + signingConfig signingConfigs.myConfig + } applicationIdSuffix '.debug' versionNameSuffix 'debug' minifyEnabled false From e7c67fcc9d7765b243f50c0f8ca6793be14e658c Mon Sep 17 00:00:00 2001 From: Modificator Date: Sun, 26 Jan 2020 14:45:22 +0800 Subject: [PATCH 2/8] =?UTF-8?q?add=20theme.=20=E9=BB=91=E7=99=BD=E3=80=81A?= =?UTF-8?q?=E5=B1=8F=E9=BB=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/lib/theme/ATH.kt | 6 ++++-- .../io/legado/app/ui/config/ThemeConfigFragment.kt | 14 +++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) 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 57c7c8403..46622b869 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 @@ -5,6 +5,7 @@ import android.app.Activity import android.app.ActivityManager import android.content.Context import android.graphics.Color +import android.graphics.drawable.ColorDrawable import android.os.Build import android.view.View import android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR @@ -206,10 +207,11 @@ object ATH { .setSelectedColor(ThemeStore.accentColor(bottom_navigation_view.context)).create() itemIconTintList = colorStateList itemTextColor = colorStateList - itemBackgroundResource = when(context.isNightTheme) { + itemBackground = ColorDrawable(ThemeStore.primaryColor(bottomBar.context)) + /*itemBackgroundResource = when(context.isNightTheme) { true -> R.drawable.item_bg_dark false -> R.drawable.item_bg_light - } + }*/ } } 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 6c87ff0af..4dff95998 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 @@ -20,7 +20,7 @@ import io.legado.app.utils.* class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener { - val items = arrayOf("极简","曜夜","经典") + val items = arrayOf("极简","曜夜","经典","黑白","A屏黑") override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { addPreferencesFromResource(R.xml.pref_config_theme) @@ -124,6 +124,18 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar putPrefInt("colorBackground", getCompatColor(R.color.md_grey_100)) putPrefBoolean("isNightTheme", false) } + 3 -> { + putPrefInt("colorPrimary", getCompatColor(R.color.white)) + putPrefInt("colorAccent", getCompatColor(R.color.black)) + putPrefInt("colorBackground", getCompatColor(R.color.white)) + putPrefBoolean("isNightTheme", false) + } + 4 -> { + putPrefInt("colorPrimaryNight", getCompatColor(R.color.black)) + putPrefInt("colorAccentNight", getCompatColor(R.color.md_grey_600)) + putPrefInt("colorBackgroundNight", getCompatColor(R.color.black)) + putPrefBoolean("isNightTheme", true) + } } App.INSTANCE.applyDayNight() recreateActivities() From 433711e0f19952b8f42ceb5b39693104e5daf4e8 Mon Sep 17 00:00:00 2001 From: Modificator Date: Mon, 27 Jan 2020 17:22:30 +0800 Subject: [PATCH 3/8] add e-ink mode --- app/src/main/java/io/legado/app/utils/ContextExtensions.kt | 3 +++ app/src/main/res/values/strings.xml | 3 ++- app/src/main/res/xml/pref_main.xml | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/utils/ContextExtensions.kt b/app/src/main/java/io/legado/app/utils/ContextExtensions.kt index 7b920dfa7..e53b33e30 100644 --- a/app/src/main/java/io/legado/app/utils/ContextExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/ContextExtensions.kt @@ -129,5 +129,8 @@ fun Context.shareWithQr(title: String, text: String) { val Context.isNightTheme: Boolean get() = getPrefBoolean("isNightTheme") +val Context.isEInkMode: Boolean + get() = getPrefBoolean("isEInkMode") + val Context.isTransparentStatusBar: Boolean get() = getPrefBoolean("transparentStatusBar", true) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 12ceceb6d..d481ccdff 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -77,7 +77,7 @@ 共%s个Text文件 加载中… 重试 - Web服务 + Web 服务 web编辑书源 http://%s:%d 离线下载 @@ -447,6 +447,7 @@ 切换显示样式 导入本地书籍需存储权限 夜间模式 + E-Ink 模式 本软件需要存储权限来存储备份书籍信息 再按一次退出程序 导入本地书籍需存储权限 diff --git a/app/src/main/res/xml/pref_main.xml b/app/src/main/res/xml/pref_main.xml index 297298599..f59dff9f7 100644 --- a/app/src/main/res/xml/pref_main.xml +++ b/app/src/main/res/xml/pref_main.xml @@ -18,6 +18,12 @@ android:title="@string/night_theme" app:iconSpaceReserved="false" /> + + Date: Wed, 29 Jan 2020 00:02:17 +0800 Subject: [PATCH 4/8] = --- app/src/main/res/xml/pref_main.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/src/main/res/xml/pref_main.xml b/app/src/main/res/xml/pref_main.xml index ea32b2865..29e66e13e 100644 --- a/app/src/main/res/xml/pref_main.xml +++ b/app/src/main/res/xml/pref_main.xml @@ -26,12 +26,6 @@ android:title="@string/eink_theme" app:iconSpaceReserved="false" /> - - Date: Fri, 22 May 2020 23:34:27 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E6=81=A2=E5=A4=8D=20E-Ink=20=E5=BC=80?= =?UTF-8?q?=E5=85=B3=EF=BC=8C=E8=B0=83=E6=95=B4=E4=B8=BB=E9=A2=98=20?= =?UTF-8?q?=E9=BB=91=E7=99=BD=E3=80=81A=20=E5=B1=8F=E9=BB=91=E5=BA=95?= =?UTF-8?q?=E6=A0=8F=E9=A2=9C=E8=89=B2=EF=BC=8C=E4=B9=A6=E6=9E=B6=E5=88=97?= =?UTF-8?q?=E8=A1=A8=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" /> - + Date: Wed, 27 May 2020 01:31:27 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E5=95=8A=E5=93=88=EF=BC=8C=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=9A=84=20RecyclerView=20=E9=83=BD=E7=BB=99=E5=8A=A0?= =?UTF-8?q?=E4=B8=8A=E4=BA=86=E5=8A=A8=E7=94=BB=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/arrange/ArrangeBookActivity.kt | 2 ++ .../io/legado/app/ui/book/changecover/ChangeCoverDialog.kt | 2 ++ .../legado/app/ui/book/changesource/ChangeSourceDialog.kt | 2 ++ .../java/io/legado/app/ui/book/download/DownloadActivity.kt | 2 ++ .../io/legado/app/ui/book/explore/ExploreShowActivity.kt | 2 ++ .../java/io/legado/app/ui/book/group/GroupManageDialog.kt | 1 + .../java/io/legado/app/ui/book/group/GroupSelectDialog.kt | 2 ++ .../java/io/legado/app/ui/book/local/ImportBookActivity.kt | 1 + .../main/java/io/legado/app/ui/book/read/TextActionMenu.kt | 2 ++ .../io/legado/app/ui/book/read/config/BgTextConfigDialog.kt | 2 ++ .../io/legado/app/ui/book/read/config/TocRegexDialog.kt | 2 ++ .../java/io/legado/app/ui/book/search/SearchActivity.kt | 4 ++++ .../app/ui/book/source/debug/BookSourceDebugActivity.kt | 2 ++ .../app/ui/book/source/edit/BookSourceEditActivity.kt | 2 ++ .../legado/app/ui/book/source/manage/BookSourceActivity.kt | 2 ++ .../legado/app/ui/book/source/manage/GroupManageDialog.kt | 2 ++ .../java/io/legado/app/ui/filechooser/FileChooserDialog.kt | 3 +++ .../java/io/legado/app/ui/main/explore/ExploreFragment.kt | 2 ++ app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt | 2 ++ .../java/io/legado/app/ui/replacerule/GroupManageDialog.kt | 2 ++ .../io/legado/app/ui/replacerule/ReplaceRuleActivity.kt | 2 ++ .../app/ui/rss/source/debug/RssSourceDebugActivity.kt | 2 ++ .../legado/app/ui/rss/source/edit/RssSourceEditActivity.kt | 2 ++ .../io/legado/app/ui/rss/source/manage/GroupManageDialog.kt | 2 ++ .../io/legado/app/ui/rss/source/manage/RssSourceActivity.kt | 2 ++ .../main/java/io/legado/app/ui/widget/KeyboardToolPop.kt | 2 ++ .../java/io/legado/app/ui/widget/font/FontSelectDialog.kt | 1 + .../io/legado/app/ui/widget/prefs/IconListPreference.kt | 2 ++ .../io/legado/app/ui/widget/recycler/RefreshRecyclerView.kt | 2 ++ .../ui/widget/recycler/scroller/FastScrollRecyclerView.kt | 6 ++++-- app/src/main/res/layout/activity_arrange_book.xml | 2 +- app/src/main/res/layout/activity_book_search.xml | 6 +++--- app/src/main/res/layout/activity_book_source_edit.xml | 2 +- app/src/main/res/layout/activity_download.xml | 2 +- app/src/main/res/layout/activity_explore_show.xml | 2 +- app/src/main/res/layout/activity_import_book.xml | 2 +- app/src/main/res/layout/activity_replace_rule.xml | 2 +- app/src/main/res/layout/activity_rss_source_edit.xml | 2 +- app/src/main/res/layout/activity_source_debug.xml | 2 +- app/src/main/res/layout/dialog_book_group_picker.xml | 2 +- app/src/main/res/layout/dialog_change_cover.xml | 2 +- app/src/main/res/layout/dialog_change_source.xml | 2 +- app/src/main/res/layout/dialog_file_chooser.xml | 4 ++-- app/src/main/res/layout/dialog_font_select.xml | 2 +- app/src/main/res/layout/dialog_read_bg_text.xml | 2 +- app/src/main/res/layout/dialog_recycler_view.xml | 2 +- app/src/main/res/layout/dialog_toc_regex.xml | 2 +- app/src/main/res/layout/fragment_find_book.xml | 2 +- app/src/main/res/layout/fragment_rss.xml | 2 +- app/src/main/res/layout/popup_action_menu.xml | 4 ++-- app/src/main/res/layout/popup_keyboard_tool.xml | 2 +- app/src/main/res/layout/view_refresh_recycler.xml | 2 +- 52 files changed, 88 insertions(+), 28 deletions(-) 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 491922cb1..2d93dfdee 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 @@ -15,6 +15,7 @@ import io.legado.app.constant.AppConst import io.legado.app.constant.PreferKey import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookGroup +import io.legado.app.help.AppConfig import io.legado.app.help.ItemTouchCallback import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.noButton @@ -65,6 +66,7 @@ class ArrangeBookActivity : VMBaseActivity(R.layout.activi private fun initView() { ATH.applyEdgeEffectColor(recycler_view) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.addItemDecoration(VerticalDivider(this)) adapter = ArrangeBookAdapter(this, this) diff --git a/app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt b/app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt index 85df58172..0df08af73 100644 --- a/app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt @@ -14,6 +14,7 @@ import androidx.recyclerview.widget.GridLayoutManager import io.legado.app.R import io.legado.app.base.BaseDialogFragment import io.legado.app.constant.Theme +import io.legado.app.help.AppConfig import io.legado.app.utils.applyTint import io.legado.app.utils.getViewModel import kotlinx.android.synthetic.main.dialog_change_source.* @@ -73,6 +74,7 @@ class ChangeCoverDialog : BaseDialogFragment(), } private fun initView() { + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = GridLayoutManager(requireContext(), 3) adapter = CoverAdapter(requireContext(), this) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt index 09fa066ec..09e1cdb74 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt @@ -19,6 +19,7 @@ import io.legado.app.constant.PreferKey import io.legado.app.constant.Theme import io.legado.app.data.entities.Book import io.legado.app.data.entities.SearchBook +import io.legado.app.help.AppConfig import io.legado.app.ui.widget.recycler.VerticalDivider import io.legado.app.utils.applyTint import io.legado.app.utils.getPrefBoolean @@ -92,6 +93,7 @@ class ChangeSourceDialog : BaseDialogFragment(), private fun initRecyclerView() { adapter = ChangeSourceAdapter(requireContext(), this) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(context) recycler_view.addItemDecoration(VerticalDivider(requireContext())) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/book/download/DownloadActivity.kt b/app/src/main/java/io/legado/app/ui/book/download/DownloadActivity.kt index b0f860527..83bf7487e 100644 --- a/app/src/main/java/io/legado/app/ui/book/download/DownloadActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/download/DownloadActivity.kt @@ -16,6 +16,7 @@ import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter +import io.legado.app.help.AppConfig import io.legado.app.help.BookHelp import io.legado.app.service.help.Download import io.legado.app.ui.filechooser.FileChooserDialog @@ -74,6 +75,7 @@ class DownloadActivity : VMBaseActivity(R.layout.activity_dow } private fun initRecyclerView() { + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(this) adapter = DownloadAdapter(this, this) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt index 04bf86188..38eeffaf6 100644 --- a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt @@ -8,6 +8,7 @@ import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.data.entities.Book import io.legado.app.data.entities.SearchBook +import io.legado.app.help.AppConfig import io.legado.app.ui.book.info.BookInfoActivity import io.legado.app.ui.widget.recycler.LoadMoreView import io.legado.app.ui.widget.recycler.VerticalDivider @@ -32,6 +33,7 @@ class ExploreShowActivity : VMBaseActivity(R.layout.activi } private fun initRecyclerView() { + recycler_view.isEnableScroll = !AppConfig.isEInkMode adapter = ExploreShowAdapter(this, this) recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.addItemDecoration(VerticalDivider(this)) diff --git a/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt index a5d719b57..cfe8f4278 100644 --- a/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt @@ -71,6 +71,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener { private fun initData() { adapter = GroupAdapter(requireContext()) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(requireContext()) recycler_view.addItemDecoration(VerticalDivider(requireContext())) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt b/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt index 9440a7c46..1976c8b2e 100644 --- a/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt @@ -22,6 +22,7 @@ import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.constant.Theme import io.legado.app.data.entities.BookGroup +import io.legado.app.help.AppConfig import io.legado.app.help.ItemTouchCallback import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.customView @@ -96,6 +97,7 @@ class GroupSelectDialog : DialogFragment(), Toolbar.OnMenuItemClickListener { tool_bar.setOnMenuItemClickListener(this) tool_bar.menu.setGroupVisible(R.id.menu_groups, false) adapter = GroupAdapter(requireContext()) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(requireContext()) recycler_view.addItemDecoration(VerticalDivider(requireContext())) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt index 3ce47ee99..eb3943200 100644 --- a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt @@ -62,6 +62,7 @@ class ImportBookActivity : VMBaseActivity(R.layout.activity } private fun initView() { + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(this) adapter = ImportBookAdapter(this, this) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt index 5c8d1d214..673942b5c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt @@ -20,6 +20,7 @@ import androidx.core.view.isVisible import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter +import io.legado.app.help.AppConfig import io.legado.app.service.BaseReadAloudService import io.legado.app.utils.gone import io.legado.app.utils.isAbsUrl @@ -61,6 +62,7 @@ class TextActionMenu(private val context: Context, private val callBack: CallBac } private fun initRecyclerView() = with(contentView) { + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.adapter = adapter recycler_view_more.adapter = adapter SupportMenuInflater(context).inflate(R.menu.content_select_action, menu) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt index 73f85dce0..5e7bd17eb 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt @@ -22,6 +22,7 @@ import io.legado.app.base.BaseDialogFragment import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.constant.EventBus +import io.legado.app.help.AppConfig import io.legado.app.help.ImageLoader import io.legado.app.help.ReadBookConfig import io.legado.app.help.permission.Permissions @@ -83,6 +84,7 @@ class BgTextConfigDialog : BaseDialogFragment() { private fun initData() = with(ReadBookConfig.durConfig) { sw_dark_status_icon.isChecked = statusIconDark() adapter = BgAdapter(requireContext()) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(requireContext(), RecyclerView.HORIZONTAL, false) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt index 300a507ea..f60f4e1e8 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt @@ -23,6 +23,7 @@ import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.constant.Theme import io.legado.app.data.entities.TxtTocRule +import io.legado.app.help.AppConfig import io.legado.app.help.ItemTouchCallback import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.cancelButton @@ -77,6 +78,7 @@ class TocRegexDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener { private fun initView() { adapter = TocRegexAdapter(requireContext()) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(requireContext()) recycler_view.addItemDecoration(VerticalDivider(requireContext())) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt index e81545adc..8b8fd82ad 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt @@ -19,6 +19,7 @@ import io.legado.app.constant.PreferKey import io.legado.app.data.entities.Book import io.legado.app.data.entities.SearchBook import io.legado.app.data.entities.SearchKeyword +import io.legado.app.help.AppConfig import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.primaryTextColor import io.legado.app.ui.book.info.BookInfoActivity @@ -136,6 +137,9 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se ATH.applyEdgeEffectColor(recycler_view) ATH.applyEdgeEffectColor(rv_bookshelf_search) ATH.applyEdgeEffectColor(rv_history_key) + recycler_view.isEnableScroll = !AppConfig.isEInkMode + rv_bookshelf_search.isEnableScroll = !AppConfig.isEInkMode + rv_history_key.isEnableScroll = !AppConfig.isEInkMode bookAdapter = BookAdapter(this, this) rv_bookshelf_search.layoutManager = FlexboxLayoutManager(this) rv_bookshelf_search.adapter = bookAdapter diff --git a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt index 75ac065e0..27ca73b26 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt @@ -8,6 +8,7 @@ import androidx.appcompat.widget.SearchView import androidx.recyclerview.widget.LinearLayoutManager import io.legado.app.R import io.legado.app.base.VMBaseActivity +import io.legado.app.help.AppConfig import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.accentColor import io.legado.app.ui.qrcode.QrCodeActivity @@ -44,6 +45,7 @@ class BookSourceDebugActivity : private fun initRecyclerView() { ATH.applyEdgeEffectColor(recycler_view) adapter = BookSourceDebugAdapter(this) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.adapter = adapter rotate_loading.loadingColor = accentColor diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt index 71ee36149..1a12bdac7 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt @@ -21,6 +21,7 @@ import io.legado.app.base.VMBaseActivity import io.legado.app.constant.AppConst import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.rule.* +import io.legado.app.help.AppConfig import io.legado.app.lib.dialogs.alert import io.legado.app.lib.theme.ATH import io.legado.app.ui.book.source.debug.BookSourceDebugActivity @@ -120,6 +121,7 @@ class BookSourceEditActivity : ATH.applyEdgeEffectColor(recycler_view) mSoftKeyboardTool = KeyboardToolPop(this, AppConst.keyboardToolChars, this) window.decorView.viewTreeObserver.addOnGlobalLayoutListener(KeyboardOnGlobalChangeListener()) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.adapter = adapter tab_layout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index a765f3b4f..2b4a588c4 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -20,6 +20,7 @@ import io.legado.app.App import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.data.entities.BookSource +import io.legado.app.help.AppConfig import io.legado.app.help.ItemTouchCallback import io.legado.app.lib.dialogs.* import io.legado.app.lib.theme.ATH @@ -123,6 +124,7 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity private fun initRecyclerView() { ATH.applyEdgeEffectColor(recycler_view) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.addItemDecoration(VerticalDivider(this)) adapter = BookSourceAdapter(this, this) diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt index d4a466948..523109569 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt @@ -18,6 +18,7 @@ import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.constant.Theme +import io.legado.app.help.AppConfig import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.customView import io.legado.app.lib.dialogs.noButton @@ -63,6 +64,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener { tool_bar.menu.applyTint(requireContext(), Theme.getTheme()) tool_bar.setOnMenuItemClickListener(this) adapter = GroupAdapter(requireContext()) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(requireContext()) recycler_view.addItemDecoration(VerticalDivider(requireContext())) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/filechooser/FileChooserDialog.kt b/app/src/main/java/io/legado/app/ui/filechooser/FileChooserDialog.kt index f1e6a7bc9..c3f6092bd 100644 --- a/app/src/main/java/io/legado/app/ui/filechooser/FileChooserDialog.kt +++ b/app/src/main/java/io/legado/app/ui/filechooser/FileChooserDialog.kt @@ -13,6 +13,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import io.legado.app.R import io.legado.app.constant.Theme +import io.legado.app.help.AppConfig import io.legado.app.ui.filechooser.adapter.FileAdapter import io.legado.app.ui.filechooser.adapter.PathAdapter import io.legado.app.ui.widget.recycler.VerticalDivider @@ -137,10 +138,12 @@ class FileChooserDialog : DialogFragment(), fileAdapter = FileAdapter(requireContext(), this) pathAdapter = PathAdapter(requireContext(), this) + rv_file.isEnableScroll = !AppConfig.isEInkMode rv_file.addItemDecoration(VerticalDivider(requireContext())) rv_file.layoutManager = LinearLayoutManager(activity) rv_file.adapter = fileAdapter + rv_path.isEnableScroll = !AppConfig.isEInkMode rv_path.layoutManager = LinearLayoutManager(activity, RecyclerView.HORIZONTAL, false) rv_path.adapter = pathAdapter 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 c8f93fc64..72d2abb78 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 @@ -15,6 +15,7 @@ import io.legado.app.App import io.legado.app.R import io.legado.app.base.VMBaseFragment import io.legado.app.data.entities.BookSource +import io.legado.app.help.AppConfig import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.primaryTextColor import io.legado.app.ui.book.explore.ExploreShowActivity @@ -75,6 +76,7 @@ class ExploreFragment : VMBaseFragment(R.layout.fragment_find_ private fun initRecyclerView() { ATH.applyEdgeEffectColor(rv_find) + rv_find.isEnableScroll = !AppConfig.isEInkMode linearLayoutManager = LinearLayoutManager(context) rv_find.layoutManager = linearLayoutManager adapter = ExploreAdapter(requireContext(), this, this) 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 334ce9e64..2a2f90dc1 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 @@ -10,6 +10,7 @@ import io.legado.app.App import io.legado.app.R import io.legado.app.base.VMBaseFragment import io.legado.app.data.entities.RssSource +import io.legado.app.help.AppConfig import io.legado.app.lib.theme.ATH import io.legado.app.ui.main.MainViewModel import io.legado.app.ui.rss.article.RssSortActivity @@ -51,6 +52,7 @@ class RssFragment : VMBaseFragment(R.layout.fragment_rss), private fun initRecyclerView() { ATH.applyEdgeEffectColor(recycler_view) adapter = RssAdapter(requireContext(), this) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = GridLayoutManager(requireContext(), 4) recycler_view.adapter = adapter } diff --git a/app/src/main/java/io/legado/app/ui/replacerule/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/replacerule/GroupManageDialog.kt index df39b9a1d..165df103b 100644 --- a/app/src/main/java/io/legado/app/ui/replacerule/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/replacerule/GroupManageDialog.kt @@ -18,6 +18,7 @@ import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.constant.Theme +import io.legado.app.help.AppConfig import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.customView import io.legado.app.lib.dialogs.noButton @@ -63,6 +64,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener { tool_bar.menu.applyTint(requireContext(), Theme.getTheme()) tool_bar.setOnMenuItemClickListener(this) adapter = GroupAdapter(requireContext()) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(requireContext()) recycler_view.addItemDecoration(VerticalDivider(requireContext())) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt index 1f9057e35..2e9139774 100644 --- a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt @@ -20,6 +20,7 @@ import io.legado.app.App import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.data.entities.ReplaceRule +import io.legado.app.help.AppConfig import io.legado.app.help.BookHelp import io.legado.app.help.ItemTouchCallback import io.legado.app.help.coroutine.Coroutine @@ -101,6 +102,7 @@ class ReplaceRuleActivity : VMBaseActivity(R.layout.activi private fun initRecyclerView() { ATH.applyEdgeEffectColor(recycler_view) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(this) adapter = ReplaceRuleAdapter(this, this) recycler_view.adapter = adapter 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 b97bae3ea..4ac48f0de 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 @@ -4,6 +4,7 @@ import android.os.Bundle import androidx.recyclerview.widget.LinearLayoutManager import io.legado.app.R import io.legado.app.base.VMBaseActivity +import io.legado.app.help.AppConfig import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.accentColor import io.legado.app.utils.getViewModel @@ -40,6 +41,7 @@ class RssSourceDebugActivity : VMBaseActivity(R.layout.acti private fun initRecyclerView() { ATH.applyEdgeEffectColor(recycler_view) adapter = RssSourceDebugAdapter(this) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.adapter = adapter rotate_loading.loadingColor = accentColor diff --git a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt index bd070639a..79f38d9e2 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt @@ -18,6 +18,7 @@ import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.constant.AppConst import io.legado.app.data.entities.RssSource +import io.legado.app.help.AppConfig import io.legado.app.lib.dialogs.alert import io.legado.app.lib.theme.ATH import io.legado.app.ui.qrcode.QrCodeActivity @@ -119,6 +120,7 @@ class RssSourceEditActivity : ATH.applyEdgeEffectColor(recycler_view) mSoftKeyboardTool = KeyboardToolPop(this, AppConst.keyboardToolChars, this) window.decorView.viewTreeObserver.addOnGlobalLayoutListener(this) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.adapter = adapter } diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt index ce2313f5a..a0f23d4e4 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt @@ -18,6 +18,7 @@ import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.constant.Theme +import io.legado.app.help.AppConfig import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.customView import io.legado.app.lib.dialogs.noButton @@ -61,6 +62,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener { tool_bar.menu.applyTint(requireContext(), Theme.getTheme()) tool_bar.setOnMenuItemClickListener(this) adapter = GroupAdapter(requireContext()) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(requireContext()) recycler_view.addItemDecoration(VerticalDivider(requireContext())) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt index be9866ef2..81e1046c7 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt @@ -20,6 +20,7 @@ import io.legado.app.App import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.data.entities.RssSource +import io.legado.app.help.AppConfig import io.legado.app.help.ItemTouchCallback import io.legado.app.lib.dialogs.* import io.legado.app.lib.theme.ATH @@ -137,6 +138,7 @@ class RssSourceActivity : VMBaseActivity(R.layout.activity_r private fun initRecyclerView() { ATH.applyEdgeEffectColor(recycler_view) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.addItemDecoration(VerticalDivider(this)) adapter = RssSourceAdapter(this, this) diff --git a/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt b/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt index 56dff107c..76f30efff 100644 --- a/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt +++ b/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt @@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter +import io.legado.app.help.AppConfig import kotlinx.android.synthetic.main.item_fillet_text.view.* import kotlinx.android.synthetic.main.popup_keyboard_tool.view.* import org.jetbrains.anko.sdk27.listeners.onClick @@ -34,6 +35,7 @@ class KeyboardToolPop( private fun initRecyclerView() = with(contentView) { val adapter = Adapter(context) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false) recycler_view.adapter = adapter adapter.setItems(chars) diff --git a/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt b/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt index 8157ed870..4f8dd67a9 100644 --- a/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt +++ b/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt @@ -64,6 +64,7 @@ class FontSelectDialog : BaseDialogFragment(), tool_bar.setTitle(R.string.select_font) tool_bar.inflateMenu(R.menu.font_select) tool_bar.setOnMenuItemClickListener(this) + recycler_view.isEnableScroll = !AppConfig.isEInkMode adapter = FontAdapter(requireContext(), this) recycler_view.layoutManager = LinearLayoutManager(context) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt b/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt index fa8b4eeb7..f8eb233c0 100644 --- a/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt +++ b/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt @@ -18,6 +18,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter +import io.legado.app.help.AppConfig import io.legado.app.utils.getCompatDrawable import kotlinx.android.synthetic.main.dialog_recycler_view.* import kotlinx.android.synthetic.main.item_icon_preference.view.* @@ -138,6 +139,7 @@ class IconListPreference(context: Context, attrs: AttributeSet) : ListPreference override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) tool_bar.setTitle(R.string.change_icon) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.layoutManager = LinearLayoutManager(requireContext()) val adapter = Adapter(requireContext()) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/widget/recycler/RefreshRecyclerView.kt b/app/src/main/java/io/legado/app/ui/widget/recycler/RefreshRecyclerView.kt index 931a7d138..2cc3c40a8 100644 --- a/app/src/main/java/io/legado/app/ui/widget/recycler/RefreshRecyclerView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/recycler/RefreshRecyclerView.kt @@ -9,6 +9,7 @@ import android.view.View import android.widget.LinearLayout import androidx.recyclerview.widget.LinearLayoutManager import io.legado.app.R +import io.legado.app.help.AppConfig import kotlinx.android.synthetic.main.view_refresh_recycler.view.* @@ -22,6 +23,7 @@ class RefreshRecyclerView(context: Context?, attrs: AttributeSet?) : LinearLayou init { orientation = VERTICAL LayoutInflater.from(context).inflate(R.layout.view_refresh_recycler, this, true) + recycler_view.isEnableScroll = !AppConfig.isEInkMode recycler_view.setOnTouchListener(object : OnTouchListener { @SuppressLint("ClickableViewAccessibility") override fun onTouch(v: View?, event: MotionEvent?): Boolean { diff --git a/app/src/main/java/io/legado/app/ui/widget/recycler/scroller/FastScrollRecyclerView.kt b/app/src/main/java/io/legado/app/ui/widget/recycler/scroller/FastScrollRecyclerView.kt index 0a2ebf741..e835e4514 100644 --- a/app/src/main/java/io/legado/app/ui/widget/recycler/scroller/FastScrollRecyclerView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/recycler/scroller/FastScrollRecyclerView.kt @@ -5,9 +5,11 @@ import android.util.AttributeSet import android.view.ViewGroup import androidx.annotation.ColorInt import androidx.recyclerview.widget.RecyclerView +import fadeapp.widgets.ScrollLessRecyclerView import io.legado.app.R +import io.legado.app.help.AppConfig -class FastScrollRecyclerView : RecyclerView { +class FastScrollRecyclerView : ScrollLessRecyclerView { private var mFastScroller: FastScroller? = null @@ -189,7 +191,7 @@ class FastScrollRecyclerView : RecyclerView { private fun layout(context: Context, attrs: AttributeSet?) { mFastScroller = FastScroller(context, attrs) mFastScroller?.id = R.id.fast_scroller - + isEnableScroll = !AppConfig.isEInkMode } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_arrange_book.xml b/app/src/main/res/layout/activity_arrange_book.xml index 1be7bdb41..b93bb8dbe 100644 --- a/app/src/main/res/layout/activity_arrange_book.xml +++ b/app/src/main/res/layout/activity_arrange_book.xml @@ -11,7 +11,7 @@ android:layout_height="wrap_content" app:title="@string/arrange_bookshelf" /> - - @@ -56,7 +56,7 @@ android:text="@string/bookshelf" android:visibility="gone" /> - - diff --git a/app/src/main/res/layout/activity_book_source_edit.xml b/app/src/main/res/layout/activity_book_source_edit.xml index ab8104256..53f152e06 100644 --- a/app/src/main/res/layout/activity_book_source_edit.xml +++ b/app/src/main/res/layout/activity_book_source_edit.xml @@ -96,7 +96,7 @@ - diff --git a/app/src/main/res/layout/activity_download.xml b/app/src/main/res/layout/activity_download.xml index 2f7ebd6f2..fcbe9933d 100644 --- a/app/src/main/res/layout/activity_download.xml +++ b/app/src/main/res/layout/activity_download.xml @@ -11,7 +11,7 @@ android:layout_height="wrap_content" app:title="@string/download_offline" /> - diff --git a/app/src/main/res/layout/activity_explore_show.xml b/app/src/main/res/layout/activity_explore_show.xml index 9bfab0f58..17532f98b 100644 --- a/app/src/main/res/layout/activity_explore_show.xml +++ b/app/src/main/res/layout/activity_explore_show.xml @@ -22,7 +22,7 @@ app:layout_constraintTop_toBottomOf="@id/title_bar"> - diff --git a/app/src/main/res/layout/activity_import_book.xml b/app/src/main/res/layout/activity_import_book.xml index 38d0b4f55..99906f6d9 100644 --- a/app/src/main/res/layout/activity_import_book.xml +++ b/app/src/main/res/layout/activity_import_book.xml @@ -53,7 +53,7 @@ tools:ignore="UnusedAttribute" /> - - - diff --git a/app/src/main/res/layout/activity_source_debug.xml b/app/src/main/res/layout/activity_source_debug.xml index 1b79a6058..50fcfd2de 100644 --- a/app/src/main/res/layout/activity_source_debug.xml +++ b/app/src/main/res/layout/activity_source_debug.xml @@ -14,7 +14,7 @@ app:layout_constraintTop_toTopOf="parent" app:title="@string/debug_source" /> - - - diff --git a/app/src/main/res/layout/dialog_change_source.xml b/app/src/main/res/layout/dialog_change_source.xml index cc7486b05..464eef953 100644 --- a/app/src/main/res/layout/dialog_change_source.xml +++ b/app/src/main/res/layout/dialog_change_source.xml @@ -19,7 +19,7 @@ android:layout_width="match_parent" android:layout_height="2dp" /> - diff --git a/app/src/main/res/layout/dialog_file_chooser.xml b/app/src/main/res/layout/dialog_file_chooser.xml index ab5974114..14fb214a0 100644 --- a/app/src/main/res/layout/dialog_file_chooser.xml +++ b/app/src/main/res/layout/dialog_file_chooser.xml @@ -10,7 +10,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> - - diff --git a/app/src/main/res/layout/dialog_font_select.xml b/app/src/main/res/layout/dialog_font_select.xml index 1e9cf6b42..5d8242f58 100644 --- a/app/src/main/res/layout/dialog_font_select.xml +++ b/app/src/main/res/layout/dialog_font_select.xml @@ -10,7 +10,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> - diff --git a/app/src/main/res/layout/dialog_read_bg_text.xml b/app/src/main/res/layout/dialog_read_bg_text.xml index 6cea816cd..14e189c8b 100644 --- a/app/src/main/res/layout/dialog_read_bg_text.xml +++ b/app/src/main/res/layout/dialog_read_bg_text.xml @@ -79,7 +79,7 @@ android:layout_height="wrap_content" android:text="@string/bg_image" /> - diff --git a/app/src/main/res/layout/dialog_recycler_view.xml b/app/src/main/res/layout/dialog_recycler_view.xml index 5b1d900a9..15d1d5315 100644 --- a/app/src/main/res/layout/dialog_recycler_view.xml +++ b/app/src/main/res/layout/dialog_recycler_view.xml @@ -11,7 +11,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> - - - diff --git a/app/src/main/res/layout/fragment_rss.xml b/app/src/main/res/layout/fragment_rss.xml index f1469fbd7..35cb73229 100644 --- a/app/src/main/res/layout/fragment_rss.xml +++ b/app/src/main/res/layout/fragment_rss.xml @@ -12,7 +12,7 @@ app:attachToActivity="false" app:title="@string/rss" /> - diff --git a/app/src/main/res/layout/popup_action_menu.xml b/app/src/main/res/layout/popup_action_menu.xml index 0f6b6e0e5..0c5a6f754 100644 --- a/app/src/main/res/layout/popup_action_menu.xml +++ b/app/src/main/res/layout/popup_action_menu.xml @@ -13,7 +13,7 @@ android:orientation="horizontal" android:gravity="center_vertical"> - - - - From f3aeba29bf22519c5fdbe80dad46aa9e93e26ae5 Mon Sep 17 00:00:00 2001 From: 383bjz82bu <383bjz82bu@fd.com> Date: Sat, 13 Jun 2020 17:27:13 +0000 Subject: [PATCH 7/8] --- .../main/java/io/legado/app/help/AppConfig.kt | 2 +- .../java/io/legado/app/help/ReadBookConfig.kt | 15 ++++++- .../io/legado/app/ui/about/AboutFragment.kt | 4 +- .../io/legado/app/ui/about/DonateFragment.kt | 4 +- .../io/legado/app/ui/book/read/ReadMenu.kt | 8 ++-- .../ui/book/read/config/MoreConfigDialog.kt | 4 +- .../book/read/config/ReadAloudConfigDialog.kt | 4 +- .../app/ui/config/BackupConfigFragment.kt | 4 +- .../app/ui/config/OtherConfigFragment.kt | 3 +- .../app/ui/config/ThemeConfigFragment.kt | 3 +- .../io/legado/app/ui/main/my/MyFragment.kt | 5 ++- .../legado/app/utils/AnimationUtilsSupport.kt | 17 ++++++++ .../app/utils/PreferenceFragmentSupport.kt | 41 +++++++++++++++++++ 13 files changed, 92 insertions(+), 22 deletions(-) create mode 100644 app/src/main/java/io/legado/app/utils/AnimationUtilsSupport.kt create mode 100644 app/src/main/java/io/legado/app/utils/PreferenceFragmentSupport.kt diff --git a/app/src/main/java/io/legado/app/help/AppConfig.kt b/app/src/main/java/io/legado/app/help/AppConfig.kt index 79353351c..fef825c70 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -81,7 +81,7 @@ object AppConfig { get() = App.INSTANCE.getPrefString(PreferKey.ttsSpeechPer) ?: "0" val isEInkMode: Boolean - get() = App.INSTANCE.getPrefBoolean("isEInkMode") + get() = App.INSTANCE.getPrefBoolean(PreferKey.einkMode) val clickAllNext: Boolean get() = App.INSTANCE.getPrefBoolean(PreferKey.clickAllNext, false) diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt index 9828bb3a1..abb739682 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -26,12 +26,25 @@ object ReadBookConfig { val json = String(App.INSTANCE.assets.open(readConfigFileName).readBytes()) GSON.fromJsonArray(json)!! } - val durConfig get() = getConfig(styleSelect) + val durConfig get() = + if (AppConfig.isEInkMode) + einkConfig + else + getConfig(styleSelect) + var bg: Drawable? = null var bgMeanColor: Int = 0 + val einkConfig:Config init { upConfig() + einkConfig = Config( + bgStr = "#FFFFFF", + bgStrNight = "#FFFFFF", + textColor = "#000000", + textColorNight = "#000000", + darkStatusIconNight = true + ) } @Synchronized diff --git a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt index e44666349..17c7eb4e6 100644 --- a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt +++ b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt @@ -6,16 +6,16 @@ import android.os.Bundle import android.view.View import androidx.annotation.StringRes import androidx.preference.Preference -import androidx.preference.PreferenceFragmentCompat import io.legado.app.App import io.legado.app.R import io.legado.app.lib.dialogs.alert import io.legado.app.ui.widget.dialog.TextDialog +import io.legado.app.utils.PreferenceFragmentSupport import io.legado.app.utils.openUrl import io.legado.app.utils.sendToClip import io.legado.app.utils.toast -class AboutFragment : PreferenceFragmentCompat() { +class AboutFragment : PreferenceFragmentSupport() { private val licenseUrl = "https://github.com/gedoor/legado/blob/master/LICENSE" private val disclaimerUrl = "https://gedoor.github.io/MyBookshelf/disclaimer.html" diff --git a/app/src/main/java/io/legado/app/ui/about/DonateFragment.kt b/app/src/main/java/io/legado/app/ui/about/DonateFragment.kt index b716c8f05..6223b5865 100644 --- a/app/src/main/java/io/legado/app/ui/about/DonateFragment.kt +++ b/app/src/main/java/io/legado/app/ui/about/DonateFragment.kt @@ -5,14 +5,14 @@ import android.content.Intent import android.os.Bundle import android.view.View import androidx.preference.Preference -import androidx.preference.PreferenceFragmentCompat import io.legado.app.R import io.legado.app.utils.ACache +import io.legado.app.utils.PreferenceFragmentSupport import io.legado.app.utils.openUrl import io.legado.app.utils.sendToClip import org.jetbrains.anko.longToast -class DonateFragment : PreferenceFragmentCompat() { +class DonateFragment : PreferenceFragmentSupport() { private val zfbHbRwmUrl = "https://gitee.com/gekunfei/Donate/raw/master/zfbhbrwm.png" private val zfbSkRwmUrl = "https://gitee.com/gekunfei/Donate/raw/master/zfbskrwm.jpg" diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt index 317af6aab..36793bed1 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt @@ -194,8 +194,8 @@ class ReadMenu : FrameLayout { } private fun initAnimation() { - menuTopIn = AnimationUtils.loadAnimation(context, R.anim.anim_readbook_top_in) - menuBottomIn = AnimationUtils.loadAnimation(context, R.anim.anim_readbook_bottom_in) + menuTopIn = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_top_in) + menuBottomIn = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_bottom_in) menuTopIn.setAnimationListener(object : Animation.AnimationListener { override fun onAnimationStart(animation: Animation) { callBack?.upSystemUiVisibility() @@ -217,8 +217,8 @@ class ReadMenu : FrameLayout { }) //隐藏菜单 - menuTopOut = AnimationUtils.loadAnimation(context, R.anim.anim_readbook_top_out) - menuBottomOut = AnimationUtils.loadAnimation(context, R.anim.anim_readbook_bottom_out) + menuTopOut = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_top_out) + menuBottomOut = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_bottom_out) menuTopOut.setAnimationListener(object : Animation.AnimationListener { override fun onAnimationStart(animation: Animation) { vw_menu_bg.setOnClickListener(null) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt index 7033b82d0..cf1558087 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt @@ -10,7 +10,6 @@ import android.view.ViewGroup import android.widget.LinearLayout import androidx.fragment.app.DialogFragment import androidx.preference.Preference -import androidx.preference.PreferenceFragmentCompat import io.legado.app.R import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey @@ -18,6 +17,7 @@ import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.bottomBackground import io.legado.app.ui.book.read.Help +import io.legado.app.utils.PreferenceFragmentSupport import io.legado.app.utils.dp import io.legado.app.utils.getPrefBoolean import io.legado.app.utils.postEvent @@ -64,7 +64,7 @@ class MoreConfigDialog : DialogFragment() { .commit() } - class ReadPreferenceFragment : PreferenceFragmentCompat(), + class ReadPreferenceFragment : PreferenceFragmentSupport(), SharedPreferences.OnSharedPreferenceChangeListener { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt index cdb10159e..dd5eadf9c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt @@ -10,7 +10,6 @@ import android.widget.LinearLayout import androidx.fragment.app.DialogFragment import androidx.preference.ListPreference import androidx.preference.Preference -import androidx.preference.PreferenceFragmentCompat import io.legado.app.R import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey @@ -20,6 +19,7 @@ import io.legado.app.lib.theme.backgroundColor import io.legado.app.service.BaseReadAloudService import io.legado.app.service.help.ReadAloud import io.legado.app.ui.book.read.Help +import io.legado.app.utils.PreferenceFragmentSupport import io.legado.app.utils.postEvent class ReadAloudConfigDialog : DialogFragment() { @@ -59,7 +59,7 @@ class ReadAloudConfigDialog : DialogFragment() { .commit() } - class ReadAloudPreferenceFragment : PreferenceFragmentCompat(), + class ReadAloudPreferenceFragment : PreferenceFragmentSupport(), SharedPreferences.OnSharedPreferenceChangeListener { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { 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 9df96e3f2..7ff39a7b3 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 @@ -8,15 +8,15 @@ import android.view.View import androidx.preference.EditTextPreference import androidx.preference.ListPreference import androidx.preference.Preference -import androidx.preference.PreferenceFragmentCompat import io.legado.app.R import io.legado.app.constant.PreferKey import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.accentColor import io.legado.app.ui.filechooser.FileChooserDialog +import io.legado.app.utils.PreferenceFragmentSupport import io.legado.app.utils.getPrefString -class BackupConfigFragment : PreferenceFragmentCompat(), +class BackupConfigFragment : PreferenceFragmentSupport(), SharedPreferences.OnSharedPreferenceChangeListener, FileChooserDialog.CallBack { 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 f23fee053..07a70b110 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 @@ -7,7 +7,6 @@ import android.os.Bundle import android.view.View import androidx.preference.ListPreference import androidx.preference.Preference -import androidx.preference.PreferenceFragmentCompat import io.legado.app.App import io.legado.app.R import io.legado.app.constant.EventBus @@ -21,7 +20,7 @@ import io.legado.app.ui.widget.number.NumberPickerDialog import io.legado.app.utils.* -class OtherConfigFragment : PreferenceFragmentCompat(), +class OtherConfigFragment : PreferenceFragmentSupport(), SharedPreferences.OnSharedPreferenceChangeListener { private val packageManager = App.INSTANCE.packageManager 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 6416040c3..774dd07e0 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 @@ -9,7 +9,6 @@ import android.view.MenuInflater import android.view.MenuItem import android.view.View import androidx.preference.Preference -import androidx.preference.PreferenceFragmentCompat import io.legado.app.App import io.legado.app.R import io.legado.app.constant.EventBus @@ -26,7 +25,7 @@ import io.legado.app.ui.widget.prefs.IconListPreference import io.legado.app.utils.* -class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener { +class ThemeConfigFragment : PreferenceFragmentSupport(), SharedPreferences.OnSharedPreferenceChangeListener { val items = arrayListOf("极简", "曜夜", "经典", "黑白", "A屏黑") 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 dab9eb544..de219c0aa 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 @@ -7,13 +7,13 @@ import android.view.Menu import android.view.MenuItem import android.view.View import androidx.preference.Preference -import androidx.preference.PreferenceFragmentCompat import io.legado.app.App import io.legado.app.R import io.legado.app.base.BaseFragment import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey import io.legado.app.help.AppConfig +import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.ATH import io.legado.app.service.WebService import io.legado.app.ui.about.AboutActivity @@ -65,7 +65,7 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config), FileChooserDialog. BackupRestoreUi.onActivityResult(requestCode, resultCode, data) } - class PreferenceFragment : PreferenceFragmentCompat(), + class PreferenceFragment : PreferenceFragmentSupport(), SharedPreferences.OnSharedPreferenceChangeListener { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { @@ -123,6 +123,7 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config), FileChooserDialog. "recordLog" -> LogUtils.upLevel() PreferKey.einkMode -> { postEvent(EventBus.RECREATE, "") + ReadBookConfig.pageAnim = 4 } } } diff --git a/app/src/main/java/io/legado/app/utils/AnimationUtilsSupport.kt b/app/src/main/java/io/legado/app/utils/AnimationUtilsSupport.kt new file mode 100644 index 000000000..1400b11f2 --- /dev/null +++ b/app/src/main/java/io/legado/app/utils/AnimationUtilsSupport.kt @@ -0,0 +1,17 @@ +package io.legado.app.utils + +import android.content.Context +import android.view.animation.Animation +import android.view.animation.AnimationUtils +import androidx.annotation.AnimRes +import io.legado.app.help.AppConfig + +object AnimationUtilsSupport { + fun loadAnimation(context: Context, @AnimRes id: Int): Animation { + val animation = AnimationUtils.loadAnimation(context, id) + if (AppConfig.isEInkMode) { + animation.duration = 0 + } + return animation + } +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/utils/PreferenceFragmentSupport.kt b/app/src/main/java/io/legado/app/utils/PreferenceFragmentSupport.kt new file mode 100644 index 000000000..23848fb52 --- /dev/null +++ b/app/src/main/java/io/legado/app/utils/PreferenceFragmentSupport.kt @@ -0,0 +1,41 @@ +package io.legado.app.utils + +import android.content.pm.PackageManager +import android.os.Bundle +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.view.setPadding +import androidx.preference.PreferenceFragmentCompat +import androidx.preference.PreferenceRecyclerViewAccessibilityDelegate +import androidx.recyclerview.widget.RecyclerView +import fadeapp.widgets.ScrollLessRecyclerView +import io.legado.app.R +import io.legado.app.help.AppConfig + +abstract class PreferenceFragmentSupport : PreferenceFragmentCompat(){ + + override fun onCreateRecyclerView( + inflater: LayoutInflater, + parent: ViewGroup, + savedInstanceState: Bundle? + ): RecyclerView { + + if (context?.packageManager?.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)==true) { + val recyclerView: RecyclerView?= parent.findViewById(R.id.recycler_view) + if (recyclerView != null) { + return recyclerView + } + } + val recyclerView = ScrollLessRecyclerView(inflater.context,null,R.attr.preferenceFragmentListStyle) + recyclerView.id = R.id.recycler_view + recyclerView.setPadding(0) + recyclerView.clipToPadding = false + recyclerView.isEnableScroll = !AppConfig.isEInkMode + recyclerView.layoutManager = onCreateLayoutManager() + recyclerView.setAccessibilityDelegateCompat( + PreferenceRecyclerViewAccessibilityDelegate(recyclerView) + ) + + return recyclerView + } +} \ No newline at end of file From 1d768c150a546929f39b58821a5132b2c33d9d1a Mon Sep 17 00:00:00 2001 From: 383bjz82bu <383bjz82bu@fd.com> Date: Sat, 13 Jun 2020 17:35:45 +0000 Subject: [PATCH 8/8] reset edit .gitignore --- .gitignore | 8 -------- .../java/io/legado/app/ui/main/my/MyFragment.kt | 13 +++++++++++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index e9f1bfd7b..700c700fe 100644 --- a/.gitignore +++ b/.gitignore @@ -13,11 +13,3 @@ node_modules/ /app/google /app/gradle.properties package-lock.json - -*__gen.go -*__ignore.go -*.swp -*.swo -~i_* -ig_* -zzzig_* 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 de219c0aa..da6dde167 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 @@ -122,8 +122,17 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config), FileChooserDialog. } "recordLog" -> LogUtils.upLevel() PreferKey.einkMode -> { - postEvent(EventBus.RECREATE, "") - ReadBookConfig.pageAnim = 4 + //既然是 E-Ink 模式,为什么不一步到位呢 + if (AppConfig.isEInkMode) { + ReadBookConfig.pageAnim = 4 + 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 + App.INSTANCE.applyDayNight() + postEvent(EventBus.RECREATE, "") + } } } }