mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-25 21:10:12 +01:00
adding the locking related menu buttons
This commit is contained in:
parent
53182f0507
commit
ae48ce07a3
@ -155,6 +155,8 @@ class MainActivity : SimpleActivity() {
|
|||||||
findItem(R.id.open_search).isVisible = !isCurrentItemChecklist()
|
findItem(R.id.open_search).isVisible = !isCurrentItemChecklist()
|
||||||
findItem(R.id.remove_done_items).isVisible = isCurrentItemChecklist()
|
findItem(R.id.remove_done_items).isVisible = isCurrentItemChecklist()
|
||||||
findItem(R.id.import_folder).isVisible = hasPermission(PERMISSION_READ_STORAGE)
|
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 = findItem(R.id.save_note)
|
||||||
saveNoteButton!!.isVisible = !config.autosaveNotes && showSaveButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
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.new_note -> displayNewNoteDialog()
|
||||||
R.id.rename_note -> displayRenameDialog()
|
R.id.rename_note -> displayRenameDialog()
|
||||||
R.id.share -> shareText()
|
R.id.share -> shareText()
|
||||||
|
R.id.lock_note -> lockNote()
|
||||||
|
R.id.unlock_note -> unlockNote()
|
||||||
R.id.open_file -> tryOpenFile()
|
R.id.open_file -> tryOpenFile()
|
||||||
R.id.import_folder -> openFolder()
|
R.id.import_folder -> openFolder()
|
||||||
R.id.export_as_file -> tryExportAsFile()
|
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) {
|
fun currentNoteTextChanged(newText: String, showUndo: Boolean, showRedo: Boolean) {
|
||||||
if (!isSearchActive) {
|
if (!isSearchActive) {
|
||||||
var shouldRecreateMenu = false
|
var shouldRecreateMenu = false
|
||||||
|
@ -6,6 +6,7 @@ import androidx.room.ColumnInfo
|
|||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
|
import com.simplemobiletools.commons.helpers.PROTECTION_NONE
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@Entity(tableName = "notes", indices = [(Index(value = ["id"], unique = true))])
|
@Entity(tableName = "notes", indices = [(Index(value = ["id"], unique = true))])
|
||||||
@ -34,4 +35,6 @@ data class Note(
|
|||||||
value
|
value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isLocked() = protectionType != PROTECTION_NONE
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,14 @@
|
|||||||
android:icon="@drawable/ic_share_vector"
|
android:icon="@drawable/ic_share_vector"
|
||||||
android:title="@string/share"
|
android:title="@string/share"
|
||||||
app:showAsAction="ifRoom" />
|
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
|
<item
|
||||||
android:id="@+id/open_file"
|
android:id="@+id/open_file"
|
||||||
android:title="@string/open_file"
|
android:title="@string/open_file"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user