com.android.resources.Keyboard Java Examples

The following examples show how to use com.android.resources.Keyboard. 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: AndroidManifestParser.java    From NBANDROID-V2 with Apache License 2.0 6 votes vote down vote up
/**
 * Processes the supports-screens node.
 *
 * @param attributes the attributes for the supports-screens node.
 */
private void processUsesConfiguration(Attributes attributes) {
    mManifestData.mUsesConfiguration = new UsesConfiguration();

    mManifestData.mUsesConfiguration.mReqFiveWayNav = getAttributeBooleanValue(
            attributes,
            AndroidManifest.ATTRIBUTE_REQ_5WAYNAV, true /*hasNamespace*/);
    mManifestData.mUsesConfiguration.mReqNavigation = Navigation.getEnum(
            getAttributeValue(attributes,
                    AndroidManifest.ATTRIBUTE_REQ_NAVIGATION, true /*hasNamespace*/));
    mManifestData.mUsesConfiguration.mReqHardKeyboard = getAttributeBooleanValue(
            attributes,
            AndroidManifest.ATTRIBUTE_REQ_HARDKEYBOARD, true /*hasNamespace*/);
    mManifestData.mUsesConfiguration.mReqKeyboardType = Keyboard.getEnum(
            getAttributeValue(attributes,
                    AndroidManifest.ATTRIBUTE_REQ_KEYBOARDTYPE, true /*hasNamespace*/));
    mManifestData.mUsesConfiguration.mReqTouchScreen = TouchScreen.getEnum(
            getAttributeValue(attributes,
                    AndroidManifest.ATTRIBUTE_REQ_TOUCHSCREEN, true /*hasNamespace*/));
}
 
Example #2
Source File: LayoutPreviewPanelImpl.java    From NBANDROID-V2 with Apache License 2.0 6 votes vote down vote up
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 #3
Source File: AndroidManifestParser.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Processes the supports-screens node.
 * @param attributes the attributes for the supports-screens node.
 */
private void processUsesConfiguration(Attributes attributes) {
    mManifestData.mUsesConfiguration = new UsesConfiguration();

    mManifestData.mUsesConfiguration.mReqFiveWayNav = getAttributeBooleanValue(
            attributes,
            AndroidManifest.ATTRIBUTE_REQ_5WAYNAV, true /*hasNamespace*/);
    mManifestData.mUsesConfiguration.mReqNavigation = Navigation.getEnum(
            getAttributeValue(attributes,
                    AndroidManifest.ATTRIBUTE_REQ_NAVIGATION, true /*hasNamespace*/));
    mManifestData.mUsesConfiguration.mReqHardKeyboard = getAttributeBooleanValue(
            attributes,
            AndroidManifest.ATTRIBUTE_REQ_HARDKEYBOARD, true /*hasNamespace*/);
    mManifestData.mUsesConfiguration.mReqKeyboardType = Keyboard.getEnum(
            getAttributeValue(attributes,
                    AndroidManifest.ATTRIBUTE_REQ_KEYBOARDTYPE, true /*hasNamespace*/));
    mManifestData.mUsesConfiguration.mReqTouchScreen = TouchScreen.getEnum(
            getAttributeValue(attributes,
                    AndroidManifest.ATTRIBUTE_REQ_TOUCHSCREEN, true /*hasNamespace*/));
}
 
Example #4
Source File: AndroidManifestParser.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Processes the supports-screens node.
 * @param attributes the attributes for the supports-screens node.
 */
private void processUsesConfiguration(Attributes attributes) {
    mManifestData.mUsesConfiguration = new UsesConfiguration();

    mManifestData.mUsesConfiguration.mReqFiveWayNav = getAttributeBooleanValue(
            attributes,
            AndroidManifest.ATTRIBUTE_REQ_5WAYNAV, true /*hasNamespace*/);
    mManifestData.mUsesConfiguration.mReqNavigation = Navigation.getEnum(
            getAttributeValue(attributes,
                    AndroidManifest.ATTRIBUTE_REQ_NAVIGATION, true /*hasNamespace*/));
    mManifestData.mUsesConfiguration.mReqHardKeyboard = getAttributeBooleanValue(
            attributes,
            AndroidManifest.ATTRIBUTE_REQ_HARDKEYBOARD, true /*hasNamespace*/);
    mManifestData.mUsesConfiguration.mReqKeyboardType = Keyboard.getEnum(
            getAttributeValue(attributes,
                    AndroidManifest.ATTRIBUTE_REQ_KEYBOARDTYPE, true /*hasNamespace*/));
    mManifestData.mUsesConfiguration.mReqTouchScreen = TouchScreen.getEnum(
            getAttributeValue(attributes,
                    AndroidManifest.ATTRIBUTE_REQ_TOUCHSCREEN, true /*hasNamespace*/));
}
 
