From 2cd223637d0f53b7e7daa9b616875e63cfaa25ea Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 9 Apr 2021 22:25:21 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E6=89=93=E5=BC=80=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=97=B6=E8=87=AA=E5=8A=A8=E8=8E=B7=E5=8F=96=E7=84=A6=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/book/search/SearchActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 fcaa0d1fe..1c7289729 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 @@ -6,6 +6,7 @@ import android.view.Menu import android.view.MenuItem import android.view.View.GONE import android.view.View.VISIBLE +import android.widget.TextView import androidx.activity.viewModels import androidx.appcompat.widget.SearchView import androidx.lifecycle.LiveData @@ -214,7 +215,8 @@ class SearchActivity : VMBaseActivity(androidx.appcompat.R.id.search_src_text) + .requestFocus() } } From b5e0808a17172690ae20d882b57fda2b5f8f48e2 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 11 Apr 2021 21:34:38 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/ui/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/README.md b/app/src/main/java/io/legado/app/ui/README.md index 059ce3ff0..bc6549bec 100644 --- a/app/src/main/java/io/legado/app/ui/README.md +++ b/app/src/main/java/io/legado/app/ui/README.md @@ -14,7 +14,7 @@ * book\download 下载界面 * book\explore 发现界面 * book\local 书籍导入界面 -* fileChooser 文件选择界面 +* document 文件选择界面 * config 配置界面 * main 主界面 * qrCode 二维码扫描界面 From db0f89d0d85036f4db05ceec7fb1060798d1199b Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 13 Apr 2021 12:18:11 +0800 Subject: [PATCH 03/17] =?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/ui/document/FilePickerActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/document/FilePickerActivity.kt b/app/src/main/java/io/legado/app/ui/document/FilePickerActivity.kt index 3c83b3845..c3f601271 100644 --- a/app/src/main/java/io/legado/app/ui/document/FilePickerActivity.kt +++ b/app/src/main/java/io/legado/app/ui/document/FilePickerActivity.kt @@ -123,7 +123,7 @@ class FilePickerActivity : "txt", "xml" -> types.add("text/*") else -> { val mime = MimeTypeMap.getSingleton() - .getMimeTypeFromExtension("json") + .getMimeTypeFromExtension(it) ?: "application/octet-stream" types.add(mime) } From e034c4c8f084ad78aaeb4ce4f5879783a0915fae Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 13 Apr 2021 14:08:03 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 3e1f883c9..ab9ec58fb 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -3,6 +3,9 @@ * 关注合作公众号 **[小说拾遗]** 获取好看的小说。 * 旧版数据导入教程:先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】。 +**2021/04/13** +* 修复导入布局bug + **2021/04/08** * 缓存时重新检查并缓存图片 * 订阅源调试添加源码查看 From d2eab14cefff137debf3ae17d19ddaa1ab434ab8 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 13 Apr 2021 17:13:32 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8Drss=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=A0=B7=E5=BC=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/rss/article/RssSortActivity.kt | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt index 3ebe5e74e..8b30ede65 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt @@ -20,7 +20,7 @@ class RssSortActivity : VMBaseActivity() + private var sorts = linkedMapOf() private lateinit var adapter: TabFragmentPageAdapter private val upSourceResult = registerForActivityResult( ActivityResultContracts.StartActivityForResult() @@ -40,7 +40,7 @@ class RssSortActivity : VMBaseActivity - tab.text = fragments.keys.elementAt(position) + tab.text = sorts.keys.elementAt(position) }.attach() viewModel.titleLiveData.observe(this, { binding.titleBar.title = it @@ -77,11 +77,10 @@ class RssSortActivity : VMBaseActivity Date: Tue, 13 Apr 2021 17:16:36 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8Drss=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=A0=B7=E5=BC=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index ab9ec58fb..da8bdc6e6 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -5,6 +5,7 @@ **2021/04/13** * 修复导入布局bug +* 修复订阅切换布局bug **2021/04/08** * 缓存时重新检查并缓存图片 From 1499ad5408284dde0763c8c253db5ecb2a8b3834 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 14 Apr 2021 15:01:34 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8Drss=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=A0=B7=E5=BC=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/rss/article/RssSortActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt index 8b30ede65..b2bdb2920 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt @@ -95,7 +95,8 @@ class RssSortActivity : VMBaseActivity Date: Thu, 15 Apr 2021 11:14:44 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E6=BA=90=E8=AE=A2=E9=98=85=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/data/dao/RuleSubDao.kt | 3 +++ .../ui/rss/subscription/RuleSubActivity.kt | 21 ++++++++++++++----- app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values-zh/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 6 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/dao/RuleSubDao.kt b/app/src/main/java/io/legado/app/data/dao/RuleSubDao.kt index a8056baae..d5aea29ad 100644 --- a/app/src/main/java/io/legado/app/data/dao/RuleSubDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/RuleSubDao.kt @@ -16,6 +16,9 @@ interface RuleSubDao { @get:Query("select customOrder from ruleSubs order by customOrder limit 0,1") val maxOrder: Int + @Query("select * from ruleSubs where url = :url") + fun findByUrl(url: String): RuleSub? + @Insert(onConflict = OnConflictStrategy.REPLACE) fun insert(vararg ruleSub: RuleSub) diff --git a/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubActivity.kt b/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubActivity.kt index 78aa3d7da..c7a74a318 100644 --- a/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubActivity.kt @@ -18,8 +18,10 @@ import io.legado.app.ui.association.ImportReplaceRuleActivity import io.legado.app.ui.association.ImportRssSourceActivity import io.legado.app.ui.widget.recycler.ItemTouchCallback import io.legado.app.utils.startActivity +import io.legado.app.utils.toastOnUi import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext /** * 规则订阅界面 @@ -100,11 +102,20 @@ class RuleSubActivity : BaseActivity(), } customView { alertBinding.root } okButton { - ruleSub.type = alertBinding.spType.selectedItemPosition - ruleSub.name = alertBinding.etName.text?.toString() ?: "" - ruleSub.url = alertBinding.etUrl.text?.toString() ?: "" - launch(IO) { - appDb.ruleSubDao.insert(ruleSub) + launch { + ruleSub.type = alertBinding.spType.selectedItemPosition + ruleSub.name = alertBinding.etName.text?.toString() ?: "" + ruleSub.url = alertBinding.etUrl.text?.toString() ?: "" + val rs = withContext(IO) { + appDb.ruleSubDao.findByUrl(ruleSub.url) + } + if (rs != null && rs.id != ruleSub.id) { + toastOnUi(R.string.url_already) + return@launch + } + withContext(IO) { + appDb.ruleSubDao.insert(ruleSub) + } } } cancelButton() diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index ec507138c..29e200c8c 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -819,5 +819,6 @@ 目录源码 正文源码 列表源码 + 此url已订阅 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 0b7551fc5..f7f2c0359 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -821,5 +821,6 @@ 目录源码 正文源码 列表源码 + 此url已订阅 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 0889ca112..05aa55b5a 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -823,5 +823,6 @@ 目录源码 正文源码 列表源码 + 此url已订阅 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index da4faf74d..04b53023e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -826,5 +826,6 @@ 目录源码 正文源码 列表源码 + 此url已订阅 From 10d420d89f7cd3130d7a28c805ff1d2cebd94383 Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 15 Apr 2021 15:40:38 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E6=BA=90=E8=AE=A2=E9=98=85=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/rss/subscription/RuleSubActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubActivity.kt b/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubActivity.kt index c7a74a318..5bfd50d57 100644 --- a/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubActivity.kt @@ -110,7 +110,7 @@ class RuleSubActivity : BaseActivity(), appDb.ruleSubDao.findByUrl(ruleSub.url) } if (rs != null && rs.id != ruleSub.id) { - toastOnUi(R.string.url_already) + toastOnUi("${getString(R.string.url_already)}(${rs.name})") return@launch } withContext(IO) { From db74bd487e66baa6b98b4edfcad7f9f4b12cd70e Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 16 Apr 2021 08:51:20 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E5=8E=BB=E6=8E=89google=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1,=E8=A7=A3=E5=86=B3=E5=8D=8E=E4=B8=BA=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E4=BD=BF=E7=94=A8=E5=B4=A9=E6=BA=83=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 9 +-------- build.gradle | 2 -- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c30060c0c..b76d28272 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,7 +3,6 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-parcelize' apply plugin: 'kotlin-kapt' apply plugin: 'de.timfreiheit.resourceplaceholders' -apply plugin: 'com.google.firebase.crashlytics' static def releaseTime() { return new Date().format("yy.MMddHH", TimeZone.getTimeZone("GMT+8")) @@ -121,10 +120,6 @@ dependencies { //kotlin implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - //fireBase - implementation 'com.google.firebase:firebase-analytics-ktx:18.0.0' - implementation 'com.google.firebase:firebase-crashlytics-ktx:17.3.0' - //androidX implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.core:core-ktx:1.3.2' @@ -212,6 +207,4 @@ dependencies { //转换繁体 implementation 'com.github.liuyueyi.quick-chinese-transfer:quick-transfer-core:0.1.3' -} - -apply plugin: 'com.google.gms.google-services' \ No newline at end of file +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index ed41f24c3..e421da86b 100644 --- a/build.gradle +++ b/build.gradle @@ -13,8 +13,6 @@ buildscript { classpath 'com.android.tools.build:gradle:4.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "de.timfreiheit.resourceplaceholders:placeholders:0.3" - classpath "com.google.gms:google-services:4.3.4" - classpath "com.google.firebase:firebase-crashlytics-gradle:2.4.1" } } From 0abd259dfe706ee510be53d3d17458cb3d995edd Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 16 Apr 2021 08:54:07 +0800 Subject: [PATCH 11/17] edit updateLog.md --- app/src/main/assets/updateLog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index da8bdc6e6..4fe83c31d 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -3,6 +3,10 @@ * 关注合作公众号 **[小说拾遗]** 获取好看的小说。 * 旧版数据导入教程:先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】。 +**2021/04/16** +* 去掉google统计,解决华为手机使用崩溃的bug +* 添加规则订阅时判断重复提醒 + **2021/04/13** * 修复导入布局bug * 修复订阅切换布局bug From ea31681fd14a297eda83ee6c8799bed24a579209 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 16 Apr 2021 09:37:31 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=BC=83=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/data/AppDatabase.kt | 14 +++++--- .../io/legado/app/data/dao/EpubChapterDao.kt | 32 ------------------- .../legado/app/data/entities/EpubChapter.kt | 23 ------------- 3 files changed, 10 insertions(+), 59 deletions(-) delete mode 100644 app/src/main/java/io/legado/app/data/dao/EpubChapterDao.kt delete mode 100644 app/src/main/java/io/legado/app/data/entities/EpubChapter.kt diff --git a/app/src/main/java/io/legado/app/data/AppDatabase.kt b/app/src/main/java/io/legado/app/data/AppDatabase.kt index c48736382..70c05de42 100644 --- a/app/src/main/java/io/legado/app/data/AppDatabase.kt +++ b/app/src/main/java/io/legado/app/data/AppDatabase.kt @@ -22,8 +22,8 @@ val appDb by lazy { ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class, RssSource::class, Bookmark::class, RssArticle::class, RssReadRecord::class, RssStar::class, TxtTocRule::class, ReadRecord::class, HttpTTS::class, Cache::class, - RuleSub::class, EpubChapter::class], - version = 31, + RuleSub::class], + version = 32, exportSchema = true ) abstract class AppDatabase : RoomDatabase() { @@ -45,7 +45,6 @@ abstract class AppDatabase : RoomDatabase() { abstract val httpTTSDao: HttpTTSDao abstract val cacheDao: CacheDao abstract val ruleSubDao: RuleSubDao - abstract val epubChapterDao: EpubChapterDao companion object { @@ -59,7 +58,8 @@ abstract class AppDatabase : RoomDatabase() { migration_14_15, migration_15_17, migration_17_18, migration_18_19, migration_19_20, migration_20_21, migration_21_22, migration_22_23, migration_23_24, migration_24_25, migration_25_26, migration_26_27, - migration_27_28, migration_28_29, migration_29_30, migration_30_31 + migration_27_28, migration_28_29, migration_29_30, migration_30_31, + migration_31_32 ) .allowMainThreadQueries() .addCallback(dbCallback) @@ -290,6 +290,12 @@ abstract class AppDatabase : RoomDatabase() { database.execSQL("insert into readRecord (deviceId, bookName, readTime) select androidId, bookName, readTime from readRecord1") } } + + private val migration_31_32 = object : Migration(31, 32) { + override fun migrate(database: SupportSQLiteDatabase) { + database.execSQL("DROP TABLE `epubChapters`") + } + } } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/dao/EpubChapterDao.kt b/app/src/main/java/io/legado/app/data/dao/EpubChapterDao.kt deleted file mode 100644 index cf2f66d2a..000000000 --- a/app/src/main/java/io/legado/app/data/dao/EpubChapterDao.kt +++ /dev/null @@ -1,32 +0,0 @@ -package io.legado.app.data.dao - -import androidx.room.* -import io.legado.app.data.entities.EpubChapter - -@Dao -interface EpubChapterDao { - @get:Query("select * from epubChapters") - val all: List - - @Query("select count(*) from epubChapters Where bookUrl = :bookUrl") - fun getCnt(bookUrl: String): Int - - @Query("select * from epubChapters Where bookUrl = :bookUrl and parentHref = :parentHref ") - fun get(bookUrl: String, parentHref: String): List - - @Insert(onConflict = OnConflictStrategy.REPLACE) - fun insert(vararg chapter: EpubChapter) - - @Query("delete from epubChapters") - fun clear() - - @Query("delete from epubChapters Where bookUrl = :bookUrl") - fun deleteByName(bookUrl: String) - - @Delete - fun delete(vararg chapter: EpubChapter) - - @Update - fun update(vararg chapter: EpubChapter) - -} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/EpubChapter.kt b/app/src/main/java/io/legado/app/data/entities/EpubChapter.kt deleted file mode 100644 index 390b63a64..000000000 --- a/app/src/main/java/io/legado/app/data/entities/EpubChapter.kt +++ /dev/null @@ -1,23 +0,0 @@ -package io.legado.app.data.entities - -import androidx.room.Entity -import androidx.room.ForeignKey -import androidx.room.Index - -@Entity( - tableName = "epubChapters", - primaryKeys = ["bookUrl", "href"], - indices = [(Index(value = ["bookUrl"], unique = false)), - (Index(value = ["bookUrl", "href"], unique = true))], - foreignKeys = [(ForeignKey( - entity = Book::class, - parentColumns = ["bookUrl"], - childColumns = ["bookUrl"], - onDelete = ForeignKey.CASCADE - ))] -) -data class EpubChapter( - var bookUrl: String = "", - var href: String = "", - var parentHref: String? = null, -) \ No newline at end of file From 66d41c98495a3124943445a2fa6c9196c10af294 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 16 Apr 2021 10:27:28 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=BC=BA=E8=B0=83?= =?UTF-8?q?=E8=89=B2=E8=AE=BE=E7=BD=AE=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/config/ThemeConfigFragment.kt | 36 ------------------- 1 file changed, 36 deletions(-) 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 4bcb6faf8..2a28a1b7f 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 @@ -85,42 +85,6 @@ class ThemeConfigFragment : BasePreferenceFragment(), } } } - findPreference(PreferKey.cAccent)?.let { - it.onSaveColor = { color -> - val background = - getPrefInt(PreferKey.cBackground, getCompatColor(R.color.md_grey_100)) - val textColor = getCompatColor(R.color.primaryText) - when { - ColorUtils.getColorDifference(color, background) <= 60 -> { - toastOnUi(R.string.accent_background_diff) - true - } - ColorUtils.getColorDifference(color, textColor) <= 60 -> { - toastOnUi(R.string.accent_text_diff) - true - } - else -> false - } - } - } - findPreference(PreferKey.cNAccent)?.let { - it.onSaveColor = { color -> - val background = - getPrefInt(PreferKey.cNBackground, getCompatColor(R.color.md_grey_900)) - val textColor = getCompatColor(R.color.primaryText) - when { - ColorUtils.getColorDifference(color, background) <= 60 -> { - toastOnUi(R.string.accent_background_diff) - true - } - ColorUtils.getColorDifference(color, textColor) <= 60 -> { - toastOnUi(R.string.accent_text_diff) - true - } - else -> false - } - } - } } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { From 346d1c60d8d37d3154430f063a3a5b557ee2d90c Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 16 Apr 2021 20:47:01 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_book_search.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/layout/activity_book_search.xml b/app/src/main/res/layout/activity_book_search.xml index 244841d15..4996fd3ff 100644 --- a/app/src/main/res/layout/activity_book_search.xml +++ b/app/src/main/res/layout/activity_book_search.xml @@ -97,6 +97,7 @@ android:layout_margin="16dp" android:src="@drawable/ic_stop_black_24dp" android:visibility="invisible" + android:contentDescription="@string/stop" app:fabSize="mini" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintRight_toRightOf="parent" /> From e7fe6b0d83d61ba346f10f0ecdff8137ce6cd22f Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 16 Apr 2021 22:19:13 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/book/read/config/BgTextConfigDialog.kt | 8 +++----- .../ui/book/read/config/PaddingConfigDialog.kt | 16 ++++++---------- .../app/ui/book/read/config/ReadAloudDialog.kt | 12 +++++------- .../app/ui/book/read/config/ReadStyleDialog.kt | 10 ++++------ 4 files changed, 18 insertions(+), 28 deletions(-) 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 51e288a13..1a89cd4b1 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 @@ -148,11 +148,9 @@ class BgTextConfigDialog : BaseDialogFragment() { cancelButton() }.show() } - binding.swDarkStatusIcon.setOnCheckedChangeListener { buttonView, isChecked -> - if (buttonView?.isPressed == true) { - setCurStatusIconDark(isChecked) - (activity as? ReadBookActivity)?.upSystemUiVisibility() - } + binding.swDarkStatusIcon.setOnCheckedChangeListener { _, isChecked -> + setCurStatusIconDark(isChecked) + (activity as? ReadBookActivity)?.upSystemUiVisibility() } binding.tvTextColor.setOnClickListener { ColorPickerDialog.newBuilder() diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt index fb6e340dc..938d0392e 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt @@ -121,17 +121,13 @@ class PaddingConfigDialog : BaseDialogFragment() { footerPaddingRight = it postEvent(EventBus.UP_CONFIG, true) } - binding.cbShowTopLine.onCheckedChangeListener = { cb, isChecked -> - if (cb.isPressed) { - showHeaderLine = isChecked - postEvent(EventBus.UP_CONFIG, true) - } + binding.cbShowTopLine.onCheckedChangeListener = { _, isChecked -> + showHeaderLine = isChecked + postEvent(EventBus.UP_CONFIG, true) } - binding.cbShowBottomLine.onCheckedChangeListener = { cb, isChecked -> - if (cb.isPressed) { - showFooterLine = isChecked - postEvent(EventBus.UP_CONFIG, true) - } + binding.cbShowBottomLine.onCheckedChangeListener = { _, isChecked -> + showFooterLine = isChecked + postEvent(EventBus.UP_CONFIG, true) } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt index 52f7e7d36..e134884b7 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt @@ -81,8 +81,8 @@ class ReadAloudDialog : BaseDialogFragment() { tvSetting.setTextColor(textColor) cbTtsFollowSys.setTextColor(textColor) } - initOnChange() initData() + initOnChange() initEvent() } @@ -96,12 +96,10 @@ class ReadAloudDialog : BaseDialogFragment() { } private fun initOnChange() = with(binding) { - cbTtsFollowSys.setOnCheckedChangeListener { buttonView, isChecked -> - if (buttonView.isPressed) { - requireContext().putPrefBoolean("ttsFollowSys", isChecked) - seekTtsSpeechRate.isEnabled = !isChecked - upTtsSpeechRate() - } + cbTtsFollowSys.setOnCheckedChangeListener { _, isChecked -> + requireContext().putPrefBoolean("ttsFollowSys", isChecked) + seekTtsSpeechRate.isEnabled = !isChecked + upTtsSpeechRate() } seekTtsSpeechRate.setOnSeekBarChangeListener(object : SeekBarChangeListener { diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt index 90f4a9b21..a6110a309 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt @@ -136,12 +136,10 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack { ReadBookConfig.pageAnim = binding.rgPageAnim.getIndexById(checkedId) callBack?.upPageAnim() } - cbShareLayout.onCheckedChangeListener = { checkBox, isChecked -> - if (checkBox.isPressed) { - ReadBookConfig.shareLayout = isChecked - upView() - postEvent(EventBus.UP_CONFIG, true) - } + cbShareLayout.onCheckedChangeListener = { _, isChecked -> + ReadBookConfig.shareLayout = isChecked + upView() + postEvent(EventBus.UP_CONFIG, true) } dsbTextSize.onChanged = { ReadBookConfig.textSize = it + 5 From 767b573da91c2f70042c047158a00873e5c9d5af Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 16 Apr 2021 22:24:23 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/book/read/config/ReadAloudDialog.kt | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt index e134884b7..8213c8bee 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt @@ -82,7 +82,6 @@ class ReadAloudDialog : BaseDialogFragment() { cbTtsFollowSys.setTextColor(textColor) } initData() - initOnChange() initEvent() } @@ -95,7 +94,25 @@ class ReadAloudDialog : BaseDialogFragment() { seekTtsSpeechRate.progress = AppConfig.ttsSpeechRate } - private fun initOnChange() = with(binding) { + private fun initEvent() = with(binding) { + llMainMenu.setOnClickListener { + callBack?.showMenuBar() + dismissAllowingStateLoss() + } + llSetting.setOnClickListener { + ReadAloudConfigDialog().show(childFragmentManager, "readAloudConfigDialog") + } + tvPre.setOnClickListener { ReadBook.moveToPrevChapter(upContent = true, toLast = false) } + tvNext.setOnClickListener { ReadBook.moveToNextChapter(true) } + ivStop.setOnClickListener { + ReadAloud.stop(requireContext()) + dismissAllowingStateLoss() + } + ivPlayPause.setOnClickListener { callBack?.onClickReadAloud() } + ivPlayPrev.setOnClickListener { ReadAloud.prevParagraph(requireContext()) } + ivPlayNext.setOnClickListener { ReadAloud.nextParagraph(requireContext()) } + llCatalog.setOnClickListener { callBack?.openChapterList() } + llToBackstage.setOnClickListener { callBack?.finish() } cbTtsFollowSys.setOnCheckedChangeListener { _, isChecked -> requireContext().putPrefBoolean("ttsFollowSys", isChecked) seekTtsSpeechRate.isEnabled = !isChecked @@ -119,27 +136,6 @@ class ReadAloudDialog : BaseDialogFragment() { }) } - private fun initEvent() = with(binding) { - llMainMenu.setOnClickListener { - callBack?.showMenuBar() - dismissAllowingStateLoss() - } - llSetting.setOnClickListener { - ReadAloudConfigDialog().show(childFragmentManager, "readAloudConfigDialog") - } - tvPre.setOnClickListener { ReadBook.moveToPrevChapter(upContent = true, toLast = false) } - tvNext.setOnClickListener { ReadBook.moveToNextChapter(true) } - ivStop.setOnClickListener { - ReadAloud.stop(requireContext()) - dismissAllowingStateLoss() - } - ivPlayPause.setOnClickListener { callBack?.onClickReadAloud() } - ivPlayPrev.setOnClickListener { ReadAloud.prevParagraph(requireContext()) } - ivPlayNext.setOnClickListener { ReadAloud.nextParagraph(requireContext()) } - llCatalog.setOnClickListener { callBack?.openChapterList() } - llToBackstage.setOnClickListener { callBack?.finish() } - } - private fun upPlayState() { if (!BaseReadAloudService.pause) { binding.ivPlayPause.setImageResource(R.drawable.ic_pause_24dp) From 2e1f52ff78554055b9498858749744a91c235452 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 18 Apr 2021 16:42:42 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/web/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/assets/web/index.js b/app/src/main/assets/web/index.js index 86f19a138..da12343b4 100644 --- a/app/src/main/assets/web/index.js +++ b/app/src/main/assets/web/index.js @@ -152,7 +152,7 @@ function rule2json() { RuleJSON.lastUpdateTime = new Date().getTime(); RuleJSON.customOrder = RuleJSON.customOrder == '' ? 0 : parseInt(RuleJSON.customOrder); RuleJSON.weight = RuleJSON.weight == '' ? 0 : parseInt(RuleJSON.weight); - RuleJSON.bookSourceType == RuleJSON.bookSourceType == '' ? 0 : parseInt(RuleJSON.weight); + RuleJSON.bookSourceType == RuleJSON.bookSourceType == '' ? 0 : parseInt(RuleJSON.bookSourceType); RuleJSON.enabled = RuleJSON.enabled == '' || String(RuleJSON.enabled).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true'; RuleJSON.enabledExplore = RuleJSON.enabledExplore == '' || String(RuleJSON.enabledExplore).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true'; return RuleJSON;