diff --git a/yuuna/lib/i18n/strings.g.dart b/yuuna/lib/i18n/strings.g.dart index 72102df39..c8c84a2da 100644 --- a/yuuna/lib/i18n/strings.g.dart +++ b/yuuna/lib/i18n/strings.g.dart @@ -1,9 +1,9 @@ /// Generated file. Do not edit. /// /// Locales: 1 -/// Strings: 369 +/// Strings: 370 /// -/// Built on 2023-05-16 at 07:45 UTC +/// Built on 2023-05-17 at 11:06 UTC // coverage:ignore-file // ignore_for_file: type=lint @@ -383,6 +383,7 @@ class _StringsEn implements BaseTranslations { String get player_option_subtitle_background_opacity => 'Subtitle background opacity'; String get player_option_subtitle_background_blur_radius => 'Subtitle background blur radius'; String get player_option_outline_width => 'Subtitle outline width'; + String get player_option_subtitle_always_above_bottom_bar => 'Always show subtitle above bottom bar area'; String get player_subtitles_transcript_empty => 'Transcript is empty.'; String get player_prepare_export => 'Preparing card...'; String get player_change_player_orientation => 'Change Player Orientation'; @@ -784,6 +785,7 @@ extension on _StringsEn { case 'player_option_subtitle_background_opacity': return 'Subtitle background opacity'; case 'player_option_subtitle_background_blur_radius': return 'Subtitle background blur radius'; case 'player_option_outline_width': return 'Subtitle outline width'; + case 'player_option_subtitle_always_above_bottom_bar': return 'Always show subtitle above bottom bar area'; case 'player_subtitles_transcript_empty': return 'Transcript is empty.'; case 'player_prepare_export': return 'Preparing card...'; case 'player_change_player_orientation': return 'Change Player Orientation'; diff --git a/yuuna/lib/i18n/strings.i18n.json b/yuuna/lib/i18n/strings.i18n.json index 9ae0f79e2..545523cbf 100644 --- a/yuuna/lib/i18n/strings.i18n.json +++ b/yuuna/lib/i18n/strings.i18n.json @@ -252,6 +252,7 @@ "player_option_subtitle_background_opacity": "Subtitle background opacity", "player_option_subtitle_background_blur_radius": "Subtitle background blur radius", "player_option_outline_width": "Subtitle outline width", + "player_option_subtitle_always_above_bottom_bar": "Always show subtitle above bottom bar area", "player_subtitles_transcript_empty": "Transcript is empty.", "player_prepare_export": "Preparing card...", "player_change_player_orientation": "Change Player Orientation", @@ -397,6 +398,7 @@ "other": "Retrying in $n seconds..." } }, + "view_replies": { "reply": { "one": "SHOW $n REPLY", diff --git a/yuuna/lib/src/models/app_model.dart b/yuuna/lib/src/models/app_model.dart index fd1f6e95b..42f38a7ae 100644 --- a/yuuna/lib/src/models/app_model.dart +++ b/yuuna/lib/src/models/app_model.dart @@ -3157,6 +3157,8 @@ class AppModel with ChangeNotifier { _preferences.get('subtitle_outline_width', defaultValue: 3.0); double subtitleBackgroundBlurRadius = _preferences.get('subtitle_background_blur_radius', defaultValue: 0.0); + bool alwaysAboveBottomBar = + _preferences.get('subtitle_above_bar', defaultValue: false); return SubtitleOptions( audioAllowance: audioAllowance, @@ -3167,6 +3169,7 @@ class AppModel with ChangeNotifier { fontName: fontName, regexFilter: regexFilter, subtitleOutlineWidth: subtitleOutlineWidth, + alwaysAboveBottomBar: alwaysAboveBottomBar, ); } @@ -3183,6 +3186,7 @@ class AppModel with ChangeNotifier { _preferences.put('subtitle_outline_width', options.subtitleOutlineWidth); _preferences.put('subtitle_background_blur_radius', options.subtitleBackgroundBlurRadius); + _preferences.put('subtitle_above_bar', options.alwaysAboveBottomBar); } /// Gets the last used audio index of a given media item. diff --git a/yuuna/lib/src/pages/implementations/player_source_page.dart b/yuuna/lib/src/pages/implementations/player_source_page.dart index 79de710af..b873a47cb 100644 --- a/yuuna/lib/src/pages/implementations/player_source_page.dart +++ b/yuuna/lib/src/pages/implementations/player_source_page.dart @@ -1791,7 +1791,8 @@ class _PlayerSourcePageState extends BaseSourcePageState return Align( alignment: Alignment.bottomCenter, child: Padding( - padding: _isMenuHidden.value + padding: _isMenuHidden.value && + !_subtitleOptionsNotifier.value.alwaysAboveBottomBar ? const EdgeInsets.only(bottom: 20) : const EdgeInsets.only(bottom: _menuHeight + 8), child: child, diff --git a/yuuna/lib/src/pages/implementations/subtitle_options_dialog_page.dart b/yuuna/lib/src/pages/implementations/subtitle_options_dialog_page.dart index 28a118a1f..1d48e5aa1 100644 --- a/yuuna/lib/src/pages/implementations/subtitle_options_dialog_page.dart +++ b/yuuna/lib/src/pages/implementations/subtitle_options_dialog_page.dart @@ -34,6 +34,8 @@ class _SubtitleOptionsDialogPage late final TextEditingController _widthController; late final TextEditingController _blurController; + late ValueNotifier _aboveBottomBarNotifier; + @override void initState() { super.initState(); @@ -54,6 +56,8 @@ class _SubtitleOptionsDialogPage TextEditingController(text: _options.subtitleOutlineWidth.toString()); _blurController = TextEditingController( text: _options.subtitleBackgroundBlurRadius.toString()); + _aboveBottomBarNotifier = + ValueNotifier(_options.alwaysAboveBottomBar); } @override @@ -329,6 +333,8 @@ class _SubtitleOptionsDialogPage ), ), const SizedBox(height: 10), + buildAlwaysAboveBottomBar(), + const SizedBox(height: 10), ], ), ), @@ -337,6 +343,25 @@ class _SubtitleOptionsDialogPage ); } + Widget buildAlwaysAboveBottomBar() { + return Row( + children: [ + Expanded(child: Text(t.player_option_subtitle_always_above_bottom_bar)), + ValueListenableBuilder( + valueListenable: _aboveBottomBarNotifier, + builder: (_, value, __) { + return Switch( + value: value, + onChanged: (value) { + _aboveBottomBarNotifier.value = value; + }, + ); + }, + ) + ], + ); + } + Future setValues({required bool saveOptions}) async { String allowanceText = _allowanceController.text; int? newAllowance = int.tryParse(allowanceText); @@ -359,6 +384,8 @@ class _SubtitleOptionsDialogPage String blurText = _blurController.text; double? newBlur = double.tryParse(blurText); + bool newAlwaysAboveBottomBar = _aboveBottomBarNotifier.value; + if (newDelay != null && newAllowance != null && newFontSize != null && @@ -386,6 +413,7 @@ class _SubtitleOptionsDialogPage subtitleOptions.subtitleBackgroundOpacity = newOpacity; subtitleOptions.subtitleOutlineWidth = newWidth; subtitleOptions.subtitleBackgroundBlurRadius = newBlur; + subtitleOptions.alwaysAboveBottomBar = newAlwaysAboveBottomBar; widget.notifier.value = subtitleOptions; diff --git a/yuuna/lib/src/utils/player/subtitle_options.dart b/yuuna/lib/src/utils/player/subtitle_options.dart index 10e8d86b6..0f38f92f4 100644 --- a/yuuna/lib/src/utils/player/subtitle_options.dart +++ b/yuuna/lib/src/utils/player/subtitle_options.dart @@ -10,6 +10,7 @@ class SubtitleOptions { required this.regexFilter, required this.subtitleOutlineWidth, required this.subtitleBackgroundBlurRadius, + required this.alwaysAboveBottomBar, }); /// Audio allowance, used for audio export, in milliseconds. @@ -35,4 +36,7 @@ class SubtitleOptions { /// Regex filter used for the subtitle. String regexFilter; + + /// Whether or not the subtitle should always be above the bottom bar. + bool alwaysAboveBottomBar; }