From 598feea84d069bc94dfa52bd76ede11ac650866b Mon Sep 17 00:00:00 2001 From: LuftVerbot <97435834+LuftVerbot@users.noreply.github.com> Date: Sat, 21 Sep 2024 15:45:02 +0200 Subject: [PATCH] Update ktor & add default value to slider setting (#32) --- .../dev/brahmkshatriya/echo/playback/ByteChannelDataSource.kt | 2 ++ .../dev/brahmkshatriya/echo/ui/settings/ExtensionFragment.kt | 1 + common/build.gradle.kts | 2 +- .../dev/brahmkshatriya/echo/common/settings/SettingSlider.kt | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/dev/brahmkshatriya/echo/playback/ByteChannelDataSource.kt b/app/src/main/java/dev/brahmkshatriya/echo/playback/ByteChannelDataSource.kt index 714560f2..fd8e9dfd 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/playback/ByteChannelDataSource.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/playback/ByteChannelDataSource.kt @@ -10,6 +10,8 @@ import androidx.media3.datasource.DataSpec import dev.brahmkshatriya.echo.common.models.Streamable import io.ktor.utils.io.ByteReadChannel import io.ktor.utils.io.cancel +import io.ktor.utils.io.discard +import io.ktor.utils.io.readAvailable import kotlinx.coroutines.runBlocking import java.io.IOException diff --git a/app/src/main/java/dev/brahmkshatriya/echo/ui/settings/ExtensionFragment.kt b/app/src/main/java/dev/brahmkshatriya/echo/ui/settings/ExtensionFragment.kt index d3082ddf..cd7a75c1 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/ui/settings/ExtensionFragment.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/ui/settings/ExtensionFragment.kt @@ -191,6 +191,7 @@ class ExtensionFragment : BaseSettingsFragment() { it.title = this.title it.key = this.key it.summary = this.summary + it.setDefaultValue(this.defaultValue) it.isIconSpaceReserved = false preferenceGroup.addPreference(it) diff --git a/common/build.gradle.kts b/common/build.gradle.kts index dcd78589..37c563c2 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -16,7 +16,7 @@ kotlin { dependencies { api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1") - api("io.ktor:ktor-utils:2.3.0") + api("io.ktor:ktor-utils:3.0.0-beta-2") } publishing { diff --git a/common/src/main/java/dev/brahmkshatriya/echo/common/settings/SettingSlider.kt b/common/src/main/java/dev/brahmkshatriya/echo/common/settings/SettingSlider.kt index 7d6aaebf..1ccb7bd6 100644 --- a/common/src/main/java/dev/brahmkshatriya/echo/common/settings/SettingSlider.kt +++ b/common/src/main/java/dev/brahmkshatriya/echo/common/settings/SettingSlider.kt @@ -4,6 +4,7 @@ data class SettingSlider ( override val title: String, override val key: String, val summary: String? = null, + val defaultValue: Int? = null, val from: Int, val to: Int, val steps: Int? = null