com.android.sdklib.devices.Hardware Java Examples
The following examples show how to use
com.android.sdklib.devices.Hardware.
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: AvdHwProfile.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
private List<State> generateStates(Hardware hardware) { List<State> states = Lists.newArrayListWithExpectedSize(4); if (portrait.isSelected()) { states.add(createState(ScreenOrientation.PORTRAIT, hardware, false)); } if (landscape.isSelected()) { states.add(createState(ScreenOrientation.LANDSCAPE, hardware, false)); } if (hwKeyb.isSelected()) { if (portrait.isSelected()) { states.add(createState(ScreenOrientation.PORTRAIT, hardware, true)); } if (landscape.isSelected()) { states.add(createState(ScreenOrientation.LANDSCAPE, hardware, true)); } } // We've added states in the order of most common to least common, so let's mark the first one as default states.get(0).setDefaultState(true); return states; }
Example #2
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 #3
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 #4
Source File: AvdHwProfile.java From NBANDROID-V2 with Apache License 2.0 | 4 votes |
public Hardware buildHardware() { Hardware hardware = new Hardware(); hardware.addNetwork(Network.BLUETOOTH); hardware.addNetwork(Network.WIFI); hardware.addNetwork(Network.NFC); hardware.addSensor(Sensor.BAROMETER); hardware.addSensor(Sensor.COMPASS); hardware.addSensor(Sensor.LIGHT_SENSOR); hardware.setHasMic(true); hardware.addInternalStorage(new Storage(4, Storage.Unit.GiB)); hardware.setCpu("Generic CPU"); hardware.setGpu("Generic GPU"); hardware.addAllSupportedAbis(EnumSet.allOf(Abi.class)); hardware.setChargeType(PowerType.BATTERY); if (accelerometer.isSelected()) { hardware.addSensor(Sensor.ACCELEROMETER); } if (gyroscope.isSelected()) { hardware.addSensor(Sensor.GYROSCOPE); } if (gps.isSelected()) { hardware.addSensor(Sensor.GPS); } if (proximity.isSelected()) { hardware.addSensor(Sensor.PROXIMITY_SENSOR); } if (cameraBack.isSelected()) { hardware.addCamera(new Camera(CameraLocation.BACK, true, true)); } if (cameraFront.isSelected()) { hardware.addCamera(new Camera(CameraLocation.FRONT, true, true)); } if (hwKeyb.isSelected()) { hardware.setKeyboard(Keyboard.QWERTY); } else { hardware.setKeyboard(Keyboard.NOKEY); } if (hwButt.isSelected()) { hardware.setButtonType(ButtonType.HARD); } else { hardware.setButtonType(ButtonType.SOFT); } switch (navigationStyle.getSelectedIndex()) { default: hardware.setNav(Navigation.NONAV); break; case 1: hardware.setNav(Navigation.DPAD); break; case 2: hardware.setNav(Navigation.TRACKBALL); break; case 3: hardware.setNav(Navigation.WHEEL); break; } if (skin.getSelectedItem() != null) { hardware.setSkinFile((File) skin.getSelectedItem()); } hardware.setRam(new Storage((long) ram.getValue(), Storage.Unit.MiB)); hardware.setScreen(createScreen()); return hardware; }