File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
java/com/skydoves/pokedex Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 7
7
8
8
<application
9
9
android : name =" .PokedexApp"
10
- android : allowBackup =" true "
10
+ android : allowBackup =" false "
11
11
android : icon =" @mipmap/ic_launcher"
12
12
android : label =" @string/app_name"
13
13
android : roundIcon =" @mipmap/ic_launcher_round"
Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ interface PokemonDao {
28
28
@Insert(onConflict = OnConflictStrategy .REPLACE )
29
29
suspend fun insertPokemonList (pokemonList : List <Pokemon >)
30
30
31
- @Query(" SELECT * FROM Pokemon WHERE page < = :page_" )
31
+ @Query(" SELECT * FROM Pokemon WHERE page = :page_" )
32
32
suspend fun getPokemonList (page_ : Int ): List <Pokemon >
33
+
34
+ @Query(" SELECT * FROM Pokemon WHERE page <= :page_" )
35
+ suspend fun getAllPokemonList (page_ : Int ): List <Pokemon >
33
36
}
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ class MainRepository @Inject constructor(
48
48
pokemons = response.results
49
49
pokemons.forEach { pokemon -> pokemon.page = page }
50
50
pokemonDao.insertPokemonList(pokemons)
51
- emit(pokemons )
51
+ emit(pokemonDao.getAllPokemonList(page) )
52
52
onSuccess()
53
53
}
54
54
}
@@ -63,7 +63,7 @@ class MainRepository @Inject constructor(
63
63
onError(message())
64
64
}
65
65
} else {
66
- emit(pokemons )
66
+ emit(pokemonDao.getAllPokemonList(page) )
67
67
onSuccess()
68
68
}
69
69
}.flowOn(Dispatchers .IO )
You can’t perform that action at this time.
0 commit comments