Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Add Paths to UI #7920

Merged
merged 4 commits into from
Mar 29, 2020
Merged

Android: Add Paths to UI #7920

merged 4 commits into from
Mar 29, 2020

Conversation

Ebola16
Copy link
Member

@Ebola16 Ebola16 commented Mar 22, 2019

Implements https://bugs.dolphin-emu.org/issues/10781

  • Android: Add Set as Default ISO to UI

  • Android: Add Paths to UI

  • Very useful for loading game mods

  • Removed some unnecessary import statements

  • Renamed some things now that FilePicker is more versatile

  • Added ConfirmRunnable to confirm running arbitrary runnables (so they're not accidentally clicked). It will also be useful for future PRs, especially when modifying multiple settings (i.e. toggling all log types).

  • Fixed a bug where launchOpenFileActivity() could select multiple files. We don't want to be able to load multiple games at once!

  • Review requested: See the TODO added to SettingsActivity. Comment out the finish() to see the weirdness. My workaround works but it probably isn't the prettiest!

Screenshot_20200105-170115_Dolphin Emulator

Screenshot_20200322-054716_Dolphin Emulator

@JosJuice
Copy link
Member

JosJuice commented Mar 22, 2019

I don't think we should have this without having the default ISO exposed in the settings, since there otherwise would be no way to clear it without editing Dolphin.ini.

@Ebola16 Ebola16 changed the title Android: Add Set as default ISO to UI Android: Add Set As Default ISO to UI Mar 22, 2019
@Ebola16 Ebola16 changed the title Android: Add Set As Default ISO to UI Android: Add Set as Default ISO to UI Mar 22, 2019
@Ebola16 Ebola16 force-pushed the DISO branch 2 times, most recently from a5a696b to 462cf6c Compare March 22, 2019 18:05
@Ebola16
Copy link
Member Author

Ebola16 commented Mar 22, 2019

There's no play button on Android so is there a reason to clear the default ISO setting? Other than the play button, I think only mod launchers care about this setting and it can now be easily changed from Dolphin's UI. But we could wait on this PR until the Paths submenu is implemented.

@@ -64,14 +68,24 @@ public Dialog onCreateDialog(Bundle savedInstanceState)
SettingsActivity.launch(getActivity(), MenuTag.WIIMOTE, gameId);
break;
case 4:
clearGameSettings(gameId);
// Set as default ISO for GC, Wii clear game settings for else
Copy link
Member

Choose a reason for hiding this comment

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

This seems very error prone to me... Is there no other way to tell what option was selected? Not a big fan of those unnamed indices which are essentially magic numbers that can even change depending on the game file platform (!)

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved my changes to earlier in the array to reduce ugliness. The cases aren't named because they change depending upon platform. I think the goal was to conditionally include Wiimote settings while keeping Clear Game Settings at the end of the array. I could separate the Game Properties .setItems by platform but then I'd need to duplicate the switch. There's only one case that differs between platforms so I'm thinking I should keep this as-is. Let me know if you disagree.

@Ebola16 Ebola16 changed the title Android: Add Set as Default ISO to UI [WIP] Android: Add Set as Default ISO to UI Aug 30, 2019
@Ebola16 Ebola16 force-pushed the DISO branch 2 times, most recently from 9695c2b to aa802eb Compare September 8, 2019 06:14
@Ebola16 Ebola16 force-pushed the DISO branch 2 times, most recently from 4ff54a0 to fe8d8f0 Compare January 5, 2020 22:14
@Ebola16 Ebola16 force-pushed the DISO branch 2 times, most recently from 6a4923a to d0c006a Compare January 17, 2020 10:47
@Ebola16 Ebola16 changed the title [WIP] Android: Add Set as Default ISO to UI [Feedback Wanted] Android: Add Paths to UI Jan 17, 2020
@Ebola16
Copy link
Member Author

Ebola16 commented Jan 17, 2020

I don't think we should have this without having the default ISO exposed in the settings, since there otherwise would be no way to clear it without editing Dolphin.ini.

I took care of @JosJuice's concerns. I expanded the scope of this PR to include the Paths submenu. See updated original description for noteworthy changes. Requesting a review!

@Ebola16
Copy link
Member Author

Ebola16 commented Jan 23, 2020

Slight comment clarification. Although the changes in SettingsActivity may be somewhat wonky, I don't think there's any drawbacks to this PR so ready for review!

@Ebola16
Copy link
Member Author

Ebola16 commented Jan 31, 2020

I realize the few Android devs may be busy but ...anyone?

Copy link
Member

@JosJuice JosJuice left a comment

Choose a reason for hiding this comment

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

There is still no way to clear the Default ISO setting as far as I can tell.

The behavior of going back to the game list once you've selected OK or Cancel in the file picker feels quite weird to me. I'm assuming this is related to the TODO comments in SettingsActivity?

@Ebola16 Ebola16 force-pushed the DISO branch 3 times, most recently from f2b9665 to 44129b1 Compare February 12, 2020 23:58
@Ebola16
Copy link
Member Author

Ebola16 commented Feb 13, 2020

I implemented clearing the default ISO as a runnable that asks the user to confirm the action (see third screenshot). This will be used in future PRs too (i.e. toggling all log types).

I agree that the behavior in SettingsActivity is weird but it's the best I can come up with at the moment. That covers two of the TODOs I added. With the most recent comment, I've added a third TODO in SettingsFragment for a minor graphical glitch. I'm open to suggestions for improvement, but I think this can be merged and I'll do follow-up PRs if I can address the TODOs. This PR is getting fairly large.

I've done things in Java that I haven't tried before in this PR so it should probably be given a thorough look.

@Ebola16
Copy link
Member Author

Ebola16 commented Mar 17, 2020

...it seems nobody has any other comments on this PR so can it be merged?

@leoetlino leoetlino requested a review from JosJuice March 18, 2020 11:06
Copy link
Member

@JosJuice JosJuice left a comment

Choose a reason for hiding this comment

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

Sorry for the delay.

@JosJuice
Copy link
Member

JosJuice commented Mar 21, 2020

I found a bug: If you first go to the paths settings and bring up the file picker for the SD card path (and press either Cancel or OK), and then go to add a game directory to the game list, the directory picker will only show .raw files instead of only game files.

The logic for which set of extensions to use seems quite fragile, with CustomFilePickerFragment (which is not part of the settings code) relying on the value of a static variable in SettingsAdapter. If it's possible to do it without static variables like that, that would be preferable.

@Ebola16 Ebola16 force-pushed the DISO branch 2 times, most recently from 0258f19 to 679b35e Compare March 22, 2020 10:01
@Ebola16
Copy link
Member Author

Ebola16 commented Mar 22, 2020

The bug you described has been fixed by clearing the static variables in SettingsActivity. Unfortunately I think the static variables are necessary here to avoid multiple inheritance problems.
The latest version of this PR:

  • Adds some static variables I accidentally removed in the previous version in SettingsAdapter. FilePicker should now properly interact with directory selection.
  • Repurposed clearDefaultISO to resetPaths (see second image in original post). It's silly to just reset one path. If users are messing around with these settings we might as well easily restore them all.

Hopefully the latest version addresses everything. I think this is good to go and I received feedback so I'm removing my [Feedback Wanted] label.

@Ebola16 Ebola16 changed the title [Feedback Wanted] Android: Add Paths to UI Android: Add Paths to UI Mar 22, 2020
@JosJuice
Copy link
Member

I have made a commit that makes CustomFilePickerFragment not rely on the static state in SettingsAdapter. If you could include it, or something similar to it, I think I would be happy with merging the PR.

I've checked that it works, but I haven't lint checked it, so maybe you'll need to edit the formatting of one or two lines.

JosJuice@779be10

@Ebola16 Ebola16 force-pushed the DISO branch 2 times, most recently from a9ffeac to c25b4c5 Compare March 23, 2020 04:48
@Ebola16
Copy link
Member Author

Ebola16 commented Mar 24, 2020

@JosJuice I pushed one more commit to fix onSettingChanged could still clobber changes made by ConfirmRunnable. The main functional changes are ConfirmRunnable now calls finish upon completion and yet another static variable has been added to resetPaths. This also allows me to remove the now unnecessary reloadSubMenu and associated changes.

I would prefer to not squash these commits in case I need to partially revert them in the future.

@Ebola16
Copy link
Member Author

Ebola16 commented Mar 25, 2020

@JosJuice can we get this merged? I have a feeling nobody else is going to review this PR.

@JosJuice JosJuice merged commit 1b97f08 into dolphin-emu:master Mar 29, 2020
@Ebola16 Ebola16 deleted the DISO branch March 29, 2020 19:02
@ds22x
Copy link

ds22x commented Apr 6, 2020

Pardon my intrusion, but this PR made me wonder if it were possible to set a custom path for the complete dolphin-emu, rather than just certain chunks.
Alternatively, the option for more folders to be given a custom path (like the GC folder).

@Ebola16
Copy link
Member Author

Ebola16 commented Apr 11, 2020

@ds22x That's likely possible, although using variables in paths may confuse users. I don't know if I'll get around to implementing that but you can file a feature request at https://bugs.dolphin-emu.org/projects/emulator/issues so people can better see your suggestion.

@ds22x
Copy link

ds22x commented Apr 11, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants