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

Allow users to turn off moveset info #919

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Agilo3
Copy link

@Agilo3 Agilo3 commented May 4, 2018

This will give users the option to hide moveset info. Saves a bit of resources and allows people to simply turn it off if they don't care about the integration in GoIV.

@thearaks
Copy link
Collaborator

thearaks commented May 4, 2018

There are a couple of things I'd like to review, but I'm busy at the moment.
There's a change in the clipboard code that probably brakes the configuration saving/restoring to preferences.
I'll post a review later,
in the meanwhile thank you!

@Agilo3 Agilo3 force-pushed the feature/set-visibility-for-moveset-info branch from 1e66c84 to 03093b5 Compare May 4, 2018 19:50
@Agilo3
Copy link
Author

Agilo3 commented May 4, 2018

Did a quick rebase onto master just to keep things tidy.

Also, I did test the clipboard functionality when turning the option on/off. I'll be interested to hear your review.

This pull request is the first Android development I've done so far so I value your feedback; thanks! I'm also available on the Discord channel for any direct messages (either PM or in #dev).

Copy link
Collaborator

@thearaks thearaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some minor fixes here and there, the only change I'd request is to not remove moveset clipboard tokens from the tokens configuration UI while I require that the ClipboardTokenCollection.getSamples return value don't change based on user preferences.
Overall a good implementation!

@@ -323,6 +325,10 @@ public int onStartCommand(Intent intent, int flags, int startId) {
return START_REDELIVER_INTENT;
}

private boolean isMovesetEnabled() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new method can be avoided if possible, I'd prefer using GoIVSettings.getInstance(this).isMovesetEnabled() directly!

super.onResume();

if (viewPager != null)
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This curly bracket should be on the previous line ;)

@@ -59,6 +59,21 @@ public View onCreateView(@NonNull LayoutInflater inflater,
return view;
}

@Override
//Pressed return button - in the case when coming back from settings screen after movesets have been enable/disabled
public void onResume() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid all this behavior, all this added complexity just to remove the moveset clipboard tokens from the list is overkill.
If a user have deactivated the moveset functionality in the settings, he would probably just ignore the movesets tokens knowing that they won't be effective.
Also, moveset tokens should already work when the movesets info isn't present (i.e. when the moveset scan fails).

tokens.add(new MovesetInitialsToken(2));

//enable/disable visibility based on setting
if (GoIVSettings.getInstance(context).isMovesetEnabled()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method and the list it returns shouldn't be changed by the user's preferences because this same list is used to read/write tokens configuration into sharedpreferences.
This list should never change its contents (aside from new token additions when a new app version is released) or the token configuration logic would fail.

moveFast = moveset.first;
moveCharge = moveset.second;

String moveFast = "";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the moveset scan fails moveFast and moveCharge should be null, otherwise ScanData / ScanResult data structures would behave like the moveset scan was successful. Please initialize this variables to null instead of empty String

@@ -59,4 +59,6 @@
<string name="token_pokemonname">Jméno Pokémona</string>
<string name="clipboard_modifier_preview">Náhled</string>
<string name="position_handler_toast">Přemísti okno táhnutím tohoto držáku.</string>
<string name="moveset_enabled_setting_summary" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not declare translation keys without values

@thearaks
Copy link
Collaborator

thearaks commented May 4, 2018

Hi @Agilo3,
Even if it's your Android development I see that you're very familiar with Java coding and gitflow.
Your code is definitely high-quality!
In fact, my review is mainly based on "how we use to make things here" since there's almost anything wrong or not working in your PR!

I'm not very active on Discord lately but I'd like to meet you there soon :)

@nahojjjen
Copy link
Collaborator

I'd like to point out that, while the code is high quality, its for a feature that I've rejected in #908 discussion. Thearaks seems to have started a discussion about changes for this PR with you, but in the future it'd be highly preferred if you discussed in Github issue threads or in the discord dev channel before creating PRs.

I'm however impressed that you managed to understand the GoIV codebase well enough to actually make this change.

@Agilo3 Agilo3 force-pushed the feature/set-visibility-for-moveset-info branch from 1768b23 to d70beb4 Compare June 1, 2018 08:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants