-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added legendary pokemon info to details
- Loading branch information
Showing
6 changed files
with
56 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 36 additions & 9 deletions
45
...c/main/java/io/github/lexadiky/pdx/feature/pokemon/details/utils/PokemonDimensionUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,56 @@ | ||
package io.github.lexadiky.pdx.feature.pokemon.details.utils | ||
|
||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Star | ||
import io.github.lexadiky.pdx.domain.pokemon.entity.PokemonDetails | ||
import io.github.lexadiky.pdx.domain.pokemon.entity.PokemonSpeciesDetails | ||
import io.github.lexadiky.pdx.feature.pokemon.details.entitiy.PokemonPhysicalDimension | ||
import io.github.lexadiky.pdx.lib.resources.image.ImageResource | ||
import io.github.lexadiky.pdx.lib.resources.image.from | ||
import io.github.lexadiky.pdx.lib.resources.string.StringResource | ||
import io.github.lexadiky.pdx.lib.resources.string.format | ||
import io.github.lexadiky.pdx.lib.resources.string.from | ||
import io.github.lexadiky.pdx.lib.uikit.R | ||
import io.github.lexadiky.pdx.ui.uikit.resources.from | ||
|
||
internal fun extractDimensions(details: PokemonDetails?): List<PokemonPhysicalDimension> = buildList { | ||
internal fun extractDimensions( | ||
species: PokemonSpeciesDetails?, | ||
details: PokemonDetails?, | ||
addMythicalOrLegendaryInfo: Boolean, | ||
): List<PokemonPhysicalDimension> = buildList { | ||
details ?: return@buildList | ||
species ?: return@buildList | ||
|
||
add( | ||
PokemonPhysicalDimension( | ||
icon = ImageResource.from(R.drawable.uikit_ic_height), | ||
label = StringResource.from(io.github.lexadiky.pdx.feature.pokemon.details.R.string.feature_pokemon_details_dimension_height) | ||
.format(details.height) | ||
) | ||
icon = ImageResource.from(R.drawable.uikit_ic_height), | ||
label = StringResource.from(io.github.lexadiky.pdx.feature.pokemon.details.R.string.feature_pokemon_details_dimension_height) | ||
.format(details.height) | ||
) | ||
) | ||
add( | ||
PokemonPhysicalDimension( | ||
icon = ImageResource.from(R.drawable.uikit_ic_scale), | ||
label = StringResource.from(io.github.lexadiky.pdx.feature.pokemon.details.R.string.feature_pokemon_details_dimension_weight) | ||
.format(details.weight) | ||
) | ||
icon = ImageResource.from(R.drawable.uikit_ic_scale), | ||
label = StringResource.from(io.github.lexadiky.pdx.feature.pokemon.details.R.string.feature_pokemon_details_dimension_weight) | ||
.format(details.weight) | ||
) | ||
) | ||
|
||
if (addMythicalOrLegendaryInfo) { | ||
if (species.isLegendary) { | ||
add( | ||
PokemonPhysicalDimension( | ||
icon = ImageResource.from(Icons.Default.Star), | ||
label = StringResource.from(io.github.lexadiky.pdx.feature.pokemon.details.R.string.feature_pokemon_details_dimension_is_legendary) | ||
) | ||
) | ||
} else if (species.isMythical) { | ||
add( | ||
PokemonPhysicalDimension( | ||
icon = ImageResource.from(Icons.Default.Star), | ||
label = StringResource.from(io.github.lexadiky.pdx.feature.pokemon.details.R.string.feature_pokemon_details_dimension_is_mythical) | ||
) | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters