mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-19 18:10:07 +01:00
Refactored ArrayList to List
This commit is contained in:
parent
8c99986e25
commit
66546df0f1
@ -67,7 +67,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
private val PICK_EXPORT_NOTES_INTENT = 4
|
private val PICK_EXPORT_NOTES_INTENT = 4
|
||||||
|
|
||||||
private lateinit var mCurrentNote: Note
|
private lateinit var mCurrentNote: Note
|
||||||
private var mNotes = ArrayList<Note>()
|
private var mNotes = listOf<Note>()
|
||||||
private var mAdapter: NotesPagerAdapter? = null
|
private var mAdapter: NotesPagerAdapter? = null
|
||||||
private var noteViewWithTextSelected: MyEditText? = null
|
private var noteViewWithTextSelected: MyEditText? = null
|
||||||
private var saveNoteButton: MenuItem? = null
|
private var saveNoteButton: MenuItem? = null
|
||||||
|
@ -13,7 +13,7 @@ import com.simplemobiletools.notes.pro.models.Note
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class NotesHelper(val context: Context) {
|
class NotesHelper(val context: Context) {
|
||||||
fun getNotes(callback: (notes: ArrayList<Note>) -> Unit) {
|
fun getNotes(callback: (notes: List<Note>) -> Unit) {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
// make sure the initial note has enough time to be precreated
|
// make sure the initial note has enough time to be precreated
|
||||||
if (context.config.appRunCount <= 1) {
|
if (context.config.appRunCount <= 1) {
|
||||||
@ -21,8 +21,8 @@ class NotesHelper(val context: Context) {
|
|||||||
Thread.sleep(200)
|
Thread.sleep(200)
|
||||||
}
|
}
|
||||||
|
|
||||||
val notes = context.notesDB.getNotes() as ArrayList<Note>
|
val notes = context.notesDB.getNotes().toMutableList()
|
||||||
val notesToDelete = ArrayList<Note>(notes.size)
|
val notesToDelete = mutableListOf<Note>()
|
||||||
notes.forEach {
|
notes.forEach {
|
||||||
if (it.path.isNotEmpty()) {
|
if (it.path.isNotEmpty()) {
|
||||||
if (!it.path.startsWith("content://") && !File(it.path).exists()) {
|
if (!it.path.startsWith("content://") && !File(it.path).exists()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user