From beca2b429cf61557adc98fed52d9959e9e77c1ea Mon Sep 17 00:00:00 2001 From: len Date: Sun, 1 Jan 2017 20:54:41 +0100 Subject: [PATCH] Minor changes --- .../java/eu/kanade/tachiyomi/ui/setting/SettingsActivity.kt | 1 + .../main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt | 5 +++++ app/src/main/java/eu/kanade/tachiyomi/util/LocaleHelper.kt | 3 +-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsActivity.kt index 449cb9ff0..b8e4cc467 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsActivity.kt @@ -28,6 +28,7 @@ class SettingsActivity : BaseActivity(), override fun onCreate(savedState: Bundle?) { setAppTheme() super.onCreate(savedState) + setTitle(R.string.label_settings) setContentView(R.layout.activity_preferences) replaceFragmentStrategy = ReplaceFragment(this, diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt b/app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt index 672a94691..1f7e96776 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt @@ -44,6 +44,11 @@ fun syncChaptersWithSource(db: DatabaseHelper, // Chapters from the db not in the source. val toDelete = dbChapters.filterNot { it in sourceChapters } + // Return if there's nothing to add or delete, avoiding unnecessary db transactions. + if (toAdd.isEmpty() && toDelete.isEmpty()) { + return Pair(emptyList(), emptyList()) + } + val readded = mutableListOf() db.inTransaction { diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/LocaleHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/util/LocaleHelper.kt index b3dd5fb41..df9c038ea 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/LocaleHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/LocaleHelper.kt @@ -78,8 +78,7 @@ object LocaleHelper { if (systemLocale == null) { systemLocale = getConfigLocale(config) } - // In API 16 and lower [systemLocale] can't be changed. - if (configChange && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { + if (configChange) { val configLocale = getConfigLocale(config) if (currentLocale == configLocale) { return