adding the locking related menu buttons

This commit is contained in:
tibbi 2021-05-20 20:54:48 +02:00
parent 53182f0507
commit ae48ce07a3
3 changed files with 23 additions and 0 deletions

View File

@ -155,6 +155,8 @@ class MainActivity : SimpleActivity() {
findItem(R.id.open_search).isVisible = !isCurrentItemChecklist()
findItem(R.id.remove_done_items).isVisible = isCurrentItemChecklist()
findItem(R.id.import_folder).isVisible = hasPermission(PERMISSION_READ_STORAGE)
findItem(R.id.lock_note).isVisible = mNotes.isNotEmpty() && !mCurrentNote.isLocked()
findItem(R.id.unlock_note).isVisible = mNotes.isNotEmpty() && mCurrentNote.isLocked()
saveNoteButton = findItem(R.id.save_note)
saveNoteButton!!.isVisible = !config.autosaveNotes && showSaveButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
@ -178,6 +180,8 @@ class MainActivity : SimpleActivity() {
R.id.new_note -> displayNewNoteDialog()
R.id.rename_note -> displayRenameDialog()
R.id.share -> shareText()
R.id.lock_note -> lockNote()
R.id.unlock_note -> unlockNote()
R.id.open_file -> tryOpenFile()
R.id.import_folder -> openFolder()
R.id.export_as_file -> tryExportAsFile()
@ -1059,6 +1063,14 @@ class MainActivity : SimpleActivity() {
}
}
private fun lockNote() {
}
private fun unlockNote() {
}
fun currentNoteTextChanged(newText: String, showUndo: Boolean, showRedo: Boolean) {
if (!isSearchActive) {
var shouldRecreateMenu = false

View File

@ -6,6 +6,7 @@ import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
import com.simplemobiletools.commons.helpers.PROTECTION_NONE
import java.io.File
@Entity(tableName = "notes", indices = [(Index(value = ["id"], unique = true))])
@ -34,4 +35,6 @@ data class Note(
value
}
}
fun isLocked() = protectionType != PROTECTION_NONE
}

View File

@ -46,6 +46,14 @@
android:icon="@drawable/ic_share_vector"
android:title="@string/share"
app:showAsAction="ifRoom" />
<item
android:id="@+id/lock_note"
android:title="@string/lock_note"
app:showAsAction="never" />
<item
android:id="@+id/unlock_note"
android:title="@string/unlock_note"
app:showAsAction="never" />
<item
android:id="@+id/open_file"
android:title="@string/open_file"