Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.
5 changes: 5 additions & 0 deletions app/src/main/java/com/kamron/pogoiv/GoIVSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class GoIVSettings {
public static final String SEND_CRASH_REPORTS = "sendCrashReports";
public static final String AUTO_UPDATE_ENABLED = "autoUpdateEnabled";
public static final String POKESPAM_ENABLED = "pokeSpamEnabled";
public static final String MOVESET_ENABLED = "movesetEnabled";
public static final String TEAM_NAME = "teamName";
public static final String APPRAISAL_WINDOW_POSITION = "appraisalWindowPosition";
public static final String MOVESET_WINDOW_POSITION = "movesetWindowPosition";
Expand Down Expand Up @@ -284,6 +285,10 @@ public boolean isPokeSpamEnabled() {
return prefs.getBoolean(POKESPAM_ENABLED, false);
}

public boolean isMovesetEnabled() {
return prefs.getBoolean(MOVESET_ENABLED, true);
}

public boolean shouldAutoOpenExpandedAppraise() {
return prefs.getBoolean(AUTO_OPEN_APPRAISE_DIALOGUE, false);
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/kamron/pogoiv/PoGoApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public void onCreate() {
FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/Lato-Medium.ttf");
FontsOverride.setDefaultFont(this, "SANS_SERIF", "fonts/Lato-Medium.ttf");

MovesetsManager.init(this);
if (GoIVSettings.getInstance(this).isMovesetEnabled()) {
MovesetsManager.init(this);
}
}
}
22 changes: 14 additions & 8 deletions app/src/main/java/com/kamron/pogoiv/Pokefly.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ public void onCreate() {
clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
sharedPref = getSharedPreferences(PREF_USER_CORRECTIONS, Context.MODE_PRIVATE);

MovesetsManager.init(this);
if (GoIVSettings.getInstance(this).isMovesetEnabled()) {
MovesetsManager.init(this);
}

LocalBroadcastManager.getInstance(this).registerReceiver(displayInfo, new IntentFilter(ACTION_SEND_INFO));
LocalBroadcastManager.getInstance(this).registerReceiver(processBitmap,
Expand Down Expand Up @@ -772,13 +774,18 @@ public void onReceive(Context context, Intent intent) {
screenShotPath = null;
}

String moveFast = intent.getStringExtra(KEY_SEND_MOVESET_QUICK);
String moveCharge = intent.getStringExtra(KEY_SEND_MOVESET_CHARGE);
if (moveFast == null || moveCharge == null) {
moveFast = "";
moveCharge = "";
}
GoIVSettings settings = GoIVSettings.getInstance(Pokefly.this);

String moveFast = null;
String moveCharge = null;
if (settings.isMovesetEnabled()) {
moveFast = intent.getStringExtra(KEY_SEND_MOVESET_QUICK);
moveCharge = intent.getStringExtra(KEY_SEND_MOVESET_CHARGE);
if (moveFast == null || moveCharge == null) {
moveFast = "";
moveCharge = "";
}
}
double estimatedPokemonLevelMin = intent.getDoubleExtra(KEY_SEND_INFO_LEVEL_LOWER, 1);
double estimatedPokemonLevelMax = intent.getDoubleExtra(KEY_SEND_INFO_LEVEL_HIGHER, 1);

Expand All @@ -799,7 +806,6 @@ public void onReceive(Context context, Intent intent) {
uniqueID);

if (!infoShownReceived) {
GoIVSettings settings = GoIVSettings.getInstance(Pokefly.this);
if (!startedInManualScreenshotMode) {
infoShownReceived = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;

import com.kamron.pogoiv.GoIVSettings;
import com.kamron.pogoiv.Pokefly;
import com.kamron.pogoiv.R;
import com.kamron.pogoiv.scanlogic.PokemonShareHandler;
Expand Down Expand Up @@ -55,6 +57,8 @@ public class IVResultFraction extends Fraction {
@BindView(R.id.resultsMaxPercentage)
TextView resultsMaxPercentage;

@BindView(R.id.movesetButton)
RadioButton movesetButton;

private Context context;
private Pokefly pokefly;
Expand Down Expand Up @@ -86,6 +90,7 @@ public int getLayoutResId() {
populateMultipleIVMatch();
}
setResultScreenPercentageRange(); //color codes the result
showMovesetInfoBasedOnSettings();
}

@Override public void onDestroy() {
Expand Down Expand Up @@ -233,6 +238,19 @@ private void setResultScreenPercentageRange() {
}
}

/**
* showMovesetInfoBasedOnSettings.
* Shows moveset button based on setting
*/
private void showMovesetInfoBasedOnSettings() {
//enable/disable visibility based on setting
if (GoIVSettings.getInstance(pokefly).isMovesetEnabled()) {
movesetButton.setVisibility(View.VISIBLE);
} else {
movesetButton.setVisibility(View.GONE);
}
}

/**
* Creates an intent to share the result of the pokemon scan, and closes the overlay.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.view.View;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.TextView;
Expand Down Expand Up @@ -72,6 +73,8 @@ public class PowerUpFraction extends Fraction {
@BindView(R.id.exResCandy)
TextView exResCandy;

@BindView(R.id.movesetButton)
RadioButton movesetButton;

private Context context;
private Pokefly pokefly;
Expand All @@ -97,6 +100,7 @@ public PowerUpFraction(@NonNull Pokefly pokefly) {
createExtendedResultEvolutionSpinner();
adjustSeekbarsThumbs();
populateAdvancedInformation();
showMovesetInfoBasedOnSettings();
}

@Override public void onDestroy() {
Expand Down Expand Up @@ -150,6 +154,19 @@ public void populateAdvancedInformation() {
setAndCalculatePokeSpamText(Pokefly.scanResult);
}

/**
* showMovesetInfoBasedOnSettings.
* Shows moveset button based on setting
*/
private void showMovesetInfoBasedOnSettings() {
//enable/disable visibility based on setting
if (GoIVSettings.getInstance(pokefly).isMovesetEnabled()) {
movesetButton.setVisibility(View.VISIBLE);
} else {
movesetButton.setVisibility(View.GONE);
}
}

/**
* Initialize the pokemon spinner in the evolution and powerup box in the result window, and return picked pokemon.
* <p/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class OcrHelper {
private static String nidoUngendered;
private static TessBaseAPI tesseract = null;
private static boolean isPokeSpamEnabled;
private static boolean isMovesetEnabled;
private static LruCache<String, String> ocrCache;
private static LruCache<String, String> appraisalCache;
private static boolean candyWordFirst;
Expand Down Expand Up @@ -100,6 +101,7 @@ public static synchronized OcrHelper init(@NonNull Context context,
GoIVSettings settings = GoIVSettings.getInstance(context);

isPokeSpamEnabled = settings.isPokeSpamEnabled();
isMovesetEnabled = settings.isMovesetEnabled();

Map<String, String> appraisalMap = settings.loadAppraisalCache();
for (Map.Entry<String, String> entry : appraisalMap.entrySet()) {
Expand Down Expand Up @@ -1130,15 +1132,18 @@ public ScanData scanPokemon(@NonNull GoIVSettings settings,
}
Optional<Integer> evolutionCost = getPokemonEvolutionCostFromImg(pokemonImage,
ScanArea.calibratedFromSettings(POKEMON_EVOLUTION_COST_AREA, settings));
Pair<String, String> moveset = getMovesetFromImg(pokemonImage,
estimatedLevelRange,
ScanArea.calibratedFromSettings(POKEMON_POWER_UP_CANDY_COST, settings),
ScanArea.calibratedFromSettings(POKEMON_EVOLUTION_COST_AREA, settings));

String moveFast = null;
String moveCharge = null;
if (moveset != null) {
moveFast = moveset.first;
moveCharge = moveset.second;
if (isMovesetEnabled) {
Pair<String, String> moveset = getMovesetFromImg(pokemonImage,
estimatedLevelRange,
ScanArea.calibratedFromSettings(POKEMON_POWER_UP_CANDY_COST, settings),
ScanArea.calibratedFromSettings(POKEMON_EVOLUTION_COST_AREA, settings));
if (moveset != null) {
moveFast = moveset.first;
moveCharge = moveset.second;
}
}
String uniqueIdentifier = name + type + candyName + hp.toString() + cp
.toString() + powerUpStardustCost.toString() + powerUpCandyCost.toString();
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,4 @@
<string name="is3">…sehen lassen</string>
<string name="is2">Hut ab!</string>
<string name="is1">die besten …gesehen</string>

</resources>
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="instructions_title">Setup Instructions</string>
<string name="instructions_message">Starting GoIV for the first time:\n\nEnter your trainer info.\n\nPress the GRANT PERMISSION button and accept all prompts.\n\nPress start.</string>
Expand Down Expand Up @@ -311,4 +311,6 @@
<string name="button_add_to_queue">"Add to queue"</string>
<string name="button_clear_to_queue">"Clear queue"</string>
<string name="button_export_to_pokebattler">Export Queue to PokeBattler</string>
<string name="moveset_enabled_setting_title">Enable moveset tab</string>
<string name="moveset_enabled_setting_summary">Allows you to hide the moveset information</string>
</resources>
6 changes: 6 additions & 0 deletions app/src/main/res/xml/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
android:summary="@string/pokespam_setting_summary"
android:title="@string/pokespam_setting_title"/>

<SwitchPreference
android:defaultValue="true"
android:key="movesetEnabled"
android:summary="@string/moveset_enabled_setting_summary"
android:title="@string/moveset_enabled_setting_title" />

<com.pavelsikun.seekbarpreference.SeekBarPreference
android:key="autoAppraisalScanDelay"
android:title="@string/autoAppraisalScanDelay_title"
Expand Down