Refactor progress dialog thread / save database menu

This commit is contained in:
J-Jamet
2019-11-18 17:54:13 +01:00
parent 02feb478e8
commit fa9d8ad6ad
25 changed files with 163 additions and 158 deletions

View File

@@ -329,9 +329,9 @@ class EntryActivity : LockingHideActivity() {
val inflater = menuInflater
MenuUtil.contributionMenuInflater(inflater, menu)
inflater.inflate(R.menu.entry, menu)
inflater.inflate(R.menu.database_lock, menu)
inflater.inflate(R.menu.database, menu)
if (mReadOnly) {
menu.findItem(R.id.menu_save_database)?.isVisible = false
menu.findItem(R.id.menu_edit)?.isVisible = false
}
@@ -400,21 +400,18 @@ class EntryActivity : LockingHideActivity() {
MenuUtil.onContributionItemSelected(this)
return true
}
R.id.menu_toggle_pass -> {
mShowPassword = !mShowPassword
changeShowPasswordIcon(item)
entryContentsView?.setHiddenPasswordStyle(!mShowPassword)
return true
}
R.id.menu_edit -> {
mEntry?.let {
EntryEditActivity.launch(this@EntryActivity, it)
}
return true
}
R.id.menu_goto_url -> {
var url: String = mEntry?.url ?: ""
@@ -424,18 +421,17 @@ class EntryActivity : LockingHideActivity() {
}
UriUtil.gotoUrl(this, url)
return true
}
R.id.menu_lock -> {
lockAndExit()
return true
}
R.id.menu_save_database -> {
mProgressDialogThread?.startDatabaseSave(!mReadOnly)
}
android.R.id.home -> finish() // close this activity and return to preview activity (if there is any)
}
return super.onOptionsItemSelected(item)
}

View File

