From 7c1732c794eff1cc36aeb4d13a0f3c6252b52fee Mon Sep 17 00:00:00 2001 From: razeeman Date: Sun, 20 Aug 2023 11:16:35 +0300 Subject: [PATCH] move export and import settings under separate dropdown --- .../util/simpletimetracker/SettingsTest.kt | 2 +- .../util/simpletimetracker/utils/NavUtils.kt | 4 + core/src/main/res/values-ar/strings.xml | 1 + core/src/main/res/values-ca/strings.xml | 1 + core/src/main/res/values-de/strings.xml | 1 + core/src/main/res/values-es/strings.xml | 1 + core/src/main/res/values-fa/strings.xml | 1 + core/src/main/res/values-fr/strings.xml | 1 + core/src/main/res/values-hi/strings.xml | 1 + core/src/main/res/values-in/strings.xml | 1 + core/src/main/res/values-it/strings.xml | 1 + core/src/main/res/values-ja/strings.xml | 1 + core/src/main/res/values-nl/strings.xml | 1 + core/src/main/res/values-pt/strings.xml | 1 + core/src/main/res/values-ru/strings.xml | 1 + core/src/main/res/values-sv/strings.xml | 1 + core/src/main/res/values-tr/strings.xml | 1 + core/src/main/res/values-uk/strings.xml | 1 + core/src/main/res/values-zh-rTW/strings.xml | 1 + core/src/main/res/values-zh/strings.xml | 1 + core/src/main/res/values/strings.xml | 1 + .../feature_settings/view/SettingsFragment.kt | 15 +- .../viewModel/SettingsViewModel.kt | 6 + .../res/layout/settings_backup_layout.xml | 192 -------------- .../layout/settings_export_import_layout.xml | 250 ++++++++++++++++++ .../src/main/res/layout/settings_fragment.xml | 4 + 26 files changed, 298 insertions(+), 194 deletions(-) create mode 100644 features/feature_settings/src/main/res/layout/settings_export_import_layout.xml diff --git a/app/src/androidTest/java/com/example/util/simpletimetracker/SettingsTest.kt b/app/src/androidTest/java/com/example/util/simpletimetracker/SettingsTest.kt index d23533d22..a7bfbaab1 100644 --- a/app/src/androidTest/java/com/example/util/simpletimetracker/SettingsTest.kt +++ b/app/src/androidTest/java/com/example/util/simpletimetracker/SettingsTest.kt @@ -1508,7 +1508,7 @@ class SettingsTest : BaseUiTest() { @Test fun csvExportSettings() { NavUtils.openSettingsScreen() - NavUtils.openSettingsBackup() + NavUtils.openSettingsExportImport() onView(withId(settingsR.id.layoutSettingsExportCsv)).perform(nestedScrollTo(), click()) // View is set up diff --git a/app/src/androidTest/java/com/example/util/simpletimetracker/utils/NavUtils.kt b/app/src/androidTest/java/com/example/util/simpletimetracker/utils/NavUtils.kt index 487f010ed..19300e6ed 100644 --- a/app/src/androidTest/java/com/example/util/simpletimetracker/utils/NavUtils.kt +++ b/app/src/androidTest/java/com/example/util/simpletimetracker/utils/NavUtils.kt @@ -69,6 +69,10 @@ object NavUtils { onView(withText(coreR.string.settings_backup_title)).perform(nestedScrollTo(), click()) } + fun openSettingsExportImport() { + onView(withText(coreR.string.settings_export_title)).perform(nestedScrollTo(), click()) + } + fun openCategoriesScreen() { onView(withText(coreR.string.settings_edit_categories)).perform(nestedScrollTo(), click()) } diff --git a/core/src/main/res/values-ar/strings.xml b/core/src/main/res/values-ar/strings.xml index e143f2022..5b33054ae 100644 --- a/core/src/main/res/values-ar/strings.xml +++ b/core/src/main/res/values-ar/strings.xml @@ -198,6 +198,7 @@ إعدادات إضافية إعدادات الإشعار إعدادات النسخ الاحتياطي + التصدير والاستيراد فرز الأنشطة الاسم اللون diff --git a/core/src/main/res/values-ca/strings.xml b/core/src/main/res/values-ca/strings.xml index 291bf9979..df29f9847 100644 --- a/core/src/main/res/values-ca/strings.xml +++ b/core/src/main/res/values-ca/strings.xml @@ -198,6 +198,7 @@ Configuració addicional Configuració de notificacions Configuració de còpia de seguretat + Exportació i importació Endreçar activitats Nom Color diff --git a/core/src/main/res/values-de/strings.xml b/core/src/main/res/values-de/strings.xml index e3b7dd1bf..57d60e176 100644 --- a/core/src/main/res/values-de/strings.xml +++ b/core/src/main/res/values-de/strings.xml @@ -198,6 +198,7 @@ Zusätzliche Einstellungen Benachrichtigungseinstellungen Backup-Einstellungen + Export und Import Aktivitäten sortieren Name Farbe diff --git a/core/src/main/res/values-es/strings.xml b/core/src/main/res/values-es/strings.xml index e89b996d1..1e26263d7 100644 --- a/core/src/main/res/values-es/strings.xml +++ b/core/src/main/res/values-es/strings.xml @@ -198,6 +198,7 @@ Ajustes adicionales Configuración de las notificaciones Configuración de copia de seguridad + Exportar e importar Ordenar actividades Nombre Color diff --git a/core/src/main/res/values-fa/strings.xml b/core/src/main/res/values-fa/strings.xml index 9755edd7c..4ed61aa2a 100644 --- a/core/src/main/res/values-fa/strings.xml +++ b/core/src/main/res/values-fa/strings.xml @@ -198,6 +198,7 @@ تنظیمت اضافه تنظیمات اعلان تنظیمات پشتیبان گیری + صادرات و واردات مرتب سازی فعالیت ها نام رنگ diff --git a/core/src/main/res/values-fr/strings.xml b/core/src/main/res/values-fr/strings.xml index 6e52b21be..c12009233 100644 --- a/core/src/main/res/values-fr/strings.xml +++ b/core/src/main/res/values-fr/strings.xml @@ -198,6 +198,7 @@ Paramètres additionnels Paramètres de notification Paramètres de sauvegarde + Exporter et importer Trier les activités Par nom Par couleur diff --git a/core/src/main/res/values-hi/strings.xml b/core/src/main/res/values-hi/strings.xml index 304914914..85eb93004 100644 --- a/core/src/main/res/values-hi/strings.xml +++ b/core/src/main/res/values-hi/strings.xml @@ -198,6 +198,7 @@ अतिरिक्त सेटिंग्स अधिसूचना सेटिंग्स बैकअप सेटिंग्स + निर्यात और आयात क्रमबद्ध गतिविधियाँ नाम रंग diff --git a/core/src/main/res/values-in/strings.xml b/core/src/main/res/values-in/strings.xml index bbbce68e4..accbb148f 100644 --- a/core/src/main/res/values-in/strings.xml +++ b/core/src/main/res/values-in/strings.xml @@ -198,6 +198,7 @@ Pengaturan tambahan Pengaturan pemberitahuan Pengaturan cadangan + Ekspor dan impor Urutkan kegiatan Nama Warna diff --git a/core/src/main/res/values-it/strings.xml b/core/src/main/res/values-it/strings.xml index ac26c186b..dd73e6775 100644 --- a/core/src/main/res/values-it/strings.xml +++ b/core/src/main/res/values-it/strings.xml @@ -198,6 +198,7 @@ Altre impostazioni Impostazioni di notifica Impostazioni di backup + Esportare e importare Ordina attività Nome Colore diff --git a/core/src/main/res/values-ja/strings.xml b/core/src/main/res/values-ja/strings.xml index b2c3f2492..c7490a9f5 100644 --- a/core/src/main/res/values-ja/strings.xml +++ b/core/src/main/res/values-ja/strings.xml @@ -198,6 +198,7 @@ 追加設定 通知設定 バックアップ設定 + エクスポートとインポート アクティビティをソート 名前 diff --git a/core/src/main/res/values-nl/strings.xml b/core/src/main/res/values-nl/strings.xml index 2e0a26711..7b11a790e 100644 --- a/core/src/main/res/values-nl/strings.xml +++ b/core/src/main/res/values-nl/strings.xml @@ -198,6 +198,7 @@ Extra instellingen Notificatie instellingen Back-up instellingen + Export en import Activiteiten sorteren Naam Kleur diff --git a/core/src/main/res/values-pt/strings.xml b/core/src/main/res/values-pt/strings.xml index ae94fa1f4..ee903ded3 100644 --- a/core/src/main/res/values-pt/strings.xml +++ b/core/src/main/res/values-pt/strings.xml @@ -198,6 +198,7 @@ Configurações adicionais Configurações de notificação Configurações de backup + Exportar e importar Ordenar atividades Nome Cor diff --git a/core/src/main/res/values-ru/strings.xml b/core/src/main/res/values-ru/strings.xml index 1aa3f4a35..453b86c03 100644 --- a/core/src/main/res/values-ru/strings.xml +++ b/core/src/main/res/values-ru/strings.xml @@ -198,6 +198,7 @@ Дополнительные настройки Настройки уведомлений Настройки резервного копирования + Экспорт и импорт Сортировать активности Имя Цвет diff --git a/core/src/main/res/values-sv/strings.xml b/core/src/main/res/values-sv/strings.xml index 712e74f6a..62b06e015 100644 --- a/core/src/main/res/values-sv/strings.xml +++ b/core/src/main/res/values-sv/strings.xml @@ -198,6 +198,7 @@ Ytterligare inställningar Aviseringsinställningar Säkerhetskopieringsinställningar + Exportera och importera Sortera aktiviteter efter Namn Färg diff --git a/core/src/main/res/values-tr/strings.xml b/core/src/main/res/values-tr/strings.xml index c72bc377a..23524dc80 100644 --- a/core/src/main/res/values-tr/strings.xml +++ b/core/src/main/res/values-tr/strings.xml @@ -198,6 +198,7 @@ Ek ayarlar Bildirim ayarları Yedekleme ayarları + Ihracat ve ithalat Aktiviteleri sırala İsim Renk diff --git a/core/src/main/res/values-uk/strings.xml b/core/src/main/res/values-uk/strings.xml index ff852e2e6..98f1ebca2 100644 --- a/core/src/main/res/values-uk/strings.xml +++ b/core/src/main/res/values-uk/strings.xml @@ -198,6 +198,7 @@ Додаткові налаштування Налаштування сповіщень Налаштування резервного копіювання + Експорт та імпорт Сортувати активності Ім\'я Колір diff --git a/core/src/main/res/values-zh-rTW/strings.xml b/core/src/main/res/values-zh-rTW/strings.xml index b07936459..efeb5e44f 100644 --- a/core/src/main/res/values-zh-rTW/strings.xml +++ b/core/src/main/res/values-zh-rTW/strings.xml @@ -198,6 +198,7 @@ 附加設定 通知設置 備份設置 + 導出和導入 排序活動 名稱 顏色 diff --git a/core/src/main/res/values-zh/strings.xml b/core/src/main/res/values-zh/strings.xml index 6ff62ec01..d368910e9 100644 --- a/core/src/main/res/values-zh/strings.xml +++ b/core/src/main/res/values-zh/strings.xml @@ -198,6 +198,7 @@ 其他设置 通知设置 备份设置 + 导出和导入 活动排序 名称 颜色 diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index a846bf0d9..ad6bbd855 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -198,6 +198,7 @@ Additional settings Notification settings Backup settings + Export and import Sort activities Name Color diff --git a/features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/view/SettingsFragment.kt b/features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/view/SettingsFragment.kt index 1db41c0d4..fdc91000e 100644 --- a/features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/view/SettingsFragment.kt +++ b/features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/view/SettingsFragment.kt @@ -152,11 +152,15 @@ class SettingsFragment : layoutSettingsBackupTitle.setOnClick(viewModel::onSettingsBackupClick) layoutSettingsSaveBackup.setOnClick(backupViewModel::onSaveClick) layoutSettingsRestoreBackup.setOnClick(backupViewModel::onRestoreClick) + checkboxSettingsAutomaticBackup.setOnClick(backupViewModel::onAutomaticBackupClick) + } + + with(layoutSettingsExportImport) { + layoutSettingsExportImportTitle.setOnClick(viewModel::onSettingsExportImportClick) layoutSettingsExportCsv.setOnClick(backupViewModel::onExportCsvClick) layoutSettingsImportCsv.setOnClick(backupViewModel::onImportCsvClick) btnSettingsImportCsvHelp.setOnClick(backupViewModel::onImportCsvHelpClick) layoutSettingsExportIcs.setOnClick(backupViewModel::onExportIcsClick) - checkboxSettingsAutomaticBackup.setOnClick(backupViewModel::onAutomaticBackupClick) checkboxSettingsAutomaticExport.setOnClick(backupViewModel::onAutomaticExportClick) } } @@ -183,6 +187,11 @@ class SettingsFragment : layoutSettingsBackup.arrowSettingsBackup .apply { if (opened) rotateDown() else rotateUp() } } + viewModel.settingsExportImportVisibility.observe { opened -> + layoutSettingsExportImport.layoutSettingsExportImportContent.visible = opened + layoutSettingsExportImport.arrowSettingsExportImport + .apply { if (opened) rotateDown() else rotateUp() } + } resetScreen.observe { containerSettings.smoothScrollTo(0, 0) mainTabsViewModel.onHandled() @@ -268,6 +277,8 @@ class SettingsFragment : tvSettingsAutomaticBackupLastSaveTime.visible = it.isNotEmpty() tvSettingsAutomaticBackupLastSaveTime.text = it } + } + with(layoutSettingsExportImport) { automaticExportCheckbox.observe(checkboxSettingsAutomaticExport::setChecked) automaticExportLastSaveTime.observe { tvSettingsAutomaticExportLastSaveTime.visible = it.isNotEmpty() @@ -321,6 +332,8 @@ class SettingsFragment : } with(layoutSettingsBackup) { checkboxSettingsAutomaticBackup.jumpDrawablesToCurrentState() + } + with(layoutSettingsExportImport) { checkboxSettingsAutomaticExport.jumpDrawablesToCurrentState() } viewModel.onVisible() diff --git a/features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/viewModel/SettingsViewModel.kt b/features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/viewModel/SettingsViewModel.kt index 98d51d404..1f3767d19 100644 --- a/features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/viewModel/SettingsViewModel.kt +++ b/features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/viewModel/SettingsViewModel.kt @@ -40,6 +40,7 @@ class SettingsViewModel @Inject constructor( val settingsDisplayVisibility: LiveData = MutableLiveData(false) val settingsAdditionalVisibility: LiveData = MutableLiveData(false) val settingsBackupVisibility: LiveData = MutableLiveData(false) + val settingsExportImportVisibility: LiveData = MutableLiveData(false) val resetScreen: SingleLiveEvent = SingleLiveEvent() init { @@ -89,6 +90,11 @@ class SettingsViewModel @Inject constructor( settingsBackupVisibility.set(newValue) } + fun onSettingsExportImportClick() { + val newValue = settingsExportImportVisibility.value?.flip().orFalse() + settingsExportImportVisibility.set(newValue) + } + fun onDurationSet(tag: String?, duration: Long) { when (tag) { INACTIVITY_DURATION_DIALOG_TAG, diff --git a/features/feature_settings/src/main/res/layout/settings_backup_layout.xml b/features/feature_settings/src/main/res/layout/settings_backup_layout.xml index ea3f6529b..4a578a747 100644 --- a/features/feature_settings/src/main/res/layout/settings_backup_layout.xml +++ b/features/feature_settings/src/main/res/layout/settings_backup_layout.xml @@ -165,198 +165,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/features/feature_settings/src/main/res/layout/settings_export_import_layout.xml b/features/feature_settings/src/main/res/layout/settings_export_import_layout.xml new file mode 100644 index 000000000..9882f60d7 --- /dev/null +++ b/features/feature_settings/src/main/res/layout/settings_export_import_layout.xml @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/features/feature_settings/src/main/res/layout/settings_fragment.xml b/features/feature_settings/src/main/res/layout/settings_fragment.xml index 63d6f7ee8..d91f9906d 100644 --- a/features/feature_settings/src/main/res/layout/settings_fragment.xml +++ b/features/feature_settings/src/main/res/layout/settings_fragment.xml @@ -35,6 +35,10 @@ android:id="@+id/layoutSettingsBackup" layout="@layout/settings_backup_layout" /> + +