diff --git a/app/src/main/java/org/jellyfin/mobile/settings/SettingsActivity.kt b/app/src/main/java/org/jellyfin/mobile/settings/SettingsActivity.kt index ecf451d4f..603c67b55 100644 --- a/app/src/main/java/org/jellyfin/mobile/settings/SettingsActivity.kt +++ b/app/src/main/java/org/jellyfin/mobile/settings/SettingsActivity.kt @@ -3,18 +3,20 @@ package org.jellyfin.mobile.settings import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import androidx.recyclerview.widget.RecyclerView +import de.Maxr1998.modernpreferences.Preference import de.Maxr1998.modernpreferences.PreferencesAdapter -import de.Maxr1998.modernpreferences.helpers.categoryHeader -import de.Maxr1998.modernpreferences.helpers.checkBox -import de.Maxr1998.modernpreferences.helpers.screen -import de.Maxr1998.modernpreferences.helpers.singleChoice +import de.Maxr1998.modernpreferences.helpers.* import de.Maxr1998.modernpreferences.preferences.choice.SelectionItem +import org.jellyfin.mobile.AppPreferences import org.jellyfin.mobile.R import org.jellyfin.mobile.utils.Constants +import org.koin.android.ext.android.inject class SettingsActivity : AppCompatActivity() { + private val appPreferences: AppPreferences by inject() private val settingsAdapter: PreferencesAdapter by lazy { PreferencesAdapter(buildSettingsScreen()) } + private lateinit var backgroundAudioPreference: Preference override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -50,9 +52,13 @@ class SettingsActivity : AppCompatActivity() { singleChoice(Constants.PREF_VIDEO_PLAYER_TYPE, videoPlayerOptions) { titleRes = R.string.pref_video_player_type_title initialSelection = VideoPlayerType.WEB_PLAYER + defaultOnSelectionChange { selection -> + backgroundAudioPreference.enabled = selection == VideoPlayerType.EXO_PLAYER + } } - checkBox(Constants.PREF_EXOPLAYER_ALLOW_BACKGROUND_AUDIO) { + backgroundAudioPreference = checkBox(Constants.PREF_EXOPLAYER_ALLOW_BACKGROUND_AUDIO) { titleRes = R.string.pref_exoplayer_allow_background_audio + enabled = appPreferences.videoPlayerType == VideoPlayerType.EXO_PLAYER } } diff --git a/build.gradle.kts b/build.gradle.kts index fcd7c3ecf..f0b9a5fb9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ buildscript { val kotlinVersion: String by project classpath("com.android.tools.build:gradle:4.0.1") classpath(kotlin("gradle-plugin", kotlinVersion)) - classpath("de.mannodermaus.gradle.plugins:android-junit5:1.3.2.0") + classpath("de.mannodermaus.gradle.plugins:android-junit5:1.6.2.0") } } @@ -26,4 +26,4 @@ tasks.wrapper { tasks.create("clean") { delete(rootProject.buildDir) -} \ No newline at end of file +} diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index dd3eaee33..2f57f7cf7 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -23,7 +23,7 @@ object Dependencies { const val constraintLayout = "1.1.3" const val material = "1.2.1" const val webkitX = "1.2.0" - const val modernAndroidPreferences = "1.1.0-alpha2" + const val modernAndroidPreferences = "1.1.0-alpha3" // Network const val apiClient = "0.7.2" diff --git a/gradle.properties b/gradle.properties index 341e0ebca..e7b4b3da1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,4 +19,4 @@ android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official # Kotlin version for this project -kotlinVersion=1.4.0 +kotlinVersion=1.4.10