From 014b0cce14854de7b5afb9c0f1ab942f9930c5d0 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 10 Apr 2021 19:29:19 +0200 Subject: [PATCH 1/3] Add duration preference with number picker --- .../settings/MagikeyboardSettingsFragment.kt | 30 +++ .../settings/NestedAppSettingsFragment.kt | 29 ++- .../NestedDatabaseSettingsFragment.kt | 1 - .../preference/DurationDialogPreference.kt | 77 ++++++++ .../DurationDialogFragmentCompat.kt | 180 ++++++++++++++++++ .../InputPreferenceDialogFragmentCompat.kt | 10 + .../main/res/drawable/ic_day_white_24dp.xml | 5 + .../main/res/layout/pref_dialog_duration.xml | 149 +++++++++++++++ app/src/main/res/values/donottranslate.xml | 25 --- .../res/xml/preferences_advanced_unlock.xml | 4 +- .../main/res/xml/preferences_application.xml | 4 +- .../main/res/xml/preferences_form_filling.xml | 4 +- app/src/main/res/xml/preferences_keyboard.xml | 4 +- 13 files changed, 483 insertions(+), 39 deletions(-) create mode 100644 app/src/main/java/com/kunzisoft/keepass/settings/preference/DurationDialogPreference.kt create mode 100644 app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DurationDialogFragmentCompat.kt create mode 100644 app/src/main/res/drawable/ic_day_white_24dp.xml create mode 100644 app/src/main/res/layout/pref_dialog_duration.xml diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/MagikeyboardSettingsFragment.kt b/app/src/main/java/com/kunzisoft/keepass/settings/MagikeyboardSettingsFragment.kt index e087a7a82..3d7e6c9e6 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/MagikeyboardSettingsFragment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/MagikeyboardSettingsFragment.kt @@ -20,9 +20,12 @@ package com.kunzisoft.keepass.settings import android.os.Bundle +import androidx.fragment.app.DialogFragment +import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import com.kunzisoft.keepass.R +import com.kunzisoft.keepass.settings.preferencedialogfragment.DurationDialogFragmentCompat class MagikeyboardSettingsFragment : PreferenceFragmentCompat() { @@ -30,4 +33,31 @@ class MagikeyboardSettingsFragment : PreferenceFragmentCompat() { // Load the preferences from an XML resource setPreferencesFromResource(R.xml.preferences_keyboard, rootKey) } + + override fun onDisplayPreferenceDialog(preference: Preference?) { + + var otherDialogFragment = false + + var dialogFragment: DialogFragment? = null + // Main Preferences + when (preference?.key) { + getString(R.string.keyboard_entry_timeout_key) -> { + dialogFragment = DurationDialogFragmentCompat.newInstance(preference.key) + } + else -> otherDialogFragment = true + } + + if (dialogFragment != null) { + dialogFragment.setTargetFragment(this, 0) + dialogFragment.show(parentFragmentManager, TAG_PREF_FRAGMENT) + } + // Could not be handled here. Try with the super method. + else if (otherDialogFragment) { + super.onDisplayPreferenceDialog(preference) + } + } + + companion object { + private const val TAG_PREF_FRAGMENT = "TAG_PREF_FRAGMENT" + } } diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/NestedAppSettingsFragment.kt b/app/src/main/java/com/kunzisoft/keepass/settings/NestedAppSettingsFragment.kt index 34674b2d7..ab6bcb22b 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/NestedAppSettingsFragment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/NestedAppSettingsFragment.kt @@ -30,6 +30,7 @@ import android.view.autofill.AutofillManager import android.widget.Toast import androidx.annotation.RequiresApi import androidx.appcompat.app.AlertDialog +import androidx.fragment.app.DialogFragment import androidx.fragment.app.FragmentActivity import androidx.preference.ListPreference import androidx.preference.Preference @@ -46,6 +47,7 @@ import com.kunzisoft.keepass.education.Education import com.kunzisoft.keepass.icons.IconPackChooser import com.kunzisoft.keepass.services.AdvancedUnlockNotificationService import com.kunzisoft.keepass.settings.preference.IconPackListPreference +import com.kunzisoft.keepass.settings.preferencedialogfragment.DurationDialogFragmentCompat import com.kunzisoft.keepass.utils.UriUtil @@ -448,6 +450,31 @@ class NestedAppSettingsFragment : NestedSettingsFragment() { } } + override fun onDisplayPreferenceDialog(preference: Preference?) { + + var otherDialogFragment = false + + var dialogFragment: DialogFragment? = null + // Main Preferences + when (preference?.key) { + getString(R.string.app_timeout_key), + getString(R.string.clipboard_timeout_key), + getString(R.string.temp_advanced_unlock_timeout_key) -> { + dialogFragment = DurationDialogFragmentCompat.newInstance(preference.key) + } + else -> otherDialogFragment = true + } + + if (dialogFragment != null) { + dialogFragment.setTargetFragment(this, 0) + dialogFragment.show(parentFragmentManager, TAG_PREF_FRAGMENT) + } + // Could not be handled here. Try with the super method. + else if (otherDialogFragment) { + super.onDisplayPreferenceDialog(preference) + } + } + override fun onResume() { super.onResume() activity?.let { activity -> @@ -478,7 +505,7 @@ class NestedAppSettingsFragment : NestedSettingsFragment() { } companion object { - private const val REQUEST_CODE_AUTOFILL = 5201 + private const val TAG_PREF_FRAGMENT = "TAG_PREF_FRAGMENT" } } \ No newline at end of file diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/NestedDatabaseSettingsFragment.kt b/app/src/main/java/com/kunzisoft/keepass/settings/NestedDatabaseSettingsFragment.kt index 5f1ad6cb0..831929a92 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/NestedDatabaseSettingsFragment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/NestedDatabaseSettingsFragment.kt @@ -576,7 +576,6 @@ class NestedDatabaseSettingsFragment : NestedSettingsFragment() { } companion object { - private const val TAG_PREF_FRAGMENT = "TAG_PREF_FRAGMENT" } } \ No newline at end of file diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preference/DurationDialogPreference.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preference/DurationDialogPreference.kt new file mode 100644 index 000000000..4d1f203d8 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preference/DurationDialogPreference.kt @@ -0,0 +1,77 @@ +/* + * Copyright 2019 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePassDX. + * + * KeePassDX is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * KeePassDX is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KeePassDX. If not, see . + * + */ +package com.kunzisoft.keepass.settings.preference + +import android.content.Context +import android.content.res.TypedArray +import android.util.AttributeSet +import androidx.preference.DialogPreference +import com.kunzisoft.keepass.R + +class DurationDialogPreference @JvmOverloads constructor(context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = R.attr.dialogPreferenceStyle, + defStyleRes: Int = defStyleAttr) + : DialogPreference(context, attrs, defStyleAttr, defStyleRes) { + + private var mDuration: Long = 0L + + override fun getDialogLayoutResource(): Int { + return R.layout.pref_dialog_duration + } + + /** + * Get current duration of preference + */ + fun getDuration(): Long { + return if (mDuration >= 0) mDuration else -1 + } + + /** + * Assign [duration] of preference + */ + fun setDuration(duration: Long) { + persistString(duration.toString()) + notifyChanged() + } + + override fun onSetInitialValue(restorePersistedValue: Boolean, defaultValue: Any?) { + if (restorePersistedValue) { + mDuration = getPersistedString(mDuration.toString()).toLongOrNull() ?: mDuration + } else { + mDuration = defaultValue?.toString()?.toLongOrNull() ?: mDuration + persistString(mDuration.toString()) + } + } + + override fun onGetDefaultValue(a: TypedArray?, index: Int): Any { + return try { + a?.getString(index)?.toLongOrNull() ?: mDuration + } catch (e: Exception) { + mDuration + } + } + + // Was previously a string + override fun persistString(value: String?): Boolean { + mDuration = value?.toLongOrNull() ?: mDuration + return super.persistString(value) + } +} diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DurationDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DurationDialogFragmentCompat.kt new file mode 100644 index 000000000..2a5277c9c --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DurationDialogFragmentCompat.kt @@ -0,0 +1,180 @@ +/* + * Copyright 2021 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePassDX. + * + * KeePassDX is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * KeePassDX is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KeePassDX. If not, see . + * + */ +package com.kunzisoft.keepass.settings.preferencedialogfragment + +import android.os.Bundle +import android.view.View +import android.widget.NumberPicker +import com.kunzisoft.keepass.R +import com.kunzisoft.keepass.settings.preference.DurationDialogPreference + + +class DurationDialogFragmentCompat : InputPreferenceDialogFragmentCompat() { + + private var mEnabled = true + private var mDays = 0 + private var mHours = 0 + private var mMinutes = 0 + private var mSeconds = 0 + + private var daysNumberPicker: NumberPicker? = null + private var hoursNumberPicker: NumberPicker? = null + private var minutesNumberPicker: NumberPicker? = null + private var secondsNumberPicker: NumberPicker? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + // To get items from saved instance state + if (savedInstanceState != null + && savedInstanceState.containsKey(ENABLE_KEY) + && savedInstanceState.containsKey(DAYS_KEY) + && savedInstanceState.containsKey(HOURS_KEY) + && savedInstanceState.containsKey(MINUTES_KEY) + && savedInstanceState.containsKey(SECONDS_KEY)) { + mEnabled = savedInstanceState.getBoolean(ENABLE_KEY) + mDays = savedInstanceState.getInt(DAYS_KEY) + mHours = savedInstanceState.getInt(HOURS_KEY) + mMinutes = savedInstanceState.getInt(MINUTES_KEY) + mSeconds = savedInstanceState.getInt(SECONDS_KEY) + } else { + val currentPreference = preference + if (currentPreference is DurationDialogPreference) { + durationToDaysHoursMinutesSeconds(currentPreference.getDuration()) + } + } + } + + private fun durationToDaysHoursMinutesSeconds(duration: Long) { + if (duration < 0) { + mDays = 0 + mHours = 0 + mMinutes = 0 + mSeconds = 0 + } else { + mDays = (duration / (24L * 60L * 60L * 1000L)).toInt() + val daysMilliseconds = mDays * 24L * 60L * 60L * 1000L + mHours = ((duration - daysMilliseconds) / (60L * 60L * 1000L)).toInt() + val hoursMilliseconds = mHours * 60L * 60L * 1000L + mMinutes = ((duration - daysMilliseconds - hoursMilliseconds) / (60L * 1000L)).toInt() + val minutesMilliseconds = mMinutes * 60L * 1000L + mSeconds = ((duration - daysMilliseconds - hoursMilliseconds - minutesMilliseconds) / (1000L)).toInt() + } + } + + private fun assignValuesInViews() { + daysNumberPicker?.value = mDays + hoursNumberPicker?.value = mHours + minutesNumberPicker?.value = mMinutes + secondsNumberPicker?.value = mSeconds + } + + override fun onBindDialogView(view: View) { + super.onBindDialogView(view) + + daysNumberPicker = view.findViewById(R.id.days_picker).apply { + minValue = 0 + maxValue = 364 + setOnValueChangedListener { _, _, newVal -> + mDays = newVal + activateSwitch() + } + } + + hoursNumberPicker = view.findViewById(R.id.hours_picker).apply { + minValue = 0 + maxValue = 23 + setOnValueChangedListener { _, _, newVal -> + mHours = newVal + activateSwitch() + } + } + + minutesNumberPicker = view.findViewById(R.id.minutes_picker).apply { + minValue = 0 + maxValue = 59 + setOnValueChangedListener { _, _, newVal -> + mMinutes = newVal + activateSwitch() + } + } + + secondsNumberPicker = view.findViewById(R.id.seconds_picker).apply { + minValue = 0 + maxValue = 59 + setOnValueChangedListener { _, _, newVal -> + mSeconds = newVal + activateSwitch() + } + } + + setSwitchAction({ isChecked -> + mEnabled = isChecked + }, mDays + mHours + mMinutes + mSeconds > 0) + + assignValuesInViews() + } + + private fun buildDuration(): Long { + return if (mEnabled) { + mDays * 24L * 60L * 60L * 1000L + + mHours * 60L * 60L * 1000L + + mMinutes * 60L * 1000L + + mSeconds * 1000L + } else { + -1 + } + } + + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + outState.putBoolean(ENABLE_KEY, mEnabled) + outState.putInt(DAYS_KEY, mDays) + outState.putInt(HOURS_KEY, mHours) + outState.putInt(MINUTES_KEY, mMinutes) + outState.putInt(SECONDS_KEY, mSeconds) + } + + override fun onDialogClosed(positiveResult: Boolean) { + if (positiveResult) { + val currentPreference = preference + if (currentPreference is DurationDialogPreference) { + currentPreference.setDuration(buildDuration()) + } + } + } + + companion object { + private const val ENABLE_KEY = "ENABLE_KEY" + private const val DAYS_KEY = "DAYS_KEY" + private const val HOURS_KEY = "HOURS_KEY" + private const val MINUTES_KEY = "MINUTES_KEY" + private const val SECONDS_KEY = "SECONDS_KEY" + + fun newInstance(key: String): DurationDialogFragmentCompat { + val fragment = DurationDialogFragmentCompat() + val bundle = Bundle(1) + bundle.putString(ARG_KEY, key) + fragment.arguments = bundle + + return fragment + } + } +} diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/InputPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/InputPreferenceDialogFragmentCompat.kt index 11751d2fb..0b6b719c2 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/InputPreferenceDialogFragmentCompat.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/InputPreferenceDialogFragmentCompat.kt @@ -154,4 +154,14 @@ abstract class InputPreferenceDialogFragmentCompat : PreferenceDialogFragmentCom onCheckedChange?.invoke(isChecked) } } + + fun activateSwitch() { + if (switchElementView?.isChecked != true) + switchElementView?.isChecked = true + } + + fun deactivateSwitch() { + if (switchElementView?.isChecked == true) + switchElementView?.isChecked = false + } } diff --git a/app/src/main/res/drawable/ic_day_white_24dp.xml b/app/src/main/res/drawable/ic_day_white_24dp.xml new file mode 100644 index 000000000..c4ba94d90 --- /dev/null +++ b/app/src/main/res/drawable/ic_day_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/layout/pref_dialog_duration.xml b/app/src/main/res/layout/pref_dialog_duration.xml new file mode 100644 index 000000000..4570a6f4a --- /dev/null +++ b/app/src/main/res/layout/pref_dialog_duration.xml @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index a29de3357..ebe164511 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -288,31 +288,6 @@ timeout_backup_key 300000 1500 - - 5000 - 10000 - 20000 - 30000 - 60000 - 300000 - 900000 - 1800000 - -1 - - - 300000 - 900000 - 1800000 - 3600000 - 7200000 - 18000000 - 36000000 - 86400000 - 172800000 - 604800000 - 2592000000 - -1 - 32dp diff --git a/app/src/main/res/xml/preferences_advanced_unlock.xml b/app/src/main/res/xml/preferences_advanced_unlock.xml index 0b66ceefb..b66b7168e 100644 --- a/app/src/main/res/xml/preferences_advanced_unlock.xml +++ b/app/src/main/res/xml/preferences_advanced_unlock.xml @@ -47,13 +47,11 @@ android:title="@string/temp_advanced_unlock_enable_title" android:summary="@string/temp_advanced_unlock_enable_summary" android:defaultValue="@bool/temp_advanced_unlock_enable_default"/> - - - - From b8890aca7f4b85b0f9f834ccba76e837f04fad1c Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 10 Apr 2021 20:30:48 +0200 Subject: [PATCH 2/3] Better notification timer implementation --- .../AdvancedUnlockNotificationService.kt | 23 ++------ .../ClipboardEntryNotificationService.kt | 52 ++++++------------- .../KeyboardEntryNotificationService.kt | 28 ++-------- .../services/LockNotificationService.kt | 5 -- .../keepass/services/NotificationService.kt | 29 +++++++++++ 5 files changed, 52 insertions(+), 85 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/services/AdvancedUnlockNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/services/AdvancedUnlockNotificationService.kt index 26c56d01f..7d3d42235 100644 --- a/app/src/main/java/com/kunzisoft/keepass/services/AdvancedUnlockNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/services/AdvancedUnlockNotificationService.kt @@ -10,7 +10,6 @@ import com.kunzisoft.keepass.R import com.kunzisoft.keepass.app.database.CipherDatabaseEntity import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.timeout.TimeoutHelper -import kotlinx.coroutines.* class AdvancedUnlockNotificationService : NotificationService() { @@ -18,9 +17,6 @@ class AdvancedUnlockNotificationService : NotificationService() { private var mActionTaskBinder = AdvancedUnlockBinder() - private var notificationTimeoutMilliSecs: Long = 0 - private var mTimerJob: Job? = null - inner class AdvancedUnlockBinder: Binder() { fun getCipherDatabase(databaseUri: Uri): CipherDatabaseEntity? { return mTempCipherDao.firstOrNull { it.databaseUri == databaseUri.toString()} @@ -80,23 +76,11 @@ class AdvancedUnlockNotificationService : NotificationService() { when (intent?.action) { ACTION_TIMEOUT -> { - notificationTimeoutMilliSecs = PreferencesUtil.getAdvancedUnlockTimeout(this) + val notificationTimeoutMilliSecs = PreferencesUtil.getAdvancedUnlockTimeout(this) // Not necessarily a foreground service if (mTimerJob == null && notificationTimeoutMilliSecs != TimeoutHelper.NEVER) { - mTimerJob = CoroutineScope(Dispatchers.Main).launch { - val maxPos = 100 - val posDurationMills = notificationTimeoutMilliSecs / maxPos - for (pos in maxPos downTo 0) { - notificationBuilder.setProgress(maxPos, pos, false) - startForeground(notificationId, notificationBuilder.build()) - delay(posDurationMills) - if (pos <= 0) { - stopSelf() - } - } - notificationManager?.cancel(notificationId) - mTimerJob = null - cancel() + defineTimerJob(notificationBuilder, notificationTimeoutMilliSecs) { + stopSelf() } } else { startForeground(notificationId, notificationBuilder.build()) @@ -118,7 +102,6 @@ class AdvancedUnlockNotificationService : NotificationService() { override fun onDestroy() { mTempCipherDao.clear() - mTimerJob?.cancel() super.onDestroy() } diff --git a/app/src/main/java/com/kunzisoft/keepass/services/ClipboardEntryNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/services/ClipboardEntryNotificationService.kt index 2930f5a78..83cb4534d 100644 --- a/app/src/main/java/com/kunzisoft/keepass/services/ClipboardEntryNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/services/ClipboardEntryNotificationService.kt @@ -37,8 +37,7 @@ class ClipboardEntryNotificationService : LockNotificationService() { override val notificationId = 485 private var mEntryInfo: EntryInfo? = null private var clipboardHelper: ClipboardHelper? = null - private var notificationTimeoutMilliSecs: Long = 0 - private var cleanCopyNotificationTimerTask: Thread? = null + private var mNotificationTimeoutMilliSecs: Long = 0 override fun retrieveChannelId(): String { return CHANNEL_CLIPBOARD_ID @@ -70,7 +69,7 @@ class ClipboardEntryNotificationService : LockNotificationService() { mEntryInfo = intent?.getParcelableExtra(EXTRA_ENTRY_INFO) //Get settings - notificationTimeoutMilliSecs = PreferencesUtil.getClipboardTimeout(this) + mNotificationTimeoutMilliSecs = PreferencesUtil.getClipboardTimeout(this) when { intent == null -> Log.w(TAG, "null intent") @@ -78,7 +77,7 @@ class ClipboardEntryNotificationService : LockNotificationService() { newNotification(mEntryInfo?.title, constructListOfField(intent)) } ACTION_CLEAN_CLIPBOARD == intent.action -> { - stopTask(cleanCopyNotificationTimerTask) + mTimerJob?.cancel() cleanClipboard() stopNotificationAndSendLockIfNeeded() } @@ -121,7 +120,7 @@ class ClipboardEntryNotificationService : LockNotificationService() { } private fun newNotification(title: String?, fieldsToAdd: ArrayList) { - stopTask(cleanCopyNotificationTimerTask) + mTimerJob?.cancel() val builder = buildNewNotification() .setSmallIcon(R.drawable.notification_ic_clipboard_key_24dp) @@ -147,7 +146,7 @@ class ClipboardEntryNotificationService : LockNotificationService() { } private fun copyField(fieldToCopy: ClipboardEntryNotificationField, nextFields: ArrayList) { - stopTask(cleanCopyNotificationTimerTask) + mTimerJob?.cancel() try { var generatedValue = fieldToCopy.getGeneratedValue(mEntryInfo) @@ -170,40 +169,23 @@ class ClipboardEntryNotificationService : LockNotificationService() { this, 0, cleanIntent, PendingIntent.FLAG_UPDATE_CURRENT) builder.setDeleteIntent(cleanPendingIntent) - val myNotificationId = notificationId - - if (notificationTimeoutMilliSecs != NEVER) { - cleanCopyNotificationTimerTask = Thread { - val maxPos = 100 - val posDurationMills = notificationTimeoutMilliSecs / maxPos - for (pos in maxPos downTo 0) { - val newGeneratedValue = fieldToCopy.getGeneratedValue(mEntryInfo) - // New auto generated value - if (generatedValue != newGeneratedValue) { - generatedValue = newGeneratedValue - clipboardHelper?.copyToClipboard(fieldToCopy.label, generatedValue) - } - builder.setProgress(maxPos, pos, false) - notificationManager?.notify(myNotificationId, builder.build()) - try { - Thread.sleep(posDurationMills) - } catch (e: InterruptedException) { - break - } - if (pos <= 0) { - stopNotificationAndSendLockIfNeeded() - } + if (mNotificationTimeoutMilliSecs != NEVER) { + defineTimerJob(builder, mNotificationTimeoutMilliSecs, { + val newGeneratedValue = fieldToCopy.getGeneratedValue(mEntryInfo) + // New auto generated value + if (generatedValue != newGeneratedValue) { + generatedValue = newGeneratedValue + clipboardHelper?.copyToClipboard(fieldToCopy.label, generatedValue) } - stopTask(cleanCopyNotificationTimerTask) - notificationManager?.cancel(myNotificationId) + }) { + stopNotificationAndSendLockIfNeeded() // Clean password only if no next field if (nextFields.size <= 0) cleanClipboard() } - cleanCopyNotificationTimerTask?.start() } else { // No timer - notificationManager?.notify(myNotificationId, builder.build()) + notificationManager?.notify(notificationId, builder.build()) } } catch (e: Exception) { @@ -228,10 +210,6 @@ class ClipboardEntryNotificationService : LockNotificationService() { override fun onDestroy() { cleanClipboard() - - stopTask(cleanCopyNotificationTimerTask) - cleanCopyNotificationTimerTask = null - super.onDestroy() } diff --git a/app/src/main/java/com/kunzisoft/keepass/services/KeyboardEntryNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/services/KeyboardEntryNotificationService.kt index af214e50b..ce13eecc9 100644 --- a/app/src/main/java/com/kunzisoft/keepass/services/KeyboardEntryNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/services/KeyboardEntryNotificationService.kt @@ -35,8 +35,7 @@ import com.kunzisoft.keepass.utils.LOCK_ACTION class KeyboardEntryNotificationService : LockNotificationService() { override val notificationId = 486 - private var cleanNotificationTimerTask: Thread? = null - private var notificationTimeoutMilliSecs: Long = 0 + private var mNotificationTimeoutMilliSecs: Long = 0 private var pendingDeleteIntent: PendingIntent? = null @@ -61,7 +60,7 @@ class KeyboardEntryNotificationService : LockNotificationService() { super.onStartCommand(intent, flags, startId) //Get settings - notificationTimeoutMilliSecs = PreferenceManager.getDefaultSharedPreferences(this) + mNotificationTimeoutMilliSecs = PreferenceManager.getDefaultSharedPreferences(this) .getString(getString(R.string.keyboard_entry_timeout_key), getString(R.string.timeout_default))?.toLong() ?: TimeoutHelper.DEFAULT_TIMEOUT @@ -107,27 +106,12 @@ class KeyboardEntryNotificationService : LockNotificationService() { notificationManager?.cancel(notificationId) notificationManager?.notify(notificationId, builder.build()) - stopTask(cleanNotificationTimerTask) // Timeout only if notification clear is available if (PreferencesUtil.isClearKeyboardNotificationEnable(this)) { - if (notificationTimeoutMilliSecs != TimeoutHelper.NEVER) { - cleanNotificationTimerTask = Thread { - val maxPos = 100 - val posDurationMills = notificationTimeoutMilliSecs / maxPos - for (pos in maxPos downTo 0) { - builder.setProgress(maxPos, pos, false) - notificationManager?.notify(notificationId, builder.build()) - try { - Thread.sleep(posDurationMills) - } catch (e: InterruptedException) { - break - } - if (pos <= 0) { - stopNotificationAndSendLockIfNeeded() - } - } + if (mNotificationTimeoutMilliSecs != TimeoutHelper.NEVER) { + defineTimerJob(builder, mNotificationTimeoutMilliSecs) { + stopNotificationAndSendLockIfNeeded() } - cleanNotificationTimerTask?.start() } } } @@ -142,8 +126,6 @@ class KeyboardEntryNotificationService : LockNotificationService() { // Remove the entry from the keyboard MagikIME.removeEntry(this) - stopTask(cleanNotificationTimerTask) - cleanNotificationTimerTask = null pendingDeleteIntent?.cancel() super.onDestroy() diff --git a/app/src/main/java/com/kunzisoft/keepass/services/LockNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/services/LockNotificationService.kt index daf37a124..e1865cf1e 100644 --- a/app/src/main/java/com/kunzisoft/keepass/services/LockNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/services/LockNotificationService.kt @@ -50,11 +50,6 @@ abstract class LockNotificationService : NotificationService() { return super.onStartCommand(intent, flags, startId) } - protected fun stopTask(task: Thread?) { - if (task != null && task.isAlive) - task.interrupt() - } - override fun onTaskRemoved(rootIntent: Intent?) { notificationManager?.cancel(notificationId) diff --git a/app/src/main/java/com/kunzisoft/keepass/services/NotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/services/NotificationService.kt index e475ad4eb..f9faf3c93 100644 --- a/app/src/main/java/com/kunzisoft/keepass/services/NotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/services/NotificationService.kt @@ -11,6 +11,7 @@ import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import com.kunzisoft.keepass.R import com.kunzisoft.keepass.activities.stylish.Stylish +import kotlinx.coroutines.* abstract class NotificationService : Service() { @@ -18,6 +19,8 @@ abstract class NotificationService : Service() { protected var notificationManager: NotificationManagerCompat? = null private var colorNotificationAccent: Int = 0 + protected var mTimerJob: Job? = null + protected abstract val notificationId: Int override fun onBind(intent: Intent): IBinder? { @@ -71,7 +74,33 @@ abstract class NotificationService : Service() { } } + protected fun defineTimerJob(builder: NotificationCompat.Builder, + timeoutMilliseconds: Long, + actionAfterASecond: (() -> Unit)? = null, + actionEnd: () -> Unit) { + mTimerJob?.cancel() + mTimerJob = CoroutineScope(Dispatchers.Main).launch { + val timeoutInSeconds = timeoutMilliseconds / 1000L + for (currentTime in timeoutInSeconds downTo 0) { + actionAfterASecond?.invoke() + builder.setProgress(100, + (currentTime * 100 / timeoutInSeconds).toInt(), + false) + startForeground(notificationId, builder.build()) + delay(1000) + if (currentTime <= 0) { + actionEnd() + } + } + notificationManager?.cancel(notificationId) + mTimerJob = null + cancel() + } + } + override fun onDestroy() { + mTimerJob?.cancel() + mTimerJob = null notificationManager?.cancel(notificationId) super.onDestroy() From a3c51884f4a7790c5aebf061eea808894895f85f Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 10 Apr 2021 20:53:24 +0200 Subject: [PATCH 3/3] Fix timeout strings --- app/src/main/res/values-ca/strings.xml | 11 --------- app/src/main/res/values-cs/strings.xml | 11 --------- app/src/main/res/values-da/strings.xml | 11 --------- app/src/main/res/values-de/strings.xml | 11 --------- app/src/main/res/values-el/strings.xml | 11 --------- app/src/main/res/values-es/strings.xml | 11 --------- app/src/main/res/values-eu/strings.xml | 11 --------- app/src/main/res/values-fi/strings.xml | 11 --------- app/src/main/res/values-fr/strings.xml | 11 --------- app/src/main/res/values-hu/strings.xml | 11 --------- app/src/main/res/values-it/strings.xml | 11 --------- app/src/main/res/values-iw/strings.xml | 11 --------- app/src/main/res/values-ja/strings.xml | 11 --------- app/src/main/res/values-lv/strings.xml | 11 --------- app/src/main/res/values-nl/strings.xml | 11 --------- app/src/main/res/values-nn/strings.xml | 11 --------- app/src/main/res/values-pl/strings.xml | 11 --------- app/src/main/res/values-pt-rBR/strings.xml | 11 --------- app/src/main/res/values-pt-rPT/strings.xml | 11 --------- app/src/main/res/values-ru/strings.xml | 11 --------- app/src/main/res/values-sk/strings.xml | 11 --------- app/src/main/res/values-sv/strings.xml | 11 --------- app/src/main/res/values-uk/strings.xml | 11 --------- app/src/main/res/values-zh-rCN/strings.xml | 11 --------- app/src/main/res/values-zh-rTW/strings.xml | 11 --------- app/src/main/res/values/strings.xml | 27 +--------------------- 26 files changed, 1 insertion(+), 301 deletions(-) diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index d1b275412..931119bd8 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -122,17 +122,6 @@ Majúscules Versió %1$s Introdueix una contrasenya i/o un arxiu clau per desbloquejar la base de dades. - - 5 segons - 10 segons - 20 segons - 30 segons - 1 minut - 5 minuts - 15 minuts - 30 minuts - Mai - Petita Mitjana diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index c8bfc69df..831469384 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -133,17 +133,6 @@ Databázi odemknete zadáním hesla a/nebo souboru s klíčem. \n \nNezapomeňte po každé úpravě zálohovat kopii svého .kdbx souboru na bezpečné místo. - - 5 sekund - 10 sekund - 20 sekund - 30 sekund - 1 minuta - 5 minut - 15 minut - 30 minut - Nikdy - Malý Střední diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 11ad6029b..7d1c9e228 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -132,17 +132,6 @@ Angiv en adgangskode og/eller en nøglefil til at låse databasen op. \n \nHusk at gemme en kopi af .kdbx filen i et sikkert sted efter hver ændring. - - 5 sekunder - 10 sekunder - 20 sekunder - 30 sekunder - 1 minut - 5 minutter - 15 minutter - 30 minutter - Aldrig - Lille Mellem diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 89fd2907b..cdb8a4560 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -147,17 +147,6 @@ Geben Sie das Passwort und/oder die Schlüsseldatei ein, um Ihre Datenbank zu entsperren. \n \nSichern Sie Ihre Datenbankdatei nach jeder Änderung an einem sicheren Ort. - - 5 Sekunden - 10 Sekunden - 20 Sekunden - 30 Sekunden - 1 Minute - 5 Minuten - 15 Minuten - 30 Minuten - Nie - Klein Mittel diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 1c275fa1b..030dbd271 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -135,17 +135,6 @@ Καταχωρίστε τον κωδικό πρόσβασης και /ή το αρχείο-κλειδί για να ξεκλειδώσετε τη βάση δεδομένων σας. \n \nΔημιουργήστε αντίγραφα ασφαλείας του αρχείου βάσης δεδομένων σας, σε ασφαλές μέρος μετά από κάθε αλλαγή. - - 5 δευτερόλεπτα - 10 δευτερόλεπτα - 20 δευτερόλεπτα - 30 δευτερόλεπτα - 1 λεπτό - 5 λεπτά - 15 λεπτά - 30 λεπτά - Ποτέ - Μικρά Μεσαία diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 38a61cc55..2a326a1c0 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -125,17 +125,6 @@ Introduzca la contraseña y/o el archivo clave para desbloquear su base de datos. \n \nHaga una copia de seguridad de su archivo de base de datos en un lugar seguro después de cada cambio. - - 5 segundos - 10 segundos - 20 segundos - 30 segundos - 1 minuto - 5 minutos - 15 minutos - 30 minutos - Nunca - Pequeño Mediano diff --git a/app/src/main/res/values-eu/strings.xml b/app/src/main/res/values-eu/strings.xml index 72e10b689..e501ae3fe 100644 --- a/app/src/main/res/values-eu/strings.xml +++ b/app/src/main/res/values-eu/strings.xml @@ -132,17 +132,6 @@ Maiuskulak Bertsioa %1$s Sartu pasahitz eta / edo gako fitxategi bat zure datubasea desblokeatzeko. - - 5 segundu - 10 segundu - 20 segundu - 30 segundu - minutu 1 - 5 minutu - 15 minutu - 30 minutu - Inoiz ez - Txikia Ertaina diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index a26f69785..17825f5ad 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -132,17 +132,6 @@ Isot kirjaimet Versio %1$s Syötä salasana ja/tai avaintiedosto avataksesi tietokantasi. - - 5 sekuntia - 10 sekuntia - 20 sekuntia - 30 sekuntia - 1 minuutti - 5 minuttia - 15 minuttia - 30 minuttia - Ei koskaan - Pieni Keskikokoinen diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 506599704..d22426531 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -258,17 +258,6 @@ N’oubliez pas de garder votre application à jour en installant les nouvelles versions. Télécharger Contribuer - - 5 secondes - 10 secondes - 20 secondes - 30 secondes - 1 minute - 5 minutes - 15 minutes - 30 minutes - Jamais - Petit Moyen diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index e3faae646..42d97e39a 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -140,17 +140,6 @@ Adja meg a jelszót és/vagy a kulcsfájlt, hogy kinyithassa az adatbázist. \n \nKészítsen biztonsági mentést az adatbázisról minden egyes módosítás után. - - 5 másodperc - 10 másodperc - 20 másodperc - 30 másodperc - 1 perc - 5 perc - 15 perc - 30 perc - Soha - Kicsi Közepes diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index ad0d3d5f9..3014df4e5 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -142,17 +142,6 @@ Inserisci la password o il file chiave per sbloccare la base di dati. \n \nEseguire il backup del file del database in un luogo sicuro dopo ogni modifica. - - 5 secondi - 10 secondi - 20 secondi - 30 secondi - 1 minuto - 5 minuti - 15 minuti - 30 minuti - Mai - Piccolo Medio diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index c10c9157e..f1b2a045d 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -129,17 +129,6 @@ רישית גרסה %1$s הזן סיסמה ו/או קובץ מפתח כדי לפתוח את מסד הנתונים. - - 5 שניות - 10 שניות - 20 שניות - 30 שניות - דקה אחת - 5 דקות - 15 דקות - 30 דקות - אף פעם - קטן בינוני diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 4bbeb1d45..8deaf976b 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -470,17 +470,6 @@ 進行中:%1$d%% 終了しています… 完了しました! - - 5秒 - 10秒 - 20秒 - 30秒 - 1分 - 5分 - 15分 - 30分 - なし - diff --git a/app/src/main/res/values-lv/strings.xml b/app/src/main/res/values-lv/strings.xml index 4cce5e774..f3100b69e 100644 --- a/app/src/main/res/values-lv/strings.xml +++ b/app/src/main/res/values-lv/strings.xml @@ -129,17 +129,6 @@ Lielie burti Versija %1$s Ievadiet paroli/atslēgas failu, lai atbloķētu savu datu bāzi. - - 5 sekundes - 10 sekundes - 20 sekundes - 30 sekundes - 1 minūte - 5 minūtes - 15 minūtes - 30 minūtes - Nekad - Mazs Vidējs diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 10647efd7..648a4c256 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -125,17 +125,6 @@ Voer het wachtwoord en/of sleutelbestand in om je database te ontgrendelen. \n \nMaak na elke aanpassing een kopie van je .kdbx-bestand op een veilige locatie. - - 5 seconden - 10 seconden - 20 seconden - 30 seconden - 1 minuut - 5 minuten - 15 minuten - 30 minuten - Nooit - Klein Medium diff --git a/app/src/main/res/values-nn/strings.xml b/app/src/main/res/values-nn/strings.xml index be7d4839e..71da3ef73 100644 --- a/app/src/main/res/values-nn/strings.xml +++ b/app/src/main/res/values-nn/strings.xml @@ -120,17 +120,6 @@ Store bokstavar Utgåve %1$s Skriv inn passordet og/eller nøkkelfil for å låsa opp databasen. - - 5 sekund - 10 sekund - 20 sekund - 30 sekund - 1 minutt - 5 minutt - 15 minutt - 30 minutt - Aldri - Liten Middels diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 00c603379..3748a8073 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -120,17 +120,6 @@ prowadź hasło i/lub plik klucza, aby odblokować bazę danych. \n \nUtwórz kopię zapasową pliku bazy danych w bezpiecznym miejscu po każdej zmianie. - - 5 sekund - 10 sekund - 20 sekund - 30 sekund - 1 minuta - 5 minut - 15 minut - 30 minut - Nigdy - Mała Średnia diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 6a13abbcf..32d102ad2 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -123,17 +123,6 @@ Entre com a senha e/ou com o caminho para o arquivo-chave do banco de dados. \n \nGuarde uma cópia do seu arquivo do banco em um lugar mais seguro depois de cada alteração. - - 5 segundos - 10 segundos - 20 segundos - 30 segundos - 1 minuto - 5 minutos - 15 minutos - 30 minutos - Nunca - Pequeno Médio diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 2ee8a71cb..a0810454c 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -139,17 +139,6 @@ Entre com a palavra-passe e/ou com o caminho para o ficheiro-chave da base de dados. \n \nGuarde uma cópia do seu ficheiro do banco num lugar mais seguro depois de cada alteração. - - 5 segundos - 10 segundos - 20 segundos - 30 segundos - 1 minuto - 5 minutos - 15 minutos - 30 minutos - Nunca - Pequena Média diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 4fdd40cbd..ba177823f 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -141,17 +141,6 @@ Введите пароль и/или файл ключа, чтобы разблокировать базу. \n \nНе забывайте сохранять копию файла базы в безопасном месте после каждого изменения. - - 5 секунд - 10 секунд - 20 секунд - 30 секунд - 1 минута - 5 минут - 15 минут - 30 минут - Никогда - Мелкий Обычный diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index eaeee45ca..7edb79f9e 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -120,17 +120,6 @@ Veľké písmená Version %1$s Vložte heslo a / alebo keyfile pre odomknutie databázy. - - 5 sekúnd - 10 sekúnd - 20 sekúnd - 30 sekúnd - 1 minúta - 5 minút - 15 minút - 30 minút - Nikdy - Malé Stredné diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 6b8bbd01a..fc946bedf 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -133,17 +133,6 @@ Ange lösenord och/eller nyckelfil för att öppna databasen. \n \nBacka upp databasfilen på ett säkert ställe efter varje ändring. - - 5 sekunder - 10 sekunder - 20 sekunder - 30 sekunder - 1 minut - 5 minuter - 15 minuter - 30 minuter - Aldrig - Liten Medium diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 719bc2a46..cc7664ae3 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -123,17 +123,6 @@ Введіть пароль та/або файл ключа, щоб відкрити базу даних. \n \nСтворюйте резервну копію файлу бази даних після кожної внесеної зміни та зберігайте її у безпечному місці. - - 5 секунд - 10 секунд - 20 секунд - 30 секунд - 1 хвилина - 5 хвилин - 15 хвилин - 30 хвилин - Ніколи - Малий Середній diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 616f99f29..6dfa67dca 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -119,17 +119,6 @@ 输入密码和/或密钥文件来解锁你的数据库。 \n \n记得在每次做出更改后,将数据库文件备份至安全的地方。 - - 5秒 - 10秒 - 20秒 - 30秒 - 1分钟 - 5分钟 - 15分钟 - 30分钟 - 从不 - diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 978a77d85..d9603a2cb 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -117,17 +117,6 @@ 不支援的資料庫版本。 大寫 輸入密碼和/或一個密鑰檔來解鎖你的資料庫. - - 5秒 - 10秒 - 20秒 - 30秒 - 1分鐘 - 5分鐘 - 15分鐘 - 30分鐘 - 從不 - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ba624eadd..21475de8e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -31,7 +31,7 @@ Encryption Encryption algorithm Key derivation function - App timeout + Timeout Idle time before locking the database App Brackets @@ -535,31 +535,6 @@ KiB MiB GiB - - 5 seconds - 10 seconds - 20 seconds - 30 seconds - 1 minute - 5 minutes - 15 minutes - 30 minutes - Never - - - 5 minutes - 15 minutes - 30 minutes - 1 hour - 2 hours - 5 hours - 10 hours - 24 hours - 48 hours - 1 week - 1 month - Never - Small Medium