tsiemens / pathfinder-toolkit

A Pathfinder RPG Android app, for managing characters and parties
22 stars 6 forks source link

Prevent fragment-view reset to 'Fluff' when switching between characters #18

Closed samcorcoran closed 10 years ago

samcorcoran commented 10 years ago

Currently, switching to a different character while any screen in the 'Characters' view prompts the page to be reset to the 'Fluff' tab as part of the character switching process. This makes switching between characters cumbersome, and the process should instead result in the page remaining the same, but displaying the newly selected character's information.

A particular use-case is that users may not always be completely conscious of which character they are viewing and may perform some ui navigation with the wrong character selected before they realise. (e.g. currently having characterA selected, but wanting to see some inventory information for characterB, user selects inventory screen. Upon realising they need to switch characters they make the selection, and have to repeat the previous ui navigation).

The tab-change is currently performed by the function "performUpdateReset()" in PTCharacterSheetFragment.java.

The view change is currently being used to "force the current tab to save its values to mCharacter", and the "Fluff" tab is hardcoded through use of the FLUFF_ID.

To remain on the same tab, while still performing an action which will save the character state, the use of FLUFF_ID could potentially be replaced with a query for the current tab I D, i.e. m_currentFragmentId of PTMainActivity.java (assuming access to this variable exists).

From a cursory look at "showView()" in PTMainActivity.java it does not seem like there is any logic to prevent switching to a view that is already the current.

If there is a way of prompting saving of values to mCharacter without the need to change fragment view to the current fragment, that may be a tidier way to implement this.

tsiemens commented 10 years ago

Approved. This should be fairly simple from what I can see. Try replacing performUpdateReset() when changing character with updateDatabase(), that may be all that is required.

tsiemens commented 10 years ago

Resolved in PR #21