@@ -33,7 +33,6 @@ import com.kunzisoft.keepass.activities.dialogs.SetOTPDialogFragment
import com.kunzisoft.keepass.activities.dialogs.GeneratePasswordDialogFragment
import com.kunzisoft.keepass.activities.dialogs.IconPickerDialogFragment
import com.kunzisoft.keepass.activities.lock.LockingHideActivity
import com.kunzisoft.keepass.database.action.ProgressDialogThread
import com.kunzisoft.keepass.database.element.*
import com.kunzisoft.keepass.education.EntryEditActivityEducation
import com.kunzisoft.keepass.notifications.ClipboardEntryNotificationService
@@ -67,9 +66,6 @@ class EntryEditActivity : LockingHideActivity(),
private var entryEditContentsView: EntryEditContentsView? = null
private var saveView: View? = null
// Dialog thread
private var progressDialogThread: ProgressDialogThread? = null
// Education
private var entryEditActivityEducation: EntryEditActivityEducation? = null
@@ -176,7 +172,7 @@ class EntryEditActivity : LockingHideActivity(),
entryEditActivityEducation = EntryEditActivityEducation(this)
// Create progress dialog
progressDialogThread = ProgressDialogThread(this) { actionTask, result ->
mProgressDialogThread?.onActionFinish = { actionTask, result ->
when (actionTask) {
ACTION_DATABASE_CREATE_ENTRY_TASK,
ACTION_DATABASE_UPDATE_ENTRY_TASK -> {
@@ -273,18 +269,18 @@ class EntryEditActivity : LockingHideActivity(),
// Open a progress dialog and save entry
if (mIsNew) {
mParent?.let { parent ->
progressDialogThread?.startDatabaseCreateEntry(
mProgressDialogThread?.startDatabaseCreateEntry(
newEntry,
parent,
!mReadOnly
!mReadOnly && mAutoSaveEnable
)
}
} else {
mEntry?.let { oldEntry ->
progressDialogThread?.startDatabaseUpdateEntry(
mProgressDialogThread?.startDatabaseUpdateEntry(
oldEntry,
newEntry,
!mReadOnly
!mReadOnly && mAutoSaveEnable
)
}
}
@@ -292,23 +288,13 @@ class EntryEditActivity : LockingHideActivity(),
}
}
override fun onResume() {
super.onResume()
progressDialogThread?.registerProgressTask()
}
override fun onPause() {
progressDialogThread?.unregisterProgressTask()
super.onPause()
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
super.onCreateOptionsMenu(menu)
val inflater = menuInflater
inflater.inflate(R.menu.database_lock, menu)
inflater.inflate(R.menu.database, menu)
// Save database not needed here
menu.findItem(R.id.menu_save_database)?.isVisible = false
MenuUtil.contributionMenuInflater(inflater, menu)
if (mDatabase?.allowOTP == true)
inflater.inflate(R.menu.entry_otp, menu)
@@ -352,12 +338,13 @@ class EntryEditActivity : LockingHideActivity(),
lockAndExit()
return true
}
R.id.menu_save_database -> {
mProgressDialogThread?.startDatabaseSave(!mReadOnly)
}
R.id.menu_contribute -> {
MenuUtil.onContributionItemSelected(this)
return true
}
R.id.menu_add_otp -> {
// Retrieve the current otpElement if exists
// and open the dialog to set up the OTP
@@ -365,7 +352,6 @@ class EntryEditActivity : LockingHideActivity(),
.show(supportFragmentManager, "addOTPDialog")
return true
}
android.R.id.home -> finish()
}

View File

@@ -76,7 +76,7 @@ class FileDatabaseSelectActivity : StylishActivity(),
private var mOpenFileHelper: OpenFileHelper? = null
private var progressDialogThread: ProgressDialogThread? = null
private var mProgressDialogThread: ProgressDialogThread? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -163,7 +163,7 @@ class FileDatabaseSelectActivity : StylishActivity(),
}
// Attach the dialog thread to this activity
progressDialogThread = ProgressDialogThread(this) { actionTask, _ ->
mProgressDialogThread?.onActionFinish = { actionTask, _ ->
when (actionTask) {
ACTION_DATABASE_CREATE_TASK -> {
// TODO Check
@@ -296,12 +296,12 @@ class FileDatabaseSelectActivity : StylishActivity(),
}
// Register progress task
progressDialogThread?.registerProgressTask()
mProgressDialogThread?.registerProgressTask()
}
override fun onPause() {
// Unregister progress task
progressDialogThread?.unregisterProgressTask()
mProgressDialogThread?.unregisterProgressTask()
super.onPause()
}
@@ -329,7 +329,7 @@ class FileDatabaseSelectActivity : StylishActivity(),
mDatabaseFileUri?.let { databaseUri ->
// Create the new database
progressDialogThread?.startDatabaseCreate(
mProgressDialogThread?.startDatabaseCreate(
databaseUri,
masterPasswordChecked,
masterPassword,

View File

@@ -49,7 +49,6 @@ import com.kunzisoft.keepass.activities.lock.LockingActivity
import com.kunzisoft.keepass.adapters.SearchEntryCursorAdapter
import com.kunzisoft.keepass.autofill.AutofillHelper
import com.kunzisoft.keepass.database.SortNodeEnum
import com.kunzisoft.keepass.database.action.ProgressDialogThread
import com.kunzisoft.keepass.database.element.*
import com.kunzisoft.keepass.education.GroupActivityEducation
import com.kunzisoft.keepass.icons.assignDatabaseIcon
@@ -94,8 +93,6 @@ class GroupActivity : LockingActivity(),
private var mListNodesFragment: ListNodesFragment? = null
private var mCurrentGroupIsASearch: Boolean = false
private var progressDialogThread: ProgressDialogThread? = null
// Nodes
private var mRootGroup: GroupVersioned? = null
private var mCurrentGroup: GroupVersioned? = null
@@ -205,7 +202,7 @@ class GroupActivity : LockingActivity(),
mSearchSuggestionAdapter = SearchEntryCursorAdapter(this, database)
// Init dialog thread
progressDialogThread = ProgressDialogThread(this) { actionTask, result ->
mProgressDialogThread?.onActionFinish = { actionTask, result ->
var oldNodes: List<NodeVersioned> = ArrayList()
result.data?.getBundle(OLD_NODES_KEY)?.let { oldNodesBundle ->
@@ -569,20 +566,20 @@ class GroupActivity : LockingActivity(),
ListNodesFragment.PasteMode.PASTE_FROM_COPY -> {
// Copy
mCurrentGroup?.let { newParent ->
progressDialogThread?.startDatabaseCopyNodes(
mProgressDialogThread?.startDatabaseCopyNodes(
nodes,
newParent,
!mReadOnly
!mReadOnly && mAutoSaveEnable
)
}
}
ListNodesFragment.PasteMode.PASTE_FROM_MOVE -> {
// Move
mCurrentGroup?.let { newParent ->
progressDialogThread?.startDatabaseMoveNodes(
mProgressDialogThread?.startDatabaseMoveNodes(
nodes,
newParent,
!mReadOnly
!mReadOnly && mAutoSaveEnable
)
}
}
@@ -598,9 +595,9 @@ class GroupActivity : LockingActivity(),
&& database.isRecycleBinEnabled
&& database.recycleBin != mCurrentGroup) {
// If recycle bin enabled and not in recycle bin, move in recycle bin
progressDialogThread?.startDatabaseDeleteNodes(
mProgressDialogThread?.startDatabaseDeleteNodes(
nodes,
!mReadOnly
!mReadOnly && mAutoSaveEnable
)
} else {
// open the dialog to confirm deletion
@@ -612,9 +609,9 @@ class GroupActivity : LockingActivity(),
}
override fun permanentlyDeleteNodes(nodes: List<NodeVersioned>) {
progressDialogThread?.startDatabaseDeleteNodes(
mProgressDialogThread?.startDatabaseDeleteNodes(
nodes,
!mReadOnly
!mReadOnly && mAutoSaveEnable
)
}
@@ -624,13 +621,9 @@ class GroupActivity : LockingActivity(),
assignGroupViewElements()
// Refresh suggestions to change preferences
mSearchSuggestionAdapter?.reInit(this)
progressDialogThread?.registerProgressTask()
}
override fun onPause() {
progressDialogThread?.unregisterProgressTask()
super.onPause()
finishNodeAction()
@@ -640,7 +633,10 @@ class GroupActivity : LockingActivity(),
val inflater = menuInflater
inflater.inflate(R.menu.search, menu)
inflater.inflate(R.menu.database_lock, menu)
inflater.inflate(R.menu.database, menu)
if (mReadOnly) {
menu.findItem(R.id.menu_save_database)?.isVisible = false
}
if (!mSelectionMode) {
inflater.inflate(R.menu.default_menu, menu)
MenuUtil.contributionMenuInflater(inflater, menu)
@@ -760,6 +756,10 @@ class GroupActivity : LockingActivity(),
lockAndExit()
return true
}
R.id.menu_save_database -> {
mProgressDialogThread?.startDatabaseSave(!mReadOnly)
return true
}
R.id.menu_empty_recycle_bin -> {
mCurrentGroup?.getChildren()?.let { listChildren ->
// Automatically delete all elements
@@ -791,8 +791,11 @@ class GroupActivity : LockingActivity(),
// Not really needed here because added in runnable but safe
newGroup.parent = currentGroup
progressDialogThread?.startDatabaseCreateGroup(
newGroup, currentGroup, !mReadOnly)
mProgressDialogThread?.startDatabaseCreateGroup(
newGroup,
currentGroup,
!mReadOnly && mAutoSaveEnable
)
}
}
}
@@ -810,8 +813,11 @@ class GroupActivity : LockingActivity(),
}
}
// If group updated save it in the database
progressDialogThread?.startDatabaseUpdateGroup(
oldGroupToUpdate, updateGroup, !mReadOnly)
mProgressDialogThread?.startDatabaseUpdateGroup(
oldGroupToUpdate,
updateGroup,
!mReadOnly && mAutoSaveEnable
)
}
}
else -> {}

View File

@@ -163,7 +163,8 @@ class PasswordActivity : StylishActivity() {
enableOrNotTheConfirmationButton()
}
progressDialogThread = ProgressDialogThread(this) { actionTask, result ->
progressDialogThread = ProgressDialogThread(this).apply {
onActionFinish = { actionTask, result ->
when (actionTask) {
ACTION_DATABASE_LOAD_TASK -> {
// Recheck biometric if error
@@ -231,6 +232,7 @@ class PasswordActivity : StylishActivity() {
}
}
}
}
private fun launchGroupActivity() {
EntrySelectionHelper.doEntrySelectionAction(intent,

View File

@@ -32,6 +32,7 @@ import android.view.ViewGroup
import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper
import com.kunzisoft.keepass.activities.helpers.ReadOnlyHelper
import com.kunzisoft.keepass.activities.stylish.StylishActivity
import com.kunzisoft.keepass.database.action.ProgressDialogThread
import com.kunzisoft.keepass.database.element.Database
import com.kunzisoft.keepass.notifications.KeyboardEntryNotificationService
import com.kunzisoft.keepass.magikeyboard.MagikIME
@@ -63,6 +64,10 @@ abstract class LockingActivity : StylishActivity() {
return field || mSelectionMode
}
protected var mSelectionMode: Boolean = false
protected var mAutoSaveEnable: Boolean = true
var mProgressDialogThread: ProgressDialogThread? = null
private set
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -86,6 +91,9 @@ abstract class LockingActivity : StylishActivity() {
mExitLock = false
mReadOnly = ReadOnlyHelper.retrieveReadOnlyFromInstanceStateOrIntent(savedInstanceState, intent)
mAutoSaveEnable = PreferencesUtil.isAutoSaveDatabaseEnabled(this)
mProgressDialogThread = ProgressDialogThread(this)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
@@ -120,6 +128,8 @@ abstract class LockingActivity : StylishActivity() {
TimeoutHelper.recordTime(this)
}
mProgressDialogThread?.registerProgressTask()
invalidateOptionsMenu()
}
@@ -130,6 +140,8 @@ abstract class LockingActivity : StylishActivity() {
}
override fun onPause() {
mProgressDialogThread?.unregisterProgressTask()
super.onPause()
if (mTimeoutEnable) {

View File

@@ -45,10 +45,10 @@ import com.kunzisoft.keepass.utils.DATABASE_STOP_TASK_ACTION
import java.util.*
import kotlin.collections.ArrayList
class ProgressDialogThread(private val activity: FragmentActivity) {
class ProgressDialogThread(private val activity: FragmentActivity,
var onActionFinish: (actionTask: String,
result: ActionRunnable.Result) -> Unit) {
var onActionFinish: ((actionTask: String,
result: ActionRunnable.Result) -> Unit)? = null
private var intentDatabaseTask = Intent(activity, DatabaseTaskNotificationService::class.java)
@@ -69,7 +69,7 @@ class ProgressDialogThread(private val activity: FragmentActivity,
}
override fun onStopAction(actionTask: String, result: ActionRunnable.Result) {
onActionFinish.invoke(actionTask, result)
onActionFinish?.invoke(actionTask, result)
// Remove the progress task
ProgressTaskDialogFragment.stop(activity)
TimeoutHelper.releaseTemporarilyDisableTimeoutAndLockIfTimeout(activity)

View File

@@ -20,6 +20,7 @@
package com.kunzisoft.keepass.settings
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.content.res.Resources
import android.graphics.Color
@@ -77,6 +78,7 @@ class NestedSettingsFragment : PreferenceFragmentCompat() {
private var mDatabase: Database = Database.getInstance()
private var mDatabaseReadOnly: Boolean = false
private var mDatabaseAutoSaveEnabled: Boolean = true
private var mCount = 0
@@ -110,6 +112,7 @@ class NestedSettingsFragment : PreferenceFragmentCompat() {
&& autofillManager.hasEnabledAutofillServices()
}
}
mDatabaseAutoSaveEnabled = PreferencesUtil.isAutoSaveDatabaseEnabled(activity)
}
}
@@ -471,7 +474,8 @@ class NestedSettingsFragment : PreferenceFragmentCompat() {
}
refreshRecycleBinGroup()
// Save the database if not in readonly mode
(context as SettingsActivity?)?.progressDialogThread?.startDatabaseSave(true)
(context as SettingsActivity?)?.
mProgressDialogThread?.startDatabaseSave(mDatabaseAutoSaveEnabled)
true
}
true

View File

@@ -134,6 +134,12 @@ object PreferencesUtil {
context.resources.getBoolean(R.bool.lock_database_back_root_default))
}
fun isAutoSaveDatabaseEnabled(context: Context): Boolean {
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
return prefs.getBoolean(context.getString(R.string.enable_auto_save_database_key),
context.resources.getBoolean(R.bool.enable_auto_save_database_default))
}
fun isPersistentNotificationEnable(context: Context): Boolean {
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
return prefs.getBoolean(context.getString(R.string.persistent_notification_key),

View File

@@ -33,7 +33,6 @@ import com.kunzisoft.keepass.activities.dialogs.AssignMasterKeyDialogFragment
import com.kunzisoft.keepass.activities.dialogs.PasswordEncodingDialogFragment
import com.kunzisoft.keepass.activities.helpers.ReadOnlyHelper
import com.kunzisoft.keepass.activities.lock.LockingActivity
import com.kunzisoft.keepass.database.action.ProgressDialogThread
import com.kunzisoft.keepass.database.element.Database
import com.kunzisoft.keepass.timeout.TimeoutHelper
@@ -46,8 +45,6 @@ open class SettingsActivity
private var toolbar: Toolbar? = null
var progressDialogThread: ProgressDialogThread? = null
companion object {
private const val TAG_NESTED = "TAG_NESTED"
@@ -90,7 +87,7 @@ open class SettingsActivity
backupManager = BackupManager(this)
progressDialogThread = ProgressDialogThread(this) { actionTask, result ->
mProgressDialogThread?.onActionFinish = { actionTask, result ->
// Call result in fragment
(supportFragmentManager
.findFragmentByTag(TAG_NESTED) as NestedSettingsFragment?)
@@ -98,19 +95,6 @@ open class SettingsActivity
}
}
override fun onResume() {
super.onResume()
progressDialogThread?.registerProgressTask()
}
override fun onPause() {
progressDialogThread?.unregisterProgressTask()
super.onPause()
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
android.R.id.home -> onBackPressed()
@@ -132,7 +116,7 @@ open class SettingsActivity
database.fileUri?.let { databaseUri ->
// Show the progress dialog now or after dialog confirmation
if (database.validatePasswordEncoding(masterPassword, keyFileChecked)) {
progressDialogThread?.startDatabaseAssignPassword(
mProgressDialogThread?.startDatabaseAssignPassword(
databaseUri,
masterPasswordChecked,
masterPassword,
@@ -142,7 +126,7 @@ open class SettingsActivity
} else {
PasswordEncodingDialogFragment().apply {
positiveButtonClickListener = DialogInterface.OnClickListener { _, _ ->
progressDialogThread?.startDatabaseAssignPassword(
mProgressDialogThread?.startDatabaseAssignPassword(
databaseUri,
masterPasswordChecked,
masterPassword,

View File

@@ -87,7 +87,7 @@ class DatabaseColorPreferenceDialogFragmentCompat : DatabaseSavePreferenceDialog
}
val oldColor = database.customColor
database.customColor = newColor
progressDialogThread?.startDatabaseSaveColor(oldColor, newColor, true)
mProgressDialogThread?.startDatabaseSaveColor(oldColor, newColor, mDatabaseAutoSaveEnable)
}
onDialogClosed(true)

View File

@@ -64,7 +64,7 @@ class DatabaseDataCompressionPreferenceDialogFragmentCompat
database.compressionAlgorithm = newCompression
if (oldCompression != null && newCompression != null)
progressDialogThread?.startDatabaseSaveCompression(oldCompression, newCompression, true)
mProgressDialogThread?.startDatabaseSaveCompression(oldCompression, newCompression, mDatabaseAutoSaveEnable)
}
}
}

View File

@@ -36,7 +36,7 @@ class DatabaseDefaultUsernamePreferenceDialogFragmentCompat : DatabaseSavePrefer
val newDefaultUsername = inputText
val oldDefaultUsername = database.defaultUsername
database.defaultUsername = newDefaultUsername
progressDialogThread?.startDatabaseSaveDefaultUsername(oldDefaultUsername, newDefaultUsername, true)
mProgressDialogThread?.startDatabaseSaveDefaultUsername(oldDefaultUsername, newDefaultUsername, mDatabaseAutoSaveEnable)
}
}
}

View File

@@ -36,7 +36,7 @@ class DatabaseDescriptionPreferenceDialogFragmentCompat : DatabaseSavePreference
val newDescription = inputText
val oldDescription = database.description
database.description = newDescription
progressDialogThread?.startDatabaseSaveDescription(oldDescription, newDescription, true)
mProgressDialogThread?.startDatabaseSaveDescription(oldDescription, newDescription, mDatabaseAutoSaveEnable)
}
}
}

View File

@@ -65,7 +65,7 @@ class DatabaseEncryptionAlgorithmPreferenceDialogFragmentCompat
database.encryptionAlgorithm = newAlgorithm
if (oldAlgorithm != null && newAlgorithm != null)
progressDialogThread?.startDatabaseSaveEncryption(oldAlgorithm, newAlgorithm, true)
mProgressDialogThread?.startDatabaseSaveEncryption(oldAlgorithm, newAlgorithm, mDatabaseAutoSaveEnable)
}
}
}

View File

@@ -66,7 +66,7 @@ class DatabaseKeyDerivationPreferenceDialogFragmentCompat
val oldKdfEngine = database.kdfEngine
if (newKdfEngine != null && oldKdfEngine != null) {
database.kdfEngine = newKdfEngine
progressDialogThread?.startDatabaseSaveKeyDerivation(oldKdfEngine, newKdfEngine, true)
mProgressDialogThread?.startDatabaseSaveKeyDerivation(oldKdfEngine, newKdfEngine, mDatabaseAutoSaveEnable)
}
}
}

View File

@@ -36,7 +36,7 @@ class DatabaseNamePreferenceDialogFragmentCompat : DatabaseSavePreferenceDialogF
val newName = inputText
val oldName = database.name
database.name = newName
progressDialogThread?.startDatabaseSaveName(oldName, newName, true)
mProgressDialogThread?.startDatabaseSaveName(oldName, newName, mDatabaseAutoSaveEnable)
}
}
}

View File

@@ -23,13 +23,14 @@ import android.content.Context
import android.os.Bundle
import com.kunzisoft.keepass.database.action.ProgressDialogThread
import com.kunzisoft.keepass.database.element.Database
import com.kunzisoft.keepass.settings.PreferencesUtil
import com.kunzisoft.keepass.settings.SettingsActivity
abstract class DatabaseSavePreferenceDialogFragmentCompat : InputPreferenceDialogFragmentCompat() {
protected var database: Database? = null
protected var progressDialogThread: ProgressDialogThread? = null
protected var mDatabaseAutoSaveEnable = true
protected var mProgressDialogThread: ProgressDialogThread? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -41,8 +42,10 @@ abstract class DatabaseSavePreferenceDialogFragmentCompat : InputPreferenceDialo
super.onAttach(context)
// Attach dialog thread to start action
if (context is SettingsActivity) {
progressDialogThread = context.progressDialogThread
mProgressDialogThread = context.mProgressDialogThread
}
this.mDatabaseAutoSaveEnable = PreferencesUtil.isAutoSaveDatabaseEnabled(context)
}
companion object {

View File

@@ -60,7 +60,7 @@ class MaxHistoryItemsPreferenceDialogFragmentCompat : DatabaseSavePreferenceDial
// Remove all history items
database.removeOldestHistoryForEachEntry()
progressDialogThread?.startDatabaseSaveMaxHistoryItems(oldMaxHistoryItems, maxHistoryItems, true)
mProgressDialogThread?.startDatabaseSaveMaxHistoryItems(oldMaxHistoryItems, maxHistoryItems, mDatabaseAutoSaveEnable)
}
}
}

View File

@@ -56,7 +56,7 @@ class MaxHistorySizePreferenceDialogFragmentCompat : DatabaseSavePreferenceDialo
val oldMaxHistorySize = database.historyMaxSize
database.historyMaxSize = maxHistorySize
progressDialogThread?.startDatabaseSaveMaxHistorySize(oldMaxHistorySize, maxHistorySize, true)
mProgressDialogThread?.startDatabaseSaveMaxHistorySize(oldMaxHistorySize, maxHistorySize, mDatabaseAutoSaveEnable)
}
}
}

View File

@@ -48,7 +48,7 @@ class MemoryUsagePreferenceDialogFragmentCompat : DatabaseSavePreferenceDialogFr
val oldMemoryUsage = database.memoryUsage
database.memoryUsage = memoryUsage
progressDialogThread?.startDatabaseSaveMemoryUsage(oldMemoryUsage, memoryUsage, true)
mProgressDialogThread?.startDatabaseSaveMemoryUsage(oldMemoryUsage, memoryUsage, mDatabaseAutoSaveEnable)
}
}
}

