mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix reloading
This commit is contained in:
@@ -346,9 +346,7 @@ class GroupActivity : LockingActivity(),
|
||||
ACTION_DATABASE_RELOAD_TASK -> {
|
||||
// Reload the current activity
|
||||
if (result.isSuccess) {
|
||||
startActivity(intent)
|
||||
finish()
|
||||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
reload()
|
||||
} else {
|
||||
this.showActionErrorIfNeeded(result)
|
||||
finish()
|
||||
@@ -367,6 +365,14 @@ class GroupActivity : LockingActivity(),
|
||||
Log.i(TAG, "Finished creating tree")
|
||||
}
|
||||
|
||||
private fun reload() {
|
||||
// Reload the current activity
|
||||
startActivity(intent)
|
||||
finish()
|
||||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
mDatabase?.wasReloaded = false
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
super.onNewIntent(intent)
|
||||
|
||||
@@ -891,6 +897,9 @@ class GroupActivity : LockingActivity(),
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
if (mDatabase?.wasReloaded == true) {
|
||||
reload()
|
||||
}
|
||||
// Show the lock button
|
||||
lockView?.visibility = if (PreferencesUtil.showLockDatabaseButton(this)) {
|
||||
View.VISIBLE
|
||||
|
||||
@@ -39,6 +39,7 @@ class ReloadDatabaseRunnable(private val context: Context,
|
||||
tempCipherKey = mDatabase.loadedCipherKey
|
||||
// Clear before we load
|
||||
mDatabase.clear(UriUtil.getBinaryDir(context))
|
||||
mDatabase.wasReloaded = true
|
||||
}
|
||||
|
||||
override fun onActionRun() {
|
||||
|
||||
@@ -77,6 +77,11 @@ class Database {
|
||||
loadTimestamp = if (field) System.currentTimeMillis() else null
|
||||
}
|
||||
|
||||
/**
|
||||
* To reload the main activity
|
||||
*/
|
||||
var wasReloaded = true
|
||||
|
||||
var loadTimestamp: Long? = null
|
||||
private set
|
||||
|
||||
|
||||
Reference in New Issue
Block a user