Add xdpi and ydpi to layout-configs XML Schema.

Also validate that whitespace around tokens is accepted.

BUG 2138329

Change-Id: Id5af7cf2b0689f05327a0cf0b17a525ceba78a12
This commit is contained in:
Raphael
2009-09-29 12:14:05 -07:00
parent 1028accb55
commit 9b8a8056d1
4 changed files with 283 additions and 137 deletions

View File

@@ -94,8 +94,13 @@ public class LayoutConfigsXsd {
public static final String NODE_SCREEN_DIMENSION = "screen-dimension"; //$NON-NLS-1$
/** The screen-dimension element has 2 size element children. */
public static final String NODE_SIZE = "size"; //$NON-NLS-1$
public static final String NODE_XPDI = "xdpi"; //$NON-NLS-1$
public static final String NODE_YDPI = "ydpi"; //$NON-NLS-1$
/**
* The "name" attribute, used by both the "device" and the "config"
* elements. It represents the user-interface name of these objects.

View File

@@ -24,7 +24,7 @@
<xsd:element name="layout-configs">
<xsd:annotation>
<xsd:documentation>
<xsd:documentation xml:lang="en">
The "layout-configs" element is the root element of this schema.
It must contain one or more "device" elements that each define the configurations
@@ -41,7 +41,7 @@
<xsd:element name="device" minOccurs="1" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
<xsd:documentation xml:lang="en">
A device element must contain at most one "default" element
followed by one or more "config" elements.
@@ -78,10 +78,14 @@
-->
<xsd:complexType name="parametersType">
<xsd:annotation>
<xsd:documentation>
<xsd:documentation xml:lang="en">
The parametersType define all the parameters that can happen either in a
"default" element or in a named "config" element.
Each parameter element can appear once at most.
Parameters here are the same as those used to specify alternate Android
resources, as documented by
http://d.android.com/guide/topics/resources/resources-i18n.html#AlternateResources
</xsd:documentation>
</xsd:annotation>
@@ -89,6 +93,11 @@
<!-- parametersType says that 0..1 of each of these elements must be declared. -->
<xsd:element name="screen-size" minOccurs="0">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Specifies that the configuration is for a particular class of screen.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="small" />
@@ -99,6 +108,14 @@
</xsd:element>
<xsd:element name="screen-ratio" minOccurs="0">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Specifies that the configuration is for a taller/wider than traditional
screen. This is based purely on the aspect ration of the screen: QVGA,
HVGA, and VGA are notlong; WQVGA, WVGA, FWVGA are long. Note that long
may mean either wide or tall, depending on the current orientation.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="long" />
@@ -108,6 +125,12 @@
</xsd:element>
<xsd:element name="screen-orientation" minOccurs="0">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Specifies that the configuration is for a screen that is tall (port) or
wide (land).
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="port" />
@@ -118,6 +141,17 @@
</xsd:element>
<xsd:element name="pixel-density" minOccurs="0">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Specifies the screen density the configuration is defined for. The medium
density of traditional HVGA screens (mdpi) is defined to be approximately
160dpi; low density (ldpi) is 120, and high density (hdpi) is 240. There
is thus a 4:3 scaling factor between each density, so a 9x9 bitmap in ldpi
would be 12x12 is mdpi and 16x16 in hdpi.
The special nodpi density that can be used in resource qualifiers is not
a valid keyword here.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="ldpi" />
@@ -128,6 +162,11 @@
</xsd:element>
<xsd:element name="touch-type" minOccurs="0">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Specifies the touch type the configuration is defined for.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="notouch" />
@@ -138,6 +177,12 @@
</xsd:element>
<xsd:element name="keyboard-state" minOccurs="0">
<xsd:annotation>
<xsd:documentation xml:lang="en">
If your configuration uses a soft keyboard, use the keyssoft value.
If it doesn't and has a real keyboard, use keysexposed or keyshidden.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="keysexposed" />
@@ -148,6 +193,11 @@
</xsd:element>
<xsd:element name="text-input-method" minOccurs="0">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Specifies the primary text input method the configuration is designed for.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="nokeys" />
@@ -158,6 +208,12 @@
</xsd:element>
<xsd:element name="nav-method" minOccurs="0">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Specifies the primary non-touchscreen navigation method the configuration
is designed for.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="dpad" />
@@ -169,6 +225,11 @@
</xsd:element>
<xsd:element name="screen-dimension" minOccurs="0">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Specifies the device screen resolution, in pixels.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence minOccurs="2" maxOccurs="2">
@@ -181,6 +242,33 @@
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="xdpi" minOccurs="0">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Specifies the actual density in X of the device screen.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:float">
<xsd:minExclusive value="0" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ydpi" minOccurs="0">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Specifies the actual density in Y of the device screen.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:float">
<xsd:minExclusive value="0" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:all>
</xsd:complexType>