adding some protection related fields to the Note model

This commit is contained in:
tibbi
2021-05-20 20:43:38 +02:00
parent 4724eebedc
commit 53182f0507
7 changed files with 38 additions and 21 deletions

View File

@ -6,6 +6,7 @@ import com.simplemobiletools.commons.extensions.getFilenameFromPath
import com.simplemobiletools.commons.extensions.humanizePath
import com.simplemobiletools.commons.extensions.isMediaFile
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.helpers.PROTECTION_NONE
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.notes.pro.R
import com.simplemobiletools.notes.pro.activities.SimpleActivity
@ -77,7 +78,7 @@ class ImportFolderDialog(val activity: SimpleActivity, val path: String, val cal
}
private fun saveNote(title: String, value: String, type: Int, path: String) {
val note = Note(null, title, value, type, path)
val note = Note(null, title, value, type, path, PROTECTION_NONE, "")
NotesHelper(activity).insertOrUpdateNote(note)
}
}

View File

@ -7,6 +7,7 @@ import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.extensions.showKeyboard
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.extensions.value
import com.simplemobiletools.commons.helpers.PROTECTION_NONE
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.notes.pro.R
import com.simplemobiletools.notes.pro.extensions.config
@ -44,7 +45,7 @@ class NewNoteDialog(val activity: Activity, title: String? = null, val setCheckl
else -> {
val type = if (view.new_note_type.checkedRadioButtonId == view.type_checklist.id) NoteType.TYPE_CHECKLIST.value else NoteType.TYPE_TEXT.value
activity.config.lastCreatedNoteType = type
val newNote = Note(null, title, "", type)
val newNote = Note(null, title, "", type, "", PROTECTION_NONE, "")
callback(newNote)
dismiss()
}

View File

@ -5,6 +5,7 @@ import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.extensions.getFilenameFromPath
import com.simplemobiletools.commons.extensions.humanizePath
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.helpers.PROTECTION_NONE
import com.simplemobiletools.notes.pro.R
import com.simplemobiletools.notes.pro.activities.SimpleActivity
import com.simplemobiletools.notes.pro.helpers.NoteType
@ -45,7 +46,7 @@ class OpenFileDialog(val activity: SimpleActivity, val path: String, val callbac
private fun saveNote(storeContent: String, storePath: String) {
val filename = path.getFilenameFromPath()
val note = Note(null, filename, storeContent, NoteType.TYPE_TEXT.value, storePath)
val note = Note(null, filename, storeContent, NoteType.TYPE_TEXT.value, storePath, PROTECTION_NONE, "")
callback(note)
dialog.dismiss()
}