Refresh pref screen after settings import, #183

This commit is contained in:
Philipp Heckel 2022-03-23 09:58:19 -04:00
parent 1a9e271dbe
commit fbf2a75e0d
2 changed files with 7 additions and 0 deletions

View file

@ -439,9 +439,15 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
} }
lifecycleScope.launch(Dispatchers.IO) { lifecycleScope.launch(Dispatchers.IO) {
try { try {
val currentDarkMode = repository.getDarkMode()
backuper.restore(uri) backuper.restore(uri)
requireActivity().runOnUiThread { requireActivity().runOnUiThread {
Toast.makeText(context, getString(R.string.settings_backup_restore_restore_successful), Toast.LENGTH_LONG).show() 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) { } catch (e: Exception) {
Log.w(TAG, "Restore failed", e) Log.w(TAG, "Restore failed", e)

View file

@ -5,6 +5,7 @@ Features:
Bugs: Bugs:
* IllegalStateException: Failed to build unique file (#177, thanks to @Fallenbagel for reporting) * IllegalStateException: Failed to build unique file (#177, thanks to @Fallenbagel for reporting)
* SQLiteConstraintException: Crash during UP registration (#185) * SQLiteConstraintException: Crash during UP registration (#185)
* Refresh preferences screen after settings import (#183, thanks to @cmeis for reporting)
Thanks: Thanks:
* Many thanks to @cmeis, @Fallenbagel, @J117 and @rogeliodh for input on the new attachment logic, and for * Many thanks to @cmeis, @Fallenbagel, @J117 and @rogeliodh for input on the new attachment logic, and for