diff --git a/CHANGELOG.md b/CHANGELOG.md index 1baa16e3c..f76ab7a9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. ## [Unreleased] -## [v1.5.8] - 2021-12-22 +## [v1.5.9] - 2021-12-22 ### Added @@ -21,6 +21,9 @@ All notable changes to this project will be documented in this file. - Collection: more consistent scroll bar thumb position to match the viewport - Settings: fixed file selection to import settings on older devices +- Viewer: UI mode switch for Android <10 + +## [v1.5.8] - 2021-12-22 [YANKED] ## [v1.5.7] - 2021-12-01 diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/DeviceHandler.kt b/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/DeviceHandler.kt index 407686da2..e9c9fbc26 100644 --- a/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/DeviceHandler.kt +++ b/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/DeviceHandler.kt @@ -36,6 +36,7 @@ class DeviceHandler(private val context: Context) : MethodCallHandler { "canRenderGoogleMaps" to (sdkInt >= Build.VERSION_CODES.KITKAT_WATCH), "hasFilePicker" to (sdkInt >= Build.VERSION_CODES.KITKAT), "showPinShortcutFeedback" to (sdkInt >= Build.VERSION_CODES.O), + "supportEdgeToEdgeUIMode" to (sdkInt >= Build.VERSION_CODES.Q), ) ) } diff --git a/lib/model/device.dart b/lib/model/device.dart index 0e4296866..7a8ab076b 100644 --- a/lib/model/device.dart +++ b/lib/model/device.dart @@ -6,7 +6,7 @@ final Device device = Device._private(); class Device { late final String _userAgent; late final bool _canGrantDirectoryAccess, _canPinShortcut, _canPrint, _canRenderFlagEmojis, _canRenderGoogleMaps; - late final bool _hasFilePicker, _showPinShortcutFeedback; + late final bool _hasFilePicker, _showPinShortcutFeedback, _supportEdgeToEdgeUIMode; String get userAgent => _userAgent; @@ -20,11 +20,12 @@ class Device { bool get canRenderGoogleMaps => _canRenderGoogleMaps; - // TODO TLAD toggle settings > import/export, about > bug report > save bool get hasFilePicker => _hasFilePicker; bool get showPinShortcutFeedback => _showPinShortcutFeedback; + bool get supportEdgeToEdgeUIMode => _supportEdgeToEdgeUIMode; + Device._private(); Future init() async { @@ -39,5 +40,6 @@ class Device { _canRenderGoogleMaps = capabilities['canRenderGoogleMaps'] ?? false; _hasFilePicker = capabilities['hasFilePicker'] ?? false; _showPinShortcutFeedback = capabilities['showPinShortcutFeedback'] ?? false; + _supportEdgeToEdgeUIMode = capabilities['supportEdgeToEdgeUIMode'] ?? false; } } diff --git a/lib/widgets/filter_grids/album_pick.dart b/lib/widgets/filter_grids/album_pick.dart index 5857eb046..dfff41e2c 100644 --- a/lib/widgets/filter_grids/album_pick.dart +++ b/lib/widgets/filter_grids/album_pick.dart @@ -33,20 +33,20 @@ Future pickAlbum({ final filter = await Navigator.push( context, MaterialPageRoute( - settings: const RouteSettings(name: AlbumPickPage.routeName), - builder: (context) => AlbumPickPage(source: source, moveType: moveType), + settings: const RouteSettings(name: _AlbumPickPage.routeName), + builder: (context) => _AlbumPickPage(source: source, moveType: moveType), ), ); return filter?.album; } -class AlbumPickPage extends StatefulWidget { +class _AlbumPickPage extends StatefulWidget { static const routeName = '/album_pick'; final CollectionSource source; final MoveType? moveType; - const AlbumPickPage({ + const _AlbumPickPage({ Key? key, required this.source, required this.moveType, @@ -56,7 +56,7 @@ class AlbumPickPage extends StatefulWidget { _AlbumPickPageState createState() => _AlbumPickPageState(); } -class _AlbumPickPageState extends State { +class _AlbumPickPageState extends State<_AlbumPickPage> { final _queryNotifier = ValueNotifier(''); CollectionSource get source => widget.source; @@ -75,13 +75,13 @@ class _AlbumPickPageState extends State { return SelectionProvider>( child: FilterGridPage( settingsRouteKey: AlbumListPage.routeName, - appBar: AlbumPickAppBar( + appBar: _AlbumPickAppBar( source: source, moveType: widget.moveType, actionDelegate: AlbumChipSetActionDelegate(gridItems), queryNotifier: _queryNotifier, ), - appBarHeight: AlbumPickAppBar.preferredHeight, + appBarHeight: _AlbumPickAppBar.preferredHeight, sections: AlbumListPage.groupToSections(context, source, gridItems), newFilters: source.getNewAlbumFilters(context), sortFactor: settings.albumSortFactor, @@ -108,15 +108,15 @@ class _AlbumPickPageState extends State { } } -class AlbumPickAppBar extends StatelessWidget { +class _AlbumPickAppBar extends StatelessWidget { final CollectionSource source; final MoveType? moveType; final AlbumChipSetActionDelegate actionDelegate; final ValueNotifier queryNotifier; - static const preferredHeight = kToolbarHeight + AlbumQueryBar.preferredHeight; + static const preferredHeight = kToolbarHeight + _AlbumQueryBar.preferredHeight; - const AlbumPickAppBar({ + const _AlbumPickAppBar({ Key? key, required this.source, required this.moveType, @@ -145,7 +145,7 @@ class AlbumPickAppBar extends StatelessWidget { title: Text(title()), source: source, ), - bottom: AlbumQueryBar( + bottom: _AlbumQueryBar( queryNotifier: queryNotifier, ), actions: [ @@ -160,7 +160,7 @@ class AlbumPickAppBar extends StatelessWidget { // wait for the dialog to hide as applying the change may block the UI await Future.delayed(Durations.dialogTransitionAnimation * timeDilation); if (newAlbum != null && newAlbum.isNotEmpty) { - Navigator.pop(context, newAlbum); + Navigator.pop(context, AlbumFilter(newAlbum, source.getAlbumDisplayName(context, newAlbum))); } }, tooltip: context.l10n.createAlbumTooltip, @@ -192,12 +192,12 @@ class AlbumPickAppBar extends StatelessWidget { } } -class AlbumQueryBar extends StatelessWidget implements PreferredSizeWidget { +class _AlbumQueryBar extends StatelessWidget implements PreferredSizeWidget { final ValueNotifier queryNotifier; static const preferredHeight = kToolbarHeight; - const AlbumQueryBar({ + const _AlbumQueryBar({ Key? key, required this.queryNotifier, }) : super(key: key); @@ -208,7 +208,7 @@ class AlbumQueryBar extends StatelessWidget implements PreferredSizeWidget { @override Widget build(BuildContext context) { return Container( - height: AlbumQueryBar.preferredHeight, + height: _AlbumQueryBar.preferredHeight, alignment: Alignment.topCenter, child: QueryBar( queryNotifier: queryNotifier, diff --git a/lib/widgets/viewer/entry_viewer_stack.dart b/lib/widgets/viewer/entry_viewer_stack.dart index f9004e3ba..299ea5bf2 100644 --- a/lib/widgets/viewer/entry_viewer_stack.dart +++ b/lib/widgets/viewer/entry_viewer_stack.dart @@ -1,5 +1,6 @@ import 'dart:math'; +import 'package:aves/model/device.dart'; import 'package:aves/model/entry.dart'; import 'package:aves/model/filters/filters.dart'; import 'package:aves/model/highlight.dart'; @@ -538,7 +539,13 @@ class _EntryViewerStackState extends State with FeedbackMixin, // system UI - static void _showSystemUI() => SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); + static void _showSystemUI() { + if (device.supportEdgeToEdgeUIMode) { + SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); + } else { + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: SystemUiOverlay.values); + } + } static void _hideSystemUI() => SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive); diff --git a/lib/widgets/viewer/panorama_page.dart b/lib/widgets/viewer/panorama_page.dart index 9e13e9965..5cdaa4dd1 100644 --- a/lib/widgets/viewer/panorama_page.dart +++ b/lib/widgets/viewer/panorama_page.dart @@ -1,5 +1,6 @@ import 'dart:math'; +import 'package:aves/model/device.dart'; import 'package:aves/model/entry.dart'; import 'package:aves/model/entry_images.dart'; import 'package:aves/model/panorama.dart'; @@ -148,7 +149,13 @@ class _PanoramaPageState extends State { // system UI - static void _showSystemUI() => SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); + static void _showSystemUI() { + if (device.supportEdgeToEdgeUIMode) { + SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); + } else { + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: SystemUiOverlay.values); + } + } static void _hideSystemUI() => SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive); diff --git a/pubspec.yaml b/pubspec.yaml index 5a362dd9b..3c42fcd40 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: aves description: A visual media gallery and metadata explorer app. repository: https://github.com/deckerst/aves -version: 1.5.8+62 +version: 1.5.9+63 publish_to: none environment: diff --git a/whatsnew/whatsnew-en-US b/whatsnew/whatsnew-en-US index 611e8e6da..743503987 100644 --- a/whatsnew/whatsnew-en-US +++ b/whatsnew/whatsnew-en-US @@ -1,5 +1,5 @@ Thanks for using Aves! -In v1.5.8: +In v1.5.9: - list view for items and albums - moving, editing or deleting items can be cancelled - enjoy the app in German