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

Commit

Permalink
Merge pull request #216 from oskomonzon/UI_changes
Browse files Browse the repository at this point in the history
Multiple small fixes
  • Loading branch information
nahojjjen authored Aug 27, 2016
2 parents cda2406 + 274bf79 commit fb0c37e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
26 changes: 21 additions & 5 deletions app/src/main/java/com/kamron/pogoiv/Pokefly.java
Original file line number Diff line number Diff line change
Expand Up @@ -552,14 +552,22 @@ public void decrementLevelExpanded() {

@OnClick(R.id.btnCheckIv)
public void checkIv() {

// Check for valid parameters before attempting to do anything else.-
try{
pokemonHP = Integer.parseInt(pokemonHPEdit.getText().toString());
pokemonCP = Integer.parseInt(pokemonCPEdit.getText().toString());
}
catch(NumberFormatException e){
Toast.makeText(this, R.string.missing_inputs, Toast.LENGTH_SHORT).show();
return;
}

if (batterySaver && !screenshotDir.isEmpty()) {
if (GoIVSettings.getSettings(getBaseContext()).getDeleteScreenshots())
if (GoIVSettings.getSettings(getBaseContext()).getDeleteScreenshots()) {
getContentResolver().delete(screenshotUri, MediaStore.Files.FileColumns.DATA + "=?", new String[]{screenshotDir});
}
}
pokemonHP = Integer.parseInt(pokemonHPEdit.getText().toString());
pokemonCP = Integer.parseInt(pokemonCPEdit.getText().toString());
initialButtonsLayout.setVisibility(View.GONE);
onCheckButtonsLayout.setVisibility(View.VISIBLE);

int selectedPokemon = pokemonList.getSelectedItemPosition();
Pokemon pokemon = pokeCalculator.get(selectedPokemon);
Expand All @@ -578,6 +586,12 @@ public void checkIv() {
ivScanResult.refineByHighest(attCheckbox.isChecked(), defCheckbox.isChecked(), staCheckbox.isChecked());
}

// If no possible combinations, inform the user and abort.
if(ivScanResult.getCount()==0){
Toast.makeText(this, R.string.ivtext_no_possibilities, Toast.LENGTH_SHORT).show();
return;
}

addToRangeToClipboardIfSettingOn(ivScanResult);
populateResultsBox(ivScanResult);
boolean enableCompare = IVScanResult.scanContainer.twoScanAgo != null;
Expand All @@ -587,6 +601,8 @@ public void checkIv() {
resultsBox.setVisibility(View.VISIBLE);
inputBox.setVisibility(View.GONE);

initialButtonsLayout.setVisibility(View.GONE);
onCheckButtonsLayout.setVisibility(View.VISIBLE);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/dialog_input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
android:layout_height="wrap_content"
android:textColor="@color/red"
android:text="XX"
android:maxLength="4"
android:textAlignment="center"
android:inputType="number"/>

Expand Down Expand Up @@ -87,6 +88,7 @@
android:layout_height="wrap_content"
android:textColor="@color/red"
android:text="XX"
android:maxLength="4"
android:textAlignment="center"
android:inputType="number"/>

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@
<string name="defense">Defensa</string>
<string name="stamina_hp">PS</string>
<string name="refine_no_progress">El refinamiento no mejoró los r</string>
<string name="missing_inputs">Datos incompletos. Por favor completa los campos PC y PS.</string>
<string name="ivtext_no_possibilities">No hay combinaciones de IV para estos datos. Por favor verifique la información.</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@
<string name="attack">Attack</string>
<string name="defense">Defense</string>
<string name="stamina_hp">HP</string>
<string name="missing_inputs">Missing data. Please fill CP and HP inputs.</string>
<string name="ivtext_no_possibilities">There are no IV possible combinations for this input. Please double check the information.</string>
</resources>

0 comments on commit fb0c37e

Please sign in to comment.