Skip to content

Commit

Permalink
Add link to Android subtitle settings in client settings (#905)
Browse files Browse the repository at this point in the history
* Add link to Android subtitle settings in client settings

* Only show subtitle settings link if Intent is available
  • Loading branch information
Maxr1998 authored Nov 28, 2022
1 parent fc893b8 commit 1ffce9e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/src/main/java/org/jellyfin/mobile/settings/SettingsFragment.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/org/jellyfin/mobile/utils/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit 1ffce9e

Please sign in to comment.