diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt b/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt
index c7e34f80..496e6cf3 100644
--- a/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt
@@ -116,9 +116,18 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
}
}
+ checkLockState()
setupAdapter()
}
+ override fun checkLockState() {
+ view.apply {
+ checklist_content_holder.beVisibleIf(!note!!.isLocked() || shouldShowLockedContent)
+ checklist_fab.beVisibleIf(!note!!.isLocked() || shouldShowLockedContent)
+ setupLockedViews(this, note!!)
+ }
+ }
+
private fun showNewItemDialog() {
NewChecklistItemDialog(activity as SimpleActivity) { titles ->
var currentMaxId = items.maxBy { item -> item.id }?.id ?: 0
diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/NoteFragment.kt b/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/NoteFragment.kt
index fced9528..2878e8fa 100644
--- a/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/NoteFragment.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/NoteFragment.kt
@@ -1,5 +1,40 @@
package com.simplemobiletools.notes.pro.fragments
+import android.util.TypedValue
+import android.view.ViewGroup
import androidx.fragment.app.Fragment
+import com.simplemobiletools.commons.dialogs.SecurityDialog
+import com.simplemobiletools.commons.extensions.applyColorFilter
+import com.simplemobiletools.commons.extensions.beVisibleIf
+import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
+import com.simplemobiletools.notes.pro.extensions.config
+import com.simplemobiletools.notes.pro.extensions.getPercentageFontSize
+import com.simplemobiletools.notes.pro.models.Note
+import kotlinx.android.synthetic.main.fragment_checklist.view.*
-abstract class NoteFragment : Fragment()
+abstract class NoteFragment : Fragment() {
+ protected var shouldShowLockedContent = false
+
+ protected fun setupLockedViews(view: ViewGroup, note: Note) {
+ view.apply {
+ note_locked_layout.beVisibleIf(note.isLocked() && !shouldShowLockedContent)
+ note_locked_image.applyColorFilter(config!!.textColor)
+
+ note_locked_label.setTextColor(context!!.config.textColor)
+ note_locked_label.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getPercentageFontSize())
+
+ note_locked_show.setTextColor(context!!.getAdjustedPrimaryColor())
+ note_locked_show.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getPercentageFontSize())
+ note_locked_show.setOnClickListener {
+ SecurityDialog(activity!!, note.protectionHash, note.protectionType) { hash, type, success ->
+ if (success) {
+ shouldShowLockedContent = true
+ checkLockState()
+ }
+ }
+ }
+ }
+ }
+
+ abstract fun checkLockState()
+}
diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/TextFragment.kt b/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/TextFragment.kt
index efa161f4..afdb962d 100644
--- a/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/TextFragment.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/TextFragment.kt
@@ -141,7 +141,7 @@ class TextFragment : NoteFragment() {
setSelection(if (config.placeCursorToEnd) text.length else 0)
}
- if (config.showKeyboard && isMenuVisible) {
+ if (config.showKeyboard && isMenuVisible && (!note!!.isLocked() || shouldShowLockedContent)) {
onGlobalLayout {
if (activity?.isDestroyed == false) {
requestFocus()
@@ -159,13 +159,11 @@ class TextFragment : NoteFragment() {
}
if (config.showWordCount) {
- view.notes_counter.beVisible()
view.notes_counter.setTextColor(config.textColor)
setWordCounter(view.text_note_view.text.toString())
- } else {
- view.notes_counter.beGone()
}
+ checkLockState()
setTextWatcher()
}
@@ -178,6 +176,14 @@ class TextFragment : NoteFragment() {
fun removeTextWatcher() = view.text_note_view.removeTextChangedListener(textWatcher)
+ override fun checkLockState() {
+ view.apply {
+ notes_counter.beVisibleIf((!note!!.isLocked() || shouldShowLockedContent) && config!!.showWordCount)
+ notes_scrollview.beVisibleIf(!note!!.isLocked() || shouldShowLockedContent)
+ setupLockedViews(this, note!!)
+ }
+ }
+
fun updateNoteValue(value: String) {
note?.value = value
}
diff --git a/app/src/main/res/layout/fragment_checklist.xml b/app/src/main/res/layout/fragment_checklist.xml
index d17be84d..96b0ddd2 100644
--- a/app/src/main/res/layout/fragment_checklist.xml
+++ b/app/src/main/res/layout/fragment_checklist.xml
@@ -10,41 +10,84 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
-
-
-
+ android:visibility="gone">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+