adding un/locking itself

This commit is contained in:
tibbi
2021-05-20 21:19:29 +02:00
parent ae48ce07a3
commit d562df65b3
3 changed files with 22 additions and 6 deletions

View File

@ -23,6 +23,7 @@ import android.widget.TextView
import com.simplemobiletools.commons.dialogs.ConfirmationAdvancedDialog
import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.dialogs.SecurityDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.models.FAQItem
@ -1064,11 +1065,27 @@ class MainActivity : SimpleActivity() {
}
private fun lockNote() {
SecurityDialog(this, "", SHOW_ALL_TABS) { hash, type, success ->
if (success) {
mCurrentNote.protectionHash = hash
mCurrentNote.protectionType = type
NotesHelper(this).insertOrUpdateNote(mCurrentNote) {
invalidateOptionsMenu()
}
}
}
}
private fun unlockNote() {
SecurityDialog(this, mCurrentNote.protectionHash, mCurrentNote.protectionType) { hash, type, success ->
if (success) {
mCurrentNote.protectionHash = ""
mCurrentNote.protectionType = PROTECTION_NONE
NotesHelper(this).insertOrUpdateNote(mCurrentNote) {
invalidateOptionsMenu()
}
}
}
}
fun currentNoteTextChanged(newText: String, showUndo: Boolean, showRedo: Boolean) {