mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 06:46:22 +01:00
Move memories settings to a new page
This commit is contained in:
parent
92bbf70bfc
commit
3040cd123e
3 changed files with 120 additions and 30 deletions
|
@ -363,6 +363,14 @@
|
|||
"@settingsServerAppSectionTitle": {
|
||||
"description": "Enable/disable various server apps"
|
||||
},
|
||||
"settingsPhotosDescription": "Customize contents shown in the Photos tab",
|
||||
"@settingsPhotosDescription": {
|
||||
"description": "The 'Photos' here means the tab called 'Photos', not literally a photo. The title of this setting will also reuse the label of that tab"
|
||||
},
|
||||
"settingsPhotosPageTitle": "Photos settings",
|
||||
"@settingsPhotosPageTitle": {
|
||||
"description": "Dedicated page for settings related to the Photos tab"
|
||||
},
|
||||
"settingsViewerTitle": "Viewer",
|
||||
"settingsViewerDescription": "Customize the image/video viewer",
|
||||
"settingsViewerPageTitle": "Viewer settings",
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
"settingsShareFolderDialogDescription",
|
||||
"settingsShareFolderPickerDescription",
|
||||
"settingsServerAppSectionTitle",
|
||||
"settingsPhotosDescription",
|
||||
"settingsPhotosPageTitle",
|
||||
"settingsMapProviderTitle",
|
||||
"settingsAlbumTitle",
|
||||
"settingsAlbumDescription",
|
||||
|
@ -166,6 +168,8 @@
|
|||
"settingsShareFolderDialogDescription",
|
||||
"settingsShareFolderPickerDescription",
|
||||
"settingsServerAppSectionTitle",
|
||||
"settingsPhotosDescription",
|
||||
"settingsPhotosPageTitle",
|
||||
"settingsMapProviderTitle",
|
||||
"settingsAlbumTitle",
|
||||
"settingsAlbumDescription",
|
||||
|
@ -321,6 +325,8 @@
|
|||
"settingsExifWifiOnlyFalseSubtitle",
|
||||
"settingsAccountLabelTitle",
|
||||
"settingsAccountLabelDescription",
|
||||
"settingsPhotosDescription",
|
||||
"settingsPhotosPageTitle",
|
||||
"settingsDoubleTapExitTitle",
|
||||
"enhanceStyleTransferStyleDialogTitle",
|
||||
"doubleTapExitNotification",
|
||||
|
@ -362,6 +368,8 @@
|
|||
|
||||
"es": [
|
||||
"settingsLanguageOptionSystemDefaultLabel",
|
||||
"settingsPhotosDescription",
|
||||
"settingsPhotosPageTitle",
|
||||
"rootPickerSkipConfirmationDialogContent2",
|
||||
"showAllButtonLabel",
|
||||
"gpsPlaceText",
|
||||
|
@ -371,6 +379,8 @@
|
|||
],
|
||||
|
||||
"fi": [
|
||||
"settingsPhotosDescription",
|
||||
"settingsPhotosPageTitle",
|
||||
"gpsPlaceText",
|
||||
"gpsPlaceAboutDialogTitle",
|
||||
"gpsPlaceAboutDialogContent",
|
||||
|
@ -384,6 +394,8 @@
|
|||
"settingsExifWifiOnlyFalseSubtitle",
|
||||
"settingsAccountLabelTitle",
|
||||
"settingsAccountLabelDescription",
|
||||
"settingsPhotosDescription",
|
||||
"settingsPhotosPageTitle",
|
||||
"settingsPhotoEnhancementTitle",
|
||||
"settingsPhotoEnhancementPageTitle",
|
||||
"settingsEnhanceMaxResolutionTitle",
|
||||
|
@ -453,6 +465,8 @@
|
|||
"settingsExifWifiOnlyFalseSubtitle",
|
||||
"settingsAccountLabelTitle",
|
||||
"settingsAccountLabelDescription",
|
||||
"settingsPhotosDescription",
|
||||
"settingsPhotosPageTitle",
|
||||
"settingsPhotoEnhancementTitle",
|
||||
"settingsPhotoEnhancementPageTitle",
|
||||
"settingsEnhanceMaxResolutionTitle",
|
||||
|
@ -540,6 +554,8 @@
|
|||
"settingsExifWifiOnlyFalseSubtitle",
|
||||
"settingsAccountLabelTitle",
|
||||
"settingsAccountLabelDescription",
|
||||
"settingsPhotosDescription",
|
||||
"settingsPhotosPageTitle",
|
||||
"settingsPhotoEnhancementTitle",
|
||||
"settingsPhotoEnhancementPageTitle",
|
||||
"settingsEnhanceMaxResolutionTitle",
|
||||
|
@ -606,6 +622,8 @@
|
|||
"settingsExifWifiOnlyFalseSubtitle",
|
||||
"settingsAccountLabelTitle",
|
||||
"settingsAccountLabelDescription",
|
||||
"settingsPhotosDescription",
|
||||
"settingsPhotosPageTitle",
|
||||
"settingsPhotoEnhancementTitle",
|
||||
"settingsPhotoEnhancementPageTitle",
|
||||
"settingsEnhanceMaxResolutionTitle",
|
||||
|
@ -672,6 +690,8 @@
|
|||
"settingsExifWifiOnlyFalseSubtitle",
|
||||
"settingsAccountLabelTitle",
|
||||
"settingsAccountLabelDescription",
|
||||
"settingsPhotosDescription",
|
||||
"settingsPhotosPageTitle",
|
||||
"settingsPhotoEnhancementTitle",
|
||||
"settingsPhotoEnhancementPageTitle",
|
||||
"settingsEnhanceMaxResolutionTitle",
|
||||
|
@ -738,6 +758,8 @@
|
|||
"settingsExifWifiOnlyFalseSubtitle",
|
||||
"settingsAccountLabelTitle",
|
||||
"settingsAccountLabelDescription",
|
||||
"settingsPhotosDescription",
|
||||
"settingsPhotosPageTitle",
|
||||
"settingsPhotoEnhancementTitle",
|
||||
"settingsPhotoEnhancementPageTitle",
|
||||
"settingsEnhanceMaxResolutionTitle",
|
||||
|
|
|
@ -72,9 +72,6 @@ class _SettingsState extends State<Settings> {
|
|||
_isEnableExif = Pref().isEnableExifOr();
|
||||
_shouldProcessExifWifiOnly = Pref().shouldProcessExifWifiOnlyOr();
|
||||
|
||||
final settings = AccountPref.of(widget.account);
|
||||
_isEnableMemoryAlbum = settings.isEnableMemoryAlbumOr(true);
|
||||
|
||||
_prefUpdatedListener.begin();
|
||||
}
|
||||
|
||||
|
@ -134,14 +131,6 @@ class _SettingsState extends State<Settings> {
|
|||
value: _shouldProcessExifWifiOnly,
|
||||
onChanged: _isEnableExif ? _onExifWifiOnlyChanged : null,
|
||||
),
|
||||
SwitchListTile(
|
||||
title: Text(L10n.global().settingsMemoriesTitle),
|
||||
subtitle: Text(L10n.global().settingsMemoriesSubtitle),
|
||||
value: _isEnableMemoryAlbum,
|
||||
onChanged: Pref().isPhotosTabSortByNameOr()
|
||||
? null
|
||||
: _onEnableMemoryAlbumChanged,
|
||||
),
|
||||
_buildSubSettings(
|
||||
context,
|
||||
leading: Icon(
|
||||
|
@ -151,6 +140,16 @@ class _SettingsState extends State<Settings> {
|
|||
label: L10n.global().settingsAccountTitle,
|
||||
builder: () => AccountSettingsWidget(account: widget.account),
|
||||
),
|
||||
_buildSubSettings(
|
||||
context,
|
||||
leading: Icon(
|
||||
Icons.image_outlined,
|
||||
color: AppTheme.getUnfocusedIconColor(context),
|
||||
),
|
||||
label: L10n.global().photosTabLabel,
|
||||
description: L10n.global().settingsPhotosDescription,
|
||||
builder: () => _PhotosSettings(account: widget.account),
|
||||
),
|
||||
_buildSubSettings(
|
||||
context,
|
||||
leading: Icon(
|
||||
|
@ -385,24 +384,6 @@ class _SettingsState extends State<Settings> {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _onEnableMemoryAlbumChanged(bool value) async {
|
||||
_log.info("[_onEnableMemoryAlbumChanged] New value: $value");
|
||||
final oldValue = _isEnableMemoryAlbum;
|
||||
setState(() {
|
||||
_isEnableMemoryAlbum = value;
|
||||
});
|
||||
if (!await AccountPref.of(widget.account).setEnableMemoryAlbum(value)) {
|
||||
_log.severe("[_onEnableMemoryAlbumChanged] Failed writing pref");
|
||||
SnackBarManager().showSnackBar(SnackBar(
|
||||
content: Text(L10n.global().writePreferenceFailureNotification),
|
||||
duration: k.snackBarDurationNormal,
|
||||
));
|
||||
setState(() {
|
||||
_isEnableMemoryAlbum = oldValue;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onCaptureLogChanged(BuildContext context, bool value) async {
|
||||
if (value) {
|
||||
final result = await showDialog<bool>(
|
||||
|
@ -472,7 +453,6 @@ class _SettingsState extends State<Settings> {
|
|||
|
||||
late bool _isEnableExif;
|
||||
late bool _shouldProcessExifWifiOnly;
|
||||
late bool _isEnableMemoryAlbum;
|
||||
|
||||
var _devSettingsUnlockCount = 3;
|
||||
var _isShowDevSettings = false;
|
||||
|
@ -818,6 +798,86 @@ class _ShareFolderDialogState extends State<_ShareFolderDialog> {
|
|||
late String _path = widget.initialValue;
|
||||
}
|
||||
|
||||
class _PhotosSettings extends StatefulWidget {
|
||||
const _PhotosSettings({
|
||||
Key? key,
|
||||
required this.account,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
createState() => _PhotosSettingsState();
|
||||
|
||||
final Account account;
|
||||
}
|
||||
|
||||
class _PhotosSettingsState extends State<_PhotosSettings> {
|
||||
@override
|
||||
initState() {
|
||||
super.initState();
|
||||
|
||||
final settings = AccountPref.of(widget.account);
|
||||
_isEnableMemoryAlbum = settings.isEnableMemoryAlbumOr(true);
|
||||
}
|
||||
|
||||
@override
|
||||
build(BuildContext context) {
|
||||
return AppTheme(
|
||||
child: Scaffold(
|
||||
body: Builder(
|
||||
builder: (context) => _buildContent(context),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildContent(BuildContext context) {
|
||||
return CustomScrollView(
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
pinned: true,
|
||||
title: Text(L10n.global().settingsPhotosPageTitle),
|
||||
),
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
SwitchListTile(
|
||||
title: Text(L10n.global().settingsMemoriesTitle),
|
||||
subtitle: Text(L10n.global().settingsMemoriesSubtitle),
|
||||
value: _isEnableMemoryAlbum,
|
||||
onChanged: Pref().isPhotosTabSortByNameOr()
|
||||
? null
|
||||
: _onEnableMemoryAlbumChanged,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _onEnableMemoryAlbumChanged(bool value) async {
|
||||
_log.info("[_onEnableMemoryAlbumChanged] New value: $value");
|
||||
final oldValue = _isEnableMemoryAlbum;
|
||||
setState(() {
|
||||
_isEnableMemoryAlbum = value;
|
||||
});
|
||||
if (!await AccountPref.of(widget.account).setEnableMemoryAlbum(value)) {
|
||||
_log.severe("[_onEnableMemoryAlbumChanged] Failed writing pref");
|
||||
SnackBarManager().showSnackBar(SnackBar(
|
||||
content: Text(L10n.global().writePreferenceFailureNotification),
|
||||
duration: k.snackBarDurationNormal,
|
||||
));
|
||||
setState(() {
|
||||
_isEnableMemoryAlbum = oldValue;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
late bool _isEnableMemoryAlbum;
|
||||
|
||||
static final _log = Logger("widget.settings._PhotosSettingsState");
|
||||
}
|
||||
|
||||
class _ViewerSettings extends StatefulWidget {
|
||||
@override
|
||||
createState() => _ViewerSettingsState();
|
||||
|
|
Loading…
Reference in a new issue