forked from mrcsxsiq/Kotlin-Pokedex
/
GenerationViewModel.kt
59 lines (55 loc) · 1.83 KB
/
GenerationViewModel.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package dev.marcosfarias.pokedex.ui.generation
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import dev.marcosfarias.pokedex.App
import dev.marcosfarias.pokedex.R
import dev.marcosfarias.pokedex.model.Generation
class GenerationViewModel : ViewModel() {
private val listGeneration = MutableLiveData<List<Generation>>()
fun getListGeneration(): LiveData<List<Generation>> {
listGeneration.value = listOf(
Generation(
1,
App.context.resources.getString(R.string.generation_item_1),
R.drawable.gen1
),
Generation(
1,
App.context.resources.getString(R.string.generation_item_2),
R.drawable.gen2
),
Generation(
1,
App.context.resources.getString(R.string.generation_item_3),
R.drawable.gen3
),
Generation(
1,
App.context.resources.getString(R.string.generation_item_4),
R.drawable.gen4
),
Generation(
1,
App.context.resources.getString(R.string.generation_item_5),
R.drawable.gen5
),
Generation(
1,
App.context.resources.getString(R.string.generation_item_6),
R.drawable.gen6
),
Generation(
1,
App.context.resources.getString(R.string.generation_item_7),
R.drawable.gen7
),
Generation(
1,
App.context.resources.getString(R.string.generation_item_8),
R.drawable.gen8
)
)
return listGeneration
}
}