diff --git a/app/src/main/java/com/kamron/pogoiv/GoIVSettings.java b/app/src/main/java/com/kamron/pogoiv/GoIVSettings.java index a40056c9e..25160ce5b 100644 --- a/app/src/main/java/com/kamron/pogoiv/GoIVSettings.java +++ b/app/src/main/java/com/kamron/pogoiv/GoIVSettings.java @@ -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"; @@ -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); } diff --git a/app/src/main/java/com/kamron/pogoiv/PoGoApplication.java b/app/src/main/java/com/kamron/pogoiv/PoGoApplication.java index b4723d826..d60707756 100644 --- a/app/src/main/java/com/kamron/pogoiv/PoGoApplication.java +++ b/app/src/main/java/com/kamron/pogoiv/PoGoApplication.java @@ -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); + } } } diff --git a/app/src/main/java/com/kamron/pogoiv/Pokefly.java b/app/src/main/java/com/kamron/pogoiv/Pokefly.java index 41b9f9f89..587a284a9 100644 --- a/app/src/main/java/com/kamron/pogoiv/Pokefly.java +++ b/app/src/main/java/com/kamron/pogoiv/Pokefly.java @@ -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, @@ -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); @@ -799,7 +806,6 @@ public void onReceive(Context context, Intent intent) { uniqueID); if (!infoShownReceived) { - GoIVSettings settings = GoIVSettings.getInstance(Pokefly.this); if (!startedInManualScreenshotMode) { infoShownReceived = true; } diff --git a/app/src/main/java/com/kamron/pogoiv/pokeflycomponents/fractions/IVResultFraction.java b/app/src/main/java/com/kamron/pogoiv/pokeflycomponents/fractions/IVResultFraction.java index f3f95deb7..4bfb8e57a 100644 --- a/app/src/main/java/com/kamron/pogoiv/pokeflycomponents/fractions/IVResultFraction.java +++ b/app/src/main/java/com/kamron/pogoiv/pokeflycomponents/fractions/IVResultFraction.java @@ -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; @@ -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; @@ -86,6 +90,7 @@ public int getLayoutResId() { populateMultipleIVMatch(); } setResultScreenPercentageRange(); //color codes the result + showMovesetInfoBasedOnSettings(); } @Override public void onDestroy() { @@ -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. */ diff --git a/app/src/main/java/com/kamron/pogoiv/pokeflycomponents/fractions/PowerUpFraction.java b/app/src/main/java/com/kamron/pogoiv/pokeflycomponents/fractions/PowerUpFraction.java index c0c59632d..9e551f8bb 100644 --- a/app/src/main/java/com/kamron/pogoiv/pokeflycomponents/fractions/PowerUpFraction.java +++ b/app/src/main/java/com/kamron/pogoiv/pokeflycomponents/fractions/PowerUpFraction.java @@ -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; @@ -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; @@ -97,6 +100,7 @@ public PowerUpFraction(@NonNull Pokefly pokefly) { createExtendedResultEvolutionSpinner(); adjustSeekbarsThumbs(); populateAdvancedInformation(); + showMovesetInfoBasedOnSettings(); } @Override public void onDestroy() { @@ -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. *

diff --git a/app/src/main/java/com/kamron/pogoiv/pokeflycomponents/ocrhelper/OcrHelper.java b/app/src/main/java/com/kamron/pogoiv/pokeflycomponents/ocrhelper/OcrHelper.java index def6b4a3b..ca141f0fe 100644 --- a/app/src/main/java/com/kamron/pogoiv/pokeflycomponents/ocrhelper/OcrHelper.java +++ b/app/src/main/java/com/kamron/pogoiv/pokeflycomponents/ocrhelper/OcrHelper.java @@ -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 ocrCache; private static LruCache appraisalCache; private static boolean candyWordFirst; @@ -100,6 +101,7 @@ public static synchronized OcrHelper init(@NonNull Context context, GoIVSettings settings = GoIVSettings.getInstance(context); isPokeSpamEnabled = settings.isPokeSpamEnabled(); + isMovesetEnabled = settings.isMovesetEnabled(); Map appraisalMap = settings.loadAppraisalCache(); for (Map.Entry entry : appraisalMap.entrySet()) { @@ -1130,15 +1132,18 @@ public ScanData scanPokemon(@NonNull GoIVSettings settings, } Optional evolutionCost = getPokemonEvolutionCostFromImg(pokemonImage, ScanArea.calibratedFromSettings(POKEMON_EVOLUTION_COST_AREA, settings)); - Pair 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 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(); diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 85b04246d..fe683c2f5 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -93,5 +93,4 @@ …sehen lassen Hut ab! die besten …gesehen - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e963b54ff..3dd695fac 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,4 @@ - + Setup Instructions Starting GoIV for the first time:\n\nEnter your trainer info.\n\nPress the GRANT PERMISSION button and accept all prompts.\n\nPress start. @@ -311,4 +311,6 @@ "Add to queue" "Clear queue" Export Queue to PokeBattler + Enable moveset tab + Allows you to hide the moveset information diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml index 4ffa7fa62..58d8f2399 100644 --- a/app/src/main/res/xml/settings.xml +++ b/app/src/main/res/xml/settings.xml @@ -67,6 +67,12 @@ android:summary="@string/pokespam_setting_summary" android:title="@string/pokespam_setting_title"/> + +