@@ -138,6 +138,8 @@ public class Engine extends View implements EngineApi
138138 private boolean m_new_intent ;
139139
140140 private int m_photo_width , m_photo_height ;
141+
142+ private int m_night_mode ;
141143
142144////////////////////////////////////////////////////////////////////////////////
143145
@@ -239,6 +241,10 @@ public void onScreenOrientationChanged(int orientation)
239241
240242 m_photo_width = 0 ;
241243 m_photo_height = 0 ;
244+
245+ m_night_mode =
246+ p_context .getResources ().getConfiguration ().uiMode &
247+ Configuration .UI_MODE_NIGHT_MASK ;
242248 }
243249
244250////////////////////////////////////////////////////////////////////////////////
@@ -356,6 +362,15 @@ public String loadExternalLibrary(String name)
356362
357363 public void onConfigurationChanged (Configuration p_new_config )
358364 {
365+ int t_night_mode =
366+ getContext ().getResources ().getConfiguration ().uiMode &
367+ Configuration .UI_MODE_NIGHT_MASK ;
368+
369+ if (t_night_mode != m_night_mode )
370+ {
371+ m_night_mode = t_night_mode ;
372+ doSystemAppearanceChanged ();
373+ }
359374 }
360375
361376////////////////////////////////////////////////////////////////////////////////
@@ -3896,7 +3911,22 @@ public Class getServiceClass()
38963911 {
38973912 return ((LiveCodeActivity )getContext ()).getServiceClass ();
38983913 }
3899-
3914+
3915+ ////////////////////////////////////////////////////////////////////////////////
3916+
3917+ public int getSystemAppearance ()
3918+ {
3919+ switch (m_night_mode )
3920+ {
3921+ case Configuration .UI_MODE_NIGHT_YES :
3922+ return 1 ;
3923+ case Configuration .UI_MODE_NIGHT_NO :
3924+ case Configuration .UI_MODE_NIGHT_UNDEFINED :
3925+ default :
3926+ return 0 ;
3927+ }
3928+ }
3929+
39003930 ////////////////////////////////////////////////////////////////////////////////
39013931
39023932 // url launch callback
@@ -3966,6 +3996,7 @@ public static native void doHeadingChanged(double p_heading, double p_magnetic_h
39663996 public static native void doShake (int action , long timestamp );
39673997
39683998 public static native void doOrientationChanged (int orientation );
3999+ public static native void doSystemAppearanceChanged ();
39694000
39704001 public static native void doKeyboardShown (int height );
39714002 public static native void doKeyboardHidden ();
0 commit comments