View File

@@ -48,7 +48,7 @@ class ParallelismPreferenceDialogFragmentCompat : DatabaseSavePreferenceDialogFr
val oldParallelism = database.parallelism
database.parallelism = parallelism
progressDialogThread?.startDatabaseSaveParallelism(oldParallelism, parallelism, true)
mProgressDialogThread?.startDatabaseSaveParallelism(oldParallelism, parallelism, mDatabaseAutoSaveEnable)
}
}
}

View File

@@ -54,7 +54,7 @@ class RoundsPreferenceDialogFragmentCompat : DatabaseSavePreferenceDialogFragmen
database.numberKeyEncryptionRounds = Long.MAX_VALUE
}
progressDialogThread?.startDatabaseSaveIterations(oldRounds, rounds, true)
mProgressDialogThread?.startDatabaseSaveIterations(oldRounds, rounds, mDatabaseAutoSaveEnable)
}
}
}

View File

@@ -24,4 +24,9 @@
android:title="@string/menu_lock"
android:orderInCategory="81"
app:showAsAction="always" />
<item android:id="@+id/menu_save_database"
android:icon="@drawable/ic_save_white_24dp"
android:title="@string/menu_save_database"
android:orderInCategory="95"
app:showAsAction="ifRoom" />
</menu>

View File

@@ -176,6 +176,7 @@
<string name="menu_cancel">Cancel</string>
<string name="menu_hide_password">Hide password</string>
<string name="menu_lock">Lock database</string>
<string name="menu_save_database">Save database</string>
<string name="menu_open">Open</string>
<string name="menu_search">Search</string>
<string name="menu_showpass">Show password</string>