Skip to content

Commit d562df6

Browse files
committed
adding un/locking itself
1 parent ae48ce0 commit d562df6

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ android {
5656
}
5757

5858
dependencies {
59-
implementation 'com.github.SimpleMobileTools:Simple-Commons:f07ca31126'
59+
implementation 'com.github.SimpleMobileTools:Simple-Commons:1b7865f1bf'
6060
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
6161
implementation 'androidx.documentfile:documentfile:1.0.1'
6262

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
<uses-permission
99
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
1010
android:maxSdkVersion="28" />
11-
<uses-permission
12-
android:name="android.permission.USE_FINGERPRINT"
13-
tools:node="remove"/>
11+
12+
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
1413

1514
<uses-feature
1615
android:name="android.hardware.faketouch"

app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/MainActivity.kt

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import android.widget.TextView
2323
import com.simplemobiletools.commons.dialogs.ConfirmationAdvancedDialog
2424
import com.simplemobiletools.commons.dialogs.FilePickerDialog
2525
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
26+
import com.simplemobiletools.commons.dialogs.SecurityDialog
2627
import com.simplemobiletools.commons.extensions.*
2728
import com.simplemobiletools.commons.helpers.*
2829
import com.simplemobiletools.commons.models.FAQItem
@@ -1064,11 +1065,27 @@ class MainActivity : SimpleActivity() {
10641065
}
10651066

10661067
private fun lockNote() {
1067-
1068+
SecurityDialog(this, "", SHOW_ALL_TABS) { hash, type, success ->
1069+
if (success) {
1070+
mCurrentNote.protectionHash = hash
1071+
mCurrentNote.protectionType = type
1072+
NotesHelper(this).insertOrUpdateNote(mCurrentNote) {
1073+
invalidateOptionsMenu()
1074+
}
1075+
}
1076+
}
10681077
}
10691078

10701079
private fun unlockNote() {
1071-
1080+
SecurityDialog(this, mCurrentNote.protectionHash, mCurrentNote.protectionType) { hash, type, success ->
1081+
if (success) {
1082+
mCurrentNote.protectionHash = ""
1083+
mCurrentNote.protectionType = PROTECTION_NONE
1084+
NotesHelper(this).insertOrUpdateNote(mCurrentNote) {
1085+
invalidateOptionsMenu()
1086+
}
1087+
}
1088+
}
10721089
}
10731090

10741091
fun currentNoteTextChanged(newText: String, showUndo: Boolean, showRedo: Boolean) {

0 commit comments

Comments
 (0)