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,
];
static const browsing = [
static const pageBrowsing = [
EntrySetAction.searchCollection,
EntrySetAction.toggleTitleSearch,
EntrySetAction.addShortcut,
@ -52,7 +52,17 @@ class EntrySetActions {
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.delete,
EntrySetAction.restore,
@ -65,6 +75,19 @@ class EntrySetActions {
// 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 = [
EntrySetAction.editDate,
EntrySetAction.editLocation,

View file

@ -118,7 +118,7 @@ mixin AlbumMixin on SourceBase {
AvesEntry? albumRecentEntry(AlbumFilter filter) {
return _filterRecentEntryMap.putIfAbsent(filter.album, () => sortedEntriesByDate.firstWhereOrNull(filter.test));
}
// new albums
void createAlbum(String directory) {
@ -136,7 +136,7 @@ mixin AlbumMixin on SourceBase {
void forgetNewAlbums(Set<String> directories) {
_newAlbums.removeAll(directories);
}
// display names
final Map<String, String> _albumDisplayNamesWithContext = {}, _albumDisplayNamesWithoutContext = {};
@ -152,18 +152,17 @@ mixin AlbumMixin on SourceBase {
if (context != null) {
final type = androidFileUtils.getAlbumType(dirPath);
final l10n = context.l10n;
switch (type) {
case AlbumType.camera:
return l10n.albumCamera;
return context.l10n.albumCamera;
case AlbumType.download:
return l10n.albumDownload;
return context.l10n.albumDownload;
case AlbumType.screenshots:
return l10n.albumScreenshots;
return context.l10n.albumScreenshots;
case AlbumType.screenRecordings:
return l10n.albumScreenRecordings;
return context.l10n.albumScreenRecordings;
case AlbumType.videoCaptures:
return l10n.albumVideoCaptures;
return context.l10n.albumVideoCaptures;
case AlbumType.regular:
case AlbumType.app:
break;

View file

@ -120,32 +120,35 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
return Selector<Query, bool>(
selector: (context, query) => query.enabled,
builder: (context, queryEnabled, child) {
return SliverAppBar(
leading: appMode.hasDrawer ? _buildAppBarLeading(isSelecting) : null,
title: SliverAppBarTitleWrapper(
child: _buildAppBarTitle(isSelecting),
),
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,
)
],
return Selector<Settings, List<EntrySetAction>>(
selector: (context, s) => s.collectionBrowsingQuickActions,
builder: (context, _, child) => SliverAppBar(
leading: appMode.hasDrawer ? _buildAppBarLeading(isSelecting) : null,
title: SliverAppBarTitleWrapper(
child: _buildAppBarTitle(isSelecting),
),
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),
);
final browsingMenuActions = EntrySetActions.browsing.where((v) => !browsingQuickActions.contains(v));
final selectionMenuActions = EntrySetActions.selection.where((v) => !selectionQuickActions.contains(v));
final browsingMenuActions = EntrySetActions.pageBrowsing.where((v) => !browsingQuickActions.contains(v));
final selectionMenuActions = EntrySetActions.pageSelection.where((v) => !selectionQuickActions.contains(v));
final contextualMenuItems = [
...(isSelecting ? selectionMenuActions : browsingMenuActions).where(isVisible).map(
(action) => _toMenuItem(action, enabled: canApply(action), selection: selection),

View file

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