Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

[Suggestion] Pokedex number view in scan result #865

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/src/main/java/com/kamron/pogoiv/Pokefly.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ public class Pokefly extends Service {
TextView exResCandy;
@BindView(R.id.exResLevel)
TextView exResLevel;
@BindView(R.id.resultsPokedexNumber)
TextView resultPokedexNumber;
@BindView(R.id.resultsPokemonName)
TextView resultsPokemonName;
@BindView(R.id.resultsCombinations)
Expand Down Expand Up @@ -1336,6 +1338,7 @@ private void populatePrevScanNarrowing() {
* Shows the name and level of the pokemon in the results dialog.
*/
private void populateResultsHeader(IVScanResult ivScanResult) {
resultPokedexNumber.setText("#" + ivScanResult.pokemon.pokedexNumber);
resultsPokemonName.setText(ivScanResult.pokemon.toString());
resultsPokemonLevel.setText(getString(R.string.level_num, ivScanResult.estimatedPokemonLevel.toString()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ public void showQuickIVPreviewLook(IVScanResult ivrs) {
int low = ivrs.getLowestIVCombination().percentPerfect;
int high = ivrs.getHighestIVCombination().percentPerfect;
if (ivrs.getCount() == 1 || high == low) { // display something like "IV: 98%"
setText(ivrs.pokemon.name + "\nIV: " + low + "%");
setText(String.format("#%d %s\nIV: %d%%", ivrs.pokemon.pokedexNumber, ivrs.pokemon.name, low));
} else { // display something like "IV: 55 - 87%"
setText(ivrs.pokemon.name + "\nIV: " + low + " - " + high + "%");
setText(String.format("#%d %s\nIV: %d - %d%%", ivrs.pokemon.pokedexNumber, ivrs.pokemon.name, low, high));
}
if (ivrs.rangeIVScan) {
setText(getText() + "*");
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/kamron/pogoiv/scanlogic/Pokemon.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public String getCharacter() {
private final String displayName;

public final int number; //index number in resources, pokedex number - 1
public final int pokedexNumber;
public final int baseAttack;
public final int baseDefense;
public final int baseStamina;
Expand All @@ -62,6 +63,7 @@ public Pokemon(String name, String displayName, int number, int baseAttack, int
this.name = name;
this.displayName = displayName;
this.number = number;
this.pokedexNumber = number + 1;
this.baseAttack = baseAttack;
this.baseDefense = baseDefense;
this.baseStamina = baseStamina;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class PokemonShareHandler {
public void spreadResultIntent(Pokefly pokefly, IVScanResult ivScan,String uniquePokemonID) {
JSONObject jsonPokemon = new JSONObject();
try {
jsonPokemon.put("PokemonId", ivScan.pokemon.number + 1);
jsonPokemon.put("PokemonId", ivScan.pokemon.pokedexNumber);
jsonPokemon.put("AtkMin", ivScan.lowAttack);
jsonPokemon.put("AtkMax", ivScan.highAttack);
jsonPokemon.put("DefMin", ivScan.lowDefense);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private View getCustomView(int position, ViewGroup parent) {

TextView row = (TextView) inflater.inflate(textViewResourceId, parent, false);
Pokemon pokemon = pokemons.get(position);
String text = String.format("#%d %s", pokemon.number + 1, pokemon.toString());
String text = String.format("#%d %s", pokemon.pokedexNumber, pokemon.toString());

int padding = GuiUtil.dpToPixels(5, context);
row.setPadding(padding, 0, 0, padding);
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/layout/dialog_results.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
android:orientation="horizontal"
android:baselineAligned="true">

<TextView
android:id="@+id/resultsPokedexNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textColor="#888"
android:text="#ddd"
android:layout_marginEnd="6dp"/>

<TextView
android:id="@+id/resultsPokemonName"
android:layout_width="wrap_content"
Expand Down