From fbf2a75e0d8a3f8dd37e065c7ddc3b2a291beb4d Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Wed, 23 Mar 2022 09:58:19 -0400 Subject: [PATCH] Refresh pref screen after settings import, #183 --- app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt | 6 ++++++ fastlane/metadata/android/en-US/changelog/25.txt | 1 + 2 files changed, 7 insertions(+) diff --git a/app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt index 52d4ee6..919f1a9 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt @@ -439,9 +439,15 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere } lifecycleScope.launch(Dispatchers.IO) { try { + val currentDarkMode = repository.getDarkMode() backuper.restore(uri) requireActivity().runOnUiThread { Toast.makeText(context, getString(R.string.settings_backup_restore_restore_successful), Toast.LENGTH_LONG).show() + requireActivity().recreate() + val newDarkMode = repository.getDarkMode() + if (newDarkMode != currentDarkMode) { + AppCompatDelegate.setDefaultNightMode(newDarkMode) + } } } catch (e: Exception) { Log.w(TAG, "Restore failed", e) diff --git a/fastlane/metadata/android/en-US/changelog/25.txt b/fastlane/metadata/android/en-US/changelog/25.txt index beb63f8..7e14b28 100644 --- a/fastlane/metadata/android/en-US/changelog/25.txt +++ b/fastlane/metadata/android/en-US/changelog/25.txt @@ -5,6 +5,7 @@ Features: Bugs: * IllegalStateException: Failed to build unique file (#177, thanks to @Fallenbagel for reporting) * SQLiteConstraintException: Crash during UP registration (#185) +* Refresh preferences screen after settings import (#183, thanks to @cmeis for reporting) Thanks: * Many thanks to @cmeis, @Fallenbagel, @J117 and @rogeliodh for input on the new attachment logic, and for