mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-06-05 17:00:23 +02:00
move the function for getting note value in the note model itself
This commit is contained in:
@ -1,3 +1,18 @@
|
||||
package com.simplemobiletools.notes.models
|
||||
|
||||
data class Note(var id: Int, var title: String, var value: String, val type: Int, var path: String = "")
|
||||
import java.io.File
|
||||
import java.io.FileNotFoundException
|
||||
|
||||
data class Note(var id: Int, var title: String, var value: String, val type: Int, var path: String = "") {
|
||||
fun getNoteStoredValue(): String? {
|
||||
return if (path.isNotEmpty()) {
|
||||
return try {
|
||||
File(path).readText()
|
||||
} catch (e: FileNotFoundException) {
|
||||
null
|
||||
}
|
||||
} else {
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user