diff --git a/app/src/main/java/live/mehiz/mpvkt/preferences/SubtitlesPreferences.kt b/app/src/main/java/live/mehiz/mpvkt/preferences/SubtitlesPreferences.kt
index 301844e..9f9385f 100644
--- a/app/src/main/java/live/mehiz/mpvkt/preferences/SubtitlesPreferences.kt
+++ b/app/src/main/java/live/mehiz/mpvkt/preferences/SubtitlesPreferences.kt
@@ -18,6 +18,7 @@ class SubtitlesPreferences(preferenceStore: PreferenceStore) {
val fontsFolder = preferenceStore.getString("sub_fonts_folder")
val font = preferenceStore.getString("sub_font", "Sans Serif")
val fontSize = preferenceStore.getInt("sub_font_size", 55)
+ val subScale = preferenceStore.getFloat("sub_scale", 1f)
val borderSize = preferenceStore.getInt("sub_border_size", 3)
val bold = preferenceStore.getBoolean("sub_bold")
val italic = preferenceStore.getBoolean("sub_italic")
diff --git a/app/src/main/java/live/mehiz/mpvkt/ui/player/MPVView.kt b/app/src/main/java/live/mehiz/mpvkt/ui/player/MPVView.kt
index c65f3e4..3c7d930 100644
--- a/app/src/main/java/live/mehiz/mpvkt/ui/player/MPVView.kt
+++ b/app/src/main/java/live/mehiz/mpvkt/ui/player/MPVView.kt
@@ -246,5 +246,6 @@ class MPVView(context: Context, attributes: AttributeSet) : BaseMPVView(context,
MPVLib.setOptionString("sub-border-style", subtitlesPreferences.borderStyle.get().value)
MPVLib.setOptionString("sub-shadow-offset", subtitlesPreferences.shadowOffset.get().toString())
MPVLib.setOptionString("sub-pos", subtitlesPreferences.subPos.get().toString())
+ MPVLib.setOptionString("sub-scale", subtitlesPreferences.subScale.get().toString())
}
}
diff --git a/app/src/main/java/live/mehiz/mpvkt/ui/player/controls/GestureHandler.kt b/app/src/main/java/live/mehiz/mpvkt/ui/player/controls/GestureHandler.kt
index add3911..4437527 100644
--- a/app/src/main/java/live/mehiz/mpvkt/ui/player/controls/GestureHandler.kt
+++ b/app/src/main/java/live/mehiz/mpvkt/ui/player/controls/GestureHandler.kt
@@ -230,8 +230,11 @@ fun GestureHandler(modifier: Modifier = Modifier) {
if (position >= duration && dragAmount > 0) return@detectHorizontalDragGestures
calculateNewHorizontalGestureValue(startingPosition, startingX, change.position.x, 0.15f).let {
viewModel.gestureSeekAmount.update { _ ->
- Pair(startingPosition, (it - startingPosition)
- .coerceIn(0 - startingPosition, (duration - startingPosition).toInt()))
+ Pair(
+ startingPosition,
+ (it - startingPosition)
+ .coerceIn(0 - startingPosition, (duration - startingPosition).toInt())
+ )
}
viewModel.seekTo(it, preciseSeeking)
}
diff --git a/app/src/main/java/live/mehiz/mpvkt/ui/player/controls/components/panels/SubtitleSettingsMiscellaneousCard.kt b/app/src/main/java/live/mehiz/mpvkt/ui/player/controls/components/panels/SubtitleSettingsMiscellaneousCard.kt
index aa8f8ee..b9d8fee 100644
--- a/app/src/main/java/live/mehiz/mpvkt/ui/player/controls/components/panels/SubtitleSettingsMiscellaneousCard.kt
+++ b/app/src/main/java/live/mehiz/mpvkt/ui/player/controls/components/panels/SubtitleSettingsMiscellaneousCard.kt
@@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.widthIn
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AlignVerticalCenter
import androidx.compose.material.icons.filled.EditOff
+import androidx.compose.material.icons.filled.FormatSize
import androidx.compose.material.icons.filled.Tune
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
@@ -27,6 +28,7 @@ import live.mehiz.mpvkt.preferences.SubtitlesPreferences
import live.mehiz.mpvkt.preferences.preference.deleteAndGet
import live.mehiz.mpvkt.presentation.components.ExpandableCard
import live.mehiz.mpvkt.presentation.components.SliderItem
+import live.mehiz.mpvkt.ui.player.controls.components.sheets.toFixed
import live.mehiz.mpvkt.ui.theme.spacing
import me.zhanghai.compose.preference.ProvidePreferenceLocals
import me.zhanghai.compose.preference.SwitchPreference
@@ -62,9 +64,29 @@ fun SubtitlesMiscellaneousCard(modifier: Modifier = Modifier) {
},
{ Text(stringResource(R.string.player_sheets_sub_override_ass)) },
)
+ var subScale by remember {
+ mutableStateOf(MPVLib.getPropertyDouble("sub-scale").toFloat())
+ }
var subPos by remember {
mutableStateOf(MPVLib.getPropertyInt("sub-pos"))
}
+ SliderItem(
+ label = stringResource(R.string.player_sheets_sub_scale),
+ value = subScale,
+ valueText = subScale.toFixed(2).toString(),
+ onChange = {
+ subScale = it
+ preferences.subScale.set(it)
+ MPVLib.setPropertyDouble("sub-scale", it.toDouble())
+ },
+ max = 5f,
+ icon = {
+ Icon(
+ Icons.Default.FormatSize,
+ null,
+ )
+ },
+ )
SliderItem(
label = stringResource(R.string.player_sheets_sub_position),
value = subPos,
@@ -80,13 +102,13 @@ fun SubtitlesMiscellaneousCard(modifier: Modifier = Modifier) {
Icons.Default.AlignVerticalCenter,
null,
)
- }
+ },
)
Row(
modifier = Modifier
.fillMaxWidth()
.padding(end = MaterialTheme.spacing.medium, bottom = MaterialTheme.spacing.medium),
- horizontalArrangement = Arrangement.End
+ horizontalArrangement = Arrangement.End,
) {
TextButton(
onClick = {
@@ -94,6 +116,10 @@ fun SubtitlesMiscellaneousCard(modifier: Modifier = Modifier) {
subPos = it
MPVLib.setPropertyInt("sub-pos", it)
}
+ preferences.subScale.deleteAndGet().let {
+ subScale = it
+ MPVLib.setPropertyDouble("sub-scale", it.toDouble())
+ }
preferences.overrideAssSubs.deleteAndGet().let { overrideAssSubs = it }
MPVLib.setPropertyString("sub-ass-override", "scale") // mpv's default is 'scale'
},
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 26c9566..87ad9c4 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -136,6 +136,7 @@
Blue
Alpha
Override ASS/SSA subtitles
+ Scale
Position
Typography
Font