com.android.resources.TouchScreen Java Examples

The following examples show how to use com.android.resources.TouchScreen. 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: AvdHwProfile.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
public Screen createScreen() {
    Screen screen = new Screen();
    screen.setMultitouch(Multitouch.JAZZ_HANDS);
    screen.setMechanism(TouchScreen.FINGER);
    screen.setScreenType(ScreenType.CAPACITIVE);

    screen.setScreenRound((round.isSelected()) ? ScreenRound.ROUND : ScreenRound.NOTROUND);

    int screenWidth = (int) resolutionX.getValue();
    int screenHeight = (int) resolutionY.getValue();
    double screenDiagonal = (double) screenSize.getValue();
    double effectiveDiagonal = screenDiagonal;
    if (round.isSelected()) {
        // For round devices, compute the diagonal of
        // the enclosing square.
        effectiveDiagonal *= Math.sqrt(2.0);
    }

    screen.setDiagonalLength(screenDiagonal);
    screen.setSize(getScreenSize(effectiveDiagonal));
    screen.setXDimension(screenWidth);
    screen.setYDimension(screenHeight);

    screen.setRatio(getScreenRatio(screenWidth, screenHeight));

    Double dpi = calculateDpi(screenWidth, screenHeight, screenDiagonal, round.isSelected());

    dpi = Math.round(dpi * 100) / 100.0d;
    screen.setYdpi(dpi);
    screen.setXdpi(dpi);
    DeviceType dt = (DeviceType) deviceType.getSelectedItem();

    screen.setPixelDensity(getScreenDensity(dt == DeviceType.TV, dpi, screenHeight));
    return screen;
}
 
Example #6
Source File: TouchScreenQualifier.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) {
    TouchScreen type = TouchScreen.getEnum(value);
    if (type != null) {
        TouchScreenQualifier qualifier = new TouchScreenQualifier();
        qualifier.mValue = type;
        config.setTouchTypeQualifier(qualifier);
        return true;
    }

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

    return false;
}
 
Example #8
Source File: TouchScreenQualifier.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public TouchScreenQualifier(TouchScreen touchValue) {
    mValue = touchValue;
}
 
Example #9
Source File: ConfigGenerator.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
public ConfigGenerator setTouchScreen(TouchScreen touchScreen) {
    mTouchScreen = touchScreen;
    return this;
}
 
Example #10
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>reqTouchScreen</code> attribute or null if not present.
 */
public TouchScreen getReqTouchScreen() {
    return mReqTouchScreen;
}
 
Example #11
Source File: TouchScreenQualifier.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public TouchScreen getValue() {
    return mValue;
}
 
Example #12
Source File: Screen.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public TouchScreen getMechanism() {
    return mMechanism;
}
 
Example #13
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 #14
Source File: Screen.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public void setMechanism(TouchScreen mechanism) {
    mMechanism = mechanism;
}
 
Example #15
Source File: Screen.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public TouchScreen getMechanism() {
    return mMechanism;
}
 
Example #16
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>reqTouchScreen</code> attribute or null if not present.
 */
public TouchScreen getReqTouchScreen() {
    return mReqTouchScreen;
}
 
Example #17
Source File: TouchScreenQualifier.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public TouchScreen getValue() {
    return mValue;
}
 
Example #18
Source File: TouchScreenQualifier.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public TouchScreenQualifier(TouchScreen touchValue) {
    mValue = touchValue;
}
 
Example #19
Source File: Screen.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public void setMechanism(TouchScreen mechanism) {
    mMechanism = mechanism;
}
 
Example #20
Source File: ManifestData.java    From NBANDROID-V2 with Apache License 2.0 2 votes vote down vote up
/**
 * returns the value of the <code>reqTouchScreen</code> attribute or
 * null if not present.
 */
public TouchScreen getReqTouchScreen() {
    return mReqTouchScreen;
}