From 26ed93e42852d4c8bffbdf34e34929bafc608f44 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 21 May 2021 11:24:55 +0200 Subject: [PATCH] adding some widget handling related improvements --- .../pro/activities/WidgetConfigureActivity.kt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/WidgetConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/WidgetConfigureActivity.kt index f371a36e..80b40300 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/WidgetConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/WidgetConfigureActivity.kt @@ -101,8 +101,22 @@ class WidgetConfigureActivity : SimpleActivity() { NotesHelper(this).getNotes { mNotes = it notes_picker_holder.beVisibleIf(mNotes.size > 1 && !mIsCustomizingColors) - val note = mNotes.firstOrNull { !it.isLocked() } ?: return@getNotes - updateCurrentNote(note) + var note = mNotes.firstOrNull { !it.isLocked() } + + if (mNotes.size == 1 && note == null) { + note = mNotes.first() + SecurityDialog(this, note.protectionHash, note.protectionType) { hash, type, success -> + if (success) { + updateCurrentNote(note) + } else { + finish() + } + } + } else { + if (note != null) { + updateCurrentNote(note) + } + } } }