diff options
Diffstat (limited to 'sdkmanager/libs/sdklib')
18 files changed, 12 insertions, 1172 deletions
diff --git a/sdkmanager/libs/sdklib/.classpath b/sdkmanager/libs/sdklib/.classpath index 123ceef..b3528a4 100644 --- a/sdkmanager/libs/sdklib/.classpath +++ b/sdkmanager/libs/sdklib/.classpath @@ -6,5 +6,6 @@ <classpathentry combineaccessrules="false" kind="src" path="/AndroidPrefs"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/> <classpathentry kind="var" path="ANDROID_SRC/prebuilt/common/commons-compress/commons-compress-1.0.jar"/> + <classpathentry combineaccessrules="false" kind="src" path="/resources"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/sdkmanager/libs/sdklib/src/Android.mk b/sdkmanager/libs/sdklib/src/Android.mk index 5a7a7c7..3c91e88 100644 --- a/sdkmanager/libs/sdklib/src/Android.mk +++ b/sdkmanager/libs/sdklib/src/Android.mk @@ -21,6 +21,7 @@ LOCAL_JAVA_RESOURCE_DIRS := . LOCAL_JAR_MANIFEST := ../manifest.txt LOCAL_JAVA_LIBRARIES := \ androidprefs \ + resources \ commons-compress-1.0 LOCAL_MODULE := sdklib diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/export/ProjectConfig.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/export/ProjectConfig.java index 271e427..8f6fcc0 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/export/ProjectConfig.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/export/ProjectConfig.java @@ -16,12 +16,12 @@ package com.android.sdklib.internal.export; +import com.android.resources.Density; import com.android.sdklib.SdkConstants; import com.android.sdklib.internal.export.MultiApkExportHelper.ExportException; import com.android.sdklib.internal.project.ApkSettings; import com.android.sdklib.internal.project.ProjectProperties; import com.android.sdklib.internal.project.ProjectProperties.PropertyType; -import com.android.sdklib.resources.Density; import com.android.sdklib.xml.ManifestData; import com.android.sdklib.xml.ManifestData.SupportsScreens; diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Density.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Density.java deleted file mode 100644 index c6f5b2a..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Density.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.resources; - - -/** - * Density enum. - * <p/>This is used in the manifest in the uses-configuration node and in the resource folder names - * as well as other places needing to know the density values. - */ -public enum Density implements ResourceEnum { - XHIGH("xhdpi", "X-High Density", 320), //$NON-NLS-1$ - HIGH("hdpi", "High Density", 240), //$NON-NLS-1$ - MEDIUM("mdpi", "Medium Density", 160), //$NON-NLS-1$ - LOW("ldpi", "Low Density", 120), //$NON-NLS-1$ - NODPI("nodpi", "No Density", 0); //$NON-NLS-1$ - - public final static int DEFAULT_DENSITY = 160; - - private final String mValue; - private final String mDisplayValue; - private final int mDensity; - - private Density(String value, String displayValue, int density) { - mValue = value; - mDisplayValue = displayValue; - mDensity = density; - } - - /** - * Returns the enum matching the provided qualifier value. - * @param value The qualifier value. - * @return the enum for the qualifier value or null if no match was found. - */ - public static Density getEnum(String value) { - for (Density orient : values()) { - if (orient.mValue.equals(value)) { - return orient; - } - } - - return null; - } - - /** - * Returns the enum matching the given density value - * @param value The density value. - * @return the enum for the density value or null if no match was found. - */ - public static Density getEnum(int value) { - for (Density d : values()) { - if (d.mDensity == value) { - return d; - } - } - - return null; - } - - public String getResourceValue() { - return mValue; - } - - public int getDpiValue() { - return mDensity; - } - - public String getLegacyValue() { - if (this != NODPI) { - return String.format("%1$ddpi", getDpiValue()); - } - - return ""; - } - - public String getShortDisplayValue() { - return mDisplayValue; - } - - public String getLongDisplayValue() { - return mDisplayValue; - } - - public static int getIndex(Density value) { - int i = 0; - for (Density input : values()) { - if (value == input) { - return i; - } - - i++; - } - - return -1; - } - - public static Density getByIndex(int index) { - int i = 0; - for (Density value : values()) { - if (i == index) { - return value; - } - i++; - } - return null; - } - - public boolean isFakeValue() { - return false; - } - - public boolean isValidValueForDevice() { - return this != NODPI; // nodpi is not a valid config for devices. - } -} diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/DockMode.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/DockMode.java deleted file mode 100644 index 4bac3e9..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/DockMode.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.resources; - -/** - * Dock enum. - * <p/>This is used in the resource folder names. - */ -public enum DockMode implements ResourceEnum { - NONE("", "No Dock"), - CAR("car", "Car Dock"), - DESK("desk", "Desk Dock"); - - private final String mValue; - private final String mDisplayValue; - - private DockMode(String value, String display) { - mValue = value; - mDisplayValue = display; - } - - /** - * Returns the enum for matching the provided qualifier value. - * @param value The qualifier value. - * @return the enum for the qualifier value or null if no matching was found. - */ - public static DockMode getEnum(String value) { - for (DockMode mode : values()) { - if (mode.mValue.equals(value)) { - return mode; - } - } - - return null; - } - - public String getResourceValue() { - return mValue; - } - - public String getShortDisplayValue() { - return mDisplayValue; - } - - public String getLongDisplayValue() { - return mDisplayValue; - } - - public static int getIndex(DockMode value) { - int i = 0; - for (DockMode mode : values()) { - if (mode == value) { - return i; - } - - i++; - } - - return -1; - } - - public static DockMode getByIndex(int index) { - int i = 0; - for (DockMode value : values()) { - if (i == index) { - return value; - } - i++; - } - return null; - } - - public boolean isFakeValue() { - return this == NONE; // NONE is not a real enum. it's used for internal state only. - } - - public boolean isValidValueForDevice() { - return this != NONE; - } -} diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Keyboard.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Keyboard.java deleted file mode 100644 index c5ff18b..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Keyboard.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.resources; - -/** - * Keyboard enum. - * <p/>This is used in the manifest in the uses-configuration node and in the resource folder names. - */ -public enum Keyboard implements ResourceEnum { - NOKEY("nokeys", null, "No Keys", "No keyboard"), //$NON-NLS-1$ - QWERTY("qwerty", null, "Qwerty", "Qwerty keybard"), //$NON-NLS-1$ - TWELVEKEY("12key", "twelvekey", "12 Key", "12 key keyboard"); //$NON-NLS-1$ //$NON-NLS-2$ - - private final String mValue, mValue2; - private final String mShortDisplayValue; - private final String mLongDisplayValue; - - private Keyboard(String value, String value2, String shortDisplayValue, - String longDisplayValue) { - mValue = value; - mValue2 = value2; - mShortDisplayValue = shortDisplayValue; - mLongDisplayValue = longDisplayValue; - } - - /** - * Returns the enum for matching the provided qualifier value. - * @param value The qualifier value. - * @return the enum for the qualifier value or null if no matching was found. - */ - public static Keyboard getEnum(String value) { - for (Keyboard kbrd : values()) { - if (kbrd.mValue.equals(value) || - (kbrd.mValue2 != null && kbrd.mValue2.equals(value))) { - return kbrd; - } - } - - return null; - } - - public String getResourceValue() { - return mValue; - } - - public String getShortDisplayValue() { - return mShortDisplayValue; - } - - public String getLongDisplayValue() { - return mLongDisplayValue; - } - - public static int getIndex(Keyboard value) { - int i = 0; - for (Keyboard input : values()) { - if (value == input) { - return i; - } - - i++; - } - - return -1; - } - - public static Keyboard getByIndex(int index) { - int i = 0; - for (Keyboard value : values()) { - if (i == index) { - return value; - } - i++; - } - return null; - } - - public boolean isFakeValue() { - return false; - } - - public boolean isValidValueForDevice() { - return true; - } -} diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/KeyboardState.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/KeyboardState.java deleted file mode 100644 index c6461a4..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/KeyboardState.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.resources; - -/** - * Keyboard state enum. - * <p/>This is used in the manifest in the uses-configuration node and in the resource folder names. - */ -public enum KeyboardState implements ResourceEnum { - EXPOSED("keysexposed", "Exposed", "Exposed keyboard"), //$NON-NLS-1$ - HIDDEN("keyshidden", "Hidden", "Hidden keyboard"), //$NON-NLS-1$ - SOFT("keyssoft", "Soft", "Soft keyboard"); //$NON-NLS-1$ - - private final String mValue; - private final String mShortDisplayValue; - private final String mLongDisplayValue; - - private KeyboardState(String value, String shortDisplayValue, String longDisplayValue) { - mValue = value; - mShortDisplayValue = shortDisplayValue; - mLongDisplayValue = longDisplayValue; - } - - /** - * Returns the enum for matching the provided qualifier value. - * @param value The qualifier value. - * @return the enum for the qualifier value or null if no matching was found. - */ - public static KeyboardState getEnum(String value) { - for (KeyboardState state : values()) { - if (state.mValue.equals(value)) { - return state; - } - } - - return null; - } - - public String getResourceValue() { - return mValue; - } - - public String getShortDisplayValue() { - return mShortDisplayValue; - } - - public String getLongDisplayValue() { - return mLongDisplayValue; - } - - public static int getIndex(KeyboardState value) { - int i = 0; - for (KeyboardState input : values()) { - if (value == input) { - return i; - } - - i++; - } - - return -1; - } - - public static KeyboardState getByIndex(int index) { - int i = 0; - for (KeyboardState value : values()) { - if (i == index) { - return value; - } - i++; - } - return null; - } - - public boolean isFakeValue() { - return false; - } - - public boolean isValidValueForDevice() { - return true; - } - -} diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Navigation.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Navigation.java deleted file mode 100644 index 5ac67f4..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Navigation.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.resources; - -/** - * Navigation enum. - * <p/>This is used in the manifest in the uses-configuration node and in the resource folder names. - */ -public enum Navigation implements ResourceEnum { - NONAV("nonav", "None", "No navigation"), //$NON-NLS-1$ - DPAD("dpad", "D-pad", "D-pad navigation"), //$NON-NLS-1$ - TRACKBALL("trackball", "Trackball", "Trackball navigation"), //$NON-NLS-1$ - WHEEL("wheel", "Wheel", "Wheel navigation"); //$NON-NLS-1$ - - private final String mValue; - private final String mShortDisplayValue; - private final String mLongDisplayValue; - - private Navigation(String value, String shortDisplayValue, String longDisplayValue) { - mValue = value; - mShortDisplayValue = shortDisplayValue; - mLongDisplayValue = longDisplayValue; - } - - /** - * Returns the enum for matching the provided qualifier value. - * @param value The qualifier value. - * @return the enum for the qualifier value or null if no matching was found. - */ - public static Navigation getEnum(String value) { - for (Navigation nav : values()) { - if (nav.mValue.equals(value)) { - return nav; - } - } - - return null; - } - - public String getResourceValue() { - return mValue; - } - - public String getShortDisplayValue() { - return mShortDisplayValue; - } - - public String getLongDisplayValue() { - return mLongDisplayValue; - } - - public static int getIndex(Navigation value) { - int i = 0; - for (Navigation nav : values()) { - if (nav == value) { - return i; - } - - i++; - } - - return -1; - } - - public static Navigation getByIndex(int index) { - int i = 0; - for (Navigation value : values()) { - if (i == index) { - return value; - } - i++; - } - return null; - } - - public boolean isFakeValue() { - return false; - } - - public boolean isValidValueForDevice() { - return true; - } - -}
\ No newline at end of file diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NavigationState.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NavigationState.java deleted file mode 100644 index 612c119..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NavigationState.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.resources; - -/** - * Navigation state enum. - * <p/>This is used in the resource folder names. - */ -public enum NavigationState implements ResourceEnum { - EXPOSED("navexposed", "Exposed", "Exposed navigation"), //$NON-NLS-1$ - HIDDEN("navhidden", "Hidden", "Hidden navigation"); //$NON-NLS-1$ - - private final String mValue; - private final String mShortDisplayValue; - private final String mLongDisplayValue; - - private NavigationState(String value, String shortDisplayValue, String longDisplayValue) { - mValue = value; - mShortDisplayValue = shortDisplayValue; - mLongDisplayValue = longDisplayValue; - } - - /** - * Returns the enum for matching the provided qualifier value. - * @param value The qualifier value. - * @return the enum for the qualifier value or null if no matching was found. - */ - public static NavigationState getEnum(String value) { - for (NavigationState state : values()) { - if (state.mValue.equals(value)) { - return state; - } - } - - return null; - } - - public String getResourceValue() { - return mValue; - } - - public String getShortDisplayValue() { - return mShortDisplayValue; - } - - public String getLongDisplayValue() { - return mLongDisplayValue; - } - - public static int getIndex(NavigationState value) { - int i = 0; - for (NavigationState input : values()) { - if (value == input) { - return i; - } - - i++; - } - - return -1; - } - - public static NavigationState getByIndex(int index) { - int i = 0; - for (NavigationState value : values()) { - if (i == index) { - return value; - } - i++; - } - return null; - } - - public boolean isFakeValue() { - return false; - } - - public boolean isValidValueForDevice() { - return true; - } - -} diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NightMode.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NightMode.java deleted file mode 100644 index c694f19..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NightMode.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.resources; - -/** - * Night enum. - * <p/>This is used in the resource folder names. - */ -public enum NightMode implements ResourceEnum { - NOTNIGHT("notnight", "Not Night", "Day time"), - NIGHT("night", "Night", "Night time"); - - private final String mValue; - private final String mShortDisplayValue; - private final String mLongDisplayValue; - - private NightMode(String value, String shortDisplayValue, String longDisplayValue) { - mValue = value; - mShortDisplayValue = shortDisplayValue; - mLongDisplayValue = longDisplayValue; - } - - /** - * Returns the enum for matching the provided qualifier value. - * @param value The qualifier value. - * @return the enum for the qualifier value or null if no matching was found. - */ - public static NightMode getEnum(String value) { - for (NightMode mode : values()) { - if (mode.mValue.equals(value)) { - return mode; - } - } - - return null; - } - - public String getResourceValue() { - return mValue; - } - - public String getShortDisplayValue() { - return mShortDisplayValue; - } - - public String getLongDisplayValue() { - return mLongDisplayValue; - } - - public static int getIndex(NightMode value) { - int i = 0; - for (NightMode mode : values()) { - if (mode == value) { - return i; - } - - i++; - } - - return -1; - } - - public static NightMode getByIndex(int index) { - int i = 0; - for (NightMode value : values()) { - if (i == index) { - return value; - } - i++; - } - return null; - } - - public boolean isFakeValue() { - return false; - } - - public boolean isValidValueForDevice() { - return true; - } - -} diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/ResourceEnum.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/ResourceEnum.java deleted file mode 100644 index 7bbcfcb..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/ResourceEnum.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.resources; - -/** - * An enum representing a resource qualifier value. - */ -public interface ResourceEnum { - - /** - * Returns the resource string. This is to be used in resource folder names. - */ - String getResourceValue(); - - /** - * Whether the value actually used on device. This returns true only if a device can report - * this value, false if it's just used to qualify resources. - */ - boolean isValidValueForDevice(); - - /** - * Whether the value is neither used for device nor resources. This returns false when - * the value is only used for internal usage in the custom editors. - */ - boolean isFakeValue(); - - /** - * Returns a short string for display value. The string does not need to show the context. - * <p/>For instance "exposed", which can be the value for the keyboard state or the navigation - * state, would be valid since something else in the UI is expected to show if this is about the - * keyboard or the navigation state. - * - * @see #getLongDisplayValue() - */ - String getShortDisplayValue(); - - /** - * Returns a long string for display value. This must not only include the enum value but - * context (qualifier) about what the value represents. - * <p/>For instance "Exposed keyboard", and "Export navigation", as "exposed" would not be - * enough to know what qualifier the value is about. - * - * @see #getShortDisplayValue() - */ - String getLongDisplayValue(); -} diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/ScreenOrientation.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/ScreenOrientation.java deleted file mode 100644 index d6fdc59..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/ScreenOrientation.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.resources; - -/** - * Screen Orientation enum. - * <p/>This is used in the manifest in the uses-configuration node and in the resource folder names. - */ -public enum ScreenOrientation implements ResourceEnum { - PORTRAIT("port", "Portrait", "Portrait Orientation"), //$NON-NLS-1$ - LANDSCAPE("land", "Landscape", "Landscape Orientation"), //$NON-NLS-1$ - SQUARE("square", "Square", "Square Orientation"); //$NON-NLS-1$ - - private final String mValue; - private final String mShortDisplayValue; - private final String mLongDisplayValue; - - private ScreenOrientation(String value, String shortDisplayValue, String longDisplayValue) { - mValue = value; - mShortDisplayValue = shortDisplayValue; - mLongDisplayValue = longDisplayValue; - } - - /** - * Returns the enum for matching the provided qualifier value. - * @param value The qualifier value. - * @return the enum for the qualifier value or null if no matching was found. - */ - public static ScreenOrientation getEnum(String value) { - for (ScreenOrientation orient : values()) { - if (orient.mValue.equals(value)) { - return orient; - } - } - - return null; - } - - public String getResourceValue() { - return mValue; - } - - public String getShortDisplayValue() { - return mShortDisplayValue; - } - - public String getLongDisplayValue() { - return mLongDisplayValue; - } - - public static int getIndex(ScreenOrientation orientation) { - int i = 0; - for (ScreenOrientation orient : values()) { - if (orient == orientation) { - return i; - } - - i++; - } - - return -1; - } - - public static ScreenOrientation getByIndex(int index) { - int i = 0; - for (ScreenOrientation orient : values()) { - if (i == index) { - return orient; - } - i++; - } - - return null; - } - - public boolean isFakeValue() { - return false; - } - - public boolean isValidValueForDevice() { - return true; - } - -} diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/ScreenRatio.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/ScreenRatio.java deleted file mode 100644 index 28d4024..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/ScreenRatio.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.resources; - -/** - * Screen Ratio enum. - * <p/>This is used in the manifest in the uses-configuration node and in the resource folder names. - */ -public enum ScreenRatio implements ResourceEnum { - NOTLONG("notlong", "Not Long", "Short screen aspect ratio"), //$NON-NLS-1$ - LONG("long", "Long", "Long screen aspect ratio"); //$NON-NLS-1$ - - private final String mValue; - private final String mShortDisplayValue; - private final String mLongDisplayValue; - - private ScreenRatio(String value, String displayValue, String longDisplayValue) { - mValue = value; - mShortDisplayValue = displayValue; - mLongDisplayValue = longDisplayValue; - } - - /** - * Returns the enum for matching the provided qualifier value. - * @param value The qualifier value. - * @return the enum for the qualifier value or null if no matching was found. - */ - public static ScreenRatio getEnum(String value) { - for (ScreenRatio orient : values()) { - if (orient.mValue.equals(value)) { - return orient; - } - } - - return null; - } - - public String getResourceValue() { - return mValue; - } - - public String getShortDisplayValue() { - return mShortDisplayValue; - } - - public String getLongDisplayValue() { - return mLongDisplayValue; - } - - public static int getIndex(ScreenRatio orientation) { - int i = 0; - for (ScreenRatio orient : values()) { - if (orient == orientation) { - return i; - } - - i++; - } - - return -1; - } - - public static ScreenRatio getByIndex(int index) { - int i = 0; - for (ScreenRatio orient : values()) { - if (i == index) { - return orient; - } - i++; - } - - return null; - } - - public boolean isFakeValue() { - return false; - } - - public boolean isValidValueForDevice() { - return true; - } - -} - diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/ScreenSize.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/ScreenSize.java deleted file mode 100644 index d6fc99d..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/ScreenSize.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.resources; - -/** - * Screen size enum. - * <p/>This is used in the manifest in the uses-configuration node and in the resource folder names. - */ -public enum ScreenSize implements ResourceEnum { - SMALL("small", "Small", "Small Screen"), //$NON-NLS-1$ - NORMAL("normal", "Normal", "Normal Screen"), //$NON-NLS-1$ - LARGE("large", "Large", "Large Screen"), //$NON-NLS-1$ - XLARGE("xlarge", "X-Large", "Extra Large Screen"); //$NON-NLS-1$ - - private final String mValue; - private final String mShortDisplayValue; - private final String mLongDisplayValue; - - private ScreenSize(String value, String shortDisplayValue, String longDisplayValue) { - mValue = value; - mShortDisplayValue = shortDisplayValue; - mLongDisplayValue = longDisplayValue; - } - - /** - * Returns the enum for matching the provided qualifier value. - * @param value The qualifier value. - * @return the enum for the qualifier value or null if no matching was found. - */ - public static ScreenSize getEnum(String value) { - for (ScreenSize orient : values()) { - if (orient.mValue.equals(value)) { - return orient; - } - } - - return null; - } - - public String getResourceValue() { - return mValue; - } - - public String getShortDisplayValue() { - return mShortDisplayValue; - } - - public String getLongDisplayValue() { - return mLongDisplayValue; - } - - public static int getIndex(ScreenSize orientation) { - int i = 0; - for (ScreenSize orient : values()) { - if (orient == orientation) { - return i; - } - - i++; - } - - return -1; - } - - public static ScreenSize getByIndex(int index) { - int i = 0; - for (ScreenSize orient : values()) { - if (i == index) { - return orient; - } - i++; - } - - return null; - } - - public boolean isFakeValue() { - return false; - } - - public boolean isValidValueForDevice() { - return true; - } - -} diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/TouchScreen.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/TouchScreen.java deleted file mode 100644 index 233308b..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/TouchScreen.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.resources; - -/** - * Touch screen enum. - * <p/>This is used in the manifest in the uses-configuration node and in the resource folder names. - */ -public enum TouchScreen implements ResourceEnum { - NOTOUCH("notouch", "No Touch", "No-touch screen"), //$NON-NLS-1$ - STYLUS("stylus", "Stylus", "Stylus-based touchscreen"), //$NON-NLS-1$ - FINGER("finger", "Finger", "Finger-based touchscreen"); //$NON-NLS-1$ - - private final String mValue; - private final String mShortDisplayValue; - private final String mLongDisplayValue; - - private TouchScreen(String value, String displayValue, String longDisplayValue) { - mValue = value; - mShortDisplayValue = displayValue; - mLongDisplayValue = longDisplayValue; - } - - /** - * Returns the enum for matching the provided qualifier value. - * @param value The qualifier value. - * @return the enum for the qualifier value or null if no matching was found. - */ - public static TouchScreen getEnum(String value) { - for (TouchScreen orient : values()) { - if (orient.mValue.equals(value)) { - return orient; - } - } - - return null; - } - - public String getResourceValue() { - return mValue; - } - - public String getShortDisplayValue() { - return mShortDisplayValue; - } - - public String getLongDisplayValue() { - return mLongDisplayValue; - } - - public static int getIndex(TouchScreen touch) { - int i = 0; - for (TouchScreen t : values()) { - if (t == touch) { - return i; - } - - i++; - } - - return -1; - } - - public static TouchScreen getByIndex(int index) { - int i = 0; - for (TouchScreen value : values()) { - if (i == index) { - return value; - } - i++; - } - - return null; - } - - public boolean isFakeValue() { - return false; - } - - public boolean isValidValueForDevice() { - return true; - } - -} diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifestParser.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifestParser.java index d7ca8ec..9a67735 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifestParser.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifestParser.java @@ -16,13 +16,13 @@ package com.android.sdklib.xml; +import com.android.resources.Keyboard; +import com.android.resources.Navigation; +import com.android.resources.TouchScreen; import com.android.sdklib.SdkConstants; import com.android.sdklib.io.IAbstractFile; import com.android.sdklib.io.IAbstractFolder; import com.android.sdklib.io.StreamException; -import com.android.sdklib.resources.Keyboard; -import com.android.sdklib.resources.Navigation; -import com.android.sdklib.resources.TouchScreen; import com.android.sdklib.xml.ManifestData.Activity; import com.android.sdklib.xml.ManifestData.Instrumentation; import com.android.sdklib.xml.ManifestData.SupportsScreens; diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/ManifestData.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/ManifestData.java index 88f2af9..c4b8c0f 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/ManifestData.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/ManifestData.java @@ -16,9 +16,9 @@ package com.android.sdklib.xml; -import com.android.sdklib.resources.Keyboard; -import com.android.sdklib.resources.Navigation; -import com.android.sdklib.resources.TouchScreen; +import com.android.resources.Keyboard; +import com.android.resources.Navigation; +import com.android.resources.TouchScreen; import java.util.ArrayList; import java.util.Set; diff --git a/sdkmanager/libs/sdklib/tests/com/android/sdklib/xml/AndroidManifestParserTest.java b/sdkmanager/libs/sdklib/tests/com/android/sdklib/xml/AndroidManifestParserTest.java index a9a7edf..02725f4 100644 --- a/sdkmanager/libs/sdklib/tests/com/android/sdklib/xml/AndroidManifestParserTest.java +++ b/sdkmanager/libs/sdklib/tests/com/android/sdklib/xml/AndroidManifestParserTest.java @@ -16,9 +16,9 @@ package com.android.sdklib.xml; -import com.android.sdklib.resources.Keyboard; -import com.android.sdklib.resources.Navigation; -import com.android.sdklib.resources.TouchScreen; +import com.android.resources.Keyboard; +import com.android.resources.Navigation; +import com.android.resources.TouchScreen; import com.android.sdklib.xml.ManifestData.UsesFeature; import com.android.sdklib.xml.ManifestData.UsesLibrary; |