Example #5
Source File: TextInputMethodQualifier.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean checkAndSet(String value, FolderConfiguration config) {
    Keyboard method = Keyboard.getEnum(value);
    if (method != null) {
        TextInputMethodQualifier qualifier = new TextInputMethodQualifier();
        qualifier.mValue = method;
        config.setTextInputMethodQualifier(qualifier);
        return true;
    }

    return false;
}
 
Example #6
Source File: TextInputMethodQualifier.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean checkAndSet(String value, FolderConfiguration config) {
    Keyboard method = Keyboard.getEnum(value);
    if (method != null) {
        TextInputMethodQualifier qualifier = new TextInputMethodQualifier();
        qualifier.mValue = method;
        config.setTextInputMethodQualifier(qualifier);
        return true;
    }

    return false;
}
 
Example #7
Source File: DeviceManager.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns hardware properties (defined in hardware.ini) as a {@link Map}.
 *
 * @param s The {@link State} from which to derive the hardware properties.
 * @return A {@link Map} of hardware properties.
 */
@NonNull
public static Map<String, String> getHardwareProperties(@NonNull State s) {
    Hardware hw = s.getHardware();
    Map<String, String> props = new HashMap<String, String>();
    props.put(HardwareProperties.HW_MAINKEYS,
            getBooleanVal(hw.getButtonType().equals(ButtonType.HARD)));
    props.put(HardwareProperties.HW_TRACKBALL,
            getBooleanVal(hw.getNav().equals(Navigation.TRACKBALL)));
    props.put(HardwareProperties.HW_KEYBOARD,
            getBooleanVal(hw.getKeyboard().equals(Keyboard.QWERTY)));
    props.put(HardwareProperties.HW_DPAD,
            getBooleanVal(hw.getNav().equals(Navigation.DPAD)));

    Set<Sensor> sensors = hw.getSensors();
    props.put(HardwareProperties.HW_GPS, getBooleanVal(sensors.contains(Sensor.GPS)));
    props.put(HardwareProperties.HW_BATTERY,
            getBooleanVal(hw.getChargeType().equals(PowerType.BATTERY)));
    props.put(HardwareProperties.HW_ACCELEROMETER,
            getBooleanVal(sensors.contains(Sensor.ACCELEROMETER)));
    props.put(HardwareProperties.HW_ORIENTATION_SENSOR,
            getBooleanVal(sensors.contains(Sensor.GYROSCOPE)));
    props.put(HardwareProperties.HW_AUDIO_INPUT, getBooleanVal(hw.hasMic()));
    props.put(HardwareProperties.HW_SDCARD, getBooleanVal(hw.getRemovableStorage().size() > 0));
    props.put(HardwareProperties.HW_LCD_DENSITY,
            Integer.toString(hw.getScreen().getPixelDensity().getDpiValue()));
    props.put(HardwareProperties.HW_PROXIMITY_SENSOR,
            getBooleanVal(sensors.contains(Sensor.PROXIMITY_SENSOR)));
    return props;
}
 
Example #8
Source File: TextInputMethodQualifier.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public TextInputMethodQualifier(Keyboard value) {
    mValue = value;
}
 
Example #9
Source File: ConfigGenerator.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
public ConfigGenerator setKeyboard(Keyboard keyboard) {
    mKeyboard = keyboard;
    return this;
}
 
Example #10
Source File: AvdHwProfile.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
/**
 * Creates new form AvdHwProfile
 */
