List of usage examples for android.content.res Configuration UI_MODE_NIGHT_UNDEFINED
int UI_MODE_NIGHT_UNDEFINED
To view the source code for android.content.res Configuration UI_MODE_NIGHT_UNDEFINED.
Click Source Link
From source file:org.bottiger.podcast.utils.UIUtils.java
public static boolean isInNightMode(@NonNull Resources argResources) { if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES) return true; if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO) return false; int currentNightMode = argResources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; switch (currentNightMode) { case Configuration.UI_MODE_NIGHT_UNDEFINED: // We don't know what mode we're in, assume notnight return false; case Configuration.UI_MODE_NIGHT_NO: // Night mode is not active, we're in day time return false; case Configuration.UI_MODE_NIGHT_YES: { // Night mode is active, we're at night! //color = (int) (color * 0.2); //color = darken(color, 1f); return true; }//from ww w. jav a 2 s . c o m } return false; }
From source file:de.sindzinski.wetter.util.Utility.java
public static boolean getUiModeNight(Context mContext) { int currentNightMode = mContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; switch (currentNightMode) { case Configuration.UI_MODE_NIGHT_NO: Log.i(TAG, "Night mode is not active, we're in day time"); return false; case Configuration.UI_MODE_NIGHT_YES: Log.i(TAG, "Night mode is active, we're at night!"); return true; case Configuration.UI_MODE_NIGHT_UNDEFINED: Log.i(TAG, "We don't know what mode we're in, assume notnight"); return true; default:/*from www . j av a 2 s . c o m*/ return true; } }