diff --git a/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/BiomPokemonAdapter.kt b/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/BiomPokemonAdapter.kt index 86033115..60e66e43 100644 --- a/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/BiomPokemonAdapter.kt +++ b/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/BiomPokemonAdapter.kt @@ -33,7 +33,7 @@ class BiomPokemonAdapter(private val onClickPokemon: PokemonListNavigateHandler) companion object { val poketmonComparator = ItemDiffCallback( - onItemsTheSame = { oldItem, newItem -> oldItem.id == newItem.id }, + onItemsTheSame = { oldItem, newItem -> oldItem.hashId == newItem.hashId }, onContentsTheSame = { oldItem, newItem -> oldItem == newItem }, ) } diff --git a/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/boss/BiomeBossAdapter.kt b/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/boss/BiomeBossAdapter.kt index 55bad61c..23f722e5 100644 --- a/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/boss/BiomeBossAdapter.kt +++ b/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/boss/BiomeBossAdapter.kt @@ -36,7 +36,7 @@ class BiomeBossAdapter( companion object { val wildPokemonComparator = ItemDiffCallback( - onItemsTheSame = { oldItem, newItem -> oldItem == newItem }, + onItemsTheSame = { oldItem, newItem -> oldItem.grade == newItem.grade }, onContentsTheSame = { oldItem, newItem -> oldItem == newItem }, ) } diff --git a/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/gym/BiomeGymAdapter.kt b/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/gym/BiomeGymAdapter.kt index 5a80e061..34477861 100644 --- a/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/gym/BiomeGymAdapter.kt +++ b/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/gym/BiomeGymAdapter.kt @@ -35,7 +35,7 @@ class BiomeGymAdapter( companion object { val gymPokemonComparator = ItemDiffCallback( - onItemsTheSame = { oldItem, newItem -> oldItem == newItem }, + onItemsTheSame = { oldItem, newItem -> oldItem.grade == newItem.grade }, onContentsTheSame = { oldItem, newItem -> oldItem == newItem }, ) } diff --git a/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/wild/BiomeWildAdapter.kt b/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/wild/BiomeWildAdapter.kt index 83ab3cae..64fdc370 100644 --- a/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/wild/BiomeWildAdapter.kt +++ b/android/app/src/main/java/poke/rogue/helper/presentation/biome/detail/wild/BiomeWildAdapter.kt @@ -36,7 +36,7 @@ class BiomeWildAdapter( companion object { val wildPokemonComparator = ItemDiffCallback( - onItemsTheSame = { oldItem, newItem -> oldItem == newItem }, + onItemsTheSame = { oldItem, newItem -> oldItem.grade == newItem.grade }, onContentsTheSame = { oldItem, newItem -> oldItem == newItem }, ) } diff --git a/android/app/src/main/java/poke/rogue/helper/presentation/biome/model/BiomePokemonUiModel.kt b/android/app/src/main/java/poke/rogue/helper/presentation/biome/model/BiomePokemonUiModel.kt index 6bea7991..7ea3e20c 100644 --- a/android/app/src/main/java/poke/rogue/helper/presentation/biome/model/BiomePokemonUiModel.kt +++ b/android/app/src/main/java/poke/rogue/helper/presentation/biome/model/BiomePokemonUiModel.kt @@ -20,7 +20,10 @@ fun WildPokemon.toUi(): BiomePokemonUiModel = grade = tier, gymLeaderUrl = null, type = null, - pokemons = pokemons.map(BiomePokemon::toPokemonUiModel), + pokemons = + pokemons.mapIndexed { index, biomePokemon -> + biomePokemon.toPokemonUiModel(index) + }, ) fun BossPokemon.toUi(): BiomePokemonUiModel = @@ -28,7 +31,10 @@ fun BossPokemon.toUi(): BiomePokemonUiModel = grade = tier, gymLeaderUrl = null, type = null, - pokemons = pokemons.map(BiomePokemon::toPokemonUiModel), + pokemons = + pokemons.mapIndexed { index, biomePokemon -> + biomePokemon.toPokemonUiModel(index) + }, ) fun GymPokemon.toUi(): BiomePokemonUiModel = @@ -36,12 +42,16 @@ fun GymPokemon.toUi(): BiomePokemonUiModel = grade = gymLeaderName, gymLeaderUrl = gymLeaderImage, type = gymLeaderTypeLogos.firstOrNull()?.toUi(), - pokemons = pokemons.map(BiomePokemon::toPokemonUiModel), + pokemons = + pokemons.mapIndexed { index, biomePokemon -> + biomePokemon.toPokemonUiModel(index) + }, ) -fun BiomePokemon.toPokemonUiModel(): PokemonUiModel = +fun BiomePokemon.toPokemonUiModel(hashId: Int): PokemonUiModel = PokemonUiModel( id = id, + hashId = hashId.toLong(), dexNumber = 0, name = name, imageUrl = imageUrl, diff --git a/android/app/src/main/res/layout/activity_battle.xml b/android/app/src/main/res/layout/activity_battle.xml index 1e66e428..9bacebdd 100644 --- a/android/app/src/main/res/layout/activity_battle.xml +++ b/android/app/src/main/res/layout/activity_battle.xml @@ -95,7 +95,9 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="8dp" + android:ellipsize="end" android:gravity="end" + android:maxLines="1" android:text="@string/battle_opponent_pokemon_selection" android:textAlignment="viewEnd" app:layout_constraintBottom_toBottomOf="@id/flexbox_opponent_types" @@ -162,7 +164,9 @@ android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginBottom="12dp" + android:ellipsize="end" android:gravity="start" + android:maxLines="1" android:text="@string/battle_mine_pokemon_selection" android:textStyle="bold" app:layout_constraintBottom_toTopOf="@id/tv_skill_title" diff --git a/android/app/src/main/res/layout/item_ability_detail_pokemon.xml b/android/app/src/main/res/layout/item_ability_detail_pokemon.xml index ba31df5d..5cbf4712 100644 --- a/android/app/src/main/res/layout/item_ability_detail_pokemon.xml +++ b/android/app/src/main/res/layout/item_ability_detail_pokemon.xml @@ -16,8 +16,8 @@ + android:background="@drawable/shape_pokemon_corner_radius" + android:paddingTop="12dp"> + tools:text="피카츄피카츄피카츄피카츄피카츄피카츄피카츄피카츄피카츄피카츄피카츄피카츄피카츄피카츄" /> + tools:text="피카츄피카츄피카츄피카츄피카츄피카츄피카츄피카츄피카츄피카츄" /> + if (original.isBlank()) { + original } else { - it[0].uppercase() + it.substring(1).lowercase() + original.replaceFirstChar { it.uppercase() } } } val formattedName = - if (formName.isBlank() || formName.trim().lowercase() == "empty" || formName.trim() - .lowercase() == "normal" - ) { - name + if (formName.isBlank() || formName.trim().lowercase() == "normal") { + pureName } else { - "$name-$newFormName" + "$pureName-$pascalCaseFormName" } return Pokemon( @@ -96,6 +95,7 @@ fun PokemonEntity.toData(): Pokemon = id = id, dexNumber = dexNumber, name = name, + formName = formName, imageUrl = imageUrl, backImageUrl = backImageUrl, types = types.map(Type::valueOf), diff --git a/android/data/src/main/java/poke/rogue/helper/data/model/biome/BossPokemon.kt b/android/data/src/main/java/poke/rogue/helper/data/model/biome/BossPokemon.kt index 35fb1dc9..ea9c9e62 100644 --- a/android/data/src/main/java/poke/rogue/helper/data/model/biome/BossPokemon.kt +++ b/android/data/src/main/java/poke/rogue/helper/data/model/biome/BossPokemon.kt @@ -13,4 +13,7 @@ fun BossPokemonResponse.toData(): BossPokemon = pokemons = pokemons.toData(), ) -fun List.toData(): List = map(BossPokemonResponse::toData) +fun List.toData(): List = + filter { + it.pokemons.isNotEmpty() + }.map(BossPokemonResponse::toData) diff --git a/android/data/src/main/java/poke/rogue/helper/data/model/biome/WildPokemon.kt b/android/data/src/main/java/poke/rogue/helper/data/model/biome/WildPokemon.kt index 86adae47..36e108f6 100644 --- a/android/data/src/main/java/poke/rogue/helper/data/model/biome/WildPokemon.kt +++ b/android/data/src/main/java/poke/rogue/helper/data/model/biome/WildPokemon.kt @@ -13,4 +13,4 @@ fun WildPokemonResponse.toData(): WildPokemon = pokemons = pokemons.toData(), ) -fun List.toData(): List = map(WildPokemonResponse::toData) +fun List.toData(): List = filter { it.pokemons.isNotEmpty() }.map(WildPokemonResponse::toData)