mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
add a preference for the captions text size
This commit is contained in:
parent
a32e4a8776
commit
da2574e71c
@ -85,6 +85,7 @@ object PreferenceKeys {
|
||||
const val QUEUE_AUTO_INSERT_RELATED = "queue_insert_related_videos"
|
||||
const val PLAYER_SWIPE_CONTROLS = "player_swipe_controls"
|
||||
const val PLAYER_SCREEN_BRIGHTNESS = "player_screen_brightness"
|
||||
const val CAPTIONS_SIZE = "captions_size"
|
||||
|
||||
/**
|
||||
* Background mode
|
||||
|
@ -729,7 +729,7 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
||||
val captionStyle = PlayerHelper.getCaptionStyle(requireContext())
|
||||
exoPlayerView.subtitleView?.apply {
|
||||
setApplyEmbeddedFontSizes(false)
|
||||
setFixedTextSize(TEXT_SIZE_TYPE_ABSOLUTE, 18F)
|
||||
setFixedTextSize(TEXT_SIZE_TYPE_ABSOLUTE, PlayerHelper.captionsTextSize)
|
||||
if (!PlayerHelper.useSystemCaptionStyle) return
|
||||
setApplyEmbeddedStyles(captionStyle == CaptionStyleCompat.DEFAULT)
|
||||
setStyle(captionStyle)
|
||||
|
@ -300,6 +300,12 @@ object PlayerHelper {
|
||||
true
|
||||
)
|
||||
|
||||
val captionsTextSize: Float
|
||||
get() = PreferenceHelper.getString(
|
||||
PreferenceKeys.CAPTIONS_SIZE,
|
||||
"18"
|
||||
).toFloat()
|
||||
|
||||
fun getDefaultResolution(context: Context): String {
|
||||
return if (NetworkHelper.isNetworkMobile(context)) {
|
||||
PreferenceHelper.getString(
|
||||
|
10
app/src/main/res/drawable/ic_text.xml
Normal file
10
app/src/main/res/drawable/ic_text.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M2.5,4v3h5v12h3V7h5V4H2.5zM21.5,9h-9v3h3v7h3v-7h3V9z" />
|
||||
</vector>
|
@ -398,6 +398,7 @@
|
||||
<string name="pop_up">Pop-Up</string>
|
||||
<string name="comments_disabled">Comments are disabled by the uploader.</string>
|
||||
<string name="no_comments_available">This video has no comments available.</string>
|
||||
<string name="captions_size">Captions size</string>
|
||||
|
||||
<!-- Notification channel strings -->
|
||||
<string name="download_channel_name">Download Service</string>
|
||||
|
@ -62,6 +62,15 @@
|
||||
app:summary="@string/buffering_goal_summary"
|
||||
app:title="@string/buffering_goal" />
|
||||
|
||||
<com.github.libretube.ui.views.SliderPreference
|
||||
android:icon="@drawable/ic_text"
|
||||
android:key="captions_size"
|
||||
android:title="@string/captions_size"
|
||||
app:defValue="18"
|
||||
app:stepSize="1"
|
||||
app:valueFrom="8"
|
||||
app:valueTo="30" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory app:title="@string/appearance">
|
||||
|
Loading…
x
Reference in New Issue
Block a user