OpenTracks
OpenTracks copied to clipboard
UI: re-add OLED friendly (aka black) theme.
Fixes #1625.
~TODO: needs some trying if it works ;)~
Okay; here is a tiny problem (and I am not sure how to continue).
- Setting a theme can only be done in
Activity.onCreate()
- ... if it is changed;
Activity.recreate()
must be called [works for SettingsActivity] - an activity in the launch stack (e.g., TrackListActivity that starts SettingsActivity) is actually only
resumed
.
Countermeasure: also after SettingsActivity is finished and control is passed it's calling activity also call Activity.recreate()
.
BUT: settings can be opened like this: TrackListActivity (start recording) -> TrackRecordingActivity -> SettingsActivity
So, now we also would need to recreate TrackListActivity to apply the changed theme. How? I mean, I don't want to recreate an activity any time another activity it called finished - that would be waste of resources, right?
One option I checked: somehow use getTheme
to check if the current theme needs to be updated.
I am not really sure, how to do this though...
@pstorch any other suggestions?
No idea. Maybe just inform the user that the changed theme needs a restart to be properly applied?
@pstorch the manual approach js implemented. Can you give it a try and see if it makes sense?
Some changes are applied immediately, some (from and to the oled theme) are applied after restart. Works for me. :+1:
@pstorch thanks for testing. I really don't get, why this is soo complicated. The easiest approach would be to just trigger a configuration change (e.g. screen rotation), but Android just does not support a "non-drastic" config change. Or something else.....