List of usage examples for android.content.res Configuration UI_MODE_NIGHT_YES
int UI_MODE_NIGHT_YES
To view the source code for android.content.res Configuration UI_MODE_NIGHT_YES.
Click Source Link
From source file:org.telegram.ui.ActionBar.Theme.java
private static void tintDrawable(Context context) { backgroundDrawableIn = context.getResources().getDrawable(R.drawable.msg_in); backgroundDrawableInSelected = context.getResources().getDrawable(R.drawable.msg_in_selected); backgroundDrawableOut = context.getResources().getDrawable(R.drawable.msg_out); backgroundDrawableOutSelected = context.getResources().getDrawable(R.drawable.msg_out_selected); backgroundMediaDrawableIn = context.getResources().getDrawable(R.drawable.msg_in_photo); backgroundMediaDrawableInSelected = context.getResources().getDrawable(R.drawable.msg_in_photo_selected); backgroundMediaDrawableOut = context.getResources().getDrawable(R.drawable.msg_out_photo); backgroundMediaDrawableOutSelected = context.getResources().getDrawable(R.drawable.msg_out_photo_selected); if ((context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_YES) != 0) { int color = ContextCompat.getColor(context, R.color.chat_drawable_tint); backgroundDrawableIn.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); backgroundDrawableInSelected.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); backgroundDrawableOut.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); backgroundDrawableOutSelected.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); backgroundMediaDrawableIn.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); backgroundMediaDrawableInSelected.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); backgroundMediaDrawableOut.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); backgroundMediaDrawableOutSelected.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); }/* ww w. j a va 2 s. c om*/ }
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 w w w .j ava 2 s. c o m return true; } }