This is my style in attr_styles.xml
<style name="AttrStyles" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="calendarAppointmentView">@style/calendar_appointment_view</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="alertDialogTheme">@style/white_style</item>
</style>
And I have 2 colors.xml files. 1 is in values, the other in values-night.
If I select from phone settings DarkMode on or off, it works. BUT I want to have a Spinner in my app, to have: AUTO, ON, OFF. How can I force it to show the light colors (values) or to show the dark colors (values-night) based on that spinner?
I tried in my App.kt class (Application class) to call onCreate() this:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
or
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
But nothing happens. What am I doing wrong?