OpenTracks icon indicating copy to clipboard operation
OpenTracks copied to clipboard

UI: re-add OLED friendly (aka black) theme.

Open dennisguse opened this issue 1 year ago • 2 comments

Fixes #1625.

~TODO: needs some trying if it works ;)~

dennisguse avatar Feb 13 '24 21:02 dennisguse

Okay; here is a tiny problem (and I am not sure how to continue).

  1. Setting a theme can only be done in Activity.onCreate()
  2. ... if it is changed; Activity.recreate() must be called [works for SettingsActivity]
  3. 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?

dennisguse avatar Feb 26 '24 17:02 dennisguse

No idea. Maybe just inform the user that the changed theme needs a restart to be properly applied?

pstorch avatar Feb 26 '24 19:02 pstorch

@pstorch the manual approach js implemented. Can you give it a try and see if it makes sense?

dennisguse avatar Mar 02 '24 15:03 dennisguse

Some changes are applied immediately, some (from and to the oled theme) are applied after restart. Works for me. :+1:

pstorch avatar Mar 02 '24 17:03 pstorch

@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.....

dennisguse avatar Mar 02 '24 18:03 dennisguse