com.android.resources.KeyboardState Java Examples
The following examples show how to use
com.android.resources.KeyboardState.
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: LayoutPreviewPanelImpl.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
private ConfigGenerator getCurrentConfig() { ConfigGenerator current = new ConfigGenerator() .setScreenHeight(imageHeight) .setScreenWidth(imageWidth) .setXdpi(dpi) .setYdpi(dpi) .setOrientation(ScreenOrientation.PORTRAIT) .setDensity(((Density) density.getSelectedItem()).getDensity()) .setRatio(ScreenRatio.NOTLONG) .setSize(ScreenSize.NORMAL) .setKeyboard(Keyboard.NOKEY) .setTouchScreen(TouchScreen.FINGER) .setKeyboardState(KeyboardState.SOFT) .setSoftButtons(true) .setNavigation(Navigation.NONAV); return current; }
Example #2
Source File: KeyboardStateQualifier.java From javaide with GNU General Public License v3.0 | 6 votes |
@Override public boolean isBetterMatchThan(ResourceQualifier compareTo, ResourceQualifier reference) { if (compareTo == null) { return true; } KeyboardStateQualifier compareQualifier = (KeyboardStateQualifier)compareTo; KeyboardStateQualifier referenceQualifier = (KeyboardStateQualifier)reference; if (referenceQualifier.mValue == KeyboardState.SOFT) { // only case where there could be a // better qualifier // only return true if it's a better value. if (compareQualifier.mValue == KeyboardState.EXPOSED && mValue == KeyboardState.SOFT) { return true; } } return false; }
Example #3
Source File: KeyboardStateQualifier.java From javaide with GNU General Public License v3.0 | 6 votes |
@Override public boolean isMatchFor(ResourceQualifier qualifier) { if (qualifier instanceof KeyboardStateQualifier) { KeyboardStateQualifier referenceQualifier = (KeyboardStateQualifier)qualifier; // special case where EXPOSED can be used for SOFT if (referenceQualifier.mValue == KeyboardState.SOFT && mValue == KeyboardState.EXPOSED) { return true; } return referenceQualifier.mValue == mValue; } return false; }
Example #4
Source File: KeyboardStateQualifier.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
@Override public boolean isMatchFor(ResourceQualifier qualifier) { if (qualifier instanceof KeyboardStateQualifier) { KeyboardStateQualifier referenceQualifier = (KeyboardStateQualifier)qualifier; // special case where EXPOSED can be used for SOFT if (referenceQualifier.mValue == KeyboardState.SOFT && mValue == KeyboardState.EXPOSED) { return true; } return referenceQualifier.mValue == mValue; } return false; }
Example #5
Source File: KeyboardStateQualifier.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
@Override public boolean isBetterMatchThan(ResourceQualifier compareTo, ResourceQualifier reference) { if (compareTo == null) { return true; } KeyboardStateQualifier compareQualifier = (KeyboardStateQualifier)compareTo; KeyboardStateQualifier referenceQualifier = (KeyboardStateQualifier)reference; if (referenceQualifier.mValue == KeyboardState.SOFT) { // only case where there could be a // better qualifier // only return true if it's a better value. if (compareQualifier.mValue == KeyboardState.EXPOSED && mValue == KeyboardState.SOFT) { return true; } } return false; }
Example #6
Source File: KeyboardStateQualifier.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
@Override public boolean checkAndSet(String value, FolderConfiguration config) { KeyboardState orientation = KeyboardState.getEnum(value); if (orientation != null) { KeyboardStateQualifier qualifier = new KeyboardStateQualifier(); qualifier.mValue = orientation; config.setKeyboardStateQualifier(qualifier); return true; } return false; }
Example #7
Source File: KeyboardStateQualifier.java From javaide with GNU General Public License v3.0 | 5 votes |
@Override public boolean checkAndSet(String value, FolderConfiguration config) { KeyboardState orientation = KeyboardState.getEnum(value); if (orientation != null) { KeyboardStateQualifier qualifier = new KeyboardStateQualifier(); qualifier.mValue = orientation; config.setKeyboardStateQualifier(qualifier); return true; } return false; }
Example #8
Source File: DeviceManager.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * Returns the hardware properties defined in * {@link AvdManager#HARDWARE_INI} as a {@link Map}. * * This is intended to be dumped in the config.ini and already contains * the device name, manufacturer and device hash. * * @param d The {@link Device} from which to derive the hardware properties. * @return A {@link Map} of hardware properties. */ @NonNull public static Map<String, String> getHardwareProperties(@NonNull Device d) { Map<String, String> props = getHardwareProperties(d.getDefaultState()); for (State s : d.getAllStates()) { if (s.getKeyState().equals(KeyboardState.HIDDEN)) { props.put("hw.keyboard.lid", getBooleanVal(true)); } } HashFunction md5 = Hashing.md5(); Hasher hasher = md5.newHasher(); ArrayList<String> keys = new ArrayList<String>(props.keySet()); Collections.sort(keys); for (String key : keys) { if (key != null) { hasher.putString(key, Charsets.UTF_8); String value = props.get(key); hasher.putString(value == null ? "null" : value, Charsets.UTF_8); } } // store the hash method for potential future compatibility String hash = "MD5:" + hasher.hash().toString(); props.put(AvdManager.AVD_INI_DEVICE_HASH_V2, hash); props.remove(AvdManager.AVD_INI_DEVICE_HASH_V1); props.put(AvdManager.AVD_INI_DEVICE_NAME, d.getId()); props.put(AvdManager.AVD_INI_DEVICE_MANUFACTURER, d.getManufacturer()); return props; }
Example #9
Source File: State.java From javaide with GNU General Public License v3.0 | 4 votes |
public void setKeyState(KeyboardState keyState) { mKeyState = keyState; }
Example #10
Source File: ConfigGenerator.java From NBANDROID-V2 with Apache License 2.0 | 4 votes |
public ConfigGenerator setKeyboardState(KeyboardState state) { mKeyboardState = state; return this; }
Example #11
Source File: KeyboardStateQualifier.java From javaide with GNU General Public License v3.0 | 4 votes |
public KeyboardState getValue() { return mValue; }
Example #12
Source File: KeyboardStateQualifier.java From javaide with GNU General Public License v3.0 | 4 votes |
public KeyboardStateQualifier(KeyboardState value) { mValue = value; }
Example #13
Source File: RenderServiceFactory.java From javaide with GNU General Public License v3.0 | 4 votes |
/** * Creates a config. This must be a valid config like a device would return. This is to * prevent issues where some resources don't exist in all cases and not in the default * (for instance only available in hdpi and mdpi but not in default). * * @param size1 * @param size2 * @param screenSize * @param screenRatio * @param orientation * @param density * @param touchScreen * @param keyboardState * @param keyboard * @param navigationState * @param navigation * @param apiLevel * @return */ public static FolderConfiguration createConfig( int size1, int size2, ScreenSize screenSize, ScreenRatio screenRatio, ScreenOrientation orientation, Density density, TouchScreen touchScreen, KeyboardState keyboardState, Keyboard keyboard, NavigationState navigationState, Navigation navigation, int apiLevel) { FolderConfiguration config = new FolderConfiguration(); int width = size1, height = size2; switch (orientation) { case LANDSCAPE: width = size1 < size2 ? size2 : size1; height = size1 < size2 ? size1 : size2; break; case PORTRAIT: width = size1 < size2 ? size1 : size2; height = size1 < size2 ? size2 : size1; break; case SQUARE: width = height = size1; break; } int wdp = (width * Density.DEFAULT_DENSITY) / density.getDpiValue(); int hdp = (height * Density.DEFAULT_DENSITY) / density.getDpiValue(); config.addQualifier(new SmallestScreenWidthQualifier(wdp < hdp ? wdp : hdp)); config.addQualifier(new ScreenWidthQualifier(wdp)); config.addQualifier(new ScreenHeightQualifier(hdp)); config.addQualifier(new ScreenSizeQualifier(screenSize)); config.addQualifier(new ScreenRatioQualifier(screenRatio)); config.addQualifier(new ScreenOrientationQualifier(orientation)); config.addQualifier(new DensityQualifier(density)); config.addQualifier(new TouchScreenQualifier(touchScreen)); config.addQualifier(new KeyboardStateQualifier(keyboardState)); config.addQualifier(new TextInputMethodQualifier(keyboard)); config.addQualifier(new NavigationStateQualifier(navigationState)); config.addQualifier(new NavigationMethodQualifier(navigation)); config.addQualifier(width > height ? new ScreenDimensionQualifier(width, height) : new ScreenDimensionQualifier(height, width)); config.addQualifier(new VersionQualifier(apiLevel)); config.updateScreenWidthAndHeight(); return config; }
Example #14
Source File: State.java From javaide with GNU General Public License v3.0 | 4 votes |
public KeyboardState getKeyState() { return mKeyState; }
Example #15
Source File: KeyboardStateQualifier.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
public KeyboardState getValue() { return mValue; }
Example #16
Source File: KeyboardStateQualifier.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
public KeyboardStateQualifier(KeyboardState value) { mValue = value; }
Example #17
Source File: State.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
public void setKeyState(KeyboardState keyState) { mKeyState = keyState; }
Example #18
Source File: State.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
public KeyboardState getKeyState() { return mKeyState; }