Database clear button
This commit is contained in:
parent
c0644b4c70
commit
4b07ce505f
2 changed files with 7 additions and 4 deletions
|
|
@ -88,7 +88,13 @@ fun SettingsMain(vm: TileViewModel, launcher: ActivityResultLauncher<DocumentFil
|
|||
Log.i(TAG, "found in db: %d, %d, %d".format(t.level, t.x, t.y))
|
||||
}
|
||||
}
|
||||
} }) { Text(text = "Load database") }
|
||||
}
|
||||
}) { Text(text = "Load database") }
|
||||
Button(onClick = {
|
||||
coroutineScope.launch {
|
||||
vm.repository.clearTiles()
|
||||
}
|
||||
}) { Text(text = "Clear database") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
package com.mirenkov.ktheightmap
|
||||
|
||||
import android.util.Log
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
|
@ -14,7 +12,6 @@ class TileRepository(private val tileDao: TileDao) {
|
|||
coroutineScope.launch(Dispatchers.IO) { tileDao.pushTile(tile) }
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
suspend fun getTile(x: Int, y: Int, level: Int): Tile? {
|
||||
val tileDeferred = coroutineScope.async(Dispatchers.IO) {
|
||||
tileDao.getTile(x, y, level)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue