Minor cleanup

This commit is contained in:
arkon 2020-08-03 23:03:31 -04:00
parent ecec1bd102
commit 4f02872a84
5 changed files with 24 additions and 14 deletions

View File

@ -155,7 +155,7 @@ class NotificationReceiver : BroadcastReceiver() {
* @param mangaId id of manga * @param mangaId id of manga
* @param chapterId id of chapter * @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 db = DatabaseHelper(context)
val manga = db.getManga(mangaId).executeAsBlocking() val manga = db.getManga(mangaId).executeAsBlocking()
val chapter = db.getChapter(chapterId).executeAsBlocking() val chapter = db.getChapter(chapterId).executeAsBlocking()

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.data.preference package eu.kanade.tachiyomi.data.preference
import android.content.SharedPreferences import android.content.SharedPreferences
import androidx.core.content.edit
import androidx.preference.PreferenceDataStore import androidx.preference.PreferenceDataStore
class SharedPreferencesDataStore(private val prefs: SharedPreferences) : 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) { 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 { 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) { 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 { 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) { 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 { 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) { 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? { 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?) { 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>? { 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>?) { override fun putStringSet(key: String?, values: MutableSet<String>?) {
prefs.edit().putStringSet(key, values).apply() prefs.edit {
putStringSet(key, values)
}
} }
} }

View File

@ -26,7 +26,7 @@ class DevRepoUpdateChecker : UpdateChecker() {
override suspend fun checkForUpdate(): UpdateResult { override suspend fun checkForUpdate(): UpdateResult {
val response = withContext(Dispatchers.IO) { 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" // Get latest repo version number from header in format "Location: tachiyomi-r1512.apk"

View File

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

View File

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