Browse Source

Minor cleanup

arkon 4 years ago
parent
commit
4f02872a84

+ 1 - 1
app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt

@@ -155,7 +155,7 @@ class NotificationReceiver : BroadcastReceiver() {
      * @param mangaId id of manga
      * @param chapterId id of chapter
      */
-    internal fun openChapter(context: Context, mangaId: Long, chapterId: Long) {
+    private fun openChapter(context: Context, mangaId: Long, chapterId: Long) {
         val db = DatabaseHelper(context)
         val manga = db.getManga(mangaId).executeAsBlocking()
         val chapter = db.getChapter(chapterId).executeAsBlocking()

+ 19 - 6
app/src/main/java/eu/kanade/tachiyomi/data/preference/SharedPreferencesDataStore.kt

@@ -1,6 +1,7 @@
 package eu.kanade.tachiyomi.data.preference
 
 import android.content.SharedPreferences
+import androidx.core.content.edit
 import androidx.preference.PreferenceDataStore
 
 class SharedPreferencesDataStore(private val prefs: SharedPreferences) : PreferenceDataStore() {
@@ -10,7 +11,9 @@ class SharedPreferencesDataStore(private val prefs: SharedPreferences) : Prefere
     }
 
     override fun putBoolean(key: String?, value: Boolean) {
-        prefs.edit().putBoolean(key, value).apply()
+        prefs.edit {
+            putBoolean(key, value)
+        }
     }
 
     override fun getInt(key: String?, defValue: Int): Int {
@@ -18,7 +21,9 @@ class SharedPreferencesDataStore(private val prefs: SharedPreferences) : Prefere
     }
 
     override fun putInt(key: String?, value: Int) {
-        prefs.edit().putInt(key, value).apply()
+        prefs.edit {
+            putInt(key, value)
+        }
     }
 
     override fun getLong(key: String?, defValue: Long): Long {
@@ -26,7 +31,9 @@ class SharedPreferencesDataStore(private val prefs: SharedPreferences) : Prefere
     }
 
     override fun putLong(key: String?, value: Long) {
-        prefs.edit().putLong(key, value).apply()
+        prefs.edit {
+            putLong(key, value)
+        }
     }
 
     override fun getFloat(key: String?, defValue: Float): Float {
@@ -34,7 +41,9 @@ class SharedPreferencesDataStore(private val prefs: SharedPreferences) : Prefere
     }
 
     override fun putFloat(key: String?, value: Float) {
-        prefs.edit().putFloat(key, value).apply()
+        prefs.edit {
+            putFloat(key, value)
+        }
     }
 
     override fun getString(key: String?, defValue: String?): String? {
@@ -42,7 +51,9 @@ class SharedPreferencesDataStore(private val prefs: SharedPreferences) : Prefere
     }
 
     override fun putString(key: String?, value: String?) {
-        prefs.edit().putString(key, value).apply()
+        prefs.edit {
+            putString(key, value)
+        }
     }
 
     override fun getStringSet(key: String?, defValues: MutableSet<String>?): MutableSet<String>? {
@@ -50,6 +61,8 @@ class SharedPreferencesDataStore(private val prefs: SharedPreferences) : Prefere
     }
 
     override fun putStringSet(key: String?, values: MutableSet<String>?) {
-        prefs.edit().putStringSet(key, values).apply()
+        prefs.edit {
+            putStringSet(key, values)
+        }
     }
 }

+ 1 - 1
app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoUpdateChecker.kt

@@ -26,7 +26,7 @@ class DevRepoUpdateChecker : UpdateChecker() {
 
     override suspend fun checkForUpdate(): UpdateResult {
         val response = withContext(Dispatchers.IO) {
-            client.newCall(GET(DevRepoRelease.LATEST_URL)).await(assertSuccess = false)
+            client.newCall(GET(DevRepoRelease.LATEST_URL)).await()
         }
 
         // Get latest repo version number from header in format "Location: tachiyomi-r1512.apk"

+ 1 - 1
app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt

@@ -32,7 +32,7 @@ internal object ExtensionLoader {
     private const val PACKAGE_FLAGS = PackageManager.GET_CONFIGURATIONS or PackageManager.GET_SIGNATURES
 
     // inorichi's key
-    val officialSignature = "7ce04da7773d41b489f4693a366c36bcd0a11fc39b547168553c285bd7348e23"
+    private const val officialSignature = "7ce04da7773d41b489f4693a366c36bcd0a11fc39b547168553c285bd7348e23"
     /**
      * List of the trusted signatures.
      */

+ 2 - 5
app/src/main/java/eu/kanade/tachiyomi/widget/ThemedSwipeRefreshLayout.kt

@@ -17,10 +17,7 @@ class ThemedSwipeRefreshLayout @JvmOverloads constructor(context: Context, attrs
         // Background is controlled with "swipeRefreshLayoutProgressSpinnerBackgroundColor" in XML
 
         // This updates the progress arrow color
-        setColorSchemeColors(
-            ContextCompat.getColor(context, R.color.md_white_1000),
-            ContextCompat.getColor(context, R.color.md_white_1000),
-            ContextCompat.getColor(context, R.color.md_white_1000)
-        )
+        val white = ContextCompat.getColor(context, R.color.md_white_1000)
+        setColorSchemeColors(white, white, white)
     }
 }