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