javax.swing.plaf.basic.BasicComboBoxRenderer#com.android.resources.Navigation源码实例Demo

下面列出了javax.swing.plaf.basic.BasicComboBoxRenderer#com.android.resources.Navigation 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * 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*/));
}
 
源代码2 项目: javaide   文件: AndroidManifestParser.java
/**
 * 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*/));
}
 
源代码3 项目: NBANDROID-V2   文件: LayoutPreviewPanelImpl.java
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;
    }
 
源代码4 项目: NBANDROID-V2   文件: AndroidManifestParser.java
/**
 * 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*/));
}
 
源代码5 项目: java-n-IDE-for-Android   文件: DeviceManager.java
/**
 * 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;
}
 
@Override
public boolean checkAndSet(String value, FolderConfiguration config) {
    Navigation method = Navigation.getEnum(value);
    if (method != null) {
        NavigationMethodQualifier qualifier = new NavigationMethodQualifier(method);
        config.setNavigationMethodQualifier(qualifier);
        return true;
    }

    return false;
}
 
源代码7 项目: javaide   文件: NavigationMethodQualifier.java
@Override
public boolean checkAndSet(String value, FolderConfiguration config) {
    Navigation method = Navigation.getEnum(value);
    if (method != null) {
        NavigationMethodQualifier qualifier = new NavigationMethodQualifier(method);
        config.setNavigationMethodQualifier(qualifier);
        return true;
    }

    return false;
}
 
源代码8 项目: java-n-IDE-for-Android   文件: Hardware.java
public Navigation getNav() {
    return mNav;
}
 
源代码9 项目: java-n-IDE-for-Android   文件: Hardware.java
public void setNav(@NonNull Navigation n) {
    mNav = n;
}
 
public NavigationMethodQualifier(Navigation value) {
    mValue = value;
}
 
public Navigation getValue() {
    return mValue;
}
 
源代码12 项目: java-n-IDE-for-Android   文件: ManifestData.java
/**
 * returns the value of the <code>reqNavigation</code> attribute or null if not present.
 */
public Navigation getReqNavigation() {
    return mReqNavigation;
}
 
源代码13 项目: javaide   文件: Hardware.java
public Navigation getNav() {
    return mNav;
}
 
源代码14 项目: javaide   文件: Hardware.java
public void setNav(@NonNull Navigation n) {
    mNav = n;
}
 
源代码15 项目: javaide   文件: RenderServiceFactory.java
/**
 * 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;
}
 
源代码16 项目: javaide   文件: NavigationMethodQualifier.java
public NavigationMethodQualifier(Navigation value) {
    mValue = value;
}
 
源代码17 项目: javaide   文件: NavigationMethodQualifier.java
public Navigation getValue() {
    return mValue;
}
 
源代码18 项目: javaide   文件: ManifestData.java
/**
 * returns the value of the <code>reqNavigation</code> attribute or null if not present.
 */
public Navigation getReqNavigation() {
    return mReqNavigation;
}
 
源代码19 项目: NBANDROID-V2   文件: AvdHwProfile.java
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;
}
 
源代码20 项目: NBANDROID-V2   文件: AvdHwProfile.java
/**
 * 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;
        }

    });
}
 
源代码21 项目: NBANDROID-V2   文件: ConfigGenerator.java
public ConfigGenerator setNavigation(Navigation navigation) {
    mNavigation = navigation;
    return this;
}
 
源代码22 项目: NBANDROID-V2   文件: ManifestData.java
/**
 * returns the value of the <code>reqNavigation</code> attribute or null
 * if not present.
 */
public Navigation getReqNavigation() {
    return mReqNavigation;
}