本文整理汇总了Java中android.app.UiModeManager.MODE_NIGHT_YES属性的典型用法代码示例。如果您正苦于以下问题:Java UiModeManager.MODE_NIGHT_YES属性的具体用法?Java UiModeManager.MODE_NIGHT_YES怎么用?Java UiModeManager.MODE_NIGHT_YES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.app.UiModeManager
的用法示例。
在下文中一共展示了UiModeManager.MODE_NIGHT_YES属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapNightModeToYesNo
@BinaryNightMode
private int mapNightModeToYesNo(@NightMode final int mode) {
switch (mode) {
case MODE_NIGHT_AUTO:
return getTwilightManager().isNight() ? MODE_NIGHT_YES : MODE_NIGHT_NO;
case MODE_NIGHT_FOLLOW_SYSTEM:
final UiModeManager uiModeManager = (UiModeManager)
mContext.getSystemService(Context.UI_MODE_SERVICE);
switch (uiModeManager.getNightMode()) {
case UiModeManager.MODE_NIGHT_YES:
return MODE_NIGHT_YES;
case UiModeManager.MODE_NIGHT_AUTO:
return MODE_NIGHT_AUTO;
case UiModeManager.MODE_NIGHT_NO:
default:
return MODE_NIGHT_NO;
}
case MODE_NIGHT_YES:
return MODE_NIGHT_YES;
case MODE_NIGHT_NO:
default:
return MODE_NIGHT_NO;
}
}
示例2: onResume
@Override
protected void onResume() {
Log.d(AnotherRSS.TAG, "onResume");
AnotherRSS.withGui = true;
new DbExpunge().execute();
SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
boolean night = mPreferences.getBoolean("nightmode_use", false);
if (night) {
int startH = mPreferences.getInt("nightmode_use_start", AnotherRSS.Config.DEFAULT_NIGHT_START);
int stopH = mPreferences.getInt("nightmode_use_stop", AnotherRSS.Config.DEFAULT_NIGHT_STOP);
if (AnotherRSS.inTimeSpan(startH, stopH) && umm.getNightMode() != UiModeManager.MODE_NIGHT_YES) {
umm.setNightMode(UiModeManager.MODE_NIGHT_YES);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
if (!AnotherRSS.inTimeSpan(startH, stopH) && umm.getNightMode() != UiModeManager.MODE_NIGHT_NO) {
umm.setNightMode(UiModeManager.MODE_NIGHT_NO);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}
} else {
if (umm.getNightMode() == UiModeManager.MODE_NIGHT_YES) {
umm.setNightMode(UiModeManager.MODE_NIGHT_NO);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}
}
super.onResume();
}
示例3: onResume
@Override
protected void onResume() {
Log.d(ViboraApp.TAG, "onResume");
ViboraApp.withGui = true;
new DbExpunge().execute();
SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
boolean night = mPreferences.getBoolean("nightmode_use", false);
if (night) {
int startH = mPreferences.getInt("nightmode_use_start", ViboraApp.Config.DEFAULT_NIGHT_START);
int stopH = mPreferences.getInt("nightmode_use_stop", ViboraApp.Config.DEFAULT_NIGHT_STOP);
if (ViboraApp.inTimeSpan(startH, stopH) && umm.getNightMode() != UiModeManager.MODE_NIGHT_YES) {
umm.setNightMode(UiModeManager.MODE_NIGHT_YES);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
if (!ViboraApp.inTimeSpan(startH, stopH) && umm.getNightMode() != UiModeManager.MODE_NIGHT_NO) {
umm.setNightMode(UiModeManager.MODE_NIGHT_NO);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}
} else {
if (umm.getNightMode() == UiModeManager.MODE_NIGHT_YES) {
umm.setNightMode(UiModeManager.MODE_NIGHT_NO);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}
}
super.onResume();
}