Add link to Android subtitle settings in client settings (#905)

* Add link to Android subtitle settings in client settings

* Only show subtitle settings link if Intent is available
This commit is contained in:
Max Rumpf 2022-11-28 09:44:35 +01:00 committed by GitHub
parent fc893b8c33
commit 1ffce9e293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 0 deletions

View File

@ -1,6 +1,8 @@
package org.jellyfin.mobile.settings
import android.content.Intent
import android.os.Bundle
import android.provider.Settings
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -11,7 +13,9 @@ import de.Maxr1998.modernpreferences.PreferencesAdapter
import de.Maxr1998.modernpreferences.helpers.categoryHeader
import de.Maxr1998.modernpreferences.helpers.checkBox
import de.Maxr1998.modernpreferences.helpers.defaultOnCheckedChange
import de.Maxr1998.modernpreferences.helpers.defaultOnClick
import de.Maxr1998.modernpreferences.helpers.defaultOnSelectionChange
import de.Maxr1998.modernpreferences.helpers.pref
import de.Maxr1998.modernpreferences.helpers.screen
import de.Maxr1998.modernpreferences.helpers.singleChoice
import de.Maxr1998.modernpreferences.preferences.CheckBoxPreference
@ -170,6 +174,16 @@ class SettingsFragment : Fragment() {
titleRes = R.string.external_player_app
enabled = appPreferences.videoPlayerType == VideoPlayerType.EXTERNAL_PLAYER
}
val subtitleSettingsIntent = Intent(Settings.ACTION_CAPTIONING_SETTINGS)
if (subtitleSettingsIntent.resolveActivity(requireContext().packageManager) != null) {
pref(Constants.PREF_SUBTITLE_STYLE) {
titleRes = R.string.pref_subtitle_style
summaryRes = R.string.pref_subtitle_style_summary
defaultOnClick {
startActivity(subtitleSettingsIntent)
}
}
}
categoryHeader(PREF_CATEGORY_DOWNLOADS) {
titleRes = R.string.pref_category_downloads
}

View File

@ -40,6 +40,7 @@ object Constants {
const val PREF_EXOPLAYER_ALLOW_BACKGROUND_AUDIO = "pref_exoplayer_allow_background_audio"
const val PREF_EXOPLAYER_DIRECT_PLAY_ASS = "pref_exoplayer_direct_play_ass"
const val PREF_EXTERNAL_PLAYER_APP = "pref_external_player_app"
const val PREF_SUBTITLE_STYLE = "pref_subtitle_style"
const val PREF_DOWNLOAD_LOCATION = "pref_download_location"
// InputManager commands

View File

@ -106,6 +106,9 @@
<string name="external_player_system_default">System default</string>
<string name="external_player_system_default_description">Let the system handle the player choice, some players may not be fully compatible.</string>
<string name="pref_subtitle_style">Customize subtitle style</string>
<string name="pref_subtitle_style_summary">You can change the subtitle style in the Android settings</string>
<string name="pref_category_downloads">Downloads</string>
<string name="pref_download_location">Download location</string>
</resources>