Skip to content

Commit

Permalink
adding a hack at first app launch to ensure proper database prepopula…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
tibbi committed Nov 7, 2018
1 parent 213cbd8 commit 60bf552
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ 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

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 {
Expand Down

0 comments on commit 60bf552

Please sign in to comment.