aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-06-09 15:42:31 -0700
committerXavier Ducrohet <xav@android.com>2011-06-09 16:20:31 -0700
commita613eae6d3c12ea0e519d38993fd471c69f6cb22 (patch)
treebb1bb038a58040bbf2c7e572c56063e004b450cd
parent662af1c41ead894171b7b79258149ea991ba07d1 (diff)
downloadsdk-a613eae6d3c12ea0e519d38993fd471c69f6cb22.zip
sdk-a613eae6d3c12ea0e519d38993fd471c69f6cb22.tar.gz
sdk-a613eae6d3c12ea0e519d38993fd471c69f6cb22.tar.bz2
Renamed some resource enum/qualifiers to be more consistent with the platform.
Change-Id: I9c5ea5183e115582e0b805ca3ec75aad70e4a65c
-rw-r--r--common/src/com/android/resources/ScreenLayoutSize.java (renamed from common/src/com/android/resources/ScreenSize.java)16
-rw-r--r--common/src/com/android/resources/UiMode.java (renamed from common/src/com/android/resources/DockMode.java)24
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java78
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderService.java10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/ResourceHelper.java12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java91
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java6
-rw-r--r--ide_common/src/com/android/ide/common/resources/SingleResourceFile.java4
-rw-r--r--ide_common/src/com/android/ide/common/resources/configuration/DensityQualifier.java (renamed from ide_common/src/com/android/ide/common/resources/configuration/PixelDensityQualifier.java)18
-rw-r--r--ide_common/src/com/android/ide/common/resources/configuration/FolderConfiguration.java46
-rw-r--r--ide_common/src/com/android/ide/common/resources/configuration/ScreenLayoutSizeQualifier.java (renamed from ide_common/src/com/android/ide/common/resources/configuration/ScreenSizeQualifier.java)18
-rw-r--r--ide_common/src/com/android/ide/common/resources/configuration/UiModeQualifier.java (renamed from ide_common/src/com/android/ide/common/resources/configuration/DockModeQualifier.java)38
-rw-r--r--ide_common/tests/src/com/android/ide/common/resources/configuration/DockModeQualifierTest.java18
-rw-r--r--ide_common/tests/src/com/android/ide/common/resources/configuration/PixelDensityQualifierTest.java18
-rw-r--r--ide_common/tests/src/com/android/ide/common/resources/configuration/ScreenSizeQualifierTest.java30
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/RenderParams.java8
22 files changed, 254 insertions, 246 deletions
diff --git a/common/src/com/android/resources/ScreenSize.java b/common/src/com/android/resources/ScreenLayoutSize.java
index b6ffc50..12c4b91 100644
--- a/common/src/com/android/resources/ScreenSize.java
+++ b/common/src/com/android/resources/ScreenLayoutSize.java
@@ -20,7 +20,7 @@ package com.android.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 {
+public enum ScreenLayoutSize 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$
@@ -30,7 +30,7 @@ public enum ScreenSize implements ResourceEnum {
private final String mShortDisplayValue;
private final String mLongDisplayValue;
- private ScreenSize(String value, String shortDisplayValue, String longDisplayValue) {
+ private ScreenLayoutSize(String value, String shortDisplayValue, String longDisplayValue) {
mValue = value;
mShortDisplayValue = shortDisplayValue;
mLongDisplayValue = longDisplayValue;
@@ -41,8 +41,8 @@ public enum ScreenSize implements ResourceEnum {
* @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()) {
+ public static ScreenLayoutSize getEnum(String value) {
+ for (ScreenLayoutSize orient : values()) {
if (orient.mValue.equals(value)) {
return orient;
}
@@ -63,9 +63,9 @@ public enum ScreenSize implements ResourceEnum {
return mLongDisplayValue;
}
- public static int getIndex(ScreenSize orientation) {
+ public static int getIndex(ScreenLayoutSize orientation) {
int i = 0;
- for (ScreenSize orient : values()) {
+ for (ScreenLayoutSize orient : values()) {
if (orient == orientation) {
return i;
}
@@ -76,9 +76,9 @@ public enum ScreenSize implements ResourceEnum {
return -1;
}
- public static ScreenSize getByIndex(int index) {
+ public static ScreenLayoutSize getByIndex(int index) {
int i = 0;
- for (ScreenSize orient : values()) {
+ for (ScreenLayoutSize orient : values()) {
if (i == index) {
return orient;
}
diff --git a/common/src/com/android/resources/DockMode.java b/common/src/com/android/resources/UiMode.java
index 71515f9..36c903b 100644
--- a/common/src/com/android/resources/DockMode.java
+++ b/common/src/com/android/resources/UiMode.java
@@ -17,11 +17,11 @@
package com.android.resources;
/**
- * Dock enum.
+ * UI Mode enum.
* <p/>This is used in the resource folder names.
*/
-public enum DockMode implements ResourceEnum {
- NONE("", "No Dock"),
+public enum UiMode implements ResourceEnum {
+ NORMAL("", "Normal"),
CAR("car", "Car Dock"),
DESK("desk", "Desk Dock"),
TELEVISION("television", "Television");
@@ -29,7 +29,7 @@ public enum DockMode implements ResourceEnum {
private final String mValue;
private final String mDisplayValue;
- private DockMode(String value, String display) {
+ private UiMode(String value, String display) {
mValue = value;
mDisplayValue = display;
}
@@ -39,8 +39,8 @@ public enum DockMode implements ResourceEnum {
* @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()) {
+ public static UiMode getEnum(String value) {
+ for (UiMode mode : values()) {
if (mode.mValue.equals(value)) {
return mode;
}
@@ -61,9 +61,9 @@ public enum DockMode implements ResourceEnum {
return mDisplayValue;
}
- public static int getIndex(DockMode value) {
+ public static int getIndex(UiMode value) {
int i = 0;
- for (DockMode mode : values()) {
+ for (UiMode mode : values()) {
if (mode == value) {
return i;
}
@@ -74,9 +74,9 @@ public enum DockMode implements ResourceEnum {
return -1;
}
- public static DockMode getByIndex(int index) {
+ public static UiMode getByIndex(int index) {
int i = 0;
- for (DockMode value : values()) {
+ for (UiMode value : values()) {
if (i == index) {
return value;
}
@@ -86,10 +86,10 @@ public enum DockMode implements ResourceEnum {
}
public boolean isFakeValue() {
- return this == NONE; // NONE is not a real enum. it's used for internal state only.
+ return this == NORMAL; // NORMAL is not a real enum. it's used for internal state only.
}
public boolean isValidValueForDevice() {
- return this != NONE;
+ return this != NORMAL;
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java
index 86b8cd5..eba18e7 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java
@@ -16,12 +16,12 @@
package com.android.ide.eclipse.adt.internal.editors.layout.configuration;
-import com.android.ide.common.resources.configuration.DockModeQualifier;
import com.android.ide.common.resources.configuration.FolderConfiguration;
import com.android.ide.common.resources.configuration.LanguageQualifier;
import com.android.ide.common.resources.configuration.NightModeQualifier;
import com.android.ide.common.resources.configuration.RegionQualifier;
import com.android.ide.common.resources.configuration.ResourceQualifier;
+import com.android.ide.common.resources.configuration.UiModeQualifier;
import com.android.ide.common.resources.configuration.VersionQualifier;
import com.android.ide.eclipse.adt.internal.editors.IconFactory;
import com.android.ide.eclipse.adt.internal.sdk.LayoutDevice;
@@ -246,7 +246,7 @@ public class ConfigEditDialog extends GridDialog {
public boolean accept(ResourceQualifier qualifier) {
if (qualifier instanceof LanguageQualifier ||
qualifier instanceof RegionQualifier ||
- qualifier instanceof DockModeQualifier ||
+ qualifier instanceof UiModeQualifier ||
qualifier instanceof NightModeQualifier ||
qualifier instanceof VersionQualifier) {
return false;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java
index 413ebde..5cd9aa3 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java
@@ -24,16 +24,16 @@ import com.android.ide.common.rendering.api.StyleResourceValue;
import com.android.ide.common.resources.ResourceFile;
import com.android.ide.common.resources.ResourceFolder;
import com.android.ide.common.resources.ResourceRepository;
-import com.android.ide.common.resources.configuration.DockModeQualifier;
+import com.android.ide.common.resources.configuration.DensityQualifier;
import com.android.ide.common.resources.configuration.FolderConfiguration;
import com.android.ide.common.resources.configuration.LanguageQualifier;
import com.android.ide.common.resources.configuration.NightModeQualifier;
-import com.android.ide.common.resources.configuration.PixelDensityQualifier;
import com.android.ide.common.resources.configuration.RegionQualifier;
import com.android.ide.common.resources.configuration.ResourceQualifier;
import com.android.ide.common.resources.configuration.ScreenDimensionQualifier;
+import com.android.ide.common.resources.configuration.ScreenLayoutSizeQualifier;
import com.android.ide.common.resources.configuration.ScreenOrientationQualifier;
-import com.android.ide.common.resources.configuration.ScreenSizeQualifier;
+import com.android.ide.common.resources.configuration.UiModeQualifier;
import com.android.ide.common.resources.configuration.VersionQualifier;
import com.android.ide.common.sdk.LoadStatus;
import com.android.ide.eclipse.adt.AdtPlugin;
@@ -48,12 +48,12 @@ import com.android.ide.eclipse.adt.internal.sdk.LayoutDevice.DeviceConfig;
import com.android.ide.eclipse.adt.internal.sdk.LayoutDeviceManager;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.resources.Density;
-import com.android.resources.DockMode;
import com.android.resources.NightMode;
import com.android.resources.ResourceFolderType;
import com.android.resources.ResourceType;
+import com.android.resources.ScreenLayoutSize;
import com.android.resources.ScreenOrientation;
-import com.android.resources.ScreenSize;
+import com.android.resources.UiMode;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.internal.repository.PlatformPackage;
@@ -146,7 +146,7 @@ public class ConfigurationComposite extends Composite {
private Combo mDeviceCombo;
private Combo mDeviceConfigCombo;
private Combo mLocaleCombo;
- private Combo mDockCombo;
+ private Combo mUiModeCombo;
private Combo mNightCombo;
private Combo mThemeCombo;
private Combo mTargetCombo;
@@ -251,8 +251,8 @@ public class ConfigurationComposite extends Composite {
String configName;
ResourceQualifier[] locale;
String theme;
- /** dock mode. Guaranteed to be non null */
- DockMode dock = DockMode.NONE;
+ /** UI mode. Guaranteed to be non null */
+ UiMode uiMode = UiMode.NORMAL;
/** night mode. Guaranteed to be non null */
NightMode night = NightMode.NOTNIGHT;
/** the version being targeted for rendering */
@@ -276,7 +276,7 @@ public class ConfigurationComposite extends Composite {
sb.append(SEP);
sb.append(theme);
sb.append(SEP);
- sb.append(dock.getResourceValue());
+ sb.append(uiMode.getResourceValue());
sb.append(SEP);
sb.append(night.getResourceValue());
sb.append(SEP);
@@ -313,9 +313,9 @@ public class ConfigurationComposite extends Composite {
}
theme = values[3];
- dock = DockMode.getEnum(values[4]);
- if (dock == null) {
- dock = DockMode.NONE;
+ uiMode = UiMode.getEnum(values[4]);
+ if (uiMode == null) {
+ uiMode = UiMode.NORMAL;
}
night = NightMode.getEnum(values[5]);
if (night == null) {
@@ -487,13 +487,13 @@ public class ConfigurationComposite extends Composite {
GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
gd.heightHint = 0;
- mDockCombo = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
- mDockCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ mUiModeCombo = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
+ mUiModeCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
| GridData.GRAB_HORIZONTAL));
- for (DockMode mode : DockMode.values()) {
- mDockCombo.add(mode.getLongDisplayValue());
+ for (UiMode mode : UiMode.values()) {
+ mUiModeCombo.add(mode.getLongDisplayValue());
}
- mDockCombo.addSelectionListener(new SelectionAdapter() {
+ mUiModeCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
onDockChange();
@@ -715,7 +715,7 @@ public class ConfigurationComposite extends Composite {
adaptConfigSelection(false /*needBestMatch*/);
- mDockCombo.select(DockMode.getIndex(mState.dock));
+ mUiModeCombo.select(UiMode.getIndex(mState.uiMode));
mNightCombo.select(NightMode.getIndex(mState.night));
mTargetCombo.select(mTargetList.indexOf(mState.target));
@@ -959,7 +959,7 @@ public class ConfigurationComposite extends Composite {
selectDevice(mState.device = match.device);
fillConfigCombo(match.name);
mLocaleCombo.select(match.bundle.localeIndex);
- mDockCombo.select(match.bundle.dockModeIndex);
+ mUiModeCombo.select(match.bundle.dockModeIndex);
mNightCombo.select(match.bundle.nightModeIndex);
// TODO: display a better warning!
@@ -982,7 +982,7 @@ public class ConfigurationComposite extends Composite {
selectDevice(mState.device = match.device);
fillConfigCombo(match.name);
mLocaleCombo.select(match.bundle.localeIndex);
- mDockCombo.select(match.bundle.dockModeIndex);
+ mUiModeCombo.select(match.bundle.dockModeIndex);
mNightCombo.select(match.bundle.nightModeIndex);
}
}
@@ -992,14 +992,14 @@ public class ConfigurationComposite extends Composite {
*/
private static class TabletConfigComparator implements Comparator<ConfigMatch> {
public int compare(ConfigMatch o1, ConfigMatch o2) {
- ScreenSize ss1 = o1.testConfig.getScreenSizeQualifier().getValue();
- ScreenSize ss2 = o2.testConfig.getScreenSizeQualifier().getValue();
+ ScreenLayoutSize ss1 = o1.testConfig.getScreenLayoutSizeQualifier().getValue();
+ ScreenLayoutSize ss2 = o2.testConfig.getScreenLayoutSizeQualifier().getValue();
// X-LARGE is better than all others (which are considered identical)
// if both X-LARGE, then LANDSCAPE is better than all others (which are identical)
- if (ss1 == ScreenSize.XLARGE) {
- if (ss2 == ScreenSize.XLARGE) {
+ if (ss1 == ScreenLayoutSize.XLARGE) {
+ if (ss2 == ScreenLayoutSize.XLARGE) {
ScreenOrientation so1 =
o1.testConfig.getScreenOrientationQualifier().getValue();
ScreenOrientation so2 =
@@ -1019,7 +1019,7 @@ public class ConfigurationComposite extends Composite {
} else {
return -1;
}
- } else if (ss2 == ScreenSize.XLARGE) {
+ } else if (ss2 == ScreenLayoutSize.XLARGE) {
return 1;
} else {
return 0;
@@ -1044,14 +1044,14 @@ public class ConfigurationComposite extends Composite {
public int compare(ConfigMatch o1, ConfigMatch o2) {
int dpi1 = Density.DEFAULT_DENSITY;
- if (o1.testConfig.getPixelDensityQualifier() != null) {
- dpi1 = o1.testConfig.getPixelDensityQualifier().getValue().getDpiValue();
+ if (o1.testConfig.getDensityQualifier() != null) {
+ dpi1 = o1.testConfig.getDensityQualifier().getValue().getDpiValue();
dpi1 = mDensitySort.get(dpi1, 100 /* valueIfKeyNotFound*/);
}
int dpi2 = Density.DEFAULT_DENSITY;
- if (o2.testConfig.getPixelDensityQualifier() != null) {
- dpi2 = o2.testConfig.getPixelDensityQualifier().getValue().getDpiValue();
+ if (o2.testConfig.getDensityQualifier() != null) {
+ dpi2 = o2.testConfig.getDensityQualifier().getValue().getDpiValue();
dpi2 = mDensitySort.get(dpi2, 100 /* valueIfKeyNotFound*/);
}
@@ -1138,9 +1138,9 @@ public class ConfigurationComposite extends Composite {
// loop on each item and for each, add all variations of the dock modes
for (ConfigBundle bundle : addConfig) {
int index = 0;
- for (DockMode mode : DockMode.values()) {
+ for (UiMode mode : UiMode.values()) {
ConfigBundle b = new ConfigBundle(bundle);
- b.config.setDockModeQualifier(new DockModeQualifier(mode));
+ b.config.setUiModeQualifier(new UiModeQualifier(mode));
b.dockModeIndex = index++;
list.add(b);
}
@@ -1305,9 +1305,9 @@ public class ConfigurationComposite extends Composite {
mState.theme = mThemeCombo.getItem(index);
}
- index = mDockCombo.getSelectionIndex();
+ index = mUiModeCombo.getSelectionIndex();
if (index != -1) {
- mState.dock = DockMode.getByIndex(index);
+ mState.uiMode = UiMode.getByIndex(index);
}
index = mNightCombo.getSelectionIndex();
@@ -1471,12 +1471,12 @@ public class ConfigurationComposite extends Composite {
ManifestInfo manifest = ManifestInfo.get(project);
// Look up the screen size for the current configuration
- ScreenSize screenSize = null;
+ ScreenLayoutSize screenSize = null;
if (mState.device != null) {
List<DeviceConfig> configs = mState.device.getConfigs();
for (DeviceConfig config : configs) {
- ScreenSizeQualifier qualifier =
- config.getConfig().getScreenSizeQualifier();
+ ScreenLayoutSizeQualifier qualifier =
+ config.getConfig().getScreenLayoutSizeQualifier();
screenSize = qualifier.getValue();
break;
}
@@ -1683,7 +1683,7 @@ public class ConfigurationComposite extends Composite {
*/
public Density getDensity() {
if (mCurrentConfig != null) {
- PixelDensityQualifier qual = mCurrentConfig.getPixelDensityQualifier();
+ DensityQualifier qual = mCurrentConfig.getDensityQualifier();
if (qual != null) {
// just a sanity check
Density d = qual.getValue();
@@ -2214,11 +2214,11 @@ public class ConfigurationComposite extends Composite {
(RegionQualifier)localeQualifiers[LOCALE_REGION]);
}
- index = mDockCombo.getSelectionIndex();
+ index = mUiModeCombo.getSelectionIndex();
if (index == -1) {
index = 0; // no selection = 0
}
- mCurrentConfig.setDockModeQualifier(new DockModeQualifier(DockMode.getByIndex(index)));
+ mCurrentConfig.setUiModeQualifier(new UiModeQualifier(UiMode.getByIndex(index)));
index = mNightCombo.getSelectionIndex();
if (index == -1) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderService.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderService.java
index a03d038..a6d7263 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderService.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderService.java
@@ -32,7 +32,7 @@ import com.android.ide.common.rendering.api.SessionParams;
import com.android.ide.common.rendering.api.ViewInfo;
import com.android.ide.common.rendering.api.SessionParams.RenderingMode;
import com.android.ide.common.resources.ResourceResolver;
-import com.android.ide.common.resources.configuration.ScreenSizeQualifier;
+import com.android.ide.common.resources.configuration.ScreenLayoutSizeQualifier;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.internal.editors.layout.ContextPullParser;
import com.android.ide.eclipse.adt.internal.editors.layout.ExplodedRenderingHelper;
@@ -85,7 +85,7 @@ public class RenderService {
private final Density mDensity;
private final float mXdpi;
private final float mYdpi;
- private final ScreenSizeQualifier mScreenSize;
+ private final ScreenLayoutSizeQualifier mScreenLayoutSize;
// The following fields are optional or configurable using the various chained
// setters:
@@ -112,7 +112,7 @@ public class RenderService {
mDensity = config.getDensity();
mXdpi = config.getXDpi();
mYdpi = config.getYDpi();
- mScreenSize = config.getCurrentConfig().getScreenSizeQualifier();
+ mScreenLayoutSize = config.getCurrentConfig().getScreenLayoutSizeQualifier();
mLayoutLib = editor.getReadyLayoutLib(true /*displayError*/);
mResourceResolver = editor.getResourceResolver();
mProjectCallback = editor.getProjectCallback(true /*reset*/, mLayoutLib);
@@ -363,8 +363,8 @@ public class RenderService {
}
}
- if (mScreenSize != null) {
- params.setConfigScreenSize(mScreenSize.getValue());
+ if (mScreenLayoutSize != null) {
+ params.setConfigScreenSize(mScreenLayoutSize.getValue());
}
if (mOverrideBgColor != null) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java
index 475f5a7..7fd6ee6 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java
@@ -27,6 +27,7 @@ import static com.android.sdklib.xml.AndroidManifest.ATTRIBUTE_TARGET_SDK_VERSIO
import static com.android.sdklib.xml.AndroidManifest.ATTRIBUTE_THEME;
import static com.android.sdklib.xml.AndroidManifest.NODE_ACTIVITY;
import static com.android.sdklib.xml.AndroidManifest.NODE_USES_SDK;
+
import static org.eclipse.jdt.core.search.IJavaSearchConstants.REFERENCES;
import com.android.ide.eclipse.adt.AdtPlugin;
@@ -34,7 +35,7 @@ import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.ide.eclipse.adt.io.IFolderWrapper;
import com.android.io.IAbstractFile;
-import com.android.resources.ScreenSize;
+import com.android.resources.ScreenLayoutSize;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.xml.AndroidManifest;
@@ -288,7 +289,7 @@ public class ManifestInfo {
* @param screenSize the screen size to obtain a default theme for, or null if unknown
* @return the theme to use for this project, never null
*/
- public String getDefaultTheme(IAndroidTarget renderingTarget, ScreenSize screenSize) {
+ public String getDefaultTheme(IAndroidTarget renderingTarget, ScreenLayoutSize screenSize) {
sync();
if (mManifestTheme != null) {
@@ -303,7 +304,7 @@ public class ManifestInfo {
int apiLevel = Math.min(mTargetSdk, renderingTargetSdk);
// For now this theme works only on XLARGE screens. When it works for all sizes,
// add that new apiLevel to this check.
- if (apiLevel >= 11 && screenSize == ScreenSize.XLARGE) {
+ if (apiLevel >= 11 && screenSize == ScreenLayoutSize.XLARGE) {
return PREFIX_ANDROID_STYLE + "Theme.Holo"; //$NON-NLS-1$
} else {
return PREFIX_ANDROID_STYLE + "Theme"; //$NON-NLS-1$
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/ResourceHelper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/ResourceHelper.java
index 107ac4e..a02fbd1 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/ResourceHelper.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/ResourceHelper.java
@@ -31,7 +31,7 @@ import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.common.resources.ResourceDeltaKind;
import com.android.ide.common.resources.ResourceResolver;
import com.android.ide.common.resources.configuration.CountryCodeQualifier;
-import com.android.ide.common.resources.configuration.DockModeQualifier;
+import com.android.ide.common.resources.configuration.DensityQualifier;
import com.android.ide.common.resources.configuration.FolderConfiguration;
import com.android.ide.common.resources.configuration.KeyboardStateQualifier;
import com.android.ide.common.resources.configuration.LanguageQualifier;
@@ -39,15 +39,15 @@ import com.android.ide.common.resources.configuration.NavigationMethodQualifier;
import com.android.ide.common.resources.configuration.NavigationStateQualifier;
import com.android.ide.common.resources.configuration.NetworkCodeQualifier;
import com.android.ide.common.resources.configuration.NightModeQualifier;
-import com.android.ide.common.resources.configuration.PixelDensityQualifier;
import com.android.ide.common.resources.configuration.RegionQualifier;
import com.android.ide.common.resources.configuration.ResourceQualifier;
import com.android.ide.common.resources.configuration.ScreenDimensionQualifier;
+import com.android.ide.common.resources.configuration.ScreenLayoutSizeQualifier;
import com.android.ide.common.resources.configuration.ScreenOrientationQualifier;
import com.android.ide.common.resources.configuration.ScreenRatioQualifier;
-import com.android.ide.common.resources.configuration.ScreenSizeQualifier;
import com.android.ide.common.resources.configuration.TextInputMethodQualifier;
import com.android.ide.common.resources.configuration.TouchScreenQualifier;
+import com.android.ide.common.resources.configuration.UiModeQualifier;
import com.android.ide.common.resources.configuration.VersionQualifier;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
@@ -121,12 +121,12 @@ public class ResourceHelper {
sIconMap.put(NetworkCodeQualifier.class, factory.getIcon("mnc")); //$NON-NLS-1$
sIconMap.put(LanguageQualifier.class, factory.getIcon("language")); //$NON-NLS-1$
sIconMap.put(RegionQualifier.class, factory.getIcon("region")); //$NON-NLS-1$
- sIconMap.put(ScreenSizeQualifier.class, factory.getIcon("size")); //$NON-NLS-1$
+ sIconMap.put(ScreenLayoutSizeQualifier.class, factory.getIcon("size")); //$NON-NLS-1$
sIconMap.put(ScreenRatioQualifier.class, factory.getIcon("ratio")); //$NON-NLS-1$
sIconMap.put(ScreenOrientationQualifier.class, factory.getIcon("orientation")); //$NON-NLS-1$
- sIconMap.put(DockModeQualifier.class, factory.getIcon("dockmode")); //$NON-NLS-1$
+ sIconMap.put(UiModeQualifier.class, factory.getIcon("dockmode")); //$NON-NLS-1$
sIconMap.put(NightModeQualifier.class, factory.getIcon("nightmode")); //$NON-NLS-1$
- sIconMap.put(PixelDensityQualifier.class, factory.getIcon("dpi")); //$NON-NLS-1$
+ sIconMap.put(DensityQualifier.class, factory.getIcon("dpi")); //$NON-NLS-1$
sIconMap.put(TouchScreenQualifier.class, factory.getIcon("touch")); //$NON-NLS-1$
sIconMap.put(KeyboardStateQualifier.class, factory.getIcon("keyboard")); //$NON-NLS-1$
sIconMap.put(TextInputMethodQualifier.class, factory.getIcon("text_input")); //$NON-NLS-1$
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java
index 60b528a..d002d35 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java
@@ -17,16 +17,16 @@
package com.android.ide.eclipse.adt.internal.sdk;
import com.android.ide.common.resources.configuration.CountryCodeQualifier;
+import com.android.ide.common.resources.configuration.DensityQualifier;
import com.android.ide.common.resources.configuration.FolderConfiguration;
import com.android.ide.common.resources.configuration.KeyboardStateQualifier;
import com.android.ide.common.resources.configuration.NavigationMethodQualifier;
import com.android.ide.common.resources.configuration.NavigationStateQualifier;
import com.android.ide.common.resources.configuration.NetworkCodeQualifier;
-import com.android.ide.common.resources.configuration.PixelDensityQualifier;
import com.android.ide.common.resources.configuration.ScreenDimensionQualifier;
+import com.android.ide.common.resources.configuration.ScreenLayoutSizeQualifier;
import com.android.ide.common.resources.configuration.ScreenOrientationQualifier;
import com.android.ide.common.resources.configuration.ScreenRatioQualifier;
-import com.android.ide.common.resources.configuration.ScreenSizeQualifier;
import com.android.ide.common.resources.configuration.TextInputMethodQualifier;
import com.android.ide.common.resources.configuration.TouchScreenQualifier;
@@ -167,10 +167,10 @@ public class LayoutDevice {
node.setTextContent(Integer.toString(ncq.getCode()));
}
- ScreenSizeQualifier ssq = config.getScreenSizeQualifier();
- if (ssq != null) {
+ ScreenLayoutSizeQualifier slsq = config.getScreenLayoutSizeQualifier();
+ if (slsq != null) {
Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_SCREEN_SIZE);
- node.setTextContent(ssq.getFolderSegment());
+ node.setTextContent(slsq.getFolderSegment());
}
ScreenRatioQualifier srq = config.getScreenRatioQualifier();
@@ -185,10 +185,10 @@ public class LayoutDevice {
node.setTextContent(soq.getFolderSegment());
}
- PixelDensityQualifier pdq = config.getPixelDensityQualifier();
- if (pdq != null) {
+ DensityQualifier dq = config.getDensityQualifier();
+ if (dq != null) {
Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_PIXEL_DENSITY);
- node.setTextContent(pdq.getFolderSegment());
+ node.setTextContent(dq.getFolderSegment());
}
TouchScreenQualifier ttq = config.getTouchTypeQualifier();
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java
index eb3853a..8aad5cb 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java
@@ -17,16 +17,16 @@
package com.android.ide.eclipse.adt.internal.sdk;
import com.android.ide.common.resources.configuration.CountryCodeQualifier;
+import com.android.ide.common.resources.configuration.DensityQualifier;
import com.android.ide.common.resources.configuration.FolderConfiguration;
import com.android.ide.common.resources.configuration.KeyboardStateQualifier;
import com.android.ide.common.resources.configuration.NavigationMethodQualifier;
import com.android.ide.common.resources.configuration.NavigationStateQualifier;
import com.android.ide.common.resources.configuration.NetworkCodeQualifier;
-import com.android.ide.common.resources.configuration.PixelDensityQualifier;
import com.android.ide.common.resources.configuration.ScreenDimensionQualifier;
+import com.android.ide.common.resources.configuration.ScreenLayoutSizeQualifier;
import com.android.ide.common.resources.configuration.ScreenOrientationQualifier;
import com.android.ide.common.resources.configuration.ScreenRatioQualifier;
-import com.android.ide.common.resources.configuration.ScreenSizeQualifier;
import com.android.ide.common.resources.configuration.TextInputMethodQualifier;
import com.android.ide.common.resources.configuration.TouchScreenQualifier;
import com.android.resources.Density;
@@ -34,9 +34,9 @@ import com.android.resources.Keyboard;
import com.android.resources.KeyboardState;
import com.android.resources.Navigation;
import com.android.resources.NavigationState;
+import com.android.resources.ScreenLayoutSize;
import com.android.resources.ScreenOrientation;
import com.android.resources.ScreenRatio;
-import com.android.resources.ScreenSize;
import com.android.resources.TouchScreen;
import org.xml.sax.Attributes;
@@ -131,9 +131,9 @@ class LayoutDeviceHandler extends DefaultHandler {
Integer.parseInt(mStringAccumulator.toString()));
mCurrentConfig.setNetworkCodeQualifier(ncq);
} else if (LayoutDevicesXsd.NODE_SCREEN_SIZE.equals(localName)) {
- ScreenSizeQualifier ssq = new ScreenSizeQualifier(
- ScreenSize.getEnum(mStringAccumulator.toString()));
- mCurrentConfig.setScreenSizeQualifier(ssq);
+ ScreenLayoutSizeQualifier ssq = new ScreenLayoutSizeQualifier(
+ ScreenLayoutSize.getEnum(mStringAccumulator.toString()));
+ mCurrentConfig.setScreenLayoutSizeQualifier(ssq);
} else if (LayoutDevicesXsd.NODE_SCREEN_RATIO.equals(localName)) {
ScreenRatioQualifier srq = new ScreenRatioQualifier(
ScreenRatio.getEnum(mStringAccumulator.toString()));
@@ -143,9 +143,9 @@ class LayoutDeviceHandler extends DefaultHandler {
ScreenOrientation.getEnum(mStringAccumulator.toString()));
mCurrentConfig.setScreenOrientationQualifier(soq);
} else if (LayoutDevicesXsd.NODE_PIXEL_DENSITY.equals(localName)) {
- PixelDensityQualifier pdq = new PixelDensityQualifier(
+ DensityQualifier dq = new DensityQualifier(
Density.getEnum(mStringAccumulator.toString()));
- mCurrentConfig.setPixelDensityQualifier(pdq);
+ mCurrentConfig.setDensityQualifier(dq);
} else if (LayoutDevicesXsd.NODE_TOUCH_TYPE.equals(localName)) {
TouchScreenQualifier tsq = new TouchScreenQualifier(
TouchScreen.getEnum(mStringAccumulator.toString()));
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java
index ffef837..6312ff9 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java
@@ -18,7 +18,7 @@ package com.android.ide.eclipse.adt.internal.ui;
import com.android.AndroidConstants;
import com.android.ide.common.resources.configuration.CountryCodeQualifier;
-import com.android.ide.common.resources.configuration.DockModeQualifier;
+import com.android.ide.common.resources.configuration.DensityQualifier;
import com.android.ide.common.resources.configuration.FolderConfiguration;
import com.android.ide.common.resources.configuration.KeyboardStateQualifier;
import com.android.ide.common.resources.configuration.LanguageQualifier;
@@ -26,32 +26,32 @@ import com.android.ide.common.resources.configuration.NavigationMethodQualifier;
import com.android.ide.common.resources.configuration.NavigationStateQualifier;
import com.android.ide.common.resources.configuration.NetworkCodeQualifier;
import com.android.ide.common.resources.configuration.NightModeQualifier;
-import com.android.ide.common.resources.configuration.PixelDensityQualifier;
import com.android.ide.common.resources.configuration.RegionQualifier;
import com.android.ide.common.resources.configuration.ResourceQualifier;
import com.android.ide.common.resources.configuration.ScreenDimensionQualifier;
import com.android.ide.common.resources.configuration.ScreenHeightQualifier;
+import com.android.ide.common.resources.configuration.ScreenLayoutSizeQualifier;
import com.android.ide.common.resources.configuration.ScreenOrientationQualifier;
import com.android.ide.common.resources.configuration.ScreenRatioQualifier;
-import com.android.ide.common.resources.configuration.ScreenSizeQualifier;
import com.android.ide.common.resources.configuration.ScreenWidthQualifier;
import com.android.ide.common.resources.configuration.SmallestScreenWidthQualifier;
import com.android.ide.common.resources.configuration.TextInputMethodQualifier;
import com.android.ide.common.resources.configuration.TouchScreenQualifier;
+import com.android.ide.common.resources.configuration.UiModeQualifier;
import com.android.ide.common.resources.configuration.VersionQualifier;
import com.android.ide.eclipse.adt.internal.resources.ResourceHelper;
import com.android.resources.Density;
-import com.android.resources.DockMode;
import com.android.resources.Keyboard;
import com.android.resources.KeyboardState;
import com.android.resources.Navigation;
import com.android.resources.NavigationState;
import com.android.resources.NightMode;
import com.android.resources.ResourceEnum;
+import com.android.resources.ScreenLayoutSize;
import com.android.resources.ScreenOrientation;
import com.android.resources.ScreenRatio;
-import com.android.resources.ScreenSize;
import com.android.resources.TouchScreen;
+import com.android.resources.UiMode;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelection;
@@ -182,7 +182,7 @@ public class ConfigurationSelector extends Composite {
}
/**
- * Implementation of {@link VerifyListener} for the Pixel Density qualifier.
+ * Implementation of {@link VerifyListener} for the Density qualifier.
*/
public static class DensityVerifier extends DigitVerifier { }
@@ -429,12 +429,13 @@ public class ConfigurationSelector extends Composite {
new SmallestScreenWidthEdit(mQualifierEditParent));
mUiMap.put(ScreenWidthQualifier.class, new ScreenWidthEdit(mQualifierEditParent));
mUiMap.put(ScreenHeightQualifier.class, new ScreenHeightEdit(mQualifierEditParent));
- mUiMap.put(ScreenSizeQualifier.class, new ScreenSizeEdit(mQualifierEditParent));
+ mUiMap.put(ScreenLayoutSizeQualifier.class,
+ new ScreenLayoutSizeEdit(mQualifierEditParent));
mUiMap.put(ScreenRatioQualifier.class, new ScreenRatioEdit(mQualifierEditParent));
mUiMap.put(ScreenOrientationQualifier.class, new OrientationEdit(mQualifierEditParent));
- mUiMap.put(DockModeQualifier.class, new DockModeEdit(mQualifierEditParent));
+ mUiMap.put(UiModeQualifier.class, new UiModeEdit(mQualifierEditParent));
mUiMap.put(NightModeQualifier.class, new NightModeEdit(mQualifierEditParent));
- mUiMap.put(PixelDensityQualifier.class, new PixelDensityEdit(mQualifierEditParent));
+ mUiMap.put(DensityQualifier.class, new DensityEdit(mQualifierEditParent));
mUiMap.put(TouchScreenQualifier.class, new TouchEdit(mQualifierEditParent));
mUiMap.put(KeyboardStateQualifier.class, new KeyboardEdit(mQualifierEditParent));
mUiMap.put(TextInputMethodQualifier.class, new TextInputEdit(mQualifierEditParent));
@@ -1171,17 +1172,17 @@ public class ConfigurationSelector extends Composite {
/**
- * Edit widget for {@link ScreenSizeQualifier}.
+ * Edit widget for {@link ScreenLayoutSizeQualifier}.
*/
- private class ScreenSizeEdit extends QualifierEditBase {
+ private class ScreenLayoutSizeEdit extends QualifierEditBase {
private Combo mSize;
- public ScreenSizeEdit(Composite parent) {
- super(parent, ScreenSizeQualifier.NAME);
+ public ScreenLayoutSizeEdit(Composite parent) {
+ super(parent, ScreenLayoutSizeQualifier.NAME);
mSize = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
- fillCombo(mSize, ScreenSize.values());
+ fillCombo(mSize, ScreenLayoutSize.values());
mSize.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
mSize.addSelectionListener(new SelectionListener() {
@@ -1199,14 +1200,14 @@ public class ConfigurationSelector extends Composite {
int index = mSize.getSelectionIndex();
if (index != -1) {
- mSelectedConfiguration.setScreenSizeQualifier(new ScreenSizeQualifier(
- ScreenSize.getByIndex(index)));
+ mSelectedConfiguration.setScreenLayoutSizeQualifier(new ScreenLayoutSizeQualifier(
+ ScreenLayoutSize.getByIndex(index)));
} else {
// empty selection, means no qualifier.
// Since the qualifier classes are immutable, and we don't want to
// remove the qualifier from the configuration, we create a new default one.
- mSelectedConfiguration.setScreenSizeQualifier(
- new ScreenSizeQualifier());
+ mSelectedConfiguration.setScreenLayoutSizeQualifier(
+ new ScreenLayoutSizeQualifier());
}
// notify of change
@@ -1215,13 +1216,13 @@ public class ConfigurationSelector extends Composite {
@Override
public void setQualifier(ResourceQualifier qualifier) {
- ScreenSizeQualifier q = (ScreenSizeQualifier)qualifier;
+ ScreenLayoutSizeQualifier q = (ScreenLayoutSizeQualifier)qualifier;
- ScreenSize value = q.getValue();
+ ScreenLayoutSize value = q.getValue();
if (value == null) {
mSize.clearSelection();
} else {
- mSize.select(ScreenSize.getIndex(value));
+ mSize.select(ScreenLayoutSize.getIndex(value));
}
}
}
@@ -1341,18 +1342,18 @@ public class ConfigurationSelector extends Composite {
/**
* Edit widget for {@link DockModeQualifier}.
*/
- private class DockModeEdit extends QualifierEditBase {
+ private class UiModeEdit extends QualifierEditBase {
- private Combo mDockMode;
+ private Combo mUiMode;
- public DockModeEdit(Composite parent) {
- super(parent, DockModeQualifier.NAME);
+ public UiModeEdit(Composite parent) {
+ super(parent, UiModeQualifier.NAME);
- mDockMode = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
- fillCombo(mDockMode, DockMode.values());
+ mUiMode = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
+ fillCombo(mUiMode, UiMode.values());
- mDockMode.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- mDockMode.addSelectionListener(new SelectionListener() {
+ mUiMode.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ mUiMode.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
onDockModeChange();
}
@@ -1364,16 +1365,16 @@ public class ConfigurationSelector extends Composite {
protected void onDockModeChange() {
// update the current config
- int index = mDockMode.getSelectionIndex();
+ int index = mUiMode.getSelectionIndex();
if (index != -1) {
- mSelectedConfiguration.setDockModeQualifier(
- new DockModeQualifier(DockMode.getByIndex(index)));
+ mSelectedConfiguration.setUiModeQualifier(
+ new UiModeQualifier(UiMode.getByIndex(index)));
} else {
// empty selection, means no qualifier.
// Since the qualifier classes are immutable, and we don't want to
// remove the qualifier from the configuration, we create a new default one.
- mSelectedConfiguration.setDockModeQualifier(new DockModeQualifier());
+ mSelectedConfiguration.setUiModeQualifier(new UiModeQualifier());
}
// notify of change
@@ -1382,13 +1383,13 @@ public class ConfigurationSelector extends Composite {
@Override
public void setQualifier(ResourceQualifier qualifier) {
- DockModeQualifier q = (DockModeQualifier)qualifier;
+ UiModeQualifier q = (UiModeQualifier)qualifier;
- DockMode value = q.getValue();
+ UiMode value = q.getValue();
if (value == null) {
- mDockMode.clearSelection();
+ mUiMode.clearSelection();
} else {
- mDockMode.select(DockMode.getIndex(value));
+ mUiMode.select(UiMode.getIndex(value));
}
}
}
@@ -1450,13 +1451,13 @@ public class ConfigurationSelector extends Composite {
/**
- * Edit widget for {@link PixelDensityQualifier}.
+ * Edit widget for {@link DensityQualifier}.
*/
- private class PixelDensityEdit extends QualifierEditBase {
+ private class DensityEdit extends QualifierEditBase {
private Combo mDensity;
- public PixelDensityEdit(Composite parent) {
- super(parent, PixelDensityQualifier.NAME);
+ public DensityEdit(Composite parent) {
+ super(parent, DensityQualifier.NAME);
mDensity = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
fillCombo(mDensity, Density.values());
@@ -1477,14 +1478,14 @@ public class ConfigurationSelector extends Composite {
int index = mDensity.getSelectionIndex();
if (index != -1) {
- mSelectedConfiguration.setPixelDensityQualifier(new PixelDensityQualifier(
+ mSelectedConfiguration.setDensityQualifier(new DensityQualifier(
Density.getByIndex(index)));
} else {
// empty selection, means no qualifier.
// Since the qualifier classes are immutable, and we don't want to
// remove the qualifier from the configuration, we create a new default one.
- mSelectedConfiguration.setPixelDensityQualifier(
- new PixelDensityQualifier());
+ mSelectedConfiguration.setDensityQualifier(
+ new DensityQualifier());
}
// notify of change
@@ -1493,7 +1494,7 @@ public class ConfigurationSelector extends Composite {
@Override
public void setQualifier(ResourceQualifier qualifier) {
- PixelDensityQualifier q = (PixelDensityQualifier)qualifier;
+ DensityQualifier q = (DensityQualifier)qualifier;
Density value = q.getValue();
if (value == null) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java
index 67d838e..c060712 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java
@@ -15,9 +15,9 @@
*/
package com.android.ide.eclipse.adt.internal.editors.manifest;
-import static com.android.resources.ScreenSize.LARGE;
-import static com.android.resources.ScreenSize.NORMAL;
-import static com.android.resources.ScreenSize.XLARGE;
+import static com.android.resources.ScreenLayoutSize.LARGE;
+import static com.android.resources.ScreenLayoutSize.NORMAL;
+import static com.android.resources.ScreenLayoutSize.XLARGE;
import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest;
import com.android.ide.eclipse.adt.internal.resources.ResourceHelper;
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
index b7ebb49..30e9bf7 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
@@ -28,14 +28,17 @@ import com.android.ide.common.rendering.api.SessionParams;
import com.android.ide.common.rendering.api.SessionParams.RenderingMode;
import com.android.ide.common.resources.ResourceRepository;
import com.android.ide.common.resources.ResourceResolver;
+import com.android.ide.common.resources.configuration.DensityQualifier;
import com.android.ide.common.resources.configuration.FolderConfiguration;
import com.android.ide.common.resources.configuration.KeyboardStateQualifier;
import com.android.ide.common.resources.configuration.NavigationMethodQualifier;
-import com.android.ide.common.resources.configuration.PixelDensityQualifier;
import com.android.ide.common.resources.configuration.ScreenDimensionQualifier;
+import com.android.ide.common.resources.configuration.ScreenHeightQualifier;
+import com.android.ide.common.resources.configuration.ScreenLayoutSizeQualifier;
import com.android.ide.common.resources.configuration.ScreenOrientationQualifier;
import com.android.ide.common.resources.configuration.ScreenRatioQualifier;
-import com.android.ide.common.resources.configuration.ScreenSizeQualifier;
+import com.android.ide.common.resources.configuration.ScreenWidthQualifier;
+import com.android.ide.common.resources.configuration.SmallestScreenWidthQualifier;
import com.android.ide.common.resources.configuration.TextInputMethodQualifier;
import com.android.ide.common.resources.configuration.TouchScreenQualifier;
import com.android.ide.common.sdk.LoadStatus;
@@ -49,9 +52,9 @@ import com.android.resources.Keyboard;
import com.android.resources.KeyboardState;
import com.android.resources.Navigation;
import com.android.resources.ResourceType;
+import com.android.resources.ScreenLayoutSize;
import com.android.resources.ScreenOrientation;
import com.android.resources.ScreenRatio;
-import com.android.resources.ScreenSize;
import com.android.resources.TouchScreen;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
@@ -274,10 +277,13 @@ public class ApiDemosRenderingTest extends SdkTestCase {
FolderConfiguration config = new FolderConfiguration();
// this matches an ADP1.
- config.addQualifier(new ScreenSizeQualifier(ScreenSize.NORMAL));
+ config.addQualifier(new SmallestScreenWidthQualifier(320));
+ config.addQualifier(new ScreenWidthQualifier(320));
+ config.addQualifier(new ScreenHeightQualifier(480));
+ config.addQualifier(new ScreenLayoutSizeQualifier(ScreenLayoutSize.NORMAL));
config.addQualifier(new ScreenRatioQualifier(ScreenRatio.NOTLONG));
config.addQualifier(new ScreenOrientationQualifier(ScreenOrientation.PORTRAIT));
- config.addQualifier(new PixelDensityQualifier(Density.MEDIUM));
+ config.addQualifier(new DensityQualifier(Density.MEDIUM));
config.addQualifier(new TouchScreenQualifier(TouchScreen.FINGER));
config.addQualifier(new KeyboardStateQualifier(KeyboardState.HIDDEN));
config.addQualifier(new TextInputMethodQualifier(Keyboard.QWERTY));
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java
index f2a6b54..46f19cf 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java
@@ -25,7 +25,6 @@ import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
import com.android.ide.eclipse.adt.io.IFileWrapper;
import com.android.ide.eclipse.adt.io.IFolderWrapper;
import com.android.ide.eclipse.mock.Mocks;
-import com.android.resources.DockMode;
import com.android.resources.Keyboard;
import com.android.resources.KeyboardState;
import com.android.resources.Navigation;
@@ -34,6 +33,7 @@ import com.android.resources.NightMode;
import com.android.resources.ResourceFolderType;
import com.android.resources.ScreenOrientation;
import com.android.resources.TouchScreen;
+import com.android.resources.UiMode;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -168,7 +168,7 @@ public class ConfigMatchTest extends TestCase {
"normal", // screen size
"notlong", // screen ratio
ScreenOrientation.LANDSCAPE.getResourceValue(), // screen orientation
- DockMode.DESK.getResourceValue(), // dock mode
+ UiMode.DESK.getResourceValue(), // dock mode
NightMode.NIGHT.getResourceValue(), // night mode
"mdpi", // dpi
TouchScreen.FINGER.getResourceValue(), // touch mode
@@ -197,7 +197,7 @@ public class ConfigMatchTest extends TestCase {
"normal", // screen size
"notlong", // screen ratio
ScreenOrientation.LANDSCAPE.getResourceValue(), // screen orientation
- DockMode.DESK.getResourceValue(), // dock mode
+ UiMode.DESK.getResourceValue(), // dock mode
NightMode.NIGHT.getResourceValue(), // night mode
"mdpi", // dpi
TouchScreen.FINGER.getResourceValue(), // touch mode
diff --git a/ide_common/src/com/android/ide/common/resources/SingleResourceFile.java b/ide_common/src/com/android/ide/common/resources/SingleResourceFile.java
index cd2b627..9c8977e 100644
--- a/ide_common/src/com/android/ide/common/resources/SingleResourceFile.java
+++ b/ide_common/src/com/android/ide/common/resources/SingleResourceFile.java
@@ -18,7 +18,7 @@ package com.android.ide.common.resources;
import com.android.ide.common.rendering.api.DensityBasedResourceValue;
import com.android.ide.common.rendering.api.ResourceValue;
-import com.android.ide.common.resources.configuration.PixelDensityQualifier;
+import com.android.ide.common.resources.configuration.DensityQualifier;
import com.android.io.IAbstractFile;
import com.android.resources.FolderTypeRelationship;
import com.android.resources.ResourceType;
@@ -57,7 +57,7 @@ public class SingleResourceFile extends ResourceFile {
mResourceName = getResourceName(mType);
// test if there's a density qualifier associated with the resource
- PixelDensityQualifier qualifier = folder.getConfiguration().getPixelDensityQualifier();
+ DensityQualifier qualifier = folder.getConfiguration().getDensityQualifier();
if (qualifier == null) {
mValue = new ResourceValue(mType, getResourceName(mType),
diff --git a/ide_common/src/com/android/ide/common/resources/configuration/PixelDensityQualifier.java b/ide_common/src/com/android/ide/common/resources/configuration/DensityQualifier.java
index 80842a8..bb23b44 100644
--- a/ide_common/src/com/android/ide/common/resources/configuration/PixelDensityQualifier.java
+++ b/ide_common/src/com/android/ide/common/resources/configuration/DensityQualifier.java
@@ -25,18 +25,18 @@ import java.util.regex.Pattern;
/**
* Resource Qualifier for Screen Pixel Density.
*/
-public final class PixelDensityQualifier extends EnumBasedResourceQualifier {
+public final class DensityQualifier extends EnumBasedResourceQualifier {
private final static Pattern sDensityLegacyPattern = Pattern.compile("^(\\d+)dpi$");//$NON-NLS-1$
- public static final String NAME = "Pixel Density";
+ public static final String NAME = "Density";
private Density mValue = Density.MEDIUM;
- public PixelDensityQualifier() {
+ public DensityQualifier() {
// pass
}
- public PixelDensityQualifier(Density value) {
+ public DensityQualifier(Density value) {
mValue = value;
}
@@ -79,9 +79,9 @@ public final class PixelDensityQualifier extends EnumBasedResourceQualifier {
}
if (density != null) {
- PixelDensityQualifier qualifier = new PixelDensityQualifier();
+ DensityQualifier qualifier = new DensityQualifier();
qualifier.mValue = density;
- config.setPixelDensityQualifier(qualifier);
+ config.setDensityQualifier(qualifier);
return true;
}
@@ -90,7 +90,7 @@ public final class PixelDensityQualifier extends EnumBasedResourceQualifier {
@Override
public boolean isMatchFor(ResourceQualifier qualifier) {
- if (qualifier instanceof PixelDensityQualifier) {
+ if (qualifier instanceof DensityQualifier) {
// as long as there's a density qualifier, it's always a match.
// The best match will be found later.
return true;
@@ -105,8 +105,8 @@ public final class PixelDensityQualifier extends EnumBasedResourceQualifier {
return true;
}
- PixelDensityQualifier compareQ = (PixelDensityQualifier)compareTo;
- PixelDensityQualifier referenceQ = (PixelDensityQualifier)reference;
+ DensityQualifier compareQ = (DensityQualifier)compareTo;
+ DensityQualifier referenceQ = (DensityQualifier)reference;
if (compareQ.mValue == referenceQ.mValue) {
// what we have is already the best possible match (exact match)
diff --git a/ide_common/src/com/android/ide/common/resources/configuration/FolderConfiguration.java b/ide_common/src/com/android/ide/common/resources/configuration/FolderConfiguration.java
index 8b04bac..c0d1293 100644
--- a/ide_common/src/com/android/ide/common/resources/configuration/FolderConfiguration.java
+++ b/ide_common/src/com/android/ide/common/resources/configuration/FolderConfiguration.java
@@ -50,10 +50,10 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
private final static int INDEX_SMALLEST_SCREEN_WIDTH = 4;
private final static int INDEX_SCREEN_WIDTH = 5;
private final static int INDEX_SCREEN_HEIGHT = 6;
- private final static int INDEX_SCREEN_SIZE = 7;
+ private final static int INDEX_SCREEN_LAYOUT_SIZE = 7;
private final static int INDEX_SCREEN_RATIO = 8;
private final static int INDEX_SCREEN_ORIENTATION = 9;
- private final static int INDEX_DOCK_MODE = 10;
+ private final static int INDEX_UI_MODE = 10;
private final static int INDEX_NIGHT_MODE = 11;
private final static int INDEX_PIXEL_DENSITY = 12;
private final static int INDEX_TOUCH_TYPE = 13;
@@ -229,8 +229,8 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
} else if (qualifier instanceof ScreenHeightQualifier) {
mQualifiers[INDEX_SCREEN_HEIGHT] = qualifier;
- } else if (qualifier instanceof ScreenSizeQualifier) {
- mQualifiers[INDEX_SCREEN_SIZE] = qualifier;
+ } else if (qualifier instanceof ScreenLayoutSizeQualifier) {
+ mQualifiers[INDEX_SCREEN_LAYOUT_SIZE] = qualifier;
} else if (qualifier instanceof ScreenRatioQualifier) {
mQualifiers[INDEX_SCREEN_RATIO] = qualifier;
@@ -238,13 +238,13 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
} else if (qualifier instanceof ScreenOrientationQualifier) {
mQualifiers[INDEX_SCREEN_ORIENTATION] = qualifier;
- } else if (qualifier instanceof DockModeQualifier) {
- mQualifiers[INDEX_DOCK_MODE] = qualifier;
+ } else if (qualifier instanceof UiModeQualifier) {
+ mQualifiers[INDEX_UI_MODE] = qualifier;
} else if (qualifier instanceof NightModeQualifier) {
mQualifiers[INDEX_NIGHT_MODE] = qualifier;
- } else if (qualifier instanceof PixelDensityQualifier) {
+ } else if (qualifier instanceof DensityQualifier) {
mQualifiers[INDEX_PIXEL_DENSITY] = qualifier;
} else if (qualifier instanceof TouchScreenQualifier) {
@@ -350,12 +350,12 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
return (ScreenHeightQualifier) mQualifiers[INDEX_SCREEN_HEIGHT];
}
- public void setScreenSizeQualifier(ScreenSizeQualifier qualifier) {
- mQualifiers[INDEX_SCREEN_SIZE] = qualifier;
+ public void setScreenLayoutSizeQualifier(ScreenLayoutSizeQualifier qualifier) {
+ mQualifiers[INDEX_SCREEN_LAYOUT_SIZE] = qualifier;
}
- public ScreenSizeQualifier getScreenSizeQualifier() {
- return (ScreenSizeQualifier)mQualifiers[INDEX_SCREEN_SIZE];
+ public ScreenLayoutSizeQualifier getScreenLayoutSizeQualifier() {
+ return (ScreenLayoutSizeQualifier)mQualifiers[INDEX_SCREEN_LAYOUT_SIZE];
}
public void setScreenRatioQualifier(ScreenRatioQualifier qualifier) {
@@ -374,12 +374,12 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
return (ScreenOrientationQualifier)mQualifiers[INDEX_SCREEN_ORIENTATION];
}
- public void setDockModeQualifier(DockModeQualifier qualifier) {
- mQualifiers[INDEX_DOCK_MODE] = qualifier;
+ public void setUiModeQualifier(UiModeQualifier qualifier) {
+ mQualifiers[INDEX_UI_MODE] = qualifier;
}
- public DockModeQualifier getDockModeQualifier() {
- return (DockModeQualifier)mQualifiers[INDEX_DOCK_MODE];
+ public UiModeQualifier getUiModeQualifier() {
+ return (UiModeQualifier)mQualifiers[INDEX_UI_MODE];
}
public void setNightModeQualifier(NightModeQualifier qualifier) {
@@ -390,12 +390,12 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
return (NightModeQualifier)mQualifiers[INDEX_NIGHT_MODE];
}
- public void setPixelDensityQualifier(PixelDensityQualifier qualifier) {
+ public void setDensityQualifier(DensityQualifier qualifier) {
mQualifiers[INDEX_PIXEL_DENSITY] = qualifier;
}
- public PixelDensityQualifier getPixelDensityQualifier() {
- return (PixelDensityQualifier)mQualifiers[INDEX_PIXEL_DENSITY];
+ public DensityQualifier getDensityQualifier() {
+ return (DensityQualifier)mQualifiers[INDEX_PIXEL_DENSITY];
}
public void setTouchTypeQualifier(TouchScreenQualifier qualifier) {
@@ -457,7 +457,7 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
/**
* Updates the {@link SmallestScreenWidthQualifier}, {@link ScreenWidthQualifier}, and
* {@link ScreenHeightQualifier} based on the (required) values of
- * {@link ScreenDimensionQualifier} {@link PixelDensityQualifier}, and
+ * {@link ScreenDimensionQualifier} {@link DensityQualifier}, and
* {@link ScreenOrientationQualifier}.
*
* Also the density cannot be {@link Density#NODPI} as it's not valid on a device.
@@ -469,7 +469,7 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
ResourceQualifier orientQ = mQualifiers[INDEX_SCREEN_ORIENTATION];
if (sizeQ != null && densityQ != null && orientQ != null) {
- Density density = ((PixelDensityQualifier) densityQ).getValue();
+ Density density = ((DensityQualifier) densityQ).getValue();
if (density == Density.NODPI) {
return;
}
@@ -846,12 +846,12 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
mQualifiers[INDEX_SMALLEST_SCREEN_WIDTH] = new SmallestScreenWidthQualifier();
mQualifiers[INDEX_SCREEN_WIDTH] = new ScreenWidthQualifier();
mQualifiers[INDEX_SCREEN_HEIGHT] = new ScreenHeightQualifier();
- mQualifiers[INDEX_SCREEN_SIZE] = new ScreenSizeQualifier();
+ mQualifiers[INDEX_SCREEN_LAYOUT_SIZE] = new ScreenLayoutSizeQualifier();
mQualifiers[INDEX_SCREEN_RATIO] = new ScreenRatioQualifier();
mQualifiers[INDEX_SCREEN_ORIENTATION] = new ScreenOrientationQualifier();
- mQualifiers[INDEX_DOCK_MODE] = new DockModeQualifier();
+ mQualifiers[INDEX_UI_MODE] = new UiModeQualifier();
mQualifiers[INDEX_NIGHT_MODE] = new NightModeQualifier();
- mQualifiers[INDEX_PIXEL_DENSITY] = new PixelDensityQualifier();
+ mQualifiers[INDEX_PIXEL_DENSITY] = new DensityQualifier();
mQualifiers[INDEX_TOUCH_TYPE] = new TouchScreenQualifier();
mQualifiers[INDEX_KEYBOARD_STATE] = new KeyboardStateQualifier();
mQualifiers[INDEX_TEXT_INPUT_METHOD] = new TextInputMethodQualifier();
diff --git a/ide_common/src/com/android/ide/common/resources/configuration/ScreenSizeQualifier.java b/ide_common/src/com/android/ide/common/resources/configuration/ScreenLayoutSizeQualifier.java
index 7ab6dd8..0f22d36 100644
--- a/ide_common/src/com/android/ide/common/resources/configuration/ScreenSizeQualifier.java
+++ b/ide_common/src/com/android/ide/common/resources/configuration/ScreenLayoutSizeQualifier.java
@@ -17,26 +17,26 @@
package com.android.ide.common.resources.configuration;
import com.android.resources.ResourceEnum;
-import com.android.resources.ScreenSize;
+import com.android.resources.ScreenLayoutSize;
/**
* Resource Qualifier for Screen Size. Size can be "small", "normal", "large" and "x-large"
*/
-public class ScreenSizeQualifier extends EnumBasedResourceQualifier {
+public class ScreenLayoutSizeQualifier extends EnumBasedResourceQualifier {
public static final String NAME = "Screen Size";
- private ScreenSize mValue = null;
+ private ScreenLayoutSize mValue = null;
- public ScreenSizeQualifier() {
+ public ScreenLayoutSizeQualifier() {
}
- public ScreenSizeQualifier(ScreenSize value) {
+ public ScreenLayoutSizeQualifier(ScreenLayoutSize value) {
mValue = value;
}
- public ScreenSize getValue() {
+ public ScreenLayoutSize getValue() {
return mValue;
}
@@ -57,10 +57,10 @@ public class ScreenSizeQualifier extends EnumBasedResourceQualifier {
@Override
public boolean checkAndSet(String value, FolderConfiguration config) {
- ScreenSize size = ScreenSize.getEnum(value);
+ ScreenLayoutSize size = ScreenLayoutSize.getEnum(value);
if (size != null) {
- ScreenSizeQualifier qualifier = new ScreenSizeQualifier(size);
- config.setScreenSizeQualifier(qualifier);
+ ScreenLayoutSizeQualifier qualifier = new ScreenLayoutSizeQualifier(size);
+ config.setScreenLayoutSizeQualifier(qualifier);
return true;
}
diff --git a/ide_common/src/com/android/ide/common/resources/configuration/DockModeQualifier.java b/ide_common/src/com/android/ide/common/resources/configuration/UiModeQualifier.java
index 2c832eb..f9ad0b7 100644
--- a/ide_common/src/com/android/ide/common/resources/configuration/DockModeQualifier.java
+++ b/ide_common/src/com/android/ide/common/resources/configuration/UiModeQualifier.java
@@ -16,27 +16,27 @@
package com.android.ide.common.resources.configuration;
-import com.android.resources.DockMode;
import com.android.resources.ResourceEnum;
+import com.android.resources.UiMode;
/**
- * Resource Qualifier for Navigation Method.
+ * Resource Qualifier for UI Mode.
*/
-public final class DockModeQualifier extends EnumBasedResourceQualifier {
+public final class UiModeQualifier extends EnumBasedResourceQualifier {
- public static final String NAME = "Dock Mode";
+ public static final String NAME = "UI Mode";
- private DockMode mValue;
+ private UiMode mValue;
- public DockModeQualifier() {
+ public UiModeQualifier() {
// pass
}
- public DockModeQualifier(DockMode value) {
+ public UiModeQualifier(UiMode value) {
mValue = value;
}
- public DockMode getValue() {
+ public UiMode getValue() {
return mValue;
}
@@ -52,15 +52,15 @@ public final class DockModeQualifier extends EnumBasedResourceQualifier {
@Override
public String getShortName() {
- return "Dock Mode";
+ return NAME;
}
@Override
public boolean checkAndSet(String value, FolderConfiguration config) {
- DockMode mode = DockMode.getEnum(value);
+ UiMode mode = UiMode.getEnum(value);
if (mode != null) {
- DockModeQualifier qualifier = new DockModeQualifier(mode);
- config.setDockModeQualifier(qualifier);
+ UiModeQualifier qualifier = new UiModeQualifier(mode);
+ config.setUiModeQualifier(qualifier);
return true;
}
@@ -69,13 +69,13 @@ public final class DockModeQualifier extends EnumBasedResourceQualifier {
@Override
public boolean isMatchFor(ResourceQualifier qualifier) {
- // only NONE is a match other DockModes
- if (mValue == DockMode.NONE) {
+ // only normal is a match for all UI mode, because it's not an actual mode.
+ if (mValue == UiMode.NORMAL) {
return true;
}
// others must be an exact match
- return ((DockModeQualifier)qualifier).mValue == mValue;
+ return ((UiModeQualifier)qualifier).mValue == mValue;
}
@Override
@@ -84,8 +84,8 @@ public final class DockModeQualifier extends EnumBasedResourceQualifier {
return true;
}
- DockModeQualifier compareQualifier = (DockModeQualifier)compareTo;
- DockModeQualifier referenceQualifier = (DockModeQualifier)reference;
+ UiModeQualifier compareQualifier = (UiModeQualifier)compareTo;
+ UiModeQualifier referenceQualifier = (UiModeQualifier)reference;
if (compareQualifier.getValue() == referenceQualifier.getValue()) {
// what we have is already the best possible match (exact match)
@@ -93,8 +93,8 @@ public final class DockModeQualifier extends EnumBasedResourceQualifier {
} else if (mValue == referenceQualifier.mValue) {
// got new exact value, this is the best!
return true;
- } else if (mValue == DockMode.NONE) {
- // else "none" can be a match in case there's no exact match
+ } else if (mValue == UiMode.NORMAL) {
+ // else "normal" can be a match in case there's no exact match
return true;
}
diff --git a/ide_common/tests/src/com/android/ide/common/resources/configuration/DockModeQualifierTest.java b/ide_common/tests/src/com/android/ide/common/resources/configuration/DockModeQualifierTest.java
index c2b7452..1653805 100644
--- a/ide_common/tests/src/com/android/ide/common/resources/configuration/DockModeQualifierTest.java
+++ b/ide_common/tests/src/com/android/ide/common/resources/configuration/DockModeQualifierTest.java
@@ -16,24 +16,24 @@
package com.android.ide.common.resources.configuration;
-import com.android.resources.DockMode;
+import com.android.resources.UiMode;
import junit.framework.TestCase;
public class DockModeQualifierTest extends TestCase {
- private DockModeQualifier mCarQualifier;
- private DockModeQualifier mDeskQualifier;
- private DockModeQualifier mTVQualifier;
- private DockModeQualifier mNoneQualifier;
+ private UiModeQualifier mCarQualifier;
+ private UiModeQualifier mDeskQualifier;
+ private UiModeQualifier mTVQualifier;
+ private UiModeQualifier mNoneQualifier;
@Override
protected void setUp() throws Exception {
super.setUp();
- mCarQualifier = new DockModeQualifier(DockMode.CAR);
- mDeskQualifier = new DockModeQualifier(DockMode.DESK);
- mTVQualifier = new DockModeQualifier(DockMode.TELEVISION);
- mNoneQualifier = new DockModeQualifier(DockMode.NONE);
+ mCarQualifier = new UiModeQualifier(UiMode.CAR);
+ mDeskQualifier = new UiModeQualifier(UiMode.DESK);
+ mTVQualifier = new UiModeQualifier(UiMode.TELEVISION);
+ mNoneQualifier = new UiModeQualifier(UiMode.NORMAL);
}
@Override
diff --git a/ide_common/tests/src/com/android/ide/common/resources/configuration/PixelDensityQualifierTest.java b/ide_common/tests/src/com/android/ide/common/resources/configuration/PixelDensityQualifierTest.java
index b99f2af..4ab493a 100644
--- a/ide_common/tests/src/com/android/ide/common/resources/configuration/PixelDensityQualifierTest.java
+++ b/ide_common/tests/src/com/android/ide/common/resources/configuration/PixelDensityQualifierTest.java
@@ -22,13 +22,13 @@ import junit.framework.TestCase;
public class PixelDensityQualifierTest extends TestCase {
- private PixelDensityQualifier pdq;
+ private DensityQualifier pdq;
private FolderConfiguration config;
@Override
protected void setUp() throws Exception {
super.setUp();
- pdq = new PixelDensityQualifier();
+ pdq = new DensityQualifier();
config = new FolderConfiguration();
}
@@ -41,9 +41,9 @@ public class PixelDensityQualifierTest extends TestCase {
public void testCheckAndSet() {
assertEquals(true, pdq.checkAndSet("ldpi", config));//$NON-NLS-1$
- assertTrue(config.getPixelDensityQualifier() != null);
- assertEquals(Density.LOW, config.getPixelDensityQualifier().getValue());
- assertEquals("ldpi", config.getPixelDensityQualifier().toString()); //$NON-NLS-1$
+ assertTrue(config.getDensityQualifier() != null);
+ assertEquals(Density.LOW, config.getDensityQualifier().getValue());
+ assertEquals("ldpi", config.getDensityQualifier().toString()); //$NON-NLS-1$
}
public void testFailures() {
@@ -55,10 +55,10 @@ public class PixelDensityQualifierTest extends TestCase {
}
public void testIsBetterMatchThan() {
- PixelDensityQualifier ldpi = new PixelDensityQualifier(Density.LOW);
- PixelDensityQualifier mdpi = new PixelDensityQualifier(Density.MEDIUM);
- PixelDensityQualifier hdpi = new PixelDensityQualifier(Density.HIGH);
- PixelDensityQualifier xhdpi = new PixelDensityQualifier(Density.XHIGH);
+ DensityQualifier ldpi = new DensityQualifier(Density.LOW);
+ DensityQualifier mdpi = new DensityQualifier(Density.MEDIUM);
+ DensityQualifier hdpi = new DensityQualifier(Density.HIGH);
+ DensityQualifier xhdpi = new DensityQualifier(Density.XHIGH);
// first test that each Q is a better match than all other Qs when the ref is the same Q.
assertTrue(ldpi.isBetterMatchThan(mdpi, ldpi));
diff --git a/ide_common/tests/src/com/android/ide/common/resources/configuration/ScreenSizeQualifierTest.java b/ide_common/tests/src/com/android/ide/common/resources/configuration/ScreenSizeQualifierTest.java
index b19f125..d05399d 100644
--- a/ide_common/tests/src/com/android/ide/common/resources/configuration/ScreenSizeQualifierTest.java
+++ b/ide_common/tests/src/com/android/ide/common/resources/configuration/ScreenSizeQualifierTest.java
@@ -16,19 +16,19 @@
package com.android.ide.common.resources.configuration;
-import com.android.resources.ScreenSize;
+import com.android.resources.ScreenLayoutSize;
import junit.framework.TestCase;
public class ScreenSizeQualifierTest extends TestCase {
- private ScreenSizeQualifier ssq;
+ private ScreenLayoutSizeQualifier ssq;
private FolderConfiguration config;
@Override
protected void setUp() throws Exception {
super.setUp();
- ssq = new ScreenSizeQualifier();
+ ssq = new ScreenLayoutSizeQualifier();
config = new FolderConfiguration();
}
@@ -41,29 +41,29 @@ public class ScreenSizeQualifierTest extends TestCase {
public void testSmall() {
assertEquals(true, ssq.checkAndSet("small", config)); //$NON-NLS-1$
- assertTrue(config.getScreenSizeQualifier() != null);
- assertEquals(ScreenSize.SMALL, config.getScreenSizeQualifier().getValue());
- assertEquals("small", config.getScreenSizeQualifier().toString()); //$NON-NLS-1$
+ assertTrue(config.getScreenLayoutSizeQualifier() != null);
+ assertEquals(ScreenLayoutSize.SMALL, config.getScreenLayoutSizeQualifier().getValue());
+ assertEquals("small", config.getScreenLayoutSizeQualifier().toString()); //$NON-NLS-1$
}
public void testNormal() {
assertEquals(true, ssq.checkAndSet("normal", config)); //$NON-NLS-1$
- assertTrue(config.getScreenSizeQualifier() != null);
- assertEquals(ScreenSize.NORMAL, config.getScreenSizeQualifier().getValue());
- assertEquals("normal", config.getScreenSizeQualifier().toString()); //$NON-NLS-1$
+ assertTrue(config.getScreenLayoutSizeQualifier() != null);
+ assertEquals(ScreenLayoutSize.NORMAL, config.getScreenLayoutSizeQualifier().getValue());
+ assertEquals("normal", config.getScreenLayoutSizeQualifier().toString()); //$NON-NLS-1$
}
public void testLarge() {
assertEquals(true, ssq.checkAndSet("large", config)); //$NON-NLS-1$
- assertTrue(config.getScreenSizeQualifier() != null);
- assertEquals(ScreenSize.LARGE, config.getScreenSizeQualifier().getValue());
- assertEquals("large", config.getScreenSizeQualifier().toString()); //$NON-NLS-1$
+ assertTrue(config.getScreenLayoutSizeQualifier() != null);
+ assertEquals(ScreenLayoutSize.LARGE, config.getScreenLayoutSizeQualifier().getValue());
+ assertEquals("large", config.getScreenLayoutSizeQualifier().toString()); //$NON-NLS-1$
}
public void testXLarge() {
assertEquals(true, ssq.checkAndSet("xlarge", config)); //$NON-NLS-1$
- assertTrue(config.getScreenSizeQualifier() != null);
- assertEquals(ScreenSize.XLARGE, config.getScreenSizeQualifier().getValue());
- assertEquals("xlarge", config.getScreenSizeQualifier().toString()); //$NON-NLS-1$
+ assertTrue(config.getScreenLayoutSizeQualifier() != null);
+ assertEquals(ScreenLayoutSize.XLARGE, config.getScreenLayoutSizeQualifier().getValue());
+ assertEquals("xlarge", config.getScreenLayoutSizeQualifier().toString()); //$NON-NLS-1$
}
}
diff --git a/layoutlib_api/src/com/android/ide/common/rendering/api/RenderParams.java b/layoutlib_api/src/com/android/ide/common/rendering/api/RenderParams.java
index 2cfe770..32c1ff2 100644
--- a/layoutlib_api/src/com/android/ide/common/rendering/api/RenderParams.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/RenderParams.java
@@ -17,7 +17,7 @@
package com.android.ide.common.rendering.api;
import com.android.resources.Density;
-import com.android.resources.ScreenSize;
+import com.android.resources.ScreenLayoutSize;
/**
* Base class for rendering parameters. This include the generic parameters but not what needs
@@ -46,7 +46,7 @@ public abstract class RenderParams {
private IImageFactory mImageFactory = null;
- private ScreenSize mConfigScreenSize = null;
+ private ScreenLayoutSize mConfigScreenSize = null;
private String mAppIcon = null;
private String mAppLabel = null;
private String mLocale = null;
@@ -138,7 +138,7 @@ public abstract class RenderParams {
mImageFactory = imageFactory;
}
- public void setConfigScreenSize(ScreenSize size) {
+ public void setConfigScreenSize(ScreenLayoutSize size) {
mConfigScreenSize = size;
}
@@ -218,7 +218,7 @@ public abstract class RenderParams {
return mImageFactory;
}
- public ScreenSize getConfigScreenSize() {
+ public ScreenLayoutSize getConfigScreenSize() {
return mConfigScreenSize;
}