SchildiChat / SchildiChat-android

Matrix client / Element Android fork
https://schildi.chat/android/
Apache License 2.0
389 stars 51 forks source link

Automatic light theme at day, dark theme at night #19

Closed cloudrac3r closed 3 years ago

cloudrac3r commented 3 years ago

I like to use a light theme for applications during the day, because I find it easier to read, and dark theme at night, because it doesn't hurt my eyes.

Perhaps this could be done by having 2 theme selectors, one for the preferred day theme, and one for the preferred night theme, and one for the preferred dark theme, and switch between them based on the time of day (e.g. dark between 8 pm and 8 am)?

I seem to remember that this used to be a feature. Was it removed?

Would you prefer if I sent this feature request to Element upstream?

Thanks for the great app!

SpiritCroc commented 3 years ago

The separated dark and light theme settings are hidden right now in Android versions prior to Android 10, since the system-wide dark/light setting was officially only introduced in Android 10 (while it might technically work in some previous ROMs as well, but I haven't seen any that make use of the same mechanism), to avoid confusion.

I don't want to implement automatic switching based on time, as this might be problematic in following scenario: Currently, there is the (possibly upstream) bug that if you write a message and change the theme while doing so, your message gets lost. If you only change the theme manually instead, you can keep that in mind and not switch theme while writing a message, but with an automatic change, this is worse.

On the other hand, since the theme selection follows the Android system design, there might be the possibility to control dark/light setting by time from the system settings, if your ROM implements that.

cloudrac3r commented 3 years ago

Thanks for the post. I'm on LineageOS based on Android 9 and I'm pretty sure day/night mode worked for me when I saw the option some time ago? Maybe put it into labs as a thing for older system users to enable at their own risk? I'd appreciate that.

I see how the automatic changing could be a problem for losing messages. Would it be better if it only checked if it was time for a theme change on the room list screen?

SpiritCroc commented 3 years ago

Right, after some research, looks like Lineage indeed respects the night mode toggle since LineageOS 15.1. However, I did get a report that it was not working as expected with Lineage 15.1... so I guess I'll add a switch, if I don't come up with a better detection mechanism.

Yes, that would work better, but I don't feel like implementing time-based switching logic in the app, as I myself like to toggle it manually. Contributions are welcome, however.