@ -35,7 +35,7 @@ class ResultsBottomDrawer(private val context: Context)
{
private const val TAG = " ResultsBottomDrawer "
private const val DRAWER_HEIGHT_COLLAPSED_DP = 80
private const val DRAWER_HEIGHT_EXPANDED_DP = 2 40
private const val DRAWER_HEIGHT_EXPANDED_DP = 400 // Increased to show all data
private const val SLIDE_ANIMATION_DURATION = 300L
private const val SWIPE_THRESHOLD = 100f
private const val EXPAND_THRESHOLD = - 50f // Negative because we're pulling up
@ -237,14 +237,13 @@ class ResultsBottomDrawer(private val context: Context)
val pokemonInfo = result . pokemonInfo
val dataPoints = mutableListOf < String > ( )
// Collect all available data points
pokemonInfo . name ?. let { dataPoints . add ( it ) }
// Collect all available data points from actual PokemonInfo structure
pokemonInfo . species ?. let { dataPoints . add ( it ) }
pokemonInfo . nationalDexNumber ?. let { dataPoints . add ( " # $it " ) }
pokemonInfo . cp ?. let { dataPoints . add ( " CP $it " ) }
pokemonInfo . level ?. let { dataPoints . add ( " Lv ${String.format("%.1f", it)} " ) }
pokemonInfo . hp ?. let { dataPoints . add ( " ${it} HP " ) }
pokemonInfo . stats ?. perfectIV ?. let { dataPoints . add ( " ${String.format("%.1f", it)} % " ) }
pokemonInfo . level ?. let { dataPoints . add ( " Lv $it " ) }
pokemonInfo . gender ?. let { dataPoints . add ( it ) }
if ( pokemonInfo . isShiny ) dataPoints . add ( " ✨ " )
if ( pokemonInfo . isAlpha ) dataPoints . add ( " 🅰 " )
// Add processing time
dataPoints . add ( " ${result.processingTimeMs} ms " )
@ -293,48 +292,99 @@ class ResultsBottomDrawer(private val context: Context)
{
val pokemonInfo = result . pokemonInfo
// Pokemon Basic Info Section
// Basic Pokemon Info Section
addView ( createSectionHeader ( " Pokemon Info " ) )
addView ( createTwoColumnRow (
leftLabel = " Name " , leftValue = pokemonInfo . name ?: " Unknown " ,
leftLabel = " Species " , leftValue = pokemonInfo . species ?: " Unknown " ,
rightLabel = " Dex # " , rightValue = pokemonInfo . nationalDexNumber ?. let { " # $it " } ?: " N/A "
) )
addView ( createTwoColumnRow (
leftLabel = " Gender " , leftValue = pokemonInfo . gender ?: " Unknown " ,
rightLabel = " Form " , rightValue = pokemonInfo . form ?: " Normal "
leftLabel = " Nickname " , leftValue = pokemonInfo . nickname ?: " None " ,
rightLabel = " Gender " , rightValue = pokemonInfo . gender ?: " Unknown "
) )
// Combat Stats Section
addView ( createSectionHeader ( " Combat Stats " ) )
addView ( createTwoColumnRow (
leftLabel = " CP " , leftValue = pokemonInfo . cp ?. toString ( ) ?: " N/A " ,
rightLabel = " HP " , rightValue = pokemonInfo . hp ?. toString ( ) ?: " N/A "
leftLabel = " Level " , leftValue = pokemonInfo . level ?. toString ( ) ?: " N/A " ,
rightLabel = " Nature " , rightValue = pokemonInfo . nature ?: " Unknown "
) )
// Types Section
addView ( createSectionHeader ( " Types " ) )
val typeDisplay = when {
pokemonInfo . primaryType != null && pokemonInfo . secondaryType != null ->
" ${pokemonInfo.primaryType} / ${pokemonInfo.secondaryType} "
pokemonInfo . primaryType != null -> pokemonInfo . primaryType
else -> " Unknown "
}
addView ( createTwoColumnRow (
leftLabel = " Level " , leftValue = pokemonInfo . level ?. let { String . format ( " %.1f " , it ) } ?: " N/A " ,
rightLabel = " IV % " , rightValue = pokemonInfo . stats ?. perfectIV ?. let { " ${String.format("%.1f", it)} % " } ?: " N/A "
leftLabel = " Type " , leftValue = typeDisplay ,
rightLabel = " Tera " , rightValue = pokemonInfo . teraType ?: " N/A "
) )
// Individual Stats Section (if available)
// Stats Section (if available)
pokemonInfo . stats ?. let { stats ->
if ( stats . attack != null || stats . defense != null || stats . stamina != null ) {
addView ( createSectionHeader ( " Individual Stats " ) )
addView ( createThreeColumnRow (
leftLabel = " ATK " , leftValue = stats . attack ?. toString ( ) ?: " ? " ,
middleLabel = " DEF " , middleValue = stats . defense ?. toString ( ) ?: " ? " ,
rightLabel = " STA " , rightValue = stats . stamina ?. toString ( ) ?: " ? "
) )
}
addView ( createSectionHeader ( " Base Stats " ) )
addView ( createThreeColumnRow (
leftLabel = " HP " , leftValue = stats . hp ?. toString ( ) ?: " ? " ,
middleLabel = " ATK " , middleValue = stats . attack ?. toString ( ) ?: " ? " ,
rightLabel = " DEF " , rightValue = stats . defense ?. toString ( ) ?: " ? "
) )
addView ( createThreeColumnRow (
leftLabel = " SP.ATK " , leftValue = stats . spAttack ?. toString ( ) ?: " ? " ,
middleLabel = " SP.DEF " , middleValue = stats . spDefense ?. toString ( ) ?: " ? " ,
rightLabel = " SPEED " , rightValue = stats . speed ?. toString ( ) ?: " ? "
) )
}
// Special Properties Section
addView ( createSectionHeader ( " Properties " ) )
addView ( createCheckboxRow (
leftLabel = " Shiny " , leftChecked = false , // TODO: get from pokemonInfo when available
rightLabel = " Alpha " , rightChecked = false // TODO: get from pokemonInfo when available
leftLabel = " Shiny " , leftChecked = pokemonInfo . isShiny ,
rightLabel = " Alpha " , rightChecked = pokemonInfo . isAlpha
) )
addView ( createMixedRow (
leftLabel = " Favorited " , leftChecked = pokemonInfo . isFavorited ,
rightLabel = " Pokeball " , rightValue = pokemonInfo . pokeballType ?: " Unknown "
) )
// Game Origin Section
addView ( createSectionHeader ( " Origin " ) )
addView ( createTwoColumnRow (
leftLabel = " Game " , leftValue = pokemonInfo . gameSource ?: " Unknown " ,
rightLabel = " Language " , rightValue = pokemonInfo . language ?: " Unknown "
) )
pokemonInfo . originalTrainerName ?. let { trainerName ->
addView ( createTwoColumnRow (
leftLabel = " OT Name " , leftValue = trainerName ,
rightLabel = " OT ID " , rightValue = pokemonInfo . originalTrainerId ?: " Unknown "
) )
}
// Ability & Moves
pokemonInfo . ability ?. let { ability ->
addView ( createSectionHeader ( " Ability & Moves " ) )
addView ( createDetailRow ( " Ability " , ability ) )
}
if ( pokemonInfo . moves . isNotEmpty ( ) ) {
addView ( createDetailRow ( " Moves " , pokemonInfo . moves . take ( 4 ) . joinToString ( " , " ) ) )
}
// Additional Data
if ( pokemonInfo . stamps . isNotEmpty ( ) || pokemonInfo . labels . isNotEmpty ( ) || pokemonInfo . marks . isNotEmpty ( ) ) {
addView ( createSectionHeader ( " Additional " ) )
if ( pokemonInfo . stamps . isNotEmpty ( ) ) {
addView ( createDetailRow ( " Stamps " , pokemonInfo . stamps . joinToString ( " , " ) ) )
}
if ( pokemonInfo . labels . isNotEmpty ( ) ) {
addView ( createDetailRow ( " Labels " , pokemonInfo . labels . joinToString ( " , " ) ) )
}
if ( pokemonInfo . marks . isNotEmpty ( ) ) {
addView ( createDetailRow ( " Marks " , pokemonInfo . marks . joinToString ( " , " ) ) )
}
}
}
else
{
@ -598,6 +648,45 @@ class ResultsBottomDrawer(private val context: Context)
}
}
private fun createMixedRow (
leftLabel : String , leftChecked : Boolean ,
rightLabel : String , rightValue : String
) : LinearLayout
{
return LinearLayout ( context ) . apply {
orientation = LinearLayout . HORIZONTAL
gravity = Gravity . CENTER_VERTICAL
// Left checkbox
val leftCheckbox = createCheckboxItem ( leftLabel , leftChecked )
leftCheckbox . layoutParams = LinearLayout . LayoutParams (
0 ,
ViewGroup . LayoutParams . WRAP_CONTENT ,
1f
)
// Right text item
val rightItem = createColumnItem ( rightLabel , rightValue )
rightItem . layoutParams = LinearLayout . LayoutParams (
0 ,
ViewGroup . LayoutParams . WRAP_CONTENT ,
1f
) . apply {
setMargins ( dpToPx ( 8 ) , 0 , 0 , 0 )
}
addView ( leftCheckbox )
addView ( rightItem )
layoutParams = LinearLayout . LayoutParams (
ViewGroup . LayoutParams . MATCH_PARENT ,
ViewGroup . LayoutParams . WRAP_CONTENT
) . apply {
setMargins ( 0 , dpToPx ( 2 ) , 0 , dpToPx ( 2 ) )
}
}
}
private fun createDrawerBackground ( ) : GradientDrawable
{
return GradientDrawable ( ) . apply {