mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-15 16:10:06 +01:00
adding a hack at first app launch to ensure proper database prepopulation
This commit is contained in:
parent
213cbd80fe
commit
60bf552984
@ -2,6 +2,7 @@ package com.simplemobiletools.notes.pro.helpers
|
||||
|
||||
import android.app.Activity
|
||||
import com.simplemobiletools.notes.pro.R
|
||||
import com.simplemobiletools.notes.pro.extensions.config
|
||||
import com.simplemobiletools.notes.pro.extensions.notesDB
|
||||
import com.simplemobiletools.notes.pro.models.Note
|
||||
import java.io.File
|
||||
@ -9,6 +10,12 @@ import java.io.File
|
||||
class NotesHelper(val activity: Activity) {
|
||||
fun getNotes(callback: (notes: ArrayList<Note>) -> Unit) {
|
||||
Thread {
|
||||
// make sure the initial note has enough time to be precreated
|
||||
if (activity.config.appRunCount == 1) {
|
||||
activity.notesDB.getNotes()
|
||||
Thread.sleep(200)
|
||||
}
|
||||
|
||||
val notes = activity.notesDB.getNotes() as ArrayList<Note>
|
||||
val notesToDelete = ArrayList<Note>(notes.size)
|
||||
notes.forEach {
|
||||
|
Loading…
x
Reference in New Issue
Block a user