From 04652d765d11b7f172a7986c25f6ba75f89a6b33 Mon Sep 17 00:00:00 2001 From: mateusz-bak <32651935+mateusz-bak@users.noreply.github.com> Date: Sun, 29 May 2022 20:59:51 +0100 Subject: [PATCH] Moved CSV import from settings to import/export settings. --- .../ui/bookslist/fragments/SettingsBackupFragment.kt | 9 ++++++++- .../ui/bookslist/fragments/SettingsFragment.kt | 9 --------- app/src/main/res/xml/preferences.xml | 6 ------ app/src/main/res/xml/preferences_backup.xml | 6 ++++++ 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/software/mdev/bookstracker/ui/bookslist/fragments/SettingsBackupFragment.kt b/app/src/main/java/software/mdev/bookstracker/ui/bookslist/fragments/SettingsBackupFragment.kt index edb6f57d2..53d821424 100644 --- a/app/src/main/java/software/mdev/bookstracker/ui/bookslist/fragments/SettingsBackupFragment.kt +++ b/app/src/main/java/software/mdev/bookstracker/ui/bookslist/fragments/SettingsBackupFragment.kt @@ -3,7 +3,6 @@ package software.mdev.bookstracker.ui.bookslist.fragments import android.content.SharedPreferences import android.content.SharedPreferences.OnSharedPreferenceChangeListener import android.os.Bundle -import android.widget.Toast import androidx.appcompat.app.AlertDialog import androidx.core.content.ContextCompat import androidx.preference.Preference @@ -26,6 +25,7 @@ class SettingsBackupFragment : PreferenceFragmentCompat(), OnSharedPreferenceCha var preferenceExport = findPreference(Constants.KEY_EXPORT) var preferenceExportLocal = findPreference(Constants.KEY_EXPORT_LOCAL) var preferenceImport = findPreference(Constants.KEY_IMPORT) + val preferenceCsvImport = findPreference(Constants.KEY_CSV_IMPORT) if (preferenceExport != null) { preferenceExport.onPreferenceClickListener = Preference.OnPreferenceClickListener { @@ -47,6 +47,13 @@ class SettingsBackupFragment : PreferenceFragmentCompat(), OnSharedPreferenceCha true } } + + if (preferenceCsvImport != null) { + preferenceCsvImport.onPreferenceClickListener = Preference.OnPreferenceClickListener { + Backup().runImporterCSV(activity as ListActivity) + true + } + } } override fun onResume() { diff --git a/app/src/main/java/software/mdev/bookstracker/ui/bookslist/fragments/SettingsFragment.kt b/app/src/main/java/software/mdev/bookstracker/ui/bookslist/fragments/SettingsFragment.kt index 9cbd57e3e..77c1025e9 100644 --- a/app/src/main/java/software/mdev/bookstracker/ui/bookslist/fragments/SettingsFragment.kt +++ b/app/src/main/java/software/mdev/bookstracker/ui/bookslist/fragments/SettingsFragment.kt @@ -19,7 +19,6 @@ import software.mdev.bookstracker.ui.bookslist.viewmodel.BooksViewModel import android.content.Intent import android.net.Uri import android.os.Build -import software.mdev.bookstracker.other.Backup class SettingsFragment : PreferenceFragmentCompat(), OnSharedPreferenceChangeListener { @@ -35,7 +34,6 @@ class SettingsFragment : PreferenceFragmentCompat(), OnSharedPreferenceChangeLis val preferenceChangelog = findPreference(Constants.KEY_CHANGELOG) val preferenceBackup = findPreference(Constants.KEY_BACKUP) val preferenceFeedback = findPreference(Constants.KEY_FEEDBACK) - val preferenceCsvImport = findPreference(Constants.KEY_CSV_IMPORT) if (preferenceCheckForUpdates != null) { val updater = Updater() @@ -75,13 +73,6 @@ class SettingsFragment : PreferenceFragmentCompat(), OnSharedPreferenceChangeLis true } } - - if (preferenceCsvImport != null) { - preferenceCsvImport.onPreferenceClickListener = Preference.OnPreferenceClickListener { - Backup().runImporterCSV(activity as ListActivity) - true - } - } } override fun onResume() { diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 3c03749c5..3cec39ad4 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -28,12 +28,6 @@ android:summary="@string/backup_summary" android:title="@string/backup_title" /> - - diff --git a/app/src/main/res/xml/preferences_backup.xml b/app/src/main/res/xml/preferences_backup.xml index 7d7d2d385..747a922ac 100644 --- a/app/src/main/res/xml/preferences_backup.xml +++ b/app/src/main/res/xml/preferences_backup.xml @@ -24,6 +24,12 @@ android:summary="@string/import_summary" android:title="@string/import_title" /> + + \ No newline at end of file