#612 option to set maximum brightness on all pages
This commit is contained in:
parent
e7985c5ea5
commit
e4b0997f94
11 changed files with 68 additions and 26 deletions
|
@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Collection: support for Sony predictive capture as burst
|
- Collection: support for Sony predictive capture as burst
|
||||||
|
- Display: option to set maximum brightness on all pages
|
||||||
- Hungarian translation (thanks György Viktor, byPety)
|
- Hungarian translation (thanks György Viktor, byPety)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -24,6 +24,7 @@ class SettingsDefaults {
|
||||||
static const themeColorMode = AvesThemeColorMode.polychrome;
|
static const themeColorMode = AvesThemeColorMode.polychrome;
|
||||||
static const enableDynamicColor = false;
|
static const enableDynamicColor = false;
|
||||||
static const enableBlurEffect = true; // `enableBlurEffect` has a contextual default value
|
static const enableBlurEffect = true; // `enableBlurEffect` has a contextual default value
|
||||||
|
static const maxBrightness = MaxBrightness.never;
|
||||||
static const forceTvLayout = false;
|
static const forceTvLayout = false;
|
||||||
|
|
||||||
// navigation
|
// navigation
|
||||||
|
@ -81,7 +82,6 @@ class SettingsDefaults {
|
||||||
static const showOverlayThumbnailPreview = false;
|
static const showOverlayThumbnailPreview = false;
|
||||||
static const viewerGestureSideTapNext = false;
|
static const viewerGestureSideTapNext = false;
|
||||||
static const viewerUseCutout = true;
|
static const viewerUseCutout = true;
|
||||||
static const viewerMaxBrightness = false;
|
|
||||||
static const enableMotionPhotoAutoPlay = false;
|
static const enableMotionPhotoAutoPlay = false;
|
||||||
|
|
||||||
// video
|
// video
|
||||||
|
|
|
@ -71,6 +71,7 @@ class Settings extends ChangeNotifier {
|
||||||
static const themeColorModeKey = 'theme_color_mode';
|
static const themeColorModeKey = 'theme_color_mode';
|
||||||
static const enableDynamicColorKey = 'dynamic_color';
|
static const enableDynamicColorKey = 'dynamic_color';
|
||||||
static const enableBlurEffectKey = 'enable_overlay_blur_effect';
|
static const enableBlurEffectKey = 'enable_overlay_blur_effect';
|
||||||
|
static const maxBrightnessKey = 'max_brightness';
|
||||||
static const forceTvLayoutKey = 'force_tv_layout';
|
static const forceTvLayoutKey = 'force_tv_layout';
|
||||||
|
|
||||||
// navigation
|
// navigation
|
||||||
|
@ -129,7 +130,6 @@ class Settings extends ChangeNotifier {
|
||||||
static const showOverlayThumbnailPreviewKey = 'show_overlay_thumbnail_preview';
|
static const showOverlayThumbnailPreviewKey = 'show_overlay_thumbnail_preview';
|
||||||
static const viewerGestureSideTapNextKey = 'viewer_gesture_side_tap_next';
|
static const viewerGestureSideTapNextKey = 'viewer_gesture_side_tap_next';
|
||||||
static const viewerUseCutoutKey = 'viewer_use_cutout';
|
static const viewerUseCutoutKey = 'viewer_use_cutout';
|
||||||
static const viewerMaxBrightnessKey = 'viewer_max_brightness';
|
|
||||||
static const enableMotionPhotoAutoPlayKey = 'motion_photo_auto_play';
|
static const enableMotionPhotoAutoPlayKey = 'motion_photo_auto_play';
|
||||||
static const imageBackgroundKey = 'image_background';
|
static const imageBackgroundKey = 'image_background';
|
||||||
|
|
||||||
|
@ -269,6 +269,7 @@ class Settings extends ChangeNotifier {
|
||||||
|
|
||||||
void applyTvSettings() {
|
void applyTvSettings() {
|
||||||
themeBrightness = AvesThemeBrightness.dark;
|
themeBrightness = AvesThemeBrightness.dark;
|
||||||
|
maxBrightness = MaxBrightness.never;
|
||||||
mustBackTwiceToExit = false;
|
mustBackTwiceToExit = false;
|
||||||
// address `TV-BU` / `TV-BY` requirements from https://developer.android.com/docs/quality-guidelines/tv-app-quality
|
// address `TV-BU` / `TV-BY` requirements from https://developer.android.com/docs/quality-guidelines/tv-app-quality
|
||||||
keepScreenOn = KeepScreenOn.videoPlayback;
|
keepScreenOn = KeepScreenOn.videoPlayback;
|
||||||
|
@ -290,7 +291,6 @@ class Settings extends ChangeNotifier {
|
||||||
showOverlayThumbnailPreview = false;
|
showOverlayThumbnailPreview = false;
|
||||||
viewerGestureSideTapNext = false;
|
viewerGestureSideTapNext = false;
|
||||||
viewerUseCutout = true;
|
viewerUseCutout = true;
|
||||||
viewerMaxBrightness = false;
|
|
||||||
videoBackgroundMode = VideoBackgroundMode.disabled;
|
videoBackgroundMode = VideoBackgroundMode.disabled;
|
||||||
videoControls = VideoControls.none;
|
videoControls = VideoControls.none;
|
||||||
videoGestureDoubleTapTogglePlay = false;
|
videoGestureDoubleTapTogglePlay = false;
|
||||||
|
@ -433,6 +433,10 @@ class Settings extends ChangeNotifier {
|
||||||
|
|
||||||
set enableBlurEffect(bool newValue) => _set(enableBlurEffectKey, newValue);
|
set enableBlurEffect(bool newValue) => _set(enableBlurEffectKey, newValue);
|
||||||
|
|
||||||
|
MaxBrightness get maxBrightness => getEnumOrDefault(maxBrightnessKey, SettingsDefaults.maxBrightness, MaxBrightness.values);
|
||||||
|
|
||||||
|
set maxBrightness(MaxBrightness newValue) => _set(maxBrightnessKey, newValue.toString());
|
||||||
|
|
||||||
bool get forceTvLayout => getBool(forceTvLayoutKey) ?? SettingsDefaults.forceTvLayout;
|
bool get forceTvLayout => getBool(forceTvLayoutKey) ?? SettingsDefaults.forceTvLayout;
|
||||||
|
|
||||||
set forceTvLayout(bool newValue) => _set(forceTvLayoutKey, newValue);
|
set forceTvLayout(bool newValue) => _set(forceTvLayoutKey, newValue);
|
||||||
|
@ -661,10 +665,6 @@ class Settings extends ChangeNotifier {
|
||||||
|
|
||||||
set viewerUseCutout(bool newValue) => _set(viewerUseCutoutKey, newValue);
|
set viewerUseCutout(bool newValue) => _set(viewerUseCutoutKey, newValue);
|
||||||
|
|
||||||
bool get viewerMaxBrightness => getBool(viewerMaxBrightnessKey) ?? SettingsDefaults.viewerMaxBrightness;
|
|
||||||
|
|
||||||
set viewerMaxBrightness(bool newValue) => _set(viewerMaxBrightnessKey, newValue);
|
|
||||||
|
|
||||||
bool get enableMotionPhotoAutoPlay => getBool(enableMotionPhotoAutoPlayKey) ?? SettingsDefaults.enableMotionPhotoAutoPlay;
|
bool get enableMotionPhotoAutoPlay => getBool(enableMotionPhotoAutoPlayKey) ?? SettingsDefaults.enableMotionPhotoAutoPlay;
|
||||||
|
|
||||||
set enableMotionPhotoAutoPlay(bool newValue) => _set(enableMotionPhotoAutoPlayKey, newValue);
|
set enableMotionPhotoAutoPlay(bool newValue) => _set(enableMotionPhotoAutoPlayKey, newValue);
|
||||||
|
@ -1105,7 +1105,6 @@ class Settings extends ChangeNotifier {
|
||||||
case showOverlayThumbnailPreviewKey:
|
case showOverlayThumbnailPreviewKey:
|
||||||
case viewerGestureSideTapNextKey:
|
case viewerGestureSideTapNextKey:
|
||||||
case viewerUseCutoutKey:
|
case viewerUseCutoutKey:
|
||||||
case viewerMaxBrightnessKey:
|
|
||||||
case enableMotionPhotoAutoPlayKey:
|
case enableMotionPhotoAutoPlayKey:
|
||||||
case enableVideoHardwareAccelerationKey:
|
case enableVideoHardwareAccelerationKey:
|
||||||
case videoGestureDoubleTapTogglePlayKey:
|
case videoGestureDoubleTapTogglePlayKey:
|
||||||
|
@ -1133,6 +1132,7 @@ class Settings extends ChangeNotifier {
|
||||||
case displayRefreshRateModeKey:
|
case displayRefreshRateModeKey:
|
||||||
case themeBrightnessKey:
|
case themeBrightnessKey:
|
||||||
case themeColorModeKey:
|
case themeColorModeKey:
|
||||||
|
case maxBrightnessKey:
|
||||||
case keepScreenOnKey:
|
case keepScreenOnKey:
|
||||||
case homePageKey:
|
case homePageKey:
|
||||||
case collectionGroupFactorKey:
|
case collectionGroupFactorKey:
|
||||||
|
|
|
@ -123,6 +123,19 @@ extension ExtraKeepScreenOnView on KeepScreenOn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension ExtraMaxBrightnessView on MaxBrightness {
|
||||||
|
String getName(BuildContext context) {
|
||||||
|
switch (this) {
|
||||||
|
case MaxBrightness.never:
|
||||||
|
return context.l10n.keepScreenOnNever;
|
||||||
|
case MaxBrightness.viewerOnly:
|
||||||
|
return context.l10n.keepScreenOnViewerOnly;
|
||||||
|
case MaxBrightness.always:
|
||||||
|
return context.l10n.keepScreenOnAlways;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension ExtraSlideshowVideoPlaybackView on SlideshowVideoPlayback {
|
extension ExtraSlideshowVideoPlaybackView on SlideshowVideoPlayback {
|
||||||
String getName(BuildContext context) {
|
String getName(BuildContext context) {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
|
|
|
@ -49,6 +49,7 @@ import 'package:flutter/services.dart';
|
||||||
import 'package:material_color_utilities/material_color_utilities.dart';
|
import 'package:material_color_utilities/material_color_utilities.dart';
|
||||||
import 'package:overlay_support/overlay_support.dart';
|
import 'package:overlay_support/overlay_support.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:screen_brightness/screen_brightness.dart';
|
||||||
import 'package:tuple/tuple.dart';
|
import 'package:tuple/tuple.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart' as ul;
|
import 'package:url_launcher/url_launcher.dart' as ul;
|
||||||
|
|
||||||
|
@ -506,6 +507,19 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyDisplayRefreshRateMode() => settings.displayRefreshRateMode.apply();
|
void applyDisplayRefreshRateMode() => settings.displayRefreshRateMode.apply();
|
||||||
|
|
||||||
|
void applyMaxBrightness() {
|
||||||
|
switch (settings.maxBrightness) {
|
||||||
|
case MaxBrightness.never:
|
||||||
|
case MaxBrightness.viewerOnly:
|
||||||
|
ScreenBrightness().resetScreenBrightness();
|
||||||
|
break;
|
||||||
|
case MaxBrightness.always:
|
||||||
|
ScreenBrightness().setScreenBrightness(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void applyKeepScreenOn() => settings.keepScreenOn.apply();
|
void applyKeepScreenOn() => settings.keepScreenOn.apply();
|
||||||
|
|
||||||
void applyIsRotationLocked() {
|
void applyIsRotationLocked() {
|
||||||
|
@ -530,6 +544,7 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
||||||
settingStream.where((event) => event.key == Settings.isInstalledAppAccessAllowedKey).listen((_) => applyIsInstalledAppAccessAllowed());
|
settingStream.where((event) => event.key == Settings.isInstalledAppAccessAllowedKey).listen((_) => applyIsInstalledAppAccessAllowed());
|
||||||
// display
|
// display
|
||||||
settingStream.where((event) => event.key == Settings.displayRefreshRateModeKey).listen((_) => applyDisplayRefreshRateMode());
|
settingStream.where((event) => event.key == Settings.displayRefreshRateModeKey).listen((_) => applyDisplayRefreshRateMode());
|
||||||
|
settingStream.where((event) => event.key == Settings.maxBrightnessKey).listen((_) => applyMaxBrightness());
|
||||||
settingStream.where((event) => event.key == Settings.forceTvLayoutKey).listen((_) => applyForceTvLayout());
|
settingStream.where((event) => event.key == Settings.forceTvLayoutKey).listen((_) => applyForceTvLayout());
|
||||||
// navigation
|
// navigation
|
||||||
settingStream.where((event) => event.key == Settings.keepScreenOnKey).listen((_) => applyKeepScreenOn());
|
settingStream.where((event) => event.key == Settings.keepScreenOnKey).listen((_) => applyKeepScreenOn());
|
||||||
|
@ -537,6 +552,7 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
||||||
settingStream.where((event) => event.key == Settings.platformAccelerometerRotationKey).listen((_) => applyIsRotationLocked());
|
settingStream.where((event) => event.key == Settings.platformAccelerometerRotationKey).listen((_) => applyIsRotationLocked());
|
||||||
|
|
||||||
applyDisplayRefreshRateMode();
|
applyDisplayRefreshRateMode();
|
||||||
|
applyMaxBrightness();
|
||||||
applyKeepScreenOn();
|
applyKeepScreenOn();
|
||||||
applyIsRotationLocked();
|
applyIsRotationLocked();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ class DisplaySection extends SettingsSection {
|
||||||
SettingsTileDisplayThemeColorMode(),
|
SettingsTileDisplayThemeColorMode(),
|
||||||
if (device.isDynamicColorAvailable) SettingsTileDisplayEnableDynamicColor(),
|
if (device.isDynamicColorAvailable) SettingsTileDisplayEnableDynamicColor(),
|
||||||
SettingsTileDisplayEnableBlurEffect(),
|
SettingsTileDisplayEnableBlurEffect(),
|
||||||
|
if (!settings.useTvLayout) SettingsTileDisplayMaxBrightness(),
|
||||||
if (!settings.useTvLayout) SettingsTileDisplayRefreshRateMode(),
|
if (!settings.useTvLayout) SettingsTileDisplayRefreshRateMode(),
|
||||||
if (!device.isTelevision) SettingsTileDisplayForceTvLayout(),
|
if (!device.isTelevision) SettingsTileDisplayForceTvLayout(),
|
||||||
];
|
];
|
||||||
|
@ -90,6 +91,20 @@ class SettingsTileDisplayEnableBlurEffect extends SettingsTile {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SettingsTileDisplayMaxBrightness extends SettingsTile {
|
||||||
|
@override
|
||||||
|
String title(BuildContext context) => context.l10n.settingsViewerMaximumBrightness;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => SettingsSelectionListTile<MaxBrightness>(
|
||||||
|
values: MaxBrightness.values,
|
||||||
|
getName: (context, v) => v.getName(context),
|
||||||
|
selector: (context, s) => s.maxBrightness,
|
||||||
|
onSelection: (v) => settings.maxBrightness = v,
|
||||||
|
tileTitle: title(context),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
class SettingsTileDisplayRefreshRateMode extends SettingsTile {
|
class SettingsTileDisplayRefreshRateMode extends SettingsTile {
|
||||||
@override
|
@override
|
||||||
String title(BuildContext context) => context.l10n.settingsDisplayRefreshRateModeTile;
|
String title(BuildContext context) => context.l10n.settingsDisplayRefreshRateModeTile;
|
||||||
|
|
|
@ -38,7 +38,6 @@ class ViewerSection extends SettingsSection {
|
||||||
SettingsTileViewerSlideshow(),
|
SettingsTileViewerSlideshow(),
|
||||||
if (!settings.useTvLayout) SettingsTileViewerGestureSideTapNext(),
|
if (!settings.useTvLayout) SettingsTileViewerGestureSideTapNext(),
|
||||||
if (!settings.useTvLayout && isCutoutAware) SettingsTileViewerUseCutout(),
|
if (!settings.useTvLayout && isCutoutAware) SettingsTileViewerUseCutout(),
|
||||||
if (!settings.useTvLayout) SettingsTileViewerMaxBrightness(),
|
|
||||||
SettingsTileViewerMotionPhotoAutoPlay(),
|
SettingsTileViewerMotionPhotoAutoPlay(),
|
||||||
SettingsTileViewerImageBackground(),
|
SettingsTileViewerImageBackground(),
|
||||||
];
|
];
|
||||||
|
@ -105,18 +104,6 @@ class SettingsTileViewerUseCutout extends SettingsTile {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SettingsTileViewerMaxBrightness extends SettingsTile {
|
|
||||||
@override
|
|
||||||
String title(BuildContext context) => context.l10n.settingsViewerMaximumBrightness;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) => SettingsSwitchListTile(
|
|
||||||
selector: (context, s) => s.viewerMaxBrightness,
|
|
||||||
onChanged: (v) => settings.viewerMaxBrightness = v,
|
|
||||||
title: title(context),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class SettingsTileViewerMotionPhotoAutoPlay extends SettingsTile {
|
class SettingsTileViewerMotionPhotoAutoPlay extends SettingsTile {
|
||||||
@override
|
@override
|
||||||
String title(BuildContext context) => context.l10n.settingsMotionPhotoAutoPlay;
|
String title(BuildContext context) => context.l10n.settingsMotionPhotoAutoPlay;
|
||||||
|
|
|
@ -77,7 +77,7 @@ class _ViewerVerticalPageViewState extends State<ViewerVerticalPageView> {
|
||||||
super.initState();
|
super.initState();
|
||||||
_registerWidget(widget);
|
_registerWidget(widget);
|
||||||
|
|
||||||
if (settings.viewerMaxBrightness) {
|
if (settings.maxBrightness == MaxBrightness.viewerOnly) {
|
||||||
_systemBrightness = ScreenBrightness().system;
|
_systemBrightness = ScreenBrightness().system;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ class _ViewerVerticalPageViewState extends State<ViewerVerticalPageView> {
|
||||||
final opacity = min(1.0, page);
|
final opacity = min(1.0, page);
|
||||||
_backgroundOpacityNotifier.value = opacity * opacity;
|
_backgroundOpacityNotifier.value = opacity * opacity;
|
||||||
|
|
||||||
if (settings.viewerMaxBrightness) {
|
if (settings.maxBrightness == MaxBrightness.viewerOnly) {
|
||||||
_systemBrightness?.then((system) {
|
_systemBrightness?.then((system) {
|
||||||
final value = lerpDouble(maximumBrightness, system, ((1 - page).abs() * 2).clamp(0, 1))!;
|
final value = lerpDouble(maximumBrightness, system, ((1 - page).abs() * 2).clamp(0, 1))!;
|
||||||
ScreenBrightness().setScreenBrightness(value);
|
ScreenBrightness().setScreenBrightness(value);
|
||||||
|
|
|
@ -104,7 +104,7 @@ class _EntryViewerStackState extends State<EntryViewerStack> with EntryViewContr
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
if (settings.viewerMaxBrightness) {
|
if (settings.maxBrightness == MaxBrightness.viewerOnly) {
|
||||||
ScreenBrightness().setScreenBrightness(1);
|
ScreenBrightness().setScreenBrightness(1);
|
||||||
}
|
}
|
||||||
if (settings.keepScreenOn == KeepScreenOn.viewerOnly) {
|
if (settings.keepScreenOn == KeepScreenOn.viewerOnly) {
|
||||||
|
@ -803,7 +803,15 @@ class _EntryViewerStackState extends State<EntryViewerStack> with EntryViewContr
|
||||||
// to be unmounted after the other async steps
|
// to be unmounted after the other async steps
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
|
|
||||||
await ScreenBrightness().resetScreenBrightness();
|
switch (settings.maxBrightness) {
|
||||||
|
case MaxBrightness.never:
|
||||||
|
case MaxBrightness.viewerOnly:
|
||||||
|
await ScreenBrightness().resetScreenBrightness();
|
||||||
|
break;
|
||||||
|
case MaxBrightness.always:
|
||||||
|
await ScreenBrightness().setScreenBrightness(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (settings.keepScreenOn == KeepScreenOn.viewerOnly) {
|
if (settings.keepScreenOn == KeepScreenOn.viewerOnly) {
|
||||||
await windowService.keepScreenOn(false);
|
await windowService.keepScreenOn(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ class _EntryEditorState extends State<EntryEditor> with EntryViewControllerMixin
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
if (settings.viewerMaxBrightness) {
|
if (settings.maxBrightness == MaxBrightness.viewerOnly) {
|
||||||
ScreenBrightness().setScreenBrightness(1);
|
ScreenBrightness().setScreenBrightness(1);
|
||||||
}
|
}
|
||||||
if (settings.keepScreenOn == KeepScreenOn.viewerOnly) {
|
if (settings.keepScreenOn == KeepScreenOn.viewerOnly) {
|
||||||
|
|
|
@ -18,6 +18,8 @@ enum HomePageSetting { collection, albums }
|
||||||
|
|
||||||
enum KeepScreenOn { never, videoPlayback, viewerOnly, always }
|
enum KeepScreenOn { never, videoPlayback, viewerOnly, always }
|
||||||
|
|
||||||
|
enum MaxBrightness { never, viewerOnly, always }
|
||||||
|
|
||||||
enum SlideshowVideoPlayback { skip, playMuted, playWithSound }
|
enum SlideshowVideoPlayback { skip, playMuted, playWithSound }
|
||||||
|
|
||||||
enum SubtitlePosition { top, bottom }
|
enum SubtitlePosition { top, bottom }
|
||||||
|
|
Loading…
Reference in a new issue