Use Kotlin way of concatenation

This commit is contained in:
Dominik Stadler 2019-03-31 11:47:59 +02:00
parent 062fe21567
commit 56723320aa

View file

@ -376,18 +376,17 @@ class Config(context: Context) : BaseConfig(context) {
set(bottomActions) = prefs.edit().putBoolean(BOTTOM_ACTIONS, bottomActions).apply() set(bottomActions) = prefs.edit().putBoolean(BOTTOM_ACTIONS, bottomActions).apply()
fun removeLastVideoPosition(path: String) { fun removeLastVideoPosition(path: String) {
prefs.edit().remove(LAST_VIDEO_POSITION_PREFIX + path.toLowerCase()).apply() prefs.edit().remove("$LAST_VIDEO_POSITION_PREFIX${path.toLowerCase()}").apply()
} }
fun saveLastVideoPosition(path: String, value: Int) { fun saveLastVideoPosition(path: String, value: Int) {
if (!path.isEmpty()) { if (!path.isEmpty()) {
prefs.edit().putInt(LAST_VIDEO_POSITION_PREFIX + path.toLowerCase(), value).apply() prefs.edit().putInt("$LAST_VIDEO_POSITION_PREFIX${path.toLowerCase()}", value).apply()
} }
} }
fun getLastVideoPosition(path: String): Int { fun getLastVideoPosition(path: String): Int {
val value = prefs.getInt(LAST_VIDEO_POSITION_PREFIX + path.toLowerCase(), 0) return prefs.getInt("$LAST_VIDEO_POSITION_PREFIX${path.toLowerCase()}", 0)
return value
} }
fun getAllLastVideoPositions() = prefs.all.filterKeys { it.startsWith(LAST_VIDEO_POSITION_PREFIX) } fun getAllLastVideoPositions() = prefs.all.filterKeys { it.startsWith(LAST_VIDEO_POSITION_PREFIX) }