fixing a crash related to Shared Theme navigation bar color fetching

This commit is contained in:
tibbi 2019-10-09 10:42:18 +02:00
parent 28db8ba25c
commit b6bce2b2ec
3 changed files with 5 additions and 2 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 21 propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1 propVersionCode = 1
propVersionName = '5.18.6' propVersionName = '5.18.7'
kotlin_version = '1.3.50' kotlin_version = '1.3.50'
} }

View file

@ -373,7 +373,7 @@ fun Context.getSharedThemeSync(cursorLoader: CursorLoader): SharedTheme? {
val backgroundColor = cursor.getIntValue(COL_BACKGROUND_COLOR) val backgroundColor = cursor.getIntValue(COL_BACKGROUND_COLOR)
val primaryColor = cursor.getIntValue(COL_PRIMARY_COLOR) val primaryColor = cursor.getIntValue(COL_PRIMARY_COLOR)
val appIconColor = cursor.getIntValue(COL_APP_ICON_COLOR) val appIconColor = cursor.getIntValue(COL_APP_ICON_COLOR)
val navigationBarColor = cursor.getIntValue(COL_NAVIGATION_BAR_COLOR) val navigationBarColor = cursor.getIntValueOrNull(COL_NAVIGATION_BAR_COLOR) ?: INVALID_NAVIGATION_BAR_COLOR
val lastUpdatedTS = cursor.getIntValue(COL_LAST_UPDATED_TS) val lastUpdatedTS = cursor.getIntValue(COL_LAST_UPDATED_TS)
return SharedTheme(textColor, backgroundColor, primaryColor, appIconColor, navigationBarColor, lastUpdatedTS) return SharedTheme(textColor, backgroundColor, primaryColor, appIconColor, navigationBarColor, lastUpdatedTS)
} }

View file

@ -1,11 +1,14 @@
package com.simplemobiletools.commons.extensions package com.simplemobiletools.commons.extensions
import android.database.Cursor import android.database.Cursor
import androidx.core.database.getIntOrNull
fun Cursor.getStringValue(key: String) = getString(getColumnIndex(key)) fun Cursor.getStringValue(key: String) = getString(getColumnIndex(key))
fun Cursor.getIntValue(key: String) = getInt(getColumnIndex(key)) fun Cursor.getIntValue(key: String) = getInt(getColumnIndex(key))
fun Cursor.getIntValueOrNull(key: String) = getIntOrNull(getColumnIndex(key))
fun Cursor.getLongValue(key: String) = getLong(getColumnIndex(key)) fun Cursor.getLongValue(key: String) = getLong(getColumnIndex(key))
fun Cursor.getBlobValue(key: String) = getBlob(getColumnIndex(key)) fun Cursor.getBlobValue(key: String) = getBlob(getColumnIndex(key))