public AvdHwProfile(Device device, DeviceManager deviceManager,boolean edit) {
    this.deviceManager = deviceManager;
    this.edit=edit;
    initComponents();
    deviceType.setModel(new DefaultComboBoxModel<>(DeviceType.values()));
    if (device != null) {
         String tagId = device.getTagId();
        initBootProperties(device);
        if (tagId == null) {
            deviceType.setSelectedItem(DeviceType.MOBILE);
        } else if (DeviceType.TV.id.equals(tagId)) {
            deviceType.setSelectedItem(DeviceType.TV);
        } else if (DeviceType.WEAR.id.equals(tagId)) {
            deviceType.setSelectedItem(DeviceType.WEAR);
        }
        if (edit) {
            deviceName.setText(device.getDisplayName());
            deviceName.setEditable(false);
        }else{
            deviceName.setText(String.format("%s (Edited)", device.getDisplayName()));
        }
        if (CreateAvdVisualPanel1.isTv(device)) {
            deviceType.setSelectedItem(DeviceType.TV);
        } else if (HardwareConfigHelper.isWear(device)) {
            deviceType.setSelectedItem(DeviceType.WEAR);
        } else {
            deviceType.setSelectedItem(DeviceType.MOBILE);
        }
        screenSize.setValue(device.getDefaultHardware().getScreen().getDiagonalLength());
        Dimension dimension = device.getScreenSize(device.getDefaultState().getOrientation());
        resolutionX.setValue(dimension.width);
        resolutionY.setValue(dimension.height);
        round.setSelected(device.isScreenRound());
        ram.setValue(device.getDefaultHardware().getRam().getSizeAsUnit(Storage.Unit.MiB));
        hwButt.setSelected(device.getDefaultHardware().getButtonType() == ButtonType.HARD);
        hwKeyb.setSelected(device.getDefaultHardware().getKeyboard() != Keyboard.NOKEY);
        List<State> states = device.getAllStates();
        portrait.setSelected(false);
        landscape.setSelected(false);
        for (State state : states) {
            if (state.getOrientation().equals(ScreenOrientation.PORTRAIT)) {
                portrait.setSelected(true);
            }
            if (state.getOrientation().equals(ScreenOrientation.LANDSCAPE)) {
                landscape.setSelected(true);
            }
        }
        Navigation nav = device.getDefaultHardware().getNav();
        switch (nav) {
            case NONAV:
                navigationStyle.setSelectedIndex(0);
                break;
            case DPAD:
                navigationStyle.setSelectedIndex(1);
                break;
            case TRACKBALL:
                navigationStyle.setSelectedIndex(2);
                break;
            case WHEEL:
                navigationStyle.setSelectedIndex(3);
                break;
        }
        cameraFront.setSelected(device.getDefaultHardware().getCamera(CameraLocation.FRONT) != null);
        cameraBack.setSelected(device.getDefaultHardware().getCamera(CameraLocation.BACK) != null);
        accelerometer.setSelected(device.getDefaultHardware().getSensors().contains(Sensor.ACCELEROMETER));
        gyroscope.setSelected(device.getDefaultHardware().getSensors().contains(Sensor.GYROSCOPE));
        gps.setSelected(device.getDefaultHardware().getSensors().contains(Sensor.GPS));
        proximity.setSelected(device.getDefaultHardware().getSensors().contains(Sensor.PROXIMITY_SENSOR));
        File skinFile = device.getDefaultHardware().getSkinFile();
        AndroidSdk defaultSdk = AndroidSdkProvider.getDefaultSdk();
        if (defaultSdk != null) {
            String skinPath = defaultSdk.getSdkPath() + File.separator + "skins";
            skin.setModel(new SkinsComboboxModel(new File(skinPath)));
        }
        skin.setSelectedItem(skinFile);
        playstore.setSelected(device.hasPlayStore());
    } else {
        deviceType.setSelectedItem(DeviceType.MOBILE);
        navigationStyle.setSelectedIndex(0);
        deviceName.setText(getUniqueId(null));
    }
    skin.setRenderer(new BasicComboBoxRenderer() {
        @Override
        public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); //To change body of generated methods, choose Tools | Templates.
            if ((component instanceof JLabel) && (value instanceof File)) {
                ((JLabel) component).setText(((File) value).getName());
            }
            return component;
        }

    });
}
 
Example #11
Source File: AvdHwProfile.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example #12
Source File: ManifestData.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
/**
 * returns the value of the <code>reqKeyboardType</code> attribute or null if not present.
 */
public Keyboard getReqKeyboardType() {
    return mReqKeyboardType;
}
 
Example #13
Source File: TextInputMethodQualifier.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public Keyboard getValue() {
    return mValue;
}
 
Example #14
Source File: RenderServiceFactory.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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 #15
Source File: Hardware.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public void setKeyboard(@NonNull Keyboard keyboard) {
    mKeyboard = keyboard;
}
 
Example #16
Source File: Hardware.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public Keyboard getKeyboard() {
    return mKeyboard;
}
 
Example #17
Source File: ManifestData.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
/**
 * returns the value of the <code>reqKeyboardType</code> attribute or null if not present.
 */
public Keyboard getReqKeyboardType() {
    return mReqKeyboardType;
}
 
Example #18
Source File: TextInputMethodQualifier.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public Keyboard getValue() {
    return mValue;
}
 
Example #19
Source File: TextInputMethodQualifier.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public TextInputMethodQualifier(Keyboard value) {
    mValue = value;
}
 
Example #20
Source File: Hardware.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public void setKeyboard(@NonNull Keyboard keyboard) {
    mKeyboard = keyboard;
}
 
Example #21
Source File: Hardware.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public Keyboard getKeyboard() {
    return mKeyboard;
}
 
Example #22
Source File: ManifestData.java    From NBANDROID-V2 with Apache License 2.0 2 votes vote down vote up
/**
 * returns the value of the <code>reqKeyboardType</code> attribute or
 * null if not present.
 */
public Keyboard getReqKeyboardType() {
    return mReqKeyboardType;
}