minor fixes

This commit is contained in:
Thibault Deckers 2022-02-21 12:22:46 +09:00
parent 06ab31bae2
commit 597518971d
4 changed files with 63 additions and 38 deletions

View file

@ -42,7 +42,7 @@ class EntrySetActions {
EntrySetAction.selectNone, EntrySetAction.selectNone,
]; ];
static const browsing = [ static const pageBrowsing = [
EntrySetAction.searchCollection, EntrySetAction.searchCollection,
EntrySetAction.toggleTitleSearch, EntrySetAction.toggleTitleSearch,
EntrySetAction.addShortcut, EntrySetAction.addShortcut,
@ -52,7 +52,17 @@ class EntrySetActions {
EntrySetAction.emptyBin, EntrySetAction.emptyBin,
]; ];
static const selection = [ // exclude bin related actions
static const collectionEditorBrowsing = [
EntrySetAction.searchCollection,
EntrySetAction.toggleTitleSearch,
EntrySetAction.addShortcut,
EntrySetAction.map,
EntrySetAction.stats,
EntrySetAction.rescan,
];
static const pageSelection = [
EntrySetAction.share, EntrySetAction.share,
EntrySetAction.delete, EntrySetAction.delete,
EntrySetAction.restore, EntrySetAction.restore,
@ -65,6 +75,19 @@ class EntrySetActions {
// editing actions are in their subsection // editing actions are in their subsection
]; ];
// exclude bin related actions
static const collectionEditorSelection = [
EntrySetAction.share,
EntrySetAction.delete,
EntrySetAction.copy,
EntrySetAction.move,
EntrySetAction.toggleFavourite,
EntrySetAction.map,
EntrySetAction.stats,
EntrySetAction.rescan,
// editing actions are in their subsection
];
static const edit = [ static const edit = [
EntrySetAction.editDate, EntrySetAction.editDate,
EntrySetAction.editLocation, EntrySetAction.editLocation,

View file

@ -152,18 +152,17 @@ mixin AlbumMixin on SourceBase {
if (context != null) { if (context != null) {
final type = androidFileUtils.getAlbumType(dirPath); final type = androidFileUtils.getAlbumType(dirPath);
final l10n = context.l10n;
switch (type) { switch (type) {
case AlbumType.camera: case AlbumType.camera:
return l10n.albumCamera; return context.l10n.albumCamera;
case AlbumType.download: case AlbumType.download:
return l10n.albumDownload; return context.l10n.albumDownload;
case AlbumType.screenshots: case AlbumType.screenshots:
return l10n.albumScreenshots; return context.l10n.albumScreenshots;
case AlbumType.screenRecordings: case AlbumType.screenRecordings:
return l10n.albumScreenRecordings; return context.l10n.albumScreenRecordings;
case AlbumType.videoCaptures: case AlbumType.videoCaptures:
return l10n.albumVideoCaptures; return context.l10n.albumVideoCaptures;
case AlbumType.regular: case AlbumType.regular:
case AlbumType.app: case AlbumType.app:
break; break;

View file

@ -120,32 +120,35 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
return Selector<Query, bool>( return Selector<Query, bool>(
selector: (context, query) => query.enabled, selector: (context, query) => query.enabled,
builder: (context, queryEnabled, child) { builder: (context, queryEnabled, child) {
return SliverAppBar( return Selector<Settings, List<EntrySetAction>>(
leading: appMode.hasDrawer ? _buildAppBarLeading(isSelecting) : null, selector: (context, s) => s.collectionBrowsingQuickActions,
title: SliverAppBarTitleWrapper( builder: (context, _, child) => SliverAppBar(
child: _buildAppBarTitle(isSelecting), leading: appMode.hasDrawer ? _buildAppBarLeading(isSelecting) : null,
), title: SliverAppBarTitleWrapper(
actions: _buildActions(selection), child: _buildAppBarTitle(isSelecting),
bottom: PreferredSize(
preferredSize: Size.fromHeight(appBarBottomHeight),
child: Column(
children: [
if (showFilterBar)
FilterBar(
filters: visibleFilters,
removable: removableFilters,
onTap: removableFilters ? collection.removeFilter : null,
),
if (queryEnabled)
EntryQueryBar(
queryNotifier: context.select<Query, ValueNotifier<String>>((query) => query.queryNotifier),
focusNode: _queryBarFocusNode,
)
],
), ),
actions: _buildActions(selection),
bottom: PreferredSize(
preferredSize: Size.fromHeight(appBarBottomHeight),
child: Column(
children: [
if (showFilterBar)
FilterBar(
filters: visibleFilters,
removable: removableFilters,
onTap: removableFilters ? collection.removeFilter : null,
),
if (queryEnabled)
EntryQueryBar(
queryNotifier: context.select<Query, ValueNotifier<String>>((query) => query.queryNotifier),
focusNode: _queryBarFocusNode,
)
],
),
),
titleSpacing: 0,
floating: true,
), ),
titleSpacing: 0,
floating: true,
); );
}, },
); );
@ -243,8 +246,8 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
(action) => _toMenuItem(action, enabled: canApply(action), selection: selection), (action) => _toMenuItem(action, enabled: canApply(action), selection: selection),
); );
final browsingMenuActions = EntrySetActions.browsing.where((v) => !browsingQuickActions.contains(v)); final browsingMenuActions = EntrySetActions.pageBrowsing.where((v) => !browsingQuickActions.contains(v));
final selectionMenuActions = EntrySetActions.selection.where((v) => !selectionQuickActions.contains(v)); final selectionMenuActions = EntrySetActions.pageSelection.where((v) => !selectionQuickActions.contains(v));
final contextualMenuItems = [ final contextualMenuItems = [
...(isSelecting ? selectionMenuActions : browsingMenuActions).where(isVisible).map( ...(isSelecting ? selectionMenuActions : browsingMenuActions).where(isVisible).map(
(action) => _toMenuItem(action, enabled: canApply(action), selection: selection), (action) => _toMenuItem(action, enabled: canApply(action), selection: selection),

View file

@ -39,7 +39,7 @@ class CollectionActionEditorPage extends StatelessWidget {
Tab(text: l10n.settingsCollectionQuickActionTabBrowsing), Tab(text: l10n.settingsCollectionQuickActionTabBrowsing),
QuickActionEditorBody<EntrySetAction>( QuickActionEditorBody<EntrySetAction>(
bannerText: context.l10n.settingsCollectionBrowsingQuickActionEditorBanner, bannerText: context.l10n.settingsCollectionBrowsingQuickActionEditorBanner,
allAvailableActions: EntrySetActions.browsing, allAvailableActions: EntrySetActions.collectionEditorBrowsing,
actionIcon: (action) => action.getIcon(), actionIcon: (action) => action.getIcon(),
actionText: (context, action) => action.getText(context), actionText: (context, action) => action.getText(context),
load: () => settings.collectionBrowsingQuickActions, load: () => settings.collectionBrowsingQuickActions,
@ -50,7 +50,7 @@ class CollectionActionEditorPage extends StatelessWidget {
Tab(text: l10n.settingsCollectionQuickActionTabSelecting), Tab(text: l10n.settingsCollectionQuickActionTabSelecting),
QuickActionEditorBody<EntrySetAction>( QuickActionEditorBody<EntrySetAction>(
bannerText: context.l10n.settingsCollectionSelectionQuickActionEditorBanner, bannerText: context.l10n.settingsCollectionSelectionQuickActionEditorBanner,
allAvailableActions: EntrySetActions.selection, allAvailableActions: EntrySetActions.collectionEditorSelection,
actionIcon: (action) => action.getIcon(), actionIcon: (action) => action.getIcon(),
actionText: (context, action) => action.getText(context), actionText: (context, action) => action.getText(context),
load: () => settings.collectionSelectionQuickActions, load: () => settings.collectionSelectionQuickActions,