Java Code Examples for android.support.v7.app.AppCompatDelegate#NightMode
The following examples show how to use
android.support.v7.app.AppCompatDelegate#NightMode .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SkinnableActivity.java From SkinSprite with MIT License | 6 votes |
public void setDayNightMode(@AppCompatDelegate.NightMode int nightMode) { final boolean isPost21 = Build.VERSION.SDK_INT >= 21; if (mSkinnableCallback != null) { mSkinnableCallback.beforeApplyDayNight(); } getDelegate().setLocalNightMode(nightMode); if (isPost21) { applyDayNightForStatusBar(); applyDayNightForActionBar(); } View decorView = getWindow().getDecorView(); applyDayNightForView(decorView); if (mSkinnableCallback != null) { mSkinnableCallback.onApplyDayNight(); } }
Example 2
Source File: DayNightModeMapper.java From PainlessMusicPlayer with Apache License 2.0 | 6 votes |
@AppCompatDelegate.NightMode public int toDayNightMode(@NonNull final Theme theme) { switch (theme) { case NIGHT: return AppCompatDelegate.MODE_NIGHT_YES; case DAY: return AppCompatDelegate.MODE_NIGHT_NO; case DAYNIGHT: return AppCompatDelegate.MODE_NIGHT_AUTO; default: throw new IllegalArgumentException("Unexpected theme: " + theme); } }
Example 3
Source File: ZulipActivity.java From zulip-android with Apache License 2.0 | 5 votes |
/** * Switches the current Day/Night mode to Night/Day mode * * @param nightMode which Mode {@link android.support.v7.app.AppCompatDelegate.NightMode} */ private void setNightMode(@AppCompatDelegate.NightMode int nightMode) { AppCompatDelegate.setDefaultNightMode(nightMode); if (Build.VERSION.SDK_INT >= 11) { recreate(); } }
Example 4
Source File: MainActivity.java From cheesesquare with Apache License 2.0 | 5 votes |
private void setNightMode(@AppCompatDelegate.NightMode int nightMode) { AppCompatDelegate.setDefaultNightMode(nightMode); if (Build.VERSION.SDK_INT >= 11) { recreate(); } }
Example 5
Source File: Scoop.java From Scoops with Apache License 2.0 | 4 votes |
/** * Get the selected day night mode to use with certain themes * * @return the day night mode to use */ @AppCompatDelegate.NightMode public int getDayNightMode(){ checkInit(); return mPreferences.getInt(PREFERENCE_DAYNIGHT_KEY, AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); }
Example 6
Source File: Scoop.java From Scoops with Apache License 2.0 | 2 votes |
/** * Choose the DayNight mode you want to use for selected day/night mode themes * * @param mode the daynight mode you wish to use */ public void chooseDayNightMode(@AppCompatDelegate.NightMode int mode){ checkInit(); mPreferences.edit().putInt(PREFERENCE_DAYNIGHT_KEY, mode).apply(); }