Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support following device theme #109

Merged
merged 8 commits into from
Aug 6, 2022

Conversation

hayribakici
Copy link

@hayribakici hayribakici commented May 25, 2022

fixes #67

This PR respects the system default (dark mode on/off) and adapts its theme (midnight/noon) accordingly.
It also adds a new dialog item "Noon" for the light theme
The word "Noon" is translated (with google translate) into the following languages: fr, nb, zh-rCN, zh-rTW, nl. The zh-rCN, zh-rTW translations need to be reviewed as well.

PS. @jkuester sorry for the four unnecessacy commits. This PR actually consists of only three commits.

bakio86 and others added 8 commits May 22, 2022 12:45
- adds preferences in Customize App Drawer -> Open Keyboard
- respects system default (dark mode on/off) and adapts theme (midnight/noon) accordingly
- adds new dialog item "Noon" for light theme
- adds "Noon" in the following languages (note, that "Noon" was translated with google translate): fr, nb, zh-rCN, zh-rTW, nl. Especially the zh-rCN, zh-rTW need to be reviewed.
Comment on lines 136 to 142
1 -> R.style.AppThemeLight
2 -> R.style.AppThemeDark
3 -> R.style.AppGreyTheme
4 -> R.style.AppTealTheme
5 -> R.style.AppCandyTheme
6 -> R.style.AppPinkTheme
else -> R.style.AppTheme
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we need to keep the existing number mapping for these themes or current installations of the app that have the setting stored (with the previous number mapping) will see their theme chance unexpectedly when taking this update. (e.g. if I have the AppDarkTheme set, then my preference will be storing 1. When I take the update, the app will start interpreting 1 as referring to AppThemeLight. (This constraint is an unfortunate consequence of using an index-based mapping for the theme...)

I think the cleanest/easiest way forwards is to add the new AppThemeLight as an additional option at the bottom of the list and then just let the existing "Default" AppTheme translate directly to the new dynamic AppTheme (as the 0 option). This will result is perhaps unexpected behavior if someone is currently using the "Default" (light) theme but has Dark Mode enabled on their Android system. When they take the update, the app will automatically apply the night colors instead of using the old "Default" notnight colors. However, this seems like a pretty extreme edge case (what kind of masochist is running their device on Dark Mode, but has Unlauncher set to light mode?).

Copy link
Owner

@jkuester jkuester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hayribakici so sorry for the delay on this! Life stuff has been keeping me crazy busy.

This is great functionality! I am super excited to support this! For reference for future me (or anyone else) the key functionality that allows for the theme to toggle with the system theme is provided by the AppCompat.DayNight functionality described here.

@jkuester jkuester changed the title Follow Device Theme Support following device theme Aug 6, 2022
@jkuester jkuester merged commit e653507 into jkuester:master Aug 6, 2022
@hayribakici hayribakici deleted the #67_follow_device_theme branch August 6, 2022 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Follow device theme
2 participants