File tree 2 files changed +6
-3
lines changed
app/src/main/java/com/esri/arcgismaps/kotlin/sampleviewer
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ package com.esri.arcgismaps.kotlin.sampleviewer
2
2
3
3
import android.app.Application
4
4
import com.esri.arcgismaps.kotlin.sampleviewer.model.DefaultSampleInfoRepository
5
- import kotlinx.coroutines.runBlocking
5
+ import kotlinx.coroutines.MainScope
6
+ import kotlinx.coroutines.launch
6
7
7
8
class SampleViewerApplication : Application () {
8
9
9
10
override fun onCreate () {
10
11
super .onCreate()
11
- runBlocking {
12
+ MainScope ().launch {
12
13
// Load the repository once at app launch
13
14
DefaultSampleInfoRepository .load(applicationContext)
14
15
}
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ object DefaultSampleInfoRepository : SampleInfoRepository {
37
37
38
38
private val isInitialized = AtomicBoolean (false )
39
39
40
+ private val json = Json { ignoreUnknownKeys = true }
41
+
40
42
private val sampleList = mutableListOf<Sample >()
41
43
42
44
/* *
@@ -46,7 +48,7 @@ object DefaultSampleInfoRepository : SampleInfoRepository {
46
48
suspend fun load (context : Context ) {
47
49
if (isInitialized.compareAndSet(false , true )) {
48
50
// Iterate through the metadata folder for all metadata files
49
- val json = Json { ignoreUnknownKeys = true }
51
+
50
52
context.assets.list(" samples" )?.forEach { samplePath ->
51
53
// Get this metadata files as a string
52
54
context.assets.open(" samples/$samplePath /README.metadata.json" ).use { inputStream ->
You can’t perform that action at this time.
0 commit comments