com.android.resources.NightMode Java Examples
The following examples show how to use
com.android.resources.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: NightModeQualifier.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
@Override public boolean checkAndSet(String value, FolderConfiguration config) { NightMode mode = NightMode.getEnum(value); if (mode != null) { NightModeQualifier qualifier = new NightModeQualifier(mode); config.setNightModeQualifier(qualifier); return true; } return false; }
Example #2
Source File: NightModeQualifier.java From javaide with GNU General Public License v3.0 | 5 votes |
@Override public boolean checkAndSet(String value, FolderConfiguration config) { NightMode mode = NightMode.getEnum(value); if (mode != null) { NightModeQualifier qualifier = new NightModeQualifier(mode); config.setNightModeQualifier(qualifier); return true; } return false; }
Example #3
Source File: ConfigGenerator.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
public FolderConfiguration getFolderConfig() { FolderConfiguration config = new FolderConfiguration(); // config.createDefault(); config.setDensityQualifier(new DensityQualifier(mDensity)); config.setNavigationMethodQualifier(new NavigationMethodQualifier(mNavigation)); if (mScreenWidth > mScreenHeight) { config.setScreenDimensionQualifier(new ScreenDimensionQualifier(mScreenWidth, mScreenHeight)); } else { config.setScreenDimensionQualifier(new ScreenDimensionQualifier(mScreenHeight, mScreenWidth)); } config.setScreenRatioQualifier(new ScreenRatioQualifier(mRatio)); config.setScreenSizeQualifier(new ScreenSizeQualifier(mSize)); config.setTextInputMethodQualifier(new TextInputMethodQualifier(mKeyboard)); config.setTouchTypeQualifier(new TouchScreenQualifier(mTouchScreen)); config.setKeyboardStateQualifier(new KeyboardStateQualifier(mKeyboardState)); config.setScreenOrientationQualifier(new ScreenOrientationQualifier(mOrientation)); config.updateScreenWidthAndHeight(); // some default qualifiers. config.setUiModeQualifier(new UiModeQualifier(UiMode.NORMAL)); config.setNightModeQualifier(new NightModeQualifier(NightMode.NOTNIGHT)); config.setCountryCodeQualifier(new CountryCodeQualifier()); config.setLayoutDirectionQualifier(new LayoutDirectionQualifier()); config.setNetworkCodeQualifier(new NetworkCodeQualifier()); config.setLocaleQualifier(new LocaleQualifier()); config.setVersionQualifier(new VersionQualifier(28)); return config; }
Example #4
Source File: DeviceConfigHelper.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
/** * Returns a {@link FolderConfiguration} based on the given state * * @param state * The {@link State} of the {@link Device} to base the * {@link FolderConfiguration} on. Can be null. * @return A {@link FolderConfiguration} based on the given {@link State}. * If the given {@link State} is null, the result is also null; */ @Nullable public static FolderConfiguration getFolderConfig(@Nullable State state) { if (state == null) { return null; } Hardware hw = state.getHardware(); FolderConfiguration config = new FolderConfiguration(); config.createDefault(); Screen screen = hw.getScreen(); config.setDensityQualifier(new DensityQualifier(screen.getPixelDensity())); config.setNavigationMethodQualifier(new NavigationMethodQualifier(hw.getNav())); ScreenDimensionQualifier sdq; if (screen.getXDimension() > screen.getYDimension()) { sdq = new ScreenDimensionQualifier(screen.getXDimension(), screen.getYDimension()); } else { sdq = new ScreenDimensionQualifier(screen.getYDimension(), screen.getXDimension()); } config.setScreenDimensionQualifier(sdq); config.setScreenRatioQualifier(new ScreenRatioQualifier(screen.getRatio())); config.setScreenSizeQualifier(new ScreenSizeQualifier(screen.getSize())); config.setTextInputMethodQualifier(new TextInputMethodQualifier(hw.getKeyboard())); config.setTouchTypeQualifier(new TouchScreenQualifier(screen.getMechanism())); config.setKeyboardStateQualifier(new KeyboardStateQualifier(state.getKeyState())); config.setNavigationStateQualifier(new NavigationStateQualifier(state.getNavState())); config.setScreenOrientationQualifier( new ScreenOrientationQualifier(state.getOrientation())); config.updateScreenWidthAndHeight(); // Setup some default qualifiers config.setUiModeQualifier(new UiModeQualifier(UiMode.NORMAL)); config.setNightModeQualifier(new NightModeQualifier(NightMode.NOTNIGHT)); config.setCountryCodeQualifier(new CountryCodeQualifier()); config.setLanguageQualifier(new LanguageQualifier()); config.setLayoutDirectionQualifier(new LayoutDirectionQualifier()); config.setNetworkCodeQualifier(new NetworkCodeQualifier()); config.setRegionQualifier(new RegionQualifier()); config.setVersionQualifier(new VersionQualifier()); return config; }
Example #5
Source File: NightModeQualifier.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
public NightModeQualifier(NightMode value) { mValue = value; }
Example #6
Source File: NightModeQualifier.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
public NightMode getValue() { return mValue; }
Example #7
Source File: DeviceConfigHelper.java From javaide with GNU General Public License v3.0 | 4 votes |
/** * Returns a {@link FolderConfiguration} based on the given state * * @param state * The {@link State} of the {@link Device} to base the * {@link FolderConfiguration} on. Can be null. * @return A {@link FolderConfiguration} based on the given {@link State}. * If the given {@link State} is null, the result is also null; */ @Nullable public static FolderConfiguration getFolderConfig(@Nullable State state) { if (state == null) { return null; } Hardware hw = state.getHardware(); FolderConfiguration config = new FolderConfiguration(); config.createDefault(); Screen screen = hw.getScreen(); config.setDensityQualifier(new DensityQualifier(screen.getPixelDensity())); config.setNavigationMethodQualifier(new NavigationMethodQualifier(hw.getNav())); ScreenDimensionQualifier sdq; if (screen.getXDimension() > screen.getYDimension()) { sdq = new ScreenDimensionQualifier(screen.getXDimension(), screen.getYDimension()); } else { sdq = new ScreenDimensionQualifier(screen.getYDimension(), screen.getXDimension()); } config.setScreenDimensionQualifier(sdq); config.setScreenRatioQualifier(new ScreenRatioQualifier(screen.getRatio())); config.setScreenSizeQualifier(new ScreenSizeQualifier(screen.getSize())); config.setTextInputMethodQualifier(new TextInputMethodQualifier(hw.getKeyboard())); config.setTouchTypeQualifier(new TouchScreenQualifier(screen.getMechanism())); ScreenRound screenRound = screen.getScreenRound(); if (screenRound == null) { // The default is not round. screenRound = ScreenRound.NOTROUND; } config.setScreenRoundQualifier(new ScreenRoundQualifier(screenRound)); config.setKeyboardStateQualifier(new KeyboardStateQualifier(state.getKeyState())); config.setNavigationStateQualifier(new NavigationStateQualifier(state.getNavState())); config.setScreenOrientationQualifier( new ScreenOrientationQualifier(state.getOrientation())); config.updateScreenWidthAndHeight(); // Setup some default qualifiers config.setUiModeQualifier(new UiModeQualifier(UiMode.NORMAL)); config.setNightModeQualifier(new NightModeQualifier(NightMode.NOTNIGHT)); config.setCountryCodeQualifier(new CountryCodeQualifier()); config.setLocaleQualifier(new LocaleQualifier()); config.setLayoutDirectionQualifier(new LayoutDirectionQualifier()); config.setNetworkCodeQualifier(new NetworkCodeQualifier()); config.setVersionQualifier(new VersionQualifier()); return config; }
Example #8
Source File: NightModeQualifier.java From javaide with GNU General Public License v3.0 | 4 votes |
public NightModeQualifier(NightMode value) { mValue = value; }
Example #9
Source File: NightModeQualifier.java From javaide with GNU General Public License v3.0 | 4 votes |
public NightMode getValue() { return mValue; }