aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-12-09 19:40:29 -0800
committerXavier Ducrohet <xav@android.com>2010-12-10 11:30:54 -0800
commit79ebb8f4ec3236d361c4b6a6d97440a29c50aa4a (patch)
tree2b0a0b0047a5e9d7c5e794370db5a79163c75f03 /eclipse
parent9a1f4d718be6c277b344ed361821e275858ebd11 (diff)
downloadsdk-79ebb8f4ec3236d361c4b6a6d97440a29c50aa4a.zip
sdk-79ebb8f4ec3236d361c4b6a6d97440a29c50aa4a.tar.gz
sdk-79ebb8f4ec3236d361c4b6a6d97440a29c50aa4a.tar.bz2
Clean up the api around Layoutlib.
Move (Style/DensityBased)ResourceValue into layoutlib_api and make the API use that instead of the interface. We'll get ride of the interfaces once only obsolete platforms use them. In ide-commons also got rid of LayoutBridgeWrapper and moved the code in LayoutLibrary which does not expose the bridge anymore, and instead expose an API similar to the LayoutBridge class. Updated ADT to use LayoutLibrary directly instead of going through LayoutLibrary.getBridge(). This allows us to hide some things like querying the API level and relying instead on Capabilities (with special handle for legacy bridges). Also added an error message to LayoutLibrary to display why it may have failed to load. Added a check to the API level and don't load layoutlib that are more recent than the client. Change-Id: Ie4e615d8d32485ee577bb88e95cd3f562bf590cb
Diffstat (limited to 'eclipse')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java26
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java45
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteComposite.java7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/MultiResourceFile.java5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java29
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ResourceFile.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/SingleResourceFile.java13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java12
11 files changed, 72 insertions, 81 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java
index 1cad70a..a7cdf35 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java
@@ -23,8 +23,8 @@ import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.layoutlib.api.IXmlPullParser;
+import com.android.layoutlib.api.ResourceDensity;
import com.android.layoutlib.api.ViewInfo;
-import com.android.layoutlib.api.IDensityBasedResourceValue.Density;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
@@ -549,7 +549,7 @@ public final class UiElementPullParser extends BasePullParser {
case COMPLEX_UNIT_DIP:
case COMPLEX_UNIT_SP: // intended fall-through since we don't
// adjust for font size
- f *= (float)mDensityValue / Density.DEFAULT_DENSITY;
+ f *= (float)mDensityValue / ResourceDensity.DEFAULT_DENSITY;
break;
case COMPLEX_UNIT_PT:
f *= mXdpi * (1.0f / 72);
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 ee6aeca..8286d3b 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
@@ -39,8 +39,8 @@ import com.android.ide.eclipse.adt.internal.sdk.LayoutDevice;
import com.android.ide.eclipse.adt.internal.sdk.LayoutDeviceManager;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.ide.eclipse.adt.internal.sdk.LayoutDevice.DeviceConfig;
-import com.android.layoutlib.api.IResourceValue;
-import com.android.layoutlib.api.IStyleResourceValue;
+import com.android.layoutlib.api.ResourceValue;
+import com.android.layoutlib.api.StyleResourceValue;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.resources.Density;
import com.android.sdklib.resources.DockMode;
@@ -183,8 +183,8 @@ public class ConfigurationComposite extends Composite {
ProjectResources getProjectResources();
ProjectResources getFrameworkResources();
ProjectResources getFrameworkResources(IAndroidTarget target);
- Map<String, Map<String, IResourceValue>> getConfiguredProjectResources();
- Map<String, Map<String, IResourceValue>> getConfiguredFrameworkResources();
+ Map<String, Map<String, ResourceValue>> getConfiguredProjectResources();
+ Map<String, Map<String, ResourceValue>> getConfiguredFrameworkResources();
}
/**
@@ -1221,17 +1221,17 @@ public class ConfigurationComposite extends Composite {
// get the themes, and languages from the Framework.
if (frameworkProject != null) {
// get the configured resources for the framework
- Map<String, Map<String, IResourceValue>> frameworResources =
+ Map<String, Map<String, ResourceValue>> frameworResources =
frameworkProject.getConfiguredResources(getCurrentConfig());
if (frameworResources != null) {
// get the styles.
- Map<String, IResourceValue> styles = frameworResources.get(
+ Map<String, ResourceValue> styles = frameworResources.get(
ResourceType.STYLE.getName());
// collect the themes out of all the styles.
- for (IResourceValue value : styles.values()) {
+ for (ResourceValue value : styles.values()) {
String name = value.getName();
if (name.startsWith("Theme.") || name.equals("Theme")) {
themes.add(value.getName());
@@ -1256,18 +1256,18 @@ public class ConfigurationComposite extends Composite {
// in cases where the opened file is not linked to a project, this could be null.
if (project != null) {
// get the configured resources for the project
- Map<String, Map<String, IResourceValue>> configuredProjectRes =
+ Map<String, Map<String, ResourceValue>> configuredProjectRes =
mListener.getConfiguredProjectResources();
if (configuredProjectRes != null) {
// get the styles.
- Map<String, IResourceValue> styleMap = configuredProjectRes.get(
+ Map<String, ResourceValue> styleMap = configuredProjectRes.get(
ResourceType.STYLE.getName());
if (styleMap != null) {
// collect the themes out of all the styles, ie styles that extend,
// directly or indirectly a platform theme.
- for (IResourceValue value : styleMap.values()) {
+ for (ResourceValue value : styleMap.values()) {
if (isTheme(value, styleMap)) {
themes.add(value.getName());
}
@@ -1901,9 +1901,9 @@ public class ConfigurationComposite extends Composite {
* @param styleMap the map of styles for the current project. Key is the style name.
* @return True if the given <var>style</var> is a theme.
*/
- private boolean isTheme(IResourceValue value, Map<String, IResourceValue> styleMap) {
- if (value instanceof IStyleResourceValue) {
- IStyleResourceValue style = (IStyleResourceValue)value;
+ private boolean isTheme(ResourceValue value, Map<String, ResourceValue> styleMap) {
+ if (value instanceof StyleResourceValue) {
+ StyleResourceValue style = (StyleResourceValue)value;
boolean frameworkStyle = false;
String parentStyle = style.getParentStyle();
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
index 0ae9c3c..4c97f62 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
@@ -47,11 +47,11 @@ import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.ide.eclipse.adt.internal.sdk.Sdk.ITargetChangeListener;
import com.android.ide.eclipse.adt.io.IFileWrapper;
-import com.android.layoutlib.api.IResourceValue;
+import com.android.layoutlib.api.Capability;
import com.android.layoutlib.api.IXmlPullParser;
-import com.android.layoutlib.api.LayoutBridge;
import com.android.layoutlib.api.LayoutLog;
import com.android.layoutlib.api.LayoutScene;
+import com.android.layoutlib.api.ResourceValue;
import com.android.layoutlib.api.SceneParams;
import com.android.layoutlib.api.SceneParams.RenderingMode;
import com.android.layoutlib.api.SceneResult.SceneStatus;
@@ -205,8 +205,8 @@ public class GraphicalEditorPart extends EditorPart
*/
private String mIncludedWithinId;
- private Map<String, Map<String, IResourceValue>> mConfiguredFrameworkRes;
- private Map<String, Map<String, IResourceValue>> mConfiguredProjectRes;
+ private Map<String, Map<String, ResourceValue>> mConfiguredFrameworkRes;
+ private Map<String, Map<String, ResourceValue>> mConfiguredProjectRes;
private ProjectCallback mProjectCallback;
private LayoutLog mLog;
@@ -623,7 +623,7 @@ public class GraphicalEditorPart extends EditorPart
preRenderingTargetChangeCleanUp(oldTarget);
}
- public Map<String, Map<String, IResourceValue>> getConfiguredFrameworkResources() {
+ public Map<String, Map<String, ResourceValue>> getConfiguredFrameworkResources() {
if (mConfiguredFrameworkRes == null && mConfigComposite != null) {
ProjectResources frameworkRes = getFrameworkResources();
@@ -639,7 +639,7 @@ public class GraphicalEditorPart extends EditorPart
return mConfiguredFrameworkRes;
}
- public Map<String, Map<String, IResourceValue>> getConfiguredProjectResources() {
+ public Map<String, Map<String, ResourceValue>> getConfiguredProjectResources() {
if (mConfiguredProjectRes == null && mConfigComposite != null) {
ProjectResources project = getProjectResources();
@@ -1023,7 +1023,7 @@ public class GraphicalEditorPart extends EditorPart
AndroidTargetData targetData = mConfigComposite.onXmlModelLoaded();
if (targetData != null) {
LayoutLibrary layoutLib = targetData.getLayoutLibrary();
- setClippingSupport(layoutLib.getBridge().getApiLevel() >= 4);
+ setClippingSupport(layoutLib.supports(Capability.UNBOUND_RENDERING));
}
mConfigListener.onConfigurationChange();
@@ -1240,7 +1240,7 @@ public class GraphicalEditorPart extends EditorPart
if (data != null) {
LayoutLibrary layoutLib = data.getLayoutLibrary();
- if (layoutLib.getBridge() != null) { // layoutLib can never be null.
+ if (layoutLib.getStatus() == LoadStatus.LOADED) {
return layoutLib;
} else if (displayError) { // getBridge() == null
// SDK is loaded but not the layout library!
@@ -1250,7 +1250,9 @@ public class GraphicalEditorPart extends EditorPart
displayError("Eclipse is loading framework information and the layout library from the SDK folder.\n%1$s will refresh automatically once the process is finished.",
mEditedFile.getName());
} else {
- displayError("Eclipse failed to load the framework information and the layout library!");
+ String message = layoutLib.getLoadMessage();
+ displayError("Eclipse failed to load the framework information and the layout library!" +
+ message != null ? "\n" + message : "");
}
}
} else { // data == null
@@ -1382,11 +1384,11 @@ public class GraphicalEditorPart extends EditorPart
}
// Get the resources of the file's project.
- Map<String, Map<String, IResourceValue>> configuredProjectRes =
+ Map<String, Map<String, ResourceValue>> configuredProjectRes =
mConfigListener.getConfiguredProjectResources();
// Get the framework resources
- Map<String, Map<String, IResourceValue>> frameworkResources =
+ Map<String, Map<String, ResourceValue>> frameworkResources =
mConfigListener.getConfiguredFrameworkResources();
// Abort the rendering if the resources are not found.
@@ -1481,9 +1483,9 @@ public class GraphicalEditorPart extends EditorPart
String contextLayoutName = mIncludedWithinId;
if (contextLayoutName != null) {
// Find the layout file.
- Map<String, IResourceValue> layouts = configuredProjectRes.get(
+ Map<String, ResourceValue> layouts = configuredProjectRes.get(
ResourceType.LAYOUT.getName());
- IResourceValue contextLayout = layouts.get(contextLayoutName);
+ ResourceValue contextLayout = layouts.get(contextLayoutName);
if (contextLayout != null) {
String path = contextLayout.getValue();
@@ -1537,7 +1539,7 @@ public class GraphicalEditorPart extends EditorPart
// set the Image Overlay as the image factory.
params.setImageFactory(getCanvasControl().getImageOverlay());
- LayoutScene scene = layoutLib.getBridge().createScene(params);
+ LayoutScene scene = layoutLib.createScene(params);
return scene;
}
@@ -1569,10 +1571,7 @@ public class GraphicalEditorPart extends EditorPart
LayoutLibrary layoutLib = data.getLayoutLibrary();
// layoutLib can never be null.
- LayoutBridge bridge = layoutLib.getBridge();
- if (bridge != null) {
- bridge.clearCaches(mEditedFile.getProject());
- }
+ layoutLib.clearCaches(mEditedFile.getProject());
}
}
@@ -1633,9 +1632,7 @@ public class GraphicalEditorPart extends EditorPart
// clear the cache in the bridge in case a bitmap/9-patch changed.
LayoutLibrary layoutLib = getReadyLayoutLib(true /*displayError*/);
if (layoutLib != null) {
- if (layoutLib.getBridge() != null) {
- layoutLib.getBridge().clearCaches(mEditedFile.getProject());
- }
+ layoutLib.clearCaches(mEditedFile.getProject());
}
}
@@ -1742,16 +1739,16 @@ public class GraphicalEditorPart extends EditorPart
// There is code to handle this, but it's in layoutlib; we should
// expose that and use it here.
- Map<String, Map<String, IResourceValue>> map;
+ Map<String, Map<String, ResourceValue>> map;
map = isFrameworkResource ? mConfiguredFrameworkRes : mConfiguredProjectRes;
if (map == null) {
// Not yet configured
return null;
}
- Map<String, IResourceValue> layoutMap = map.get(type.getName());
+ Map<String, ResourceValue> layoutMap = map.get(type.getName());
if (layoutMap != null) {
- IResourceValue value = layoutMap.get(name);
+ ResourceValue value = layoutMap.get(name);
if (value != null) {
String valueStr = value.getValue();
if (valueStr.startsWith("?")) { //$NON-NLS-1$
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteComposite.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteComposite.java
index 2bc9f34..f5aaeed 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteComposite.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteComposite.java
@@ -37,7 +37,7 @@ import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElement
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
-import com.android.layoutlib.api.LayoutBridge;
+import com.android.layoutlib.api.Capability;
import com.android.layoutlib.api.LayoutScene;
import com.android.layoutlib.api.ViewInfo;
import com.android.sdklib.SdkConstants;
@@ -725,10 +725,7 @@ public class PaletteComposite extends Composite {
boolean hasTransparency = false;
LayoutLibrary layoutLibrary = editor.getLayoutLibrary();
if (layoutLibrary != null) {
- LayoutBridge bridge = layoutLibrary.getBridge();
- if (bridge != null) {
- hasTransparency = bridge.getApiLevel() >= 5;
- }
+ hasTransparency = layoutLibrary.supports(Capability.TRANSPARENCY);
}
LayoutScene scene = null;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/MultiResourceFile.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/MultiResourceFile.java
index a96a4e8..3ad97e9 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/MultiResourceFile.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/MultiResourceFile.java
@@ -16,11 +16,10 @@
package com.android.ide.eclipse.adt.internal.resources.manager;
-import com.android.ide.common.layoutlib.ResourceValue;
import com.android.ide.common.layoutlib.ValueResourceParser;
import com.android.ide.common.layoutlib.ValueResourceParser.IValueResourceRepository;
import com.android.ide.eclipse.adt.internal.resources.ResourceType;
-import com.android.layoutlib.api.IResourceValue;
+import com.android.layoutlib.api.ResourceValue;
import com.android.sdklib.io.IAbstractFile;
import com.android.sdklib.io.StreamException;
@@ -160,7 +159,7 @@ public final class MultiResourceFile extends ResourceFile implements IValueResou
}
@Override
- public IResourceValue getValue(ResourceType type, String name) {
+ public ResourceValue getValue(ResourceType type, String name) {
update();
// get the list for the given type
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java
index 36ce3b0..3795811 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java
@@ -16,7 +16,6 @@
package com.android.ide.eclipse.adt.internal.resources.manager;
-import com.android.ide.common.layoutlib.ResourceValue;
import com.android.ide.eclipse.adt.internal.resources.IResourceRepository;
import com.android.ide.eclipse.adt.internal.resources.ResourceItem;
import com.android.ide.eclipse.adt.internal.resources.ResourceType;
@@ -27,7 +26,7 @@ import com.android.ide.eclipse.adt.internal.resources.configurations.ResourceQua
import com.android.ide.eclipse.adt.internal.sdk.ProjectState;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.ide.eclipse.adt.io.IFolderWrapper;
-import com.android.layoutlib.api.IResourceValue;
+import com.android.layoutlib.api.ResourceValue;
import com.android.sdklib.io.IAbstractFolder;
import org.eclipse.core.resources.IFolder;
@@ -372,11 +371,11 @@ public class ProjectResources implements IResourceRepository {
* Returns the resources values matching a given {@link FolderConfiguration}.
* @param referenceConfig the configuration that each value must match.
*/
- public Map<String, Map<String, IResourceValue>> getConfiguredResources(
+ public Map<String, Map<String, ResourceValue>> getConfiguredResources(
FolderConfiguration referenceConfig) {
- Map<String, Map<String, IResourceValue>> map =
- new HashMap<String, Map<String, IResourceValue>>();
+ Map<String, Map<String, ResourceValue>> map =
+ new HashMap<String, Map<String, ResourceValue>>();
// if the project contains libraries, we need to add the libraries resources here
// so that they are accessible to the layout rendering.
@@ -401,12 +400,12 @@ public class ProjectResources implements IResourceRepository {
// we don't want to simply replace the whole map, but instead merge the
// content of any sub-map
- Map<String, Map<String, IResourceValue>> libMap =
+ Map<String, Map<String, ResourceValue>> libMap =
libRes.getConfiguredResources(referenceConfig);
- for (Entry<String, Map<String, IResourceValue>> entry : libMap.entrySet()) {
+ for (Entry<String, Map<String, ResourceValue>> entry : libMap.entrySet()) {
// get the map currently in the result map for this resource type
- Map<String, IResourceValue> tempMap = map.get(entry.getKey());
+ Map<String, ResourceValue> tempMap = map.get(entry.getKey());
if (tempMap == null) {
// since there's no current map for this type, just add the map
// directly coming from the library resources
@@ -430,10 +429,10 @@ public class ProjectResources implements IResourceRepository {
// in the XML files.
if (mIdResourceList.size() > 0) {
String idType = ResourceType.ID.getName();
- Map<String, IResourceValue> idMap = map.get(idType);
+ Map<String, ResourceValue> idMap = map.get(idType);
if (idMap == null) {
- idMap = new HashMap<String, IResourceValue>();
+ idMap = new HashMap<String, ResourceValue>();
map.put(idType, idMap);
}
for (IdResourceItem id : mIdResourceList) {
@@ -449,12 +448,12 @@ public class ProjectResources implements IResourceRepository {
// we don't process ID resources since we already did it above.
if (key != ResourceType.ID) {
// get the local results
- Map<String, IResourceValue> localResMap = getConfiguredResource(key,
+ Map<String, ResourceValue> localResMap = getConfiguredResource(key,
referenceConfig);
// check if a map for this type already exists
String resName = key.getName();
- Map<String, IResourceValue> resMap = map.get(resName);
+ Map<String, ResourceValue> resMap = map.get(resName);
if (resMap == null) {
// just use the local results.
map.put(resName, localResMap);
@@ -601,13 +600,13 @@ public class ProjectResources implements IResourceRepository {
* @param type the type of the resources.
* @param referenceConfig the configuration to best match.
*/
- private Map<String, IResourceValue> getConfiguredResource(ResourceType type,
+ private Map<String, ResourceValue> getConfiguredResource(ResourceType type,
FolderConfiguration referenceConfig) {
// get the resource item for the given type
List<ProjectResourceItem> items = mResourceMap.get(type);
// create the map
- HashMap<String, IResourceValue> map = new HashMap<String, IResourceValue>();
+ HashMap<String, ResourceValue> map = new HashMap<String, ResourceValue>();
for (ProjectResourceItem item : items) {
// get the source files generating this resource
@@ -620,7 +619,7 @@ public class ProjectResources implements IResourceRepository {
ResourceFile matchResFile = (ResourceFile)match;
// get the value of this configured resource.
- IResourceValue value = matchResFile.getValue(type, item.getName());
+ ResourceValue value = matchResFile.getValue(type, item.getName());
if (value != null) {
map.put(item.getName(), value);
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ResourceFile.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ResourceFile.java
index 3a349be..1cba12e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ResourceFile.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ResourceFile.java
@@ -18,7 +18,7 @@ package com.android.ide.eclipse.adt.internal.resources.manager;
import com.android.ide.eclipse.adt.internal.resources.ResourceType;
import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.layoutlib.api.IResourceValue;
+import com.android.layoutlib.api.ResourceValue;
import com.android.sdklib.io.IAbstractFile;
import java.util.Collection;
@@ -95,7 +95,7 @@ public abstract class ResourceFile extends Resource {
* @param type the type of the resource.
* @param name the name of the resource.
*/
- public abstract IResourceValue getValue(ResourceType type, String name);
+ public abstract ResourceValue getValue(ResourceType type, String name);
@Override
public String toString() {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/SingleResourceFile.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/SingleResourceFile.java
index 637d20b..2bd9406 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/SingleResourceFile.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/SingleResourceFile.java
@@ -16,12 +16,11 @@
package com.android.ide.eclipse.adt.internal.resources.manager;
-import com.android.ide.common.layoutlib.DensityBasedResourceValue;
-import com.android.ide.common.layoutlib.ResourceValue;
import com.android.ide.eclipse.adt.internal.resources.ResourceType;
import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
-import com.android.layoutlib.api.IResourceValue;
-import com.android.layoutlib.api.IDensityBasedResourceValue.Density;
+import com.android.layoutlib.api.DensityBasedResourceValue;
+import com.android.layoutlib.api.ResourceDensity;
+import com.android.layoutlib.api.ResourceValue;
import com.android.sdklib.io.IAbstractFile;
import java.util.ArrayList;
@@ -56,7 +55,7 @@ public class SingleResourceFile extends ResourceFile {
private String mResourceName;
private ResourceType mType;
- private IResourceValue mValue;
+ private ResourceValue mValue;
public SingleResourceFile(IAbstractFile file, ResourceFolder folder) {
super(file, folder);
@@ -80,7 +79,7 @@ public class SingleResourceFile extends ResourceFile {
mType.getName(),
getResourceName(mType),
file.getOsLocation(),
- Density.getEnum(qualifier.getValue().getDpiValue()),
+ ResourceDensity.getEnum(qualifier.getValue().getDpiValue()),
isFramework());
}
}
@@ -124,7 +123,7 @@ public class SingleResourceFile extends ResourceFile {
* The value returned is the full absolute path of the file in OS form.
*/
@Override
- public IResourceValue getValue(ResourceType type, String name) {
+ public ResourceValue getValue(ResourceType type, String name) {
return mValue;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java
index 3667d3f..a539513 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java
@@ -247,11 +247,11 @@ public class AndroidTargetData {
* <p/>Valid {@link LayoutBridge} objects are always initialized before being returned.
*/
public synchronized LayoutLibrary getLayoutLibrary() {
- if (mLayoutBridgeInit == false && mLayoutLibrary.getBridge() != null) {
- mLayoutLibrary.getBridge().init(mTarget.getPath(IAndroidTarget.FONTS),
- getEnumValueMap());
+ if (mLayoutBridgeInit == false && mLayoutLibrary.getStatus() == LoadStatus.LOADED) {
+ mLayoutLibrary.init(mTarget.getPath(IAndroidTarget.FONTS), getEnumValueMap());
mLayoutBridgeInit = true;
}
+
return mLayoutLibrary;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java
index e75b846..27e8743 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java
@@ -767,7 +767,7 @@ public final class Sdk {
if (data != null) {
LayoutLibrary layoutLib = data.getLayoutLibrary();
if (layoutLib != null && layoutLib.getStatus() == LoadStatus.LOADED) {
- layoutLib.getBridge().clearCaches(project);
+ layoutLib.clearCaches(project);
}
}
}
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 53a36fb..dd3393d 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
@@ -33,9 +33,9 @@ import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
import com.android.ide.eclipse.tests.SdkTestCase;
import com.android.layoutlib.api.IProjectCallback;
-import com.android.layoutlib.api.IResourceValue;
import com.android.layoutlib.api.IXmlPullParser;
import com.android.layoutlib.api.LayoutScene;
+import com.android.layoutlib.api.ResourceValue;
import com.android.layoutlib.api.SceneParams;
import com.android.layoutlib.api.SceneParams.RenderingMode;
import com.android.sdklib.IAndroidTarget;
@@ -154,8 +154,8 @@ public class ApiDemosRenderingTest extends SdkTestCase {
}
LayoutLibrary layoutLib = data.getLayoutLibrary();
- if (layoutLib.getStatus() != LoadStatus.LOADED || layoutLib.getBridge() == null) {
- fail("Fail to load the bridge");
+ if (layoutLib.getStatus() != LoadStatus.LOADED) {
+ fail("Fail to load the bridge: " + layoutLib.getLoadMessage());
}
FolderWrapper resFolder = new FolderWrapper(sampleProject, SdkConstants.FD_RES);
@@ -180,9 +180,9 @@ public class ApiDemosRenderingTest extends SdkTestCase {
FolderConfiguration config = getConfiguration();
// get the configured resources
- Map<String, Map<String, IResourceValue>> configuredFramework =
+ Map<String, Map<String, ResourceValue>> configuredFramework =
framework.getConfiguredResources(config);
- Map<String, Map<String, IResourceValue>> configuredProject =
+ Map<String, Map<String, ResourceValue>> configuredProject =
project.getConfiguredResources(config);
boolean saveFiles = System.getenv("save_file") != null;
@@ -199,7 +199,7 @@ public class ApiDemosRenderingTest extends SdkTestCase {
ProjectCallBack projectCallBack = new ProjectCallBack();
- LayoutScene scene = layoutLib.getBridge().createScene(new SceneParams(
+ LayoutScene scene = layoutLib.createScene(new SceneParams(
parser,
null /*projectKey*/,
320,