Sentaroh/SMBSync2

More wired issues on rotation

Closed this issue · 3 comments

Just for your info if it can help you fix it: in portrait mode I enable Size Only compare while time diff compare was enabled. After rotation to landscape and back to portrait, time_diff layout is shown back

2020-05-12 22 25 20

I suspect the cause is values of settings not initialized on changes. They are only drawn to screen with show/hide layout. Maybe a 2nd buffered gui layout is needed. But it would be more proper to write edited settings to temp variables and use the temp settings to properly set the view. Just boolean and integers for all fields. This would avoid similar issues in the future caused by having the actual checked view/spinner not corresponding to the linked variable value. When ok button is pressed, temp values are used to initialize all the settings so that they match the layout

I tested the new code, much better rendering.
Still a few issues to fix:

  • DST view not restored
    Check DST option and set spinner to other value, rotate screen in landscape than back to portrait
    DST offset spinner is gone despite DST option is checked

Screenshot_1589366158

  • Size dependent view not restored
    Edit existing task that have "Size compare" option checked and "Size Only" option unchecked.
    Uncheck "Size Compare" in portrait mode, rotate and back to portrait
    "Size Only" option is not greyed/disabled and can be enabled while "Size Compare" is unchecked

Screenshot_1589366482

Screenshot_1589366573

  • SMB and wifi spinner
  • Target/Master icon not restored
  • Network options and Advanced Network options not restored
    In existing task where master is Internal storage, edit task in portrait mode and change master to smb, save master folder. Answer yes to enable the wifi spinner. When in Task Edit main view with the new master as SMB, rotate screen and back to portrait
    • icon of smb server is displayed as previous storage (internal storage here)
    • Wifi spinner and Network options are gone
    • advanced network options in Advanced Options is gone

Screenshot_1589376098

Screenshot_1589372937

  • Swap source and destination not restored
    Edit existing sync task with ZIP as target, change target to sdcard
    Rotate screen and back to portrait
    Icon of Zip is back (previous bug), but Swap Master Target button is also gone

Screenshot_1589373184

Swap Button can also remain active when target was changed from existing sdcard to zip then screen rotated
Screenshot_1589373297

On this last view, if you press the Swap button, previous view is retored and not the zip file, meaning the real target was not saved!
Screenshot_1589373309

  • Landscape layout disabled while in target/master folder edit dialogs
    also when "List folders" is used. Really was usefull to browse folders in landscape mainly on small screens !

  • Target/Master folder not saved when editing in landscape mode and back to Portrait
    Put phone in Landscape mode
    Enter Task Edit in an existing task, enter Master Folder
    Change master folder from SDCARD to Internal Storage, do not Save
    Back to Portrait Mode and Save the new target folder
    In Task edit view, Master folder is still SDCARD

To fix the last two one, there are two options:

  • force back to portrait when editing target/master in landscape: really bad idea as we loose landscape view in many useful parts mainly on small devices !
  • save properly all the settings view and restore them in each folder view (Master, Taget, Zip, Archive, SWAP interactions...)

Or, again, in my opinion, these are all symptomatic fixes that will make the maintenance very hard when ever you add or change a GUI option + prone to errors.
I'd advise a file that groups all your app settings that a user can modify, default values for them and functions to init these defaults. In edit view, you use a clone class with temp values that are saved/restored in each view change. When ok button is pressed, cloned class will init the real settings functions. If cancel is pressed, the temps settings are cleared. Real settings are not modified unless ok button is pressed.

This makes the maintenance very easy as you only have to add/modify new user settings to this file and then add your function in code. I am not able to do it because of time and mainly because I do not know well all of your code.

Here's an example, but without the clone function in code I wrote in C (settings were directly written in a file as I did not need to save the GUI state like you want)
https://github.com/PhilZ-cwm6/philz_touch_cwm6/blob/cm-11.0/recovery_settings.h

and the settings functions called to init from/to file
https://github.com/PhilZ-cwm6/philz_touch_cwm6/blob/cm-11.0/recovery_settings.c

Thank you for your suggestion.
1.When the screen is rotated, editSyncTask() will not be executed and the last change is saved.
2.Restore the screen when rotating:
2.1 CheckedTextView is now performed by performClick()
2.2 Because Button/Icon was not restored, I made it to restore it.

Thank you a lot, much better
I open a new issue for readability list