QuantumBadger / RedReader

An unofficial open source Android app for Reddit.
GNU General Public License v3.0
1.99k stars 484 forks source link

[Feature Request] Automatic dark mode #829

Open Septolum opened 3 years ago

Septolum commented 3 years ago

Add an automatic dark mode, following the system (Android 9/10+), a schedule, or sunrise at a location? I guess you'd have to choose your day theme and your night theme as well. Thanks for the excellent app :)

QuantumBadger commented 3 years ago

Thanks for the suggestion!

The difficult part of this would be how to handle switching from light to dark (or vice versa) when an activity is currently open. That would involve restarting the activity, and currently the app doesn't save enough activity state to do this in a seamless way -- the user has to wait for current posts/comments to be retrieved from the cache, as opposed to storing them as part of the saved instance state.

Even if we store the post/comment content, the restart would cause any context menus/dialogs to be closed, but maybe that's acceptable.

We should be careful that only some activities are restarted in this way (maybe just MainActivity, PostListingActivity, CommentListingActivity, MoreCommentsListingActivity) to avoid unexpected effects elsewhere.

Septolum commented 3 years ago

I'm not sure how other apps handle it, but would it be acceptable to switch on the next page change? (eg main menu to post list, post list to comment list, etc)

QuantumBadger commented 3 years ago

@Septolum That would be a good idea as we can be reasonably sure there are no dialogs/menus showing at that point.

Obviously we'd still need change the theme of the activity being navigated away from -- i.e. if the switch is done when moving from the post list to a comment list, the comment list can have the correct theme from the start, but the post list will need to be restarted for when the user returns to it.

So maybe the best thing to do is to restart activities in onResume() if the theme needs changing. This would also work in cases where the user returns to the app through the recent apps list.

We also need to take into account that changing the theme preference currently causes all activities to restart immediately. So to avoid changing the preference, it might be a good idea to add a new "Custom schedule" item to the list of theme choices (alongside "Red", "Blue", "Night", etc). This would sidestep the decision of what to do during a scheduled theme change if earlier the user has forced a different theme (because they'd have to switch the theme back to "Custom schedule" before the schedule kicks back in).

Septolum commented 3 years ago

Interesting update to this: Using the Developer Toggle "Force Dark Mode" on Android 10, RedReader behaves almost perfectly, with the only caveats being some post flairs still have a white/light background, and the comment indent lines are rather bright. That seems to be it! When you enable dark mode with this toggle on, even the colours fade to black smoothly, no refresh of the post list or anything. For reference I'm using the default Red theme

starcraft66 commented 1 year ago

Coming from the now-defunct RIF, this is one of the only features I'm left hoping is implemented to reach feature parity with what RIF offered. Ability to select one theme as the light one and one as the dark one and have it switch when the phone's dark mode is toggled.

PurpleCodingWizard commented 1 year ago

The only feature which would make this perfect. Hopefully, someone implements this in redreader