Fix theme issue related to system default

This commit is contained in:
Rahul Kumar Patel
2021-02-16 10:28:22 +05:30
parent 59e381b889
commit fc3b05a5ef

View File

@@ -44,7 +44,7 @@ fun Fragment.applyTheme(
) { ) {
val themeStyle = CommonUtil.getThemeStyleById(themeId) val themeStyle = CommonUtil.getThemeStyleById(themeId)
if (themeStyle == 0) { if (themeId == 0) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
(requireActivity() as AppCompatActivity).applyDayNightMask() (requireActivity() as AppCompatActivity).applyDayNightMask()
} else { } else {
@@ -77,7 +77,7 @@ fun AppCompatActivity.applyTheme(themeId: Int, accentId: Int = 1) {
val themeStyle = CommonUtil.getThemeStyleById(themeId) val themeStyle = CommonUtil.getThemeStyleById(themeId)
val accentStyle = CommonUtil.getAccentStyleById(accentId) val accentStyle = CommonUtil.getAccentStyleById(accentId)
if (themeStyle == 0) { if (themeId == 0) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
applyDayNightMask() applyDayNightMask()
} else { } else {