medyo / android-about-page

Create an awesome About Page for your Android App in 2 minutes
2.04k stars 283 forks source link

Auto night mode support #151

Closed ardevd closed 3 years ago

ardevd commented 3 years ago

I believe this library previously supported auto night mode. Meaning, if the device was set to night mode, the about page would display in night mode. It seems like we now have to explicitly specify whether we want night mode in the builder.

Any chance to get support for auto night mode?

medyo commented 3 years ago

Yes, that was the previous behaviour.

You can explicitly auto-enable the dark mode by doing:

val nightModeFlags = getContext().getResources().getConfiguration().uiMode &
    Configuration.UI_MODE_NIGHT_MASK
val nightModeEnabled = nightModeFlags == Configuration.UI_MODE_NIGHT_YES) 
View aboutPage = new AboutPage(this)
  .isRTL(false)
  .enableDarkMode(nightModeEnabled)
  ...
ardevd commented 3 years ago

Thanks. This is what I'm currently doing as well. Works well enough.