aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/BasePullParser.java22
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ContextPullParser.java16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java24
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java4
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasViewInfo.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DynamicContextMenu.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java54
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageOverlay.java2
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java14
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java22
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ViewHierarchy.java40
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/MultiResourceFile.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ResourceFile.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/SingleResourceFile.java6
-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/AndroidTargetParser.java2
-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.java28
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/NodeFactoryTest.java2
-rw-r--r--ide_common/.classpath1
-rw-r--r--ide_common/Android.mk3
-rw-r--r--ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java (renamed from ide_common/src/com/android/ide/common/layoutlib/LayoutLibrary.java)122
-rw-r--r--ide_common/src/com/android/ide/common/rendering/StaticRenderSession.java (renamed from ide_common/src/com/android/ide/common/layoutlib/BasicLayoutScene.java)21
-rw-r--r--ide_common/src/com/android/ide/common/rendering/ValueResourceParser.java (renamed from ide_common/src/com/android/ide/common/layoutlib/ValueResourceParser.java)6
-rw-r--r--ide_common/src/com/android/ide/common/rendering/legacy/ILegacyCallback.java31
-rw-r--r--ide_common/src/com/android/ide/common/rendering/legacy/ILegacyPullParser.java31
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/Bridge.java (renamed from layoutlib_api/src/com/android/layoutlib/api/LayoutBridge.java)21
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/Capability.java (renamed from layoutlib_api/src/com/android/layoutlib/api/Capability.java)2
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/DensityBasedResourceValue.java (renamed from layoutlib_api/src/com/android/layoutlib/api/DensityBasedResourceValue.java)4
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/IAnimationListener.java48
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/IImageFactory.java (renamed from layoutlib_api/src/com/android/layoutlib/api/IImageFactory.java)5
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/ILayoutPullParser.java45
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java74
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/LayoutLog.java (renamed from layoutlib_api/src/com/android/layoutlib/api/LayoutLog.java)6
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/Params.java (renamed from layoutlib_api/src/com/android/layoutlib/api/SceneParams.java)28
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/RenderSession.java (renamed from layoutlib_api/src/com/android/layoutlib/api/LayoutScene.java)113
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/ResourceDensity.java (renamed from layoutlib_api/src/com/android/layoutlib/api/ResourceDensity.java)2
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/ResourceValue.java (renamed from layoutlib_api/src/com/android/layoutlib/api/ResourceValue.java)4
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/Result.java (renamed from layoutlib_api/src/com/android/layoutlib/api/SceneResult.java)62
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/StyleResourceValue.java (renamed from layoutlib_api/src/com/android/layoutlib/api/StyleResourceValue.java)5
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/ViewInfo.java (renamed from layoutlib_api/src/com/android/layoutlib/api/ViewInfo.java)6
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/IDensityBasedResourceValue.java3
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/ILayoutBridge.java14
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/ILayoutLog.java2
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/ILayoutResult.java5
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/IProjectCallback.java11
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/IResourceValue.java2
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/IStyleResourceValue.java2
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/IXmlPullParser.java13
54 files changed, 638 insertions, 345 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
index ba106b5..fbd1809 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
@@ -48,8 +48,11 @@ Require-Bundle: com.android.ide.eclipse.ddms,
Eclipse-LazyStart: true
Export-Package: com.android.ide.common.api;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.common.layout;x-friends:="com.android.ide.eclipse.tests",
- com.android.ide.common.layoutlib;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.common.log;x-friends:="com.android.ide.eclipse.tests",
+ com.android.ide.common.rendering;x-friends:="com.android.ide.eclipse.tests",
+ com.android.ide.common.rendering.api;x-friends:="com.android.ide.eclipse.tests",
+ com.android.ide.common.rendering.legacy;x-friends:="com.android.ide.eclipse.tests",
+ com.android.ide.common.resources.platform;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.common.sdk;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal;x-friends:="com.android.ide.eclipse.tests",
@@ -85,7 +88,10 @@ Export-Package: com.android.ide.common.api;x-friends:="com.android.ide.eclipse.t
com.android.ide.eclipse.adt.internal.preferences;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.project;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.properties;x-friends:="com.android.ide.eclipse.tests",
+ com.android.ide.eclipse.adt.internal.refactoring.changes;x-friends:="com.android.ide.eclipse.tests",
+ com.android.ide.eclipse.adt.internal.refactoring.core;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.refactorings.extractstring;x-friends:="com.android.ide.eclipse.tests",
+ com.android.ide.eclipse.adt.internal.refactorings.renamepackage;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.resources;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.resources.configurations;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.resources.manager;x-friends:="com.android.ide.eclipse.tests",
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/BasePullParser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/BasePullParser.java
index a44f1f3..387fed3 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/BasePullParser.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/BasePullParser.java
@@ -16,7 +16,7 @@
package com.android.ide.eclipse.adt.internal.editors.layout;
-import com.android.layoutlib.api.IXmlPullParser;
+import com.android.ide.common.rendering.legacy.ILegacyPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -24,26 +24,26 @@ import java.io.InputStream;
import java.io.Reader;
/**
- * Base implementation of an {@link IXmlPullParser} for cases where the parser is not sitting
+ * Base implementation of an {@link ILegacyPullParser} for cases where the parser is not sitting
* on top of an actual XML file.
* <p/>It's designed to work on layout files, and will most likely not work on other resource
* files.
*/
-public abstract class BasePullParser implements IXmlPullParser {
-
+public abstract class BasePullParser implements ILegacyPullParser {
+
protected int mParsingState = START_DOCUMENT;
-
+
public BasePullParser() {
}
-
+
// --- new methods to override ---
-
+
public abstract void onNextFromStartDocument();
public abstract void onNextFromStartTag();
public abstract void onNextFromEndTag();
-
+
// --- basic implementation of IXmlPullParser ---
-
+
public void setFeature(String name, boolean state) throws XmlPullParserException {
if (FEATURE_PROCESS_NAMESPACES.equals(name) && state) {
return;
@@ -137,7 +137,7 @@ public abstract class BasePullParser implements IXmlPullParser {
public boolean isWhitespace() {
return false;
}
-
+
public int next() throws XmlPullParserException {
switch (mParsingState) {
case END_DOCUMENT:
@@ -173,7 +173,7 @@ public abstract class BasePullParser implements IXmlPullParser {
// not used
break;
}
-
+
return mParsingState;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ContextPullParser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ContextPullParser.java
index 3a94fd6..d8911e4 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ContextPullParser.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ContextPullParser.java
@@ -18,27 +18,27 @@ package com.android.ide.eclipse.adt.internal.editors.layout;
import static com.android.ide.common.layout.LayoutConstants.ATTR_LAYOUT_HEIGHT;
import static com.android.ide.common.layout.LayoutConstants.ATTR_LAYOUT_WIDTH;
-import static com.android.ide.common.layout.LayoutConstants.VALUE_MATCH_PARENT;
import static com.android.ide.common.layout.LayoutConstants.VALUE_FILL_PARENT;
+import static com.android.ide.common.layout.LayoutConstants.VALUE_MATCH_PARENT;
-import com.android.layoutlib.api.IXmlPullParser;
+import com.android.ide.common.rendering.api.ILayoutPullParser;
import com.android.sdklib.SdkConstants;
import org.kxml2.io.KXmlParser;
/**
- * Modified {@link KXmlParser} that adds the methods of {@link IXmlPullParser}.
+ * Modified {@link KXmlParser} that adds the methods of {@link ILayoutPullParser}.
* <p/>
* It will return a given parser when queried for one through
* {@link IXmlPullParser#getParser(String)} for a given name.
*
*/
-public class ContextPullParser extends KXmlParser implements IXmlPullParser {
+public class ContextPullParser extends KXmlParser implements ILayoutPullParser {
private final String mName;
- private final IXmlPullParser mEmbeddedParser;
+ private final ILayoutPullParser mEmbeddedParser;
- public ContextPullParser(String name, IXmlPullParser embeddedParser) {
+ public ContextPullParser(String name, ILayoutPullParser embeddedParser) {
super();
mName = name;
mEmbeddedParser = embeddedParser;
@@ -46,7 +46,7 @@ public class ContextPullParser extends KXmlParser implements IXmlPullParser {
// --- Layout lib API methods
- public IXmlPullParser getParser(String layoutName) {
+ public ILayoutPullParser getParser(String layoutName) {
if (mName.equals(layoutName)) {
return mEmbeddedParser;
}
@@ -54,7 +54,7 @@ public class ContextPullParser extends KXmlParser implements IXmlPullParser {
return null;
}
- public Object getViewKey() {
+ public Object getViewCookie() {
return null; // never any key to return
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java
index 1df5bbe..0b7e9fa 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java
@@ -16,12 +16,13 @@
package com.android.ide.eclipse.adt.internal.editors.layout;
+import com.android.ide.common.rendering.api.IProjectCallback;
+import com.android.ide.common.rendering.legacy.ILegacyCallback;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.AndroidConstants;
import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;
import com.android.ide.eclipse.adt.internal.resources.manager.ProjectClassLoader;
import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
-import com.android.layoutlib.api.IProjectCallback;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.xml.ManifestData;
@@ -35,8 +36,10 @@ import java.util.TreeSet;
/**
* Loader for Android Project class in order to use them in the layout editor.
+ * <p/>This implements {@link IProjectCallback} for the old and new API through
+ * {@link ILegacyCallback}
*/
-public final class ProjectCallback implements IProjectCallback {
+public final class ProjectCallback implements ILegacyCallback {
private final HashMap<String, Class<?>> mLoadedClasses = new HashMap<String, Class<?>>();
private final Set<String> mMissingClasses = new TreeSet<String>();
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 d4b6e94..82e1402 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
@@ -16,21 +16,20 @@
package com.android.ide.eclipse.adt.internal.editors.layout;
-import static com.android.ide.common.layout.LayoutConstants.ATTR_LAYOUT_WIDTH;
import static com.android.ide.common.layout.LayoutConstants.ATTR_LAYOUT_HEIGHT;
-import static com.android.ide.common.layout.LayoutConstants.VALUE_MATCH_PARENT;
+import static com.android.ide.common.layout.LayoutConstants.ATTR_LAYOUT_WIDTH;
import static com.android.ide.common.layout.LayoutConstants.VALUE_FILL_PARENT;
+import static com.android.ide.common.layout.LayoutConstants.VALUE_MATCH_PARENT;
-
+import com.android.ide.common.rendering.api.ILayoutPullParser;
+import com.android.ide.common.rendering.api.ResourceDensity;
+import com.android.ide.common.rendering.api.ViewInfo;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiAttributeNode;
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.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
@@ -48,7 +47,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
- * {@link IXmlPullParser} implementation on top of {@link UiElementNode}.
+ * {@link ILayoutPullParser} implementation on top of {@link UiElementNode}.
* <p/>
* It's designed to work on layout files, and will most likely not work on other resource files.
* <p/>
@@ -193,15 +192,22 @@ public final class UiElementPullParser extends BasePullParser {
* - private method GraphicalLayoutEditor#updateNodeWithBounds(ILayoutViewInfo).
* - private constructor of LayoutCanvas.CanvasViewInfo.
*/
- public Object getViewKey() {
+ public Object getViewCookie() {
return getCurrentNode();
}
/**
+ * Legacy method required by {@link com.android.layoutlib.api.IXmlPullParser}
+ */
+ public Object getViewKey() {
+ return getViewCookie();
+ }
+
+ /**
* This implementation does nothing for now as all the embedded XML will use a normal KXML
* parser.
*/
- public IXmlPullParser getParser(String layoutName) {
+ public ILayoutPullParser getParser(String layoutName) {
return null;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java
index 2d8a2b2..153a2d2 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java
@@ -16,16 +16,15 @@
package com.android.ide.eclipse.adt.internal.editors.layout;
+import com.android.ide.common.rendering.api.ILayoutPullParser;
import com.android.ide.eclipse.adt.AndroidConstants;
import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.ViewElementDescriptor;
-import com.android.layoutlib.api.IXmlPullParser;
-import com.android.layoutlib.api.ILayoutResult.ILayoutViewInfo;
import com.android.sdklib.SdkConstants;
import org.xmlpull.v1.XmlPullParserException;
/**
- * {@link IXmlPullParser} implementation to render android widget bitmap.
+ * {@link ILayoutPullParser} implementation to render android widget bitmap.
* <p/>
* The parser emulates a layout that contains just one widget, described by the
* {@link ViewElementDescriptor} passed in the constructor.
@@ -48,12 +47,19 @@ public class WidgetPullParser extends BasePullParser {
mAttributes[0][1] = segments[segments.length-1];
}
- public Object getViewKey() {
+ public Object getViewCookie() {
// we need a viewKey or the ILayoutResult will not contain any ILayoutViewInfo
return mDescriptor;
}
- public IXmlPullParser getParser(String layoutName) {
+ /**
+ * Legacy method required by {@link com.android.layoutlib.api.IXmlPullParser}
+ */
+ public Object getViewKey() {
+ return getViewCookie();
+ }
+
+ public ILayoutPullParser getParser(String layoutName) {
// there's no embedded layout for a single widget.
return null;
}
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 9a7f810..5fd953d 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
@@ -16,6 +16,8 @@
package com.android.ide.eclipse.adt.internal.editors.layout.configuration;
+import com.android.ide.common.rendering.api.ResourceValue;
+import com.android.ide.common.rendering.api.StyleResourceValue;
import com.android.ide.common.sdk.LoadStatus;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.internal.resources.ResourceType;
@@ -39,8 +41,6 @@ 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.ResourceValue;
-import com.android.layoutlib.api.StyleResourceValue;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.resources.Density;
import com.android.sdklib.resources.DockMode;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasViewInfo.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasViewInfo.java
index 29f4874..0bab655 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasViewInfo.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasViewInfo.java
@@ -17,13 +17,13 @@
package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
import com.android.ide.common.api.Rect;
+import com.android.ide.common.rendering.api.ViewInfo;
import com.android.ide.eclipse.adt.internal.editors.descriptors.AttributeDescriptor;
import com.android.ide.eclipse.adt.internal.editors.layout.UiElementPullParser;
import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors;
import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElementNode;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiAttributeNode;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
-import com.android.layoutlib.api.ViewInfo;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DynamicContextMenu.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DynamicContextMenu.java
index 79060d1..1d703de 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DynamicContextMenu.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DynamicContextMenu.java
@@ -19,12 +19,12 @@ package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
import com.android.ide.common.api.IMenuCallback;
import com.android.ide.common.api.IViewRule;
import com.android.ide.common.api.MenuAction;
+import com.android.ide.common.rendering.api.Capability;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.internal.editors.IconFactory;
import com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor;
import com.android.ide.eclipse.adt.internal.editors.layout.gle2.IncludeFinder.Reference;
import com.android.ide.eclipse.adt.internal.editors.layout.gre.NodeProxy;
-import com.android.layoutlib.api.Capability;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
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 cf72e16..0453688 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
@@ -19,8 +19,16 @@ package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
import static com.android.ide.eclipse.adt.AndroidConstants.ANDROID_PKG;
import static com.android.sdklib.resources.Density.DEFAULT_DENSITY;
-import com.android.ide.common.layoutlib.BasicLayoutScene;
-import com.android.ide.common.layoutlib.LayoutLibrary;
+import com.android.ide.common.rendering.LayoutLibrary;
+import com.android.ide.common.rendering.StaticRenderSession;
+import com.android.ide.common.rendering.api.Capability;
+import com.android.ide.common.rendering.api.ILayoutPullParser;
+import com.android.ide.common.rendering.api.LayoutLog;
+import com.android.ide.common.rendering.api.Params;
+import com.android.ide.common.rendering.api.RenderSession;
+import com.android.ide.common.rendering.api.ResourceValue;
+import com.android.ide.common.rendering.api.Result;
+import com.android.ide.common.rendering.api.Params.RenderingMode;
import com.android.ide.common.sdk.LoadStatus;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.internal.editors.IPageImageProvider;
@@ -53,14 +61,6 @@ 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.Capability;
-import com.android.layoutlib.api.IXmlPullParser;
-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;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
import com.android.sdkuilib.internal.widgets.ResolutionChooserDialog;
@@ -1123,8 +1123,9 @@ public class GraphicalEditorPart extends EditorPart
// For that purpose, create a special LayoutScene that has no image,
// no root view yet indicates success and then update the canvas with it.
- mCanvasViewer.getCanvas().setResult(
- new BasicLayoutScene(SceneStatus.SUCCESS.createResult(),
+ mCanvasViewer.getCanvas().setSession(
+ new StaticRenderSession(
+ Result.Status.SUCCESS.createResult(),
null /*rootViewInfo*/, null /*image*/),
null /*explodeNodes*/);
return;
@@ -1171,7 +1172,7 @@ public class GraphicalEditorPart extends EditorPart
* background using a fully transparent background color
* @return the resulting rendered image wrapped in an {@link LayoutScene}
*/
- public LayoutScene render(UiDocumentNode model, int width, int height,
+ public RenderSession render(UiDocumentNode model, int width, int height,
Set<UiElementNode> explodeNodes, boolean transparentBackground) {
if (!ensureFileValid()) {
return null;
@@ -1403,15 +1404,15 @@ public class GraphicalEditorPart extends EditorPart
int width = rect.width;
int height = rect.height;
- LayoutScene scene = renderWithBridge(iProject, model, layoutLib, width, height,
+ RenderSession session = renderWithBridge(iProject, model, layoutLib, width, height,
explodeNodes, false);
- canvas.setResult(scene, explodeNodes);
+ canvas.setSession(session, explodeNodes);
// update the UiElementNode with the layout info.
- if (scene.getResult().isSuccess() == false) {
+ if (session.getResult().isSuccess() == false) {
// An error was generated. Print it.
- displayError(scene.getResult().getErrorMessage());
+ displayError(session.getResult().getErrorMessage());
} else {
// Success means there was no exception. But we might have detected
@@ -1428,7 +1429,7 @@ public class GraphicalEditorPart extends EditorPart
model.refreshUi();
}
- private LayoutScene renderWithBridge(IProject iProject, UiDocumentNode model,
+ private RenderSession renderWithBridge(IProject iProject, UiDocumentNode model,
LayoutLibrary layoutLib, int width, int height, Set<UiElementNode> explodeNodes,
boolean transparentBackground) {
ResourceManager resManager = ResourceManager.getInstance();
@@ -1498,6 +1499,11 @@ public class GraphicalEditorPart extends EditorPart
public void warning(String tag, String message) {
AdtPlugin.printToConsole(mEditedFile.getName(), message);
}
+
+ @Override
+ public void fidelityWarning(String tag, String message, Throwable throwable) {
+ AdtPlugin.printToConsole(mEditedFile.getName(), message);
+ }
};
}
@@ -1529,9 +1535,9 @@ public class GraphicalEditorPart extends EditorPart
float ydpi = mConfigComposite.getYDpi();
boolean isProjectTheme = mConfigComposite.isProjectTheme();
- IXmlPullParser modelParser = new UiElementPullParser(model,
+ ILayoutPullParser modelParser = new UiElementPullParser(model,
mUseExplodeMode, explodeNodes, density, xdpi, iProject);
- IXmlPullParser topParser = modelParser;
+ ILayoutPullParser topParser = modelParser;
// Code to support editing included layout
@@ -1574,7 +1580,7 @@ public class GraphicalEditorPart extends EditorPart
}
}
- SceneParams params = new SceneParams(
+ Params params = new Params(
topParser,
iProject /* projectKey */,
width, height,
@@ -1588,15 +1594,13 @@ public class GraphicalEditorPart extends EditorPart
// It doesn't matter what the background color is as long as the alpha
// is 0 (fully transparent). We're using red to make it more obvious if
// for some reason the background is painted when it shouldn't be.
- params.setCustomBackgroundColor(0x00FF0000);
+ params.setOverrideBgColor(0x00FF0000);
}
// set the Image Overlay as the image factory.
params.setImageFactory(getCanvasControl().getImageOverlay());
- LayoutScene scene = layoutLib.createScene(params);
-
- return scene;
+ return layoutLib.createSession(params);
}
/**
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageOverlay.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageOverlay.java
index 3177f32..7833570 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageOverlay.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageOverlay.java
@@ -16,7 +16,7 @@
package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
-import com.android.layoutlib.api.IImageFactory;
+import com.android.ide.common.rendering.api.IImageFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java
index cd411d2..53ae909 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java
@@ -18,6 +18,8 @@ package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
import com.android.ide.common.api.INode;
import com.android.ide.common.api.Point;
+import com.android.ide.common.rendering.api.Capability;
+import com.android.ide.common.rendering.api.RenderSession;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.internal.editors.descriptors.DescriptorsUtils;
import com.android.ide.eclipse.adt.internal.editors.descriptors.XmlnsAttributeDescriptor;
@@ -31,8 +33,6 @@ 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.Sdk;
-import com.android.layoutlib.api.Capability;
-import com.android.layoutlib.api.LayoutScene;
import com.android.sdklib.SdkConstants;
import org.eclipse.core.filesystem.EFS;
@@ -482,20 +482,20 @@ public class LayoutCanvas extends Canvas {
* allocated ILayourResult. That means we can keep this result and hold on to it
* when it is valid.
*
- * @param scene The new scene, either valid or not.
+ * @param session The new scene, either valid or not.
* @param explodedNodes The set of individual nodes the layout computer was asked to
* explode. Note that these are independent of the explode-all mode where
* all views are exploded; this is used only for the mode (
* {@link #showInvisibleViews(boolean)}) where individual invisible nodes
* are padded during certain interactions.
*/
- /* package */ void setResult(LayoutScene scene, Set<UiElementNode> explodedNodes) {
+ /* package */ void setSession(RenderSession session, Set<UiElementNode> explodedNodes) {
// disable any hover
clearHover();
- mViewHierarchy.setResult(scene, explodedNodes);
- if (mViewHierarchy.isValid() && scene != null) {
- Image image = mImageOverlay.setImage(scene.getImage());
+ mViewHierarchy.setSession(session, explodedNodes);
+ if (mViewHierarchy.isValid() && session != null) {
+ Image image = mImageOverlay.setImage(session.getImage());
mOutlinePage.setModel(mViewHierarchy.getRoot());
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java
index c00367b..fbeeed8 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java
@@ -24,8 +24,11 @@ import static com.android.ide.common.layout.LayoutConstants.VALUE_WRAP_CONTENT;
import com.android.ide.common.api.InsertType;
import com.android.ide.common.api.Rect;
-import com.android.ide.common.layoutlib.LayoutLibrary;
import com.android.ide.eclipse.adt.internal.editors.IconFactory;
+import com.android.ide.common.rendering.LayoutLibrary;
+import com.android.ide.common.rendering.api.Capability;
+import com.android.ide.common.rendering.api.RenderSession;
+import com.android.ide.common.rendering.api.ViewInfo;
import com.android.ide.eclipse.adt.internal.editors.descriptors.DescriptorsUtils;
import com.android.ide.eclipse.adt.internal.editors.descriptors.DocumentDescriptor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
@@ -42,9 +45,6 @@ import com.android.ide.eclipse.adt.internal.editors.ui.IDecorContent;
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.Capability;
-import com.android.layoutlib.api.LayoutScene;
-import com.android.layoutlib.api.ViewInfo;
import com.android.sdklib.SdkConstants;
import org.eclipse.swt.SWT;
@@ -757,7 +757,7 @@ public class PaletteControl extends Composite {
hasTransparency = layoutLibrary.supports(Capability.TRANSPARENCY);
}
- LayoutScene scene = null;
+ RenderSession session = null;
try {
// Use at most the size of the screen for the preview render.
// This is important since when we fill the size of certain views (like
@@ -767,7 +767,7 @@ public class PaletteControl extends Composite {
int renderWidth = Math.min(screenBounds.width, MAX_RENDER_WIDTH);
int renderHeight = Math.min(screenBounds.height, MAX_RENDER_HEIGHT);
- scene = editor.render(model, renderWidth, renderHeight,
+ session = editor.render(model, renderWidth, renderHeight,
null /* explodeNodes */, hasTransparency);
} catch (Throwable t) {
// Previews can fail for a variety of reasons -- let's not bug
@@ -775,13 +775,13 @@ public class PaletteControl extends Composite {
return null;
}
- if (scene != null) {
- if (scene.getResult().isSuccess()) {
- BufferedImage image = scene.getImage();
+ if (session != null) {
+ if (session.getResult().isSuccess()) {
+ BufferedImage image = session.getImage();
if (image != null) {
BufferedImage cropped;
Rect initialCrop = null;
- ViewInfo viewInfo = scene.getRootView();
+ ViewInfo viewInfo = session.getRootView();
if (viewInfo != null) {
int x1 = viewInfo.getLeft();
int x2 = viewInfo.getRight();
@@ -829,7 +829,7 @@ public class PaletteControl extends Composite {
}
}
- scene.dispose();
+ session.dispose();
}
return null;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ViewHierarchy.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ViewHierarchy.java
index 1521152..eb1dc15 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ViewHierarchy.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ViewHierarchy.java
@@ -17,11 +17,11 @@
package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
import com.android.ide.common.api.INode;
+import com.android.ide.common.rendering.api.RenderSession;
+import com.android.ide.common.rendering.api.ViewInfo;
import com.android.ide.eclipse.adt.internal.editors.layout.gre.NodeProxy;
import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElementNode;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
-import com.android.layoutlib.api.LayoutScene;
-import com.android.layoutlib.api.ViewInfo;
import org.eclipse.swt.graphics.Rectangle;
import org.w3c.dom.Node;
@@ -99,16 +99,16 @@ public class ViewHierarchy {
*/
private List<CanvasViewInfo> mIncluded;
- /** The layout scene for the current view hierarchy */
- private LayoutScene mScene;
+ /** The render session for the current view hierarchy */
+ private RenderSession mSession;
/**
* Disposes the view hierarchy content.
*/
public void dispose() {
- if (mScene != null) {
- mScene.dispose();
- mScene = null;
+ if (mSession != null) {
+ mSession.dispose();
+ mSession = null;
}
}
@@ -121,30 +121,30 @@ public class ViewHierarchy {
* allocated ILayourResult. That means we can keep this result and hold on to it
* when it is valid.
*
- * @param scene The new result, either valid or not.
+ * @param session The new session, either valid or not.
* @param explodedNodes The set of individual nodes the layout computer was asked to
* explode. Note that these are independent of the explode-all mode where
* all views are exploded; this is used only for the mode (
* {@link LayoutCanvas#showInvisibleViews}) where individual invisible
* nodes are padded during certain interactions.
*/
- /* package */ void setResult(LayoutScene scene, Set<UiElementNode> explodedNodes) {
+ /* package */ void setSession(RenderSession session, Set<UiElementNode> explodedNodes) {
// replace the previous scene, so the previous scene must be disposed.
- if (mScene != null) {
- mScene.dispose();
+ if (mSession != null) {
+ mSession.dispose();
}
- mScene = scene;
- mIsResultValid = (scene != null && scene.getResult().isSuccess());
+ mSession = session;
+ mIsResultValid = (session != null && session.getResult().isSuccess());
mExplodedParents = false;
mIncluded = null;
- if (mIsResultValid && scene != null) {
- ViewInfo root = scene.getRootView();
+ if (mIsResultValid && session != null) {
+ ViewInfo root = session.getRootView();
if (root == null) {
mLastValidViewInfoRoot = null;
} else {
- mLastValidViewInfoRoot = new CanvasViewInfo(scene.getRootView());
+ mLastValidViewInfoRoot = new CanvasViewInfo(session.getRootView());
}
updateNodeProxies(mLastValidViewInfoRoot, null);
@@ -235,11 +235,11 @@ public class ViewHierarchy {
}
/**
- * Returns the current {@link LayoutScene}.
- * @return the scene or null if none have been set.
+ * Returns the current {@link RenderSession}.
+ * @return the session or null if none have been set.
*/
- public LayoutScene getScene() {
- return mScene;
+ public RenderSession getSession() {
+ return mSession;
}
/**
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java
index cdc7d8a..54b2cb3 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java
@@ -33,6 +33,7 @@ import static com.android.sdklib.xml.AndroidManifest.NODE_ACTIVITY;
import static com.android.sdklib.xml.AndroidManifest.NODE_SERVICE;
import com.android.ide.common.layout.Pair;
+import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.AndroidConstants;
import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
@@ -46,7 +47,6 @@ import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.ide.eclipse.adt.io.IFolderWrapper;
-import com.android.layoutlib.api.ResourceValue;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.annotations.VisibleForTesting;
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 3ad97e9..247e371 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,10 +16,10 @@
package com.android.ide.eclipse.adt.internal.resources.manager;
-import com.android.ide.common.layoutlib.ValueResourceParser;
-import com.android.ide.common.layoutlib.ValueResourceParser.IValueResourceRepository;
+import com.android.ide.common.rendering.ValueResourceParser;
+import com.android.ide.common.rendering.ValueResourceParser.IValueResourceRepository;
+import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.eclipse.adt.internal.resources.ResourceType;
-import com.android.layoutlib.api.ResourceValue;
import com.android.sdklib.io.IAbstractFile;
import com.android.sdklib.io.StreamException;
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 3795811..08d195b 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,6 +16,7 @@
package com.android.ide.eclipse.adt.internal.resources.manager;
+import com.android.ide.common.rendering.api.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;
@@ -26,7 +27,6 @@ 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.ResourceValue;
import com.android.sdklib.io.IAbstractFolder;
import org.eclipse.core.resources.IFolder;
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 1cba12e..b5538ac 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
@@ -16,9 +16,9 @@
package com.android.ide.eclipse.adt.internal.resources.manager;
+import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.eclipse.adt.internal.resources.ResourceType;
import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.layoutlib.api.ResourceValue;
import com.android.sdklib.io.IAbstractFile;
import java.util.Collection;
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 2bd9406..4e085ad 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,11 +16,11 @@
package com.android.ide.eclipse.adt.internal.resources.manager;
+import com.android.ide.common.rendering.api.DensityBasedResourceValue;
+import com.android.ide.common.rendering.api.ResourceDensity;
+import com.android.ide.common.rendering.api.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.DensityBasedResourceValue;
-import com.android.layoutlib.api.ResourceDensity;
-import com.android.layoutlib.api.ResourceValue;
import com.android.sdklib.io.IAbstractFile;
import java.util.ArrayList;
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 a539513..e214407 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
@@ -16,7 +16,7 @@
package com.android.ide.eclipse.adt.internal.sdk;
-import com.android.ide.common.layoutlib.LayoutLibrary;
+import com.android.ide.common.rendering.LayoutLibrary;
import com.android.ide.common.sdk.LoadStatus;
import com.android.ide.eclipse.adt.internal.editors.descriptors.IDescriptorProvider;
import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors;
@@ -26,10 +26,10 @@ import com.android.ide.eclipse.adt.internal.editors.resources.descriptors.Resour
import com.android.ide.eclipse.adt.internal.editors.xml.descriptors.XmlDescriptors;
import com.android.ide.eclipse.adt.internal.resources.IResourceRepository;
import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
-import com.android.layoutlib.api.LayoutBridge;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.IAndroidTarget.IOptionalLibrary;
+import java.io.File;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Map;
@@ -248,7 +248,7 @@ public class AndroidTargetData {
*/
public synchronized LayoutLibrary getLayoutLibrary() {
if (mLayoutBridgeInit == false && mLayoutLibrary.getStatus() == LoadStatus.LOADED) {
- mLayoutLibrary.init(mTarget.getPath(IAndroidTarget.FONTS), getEnumValueMap());
+ mLayoutLibrary.init(new File(mTarget.getPath(IAndroidTarget.FONTS)), getEnumValueMap());
mLayoutBridgeInit = true;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetParser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetParser.java
index 0d5ad23..f1f1aa7 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetParser.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetParser.java
@@ -16,7 +16,7 @@
package com.android.ide.eclipse.adt.internal.sdk;
-import com.android.ide.common.layoutlib.LayoutLibrary;
+import com.android.ide.common.rendering.LayoutLibrary;
import com.android.ide.common.resources.platform.AttrsXmlParser;
import com.android.ide.common.resources.platform.DeclareStyleableInfo;
import com.android.ide.common.resources.platform.ViewClassInfo;
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 27e8743..61e3176 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
@@ -17,7 +17,7 @@
package com.android.ide.eclipse.adt.internal.sdk;
import com.android.ddmlib.IDevice;
-import com.android.ide.common.layoutlib.LayoutLibrary;
+import com.android.ide.common.rendering.LayoutLibrary;
import com.android.ide.common.sdk.LoadStatus;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.AndroidConstants;
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 dd3393d..2fee75b 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
@@ -16,7 +16,13 @@
package com.android.ide.eclipse.tests.functests.layoutRendering;
-import com.android.ide.common.layoutlib.LayoutLibrary;
+import com.android.ide.common.rendering.LayoutLibrary;
+import com.android.ide.common.rendering.api.ILayoutPullParser;
+import com.android.ide.common.rendering.api.IProjectCallback;
+import com.android.ide.common.rendering.api.Params;
+import com.android.ide.common.rendering.api.RenderSession;
+import com.android.ide.common.rendering.api.ResourceValue;
+import com.android.ide.common.rendering.api.Params.RenderingMode;
import com.android.ide.common.sdk.LoadStatus;
import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier;
@@ -32,12 +38,6 @@ import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
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.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;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.io.FolderWrapper;
@@ -68,16 +68,16 @@ public class ApiDemosRenderingTest extends SdkTestCase {
* Custom parser that implements {@link IXmlPullParser} (which itself extends
* {@link XmlPullParser}).
*/
- private final static class TestParser extends KXmlParser implements IXmlPullParser {
+ private final static class TestParser extends KXmlParser implements ILayoutPullParser {
/**
* Since we're not going to go through the result of the rendering/layout, we can return
* null for the View Key.
*/
- public Object getViewKey() {
+ public Object getViewCookie() {
return null;
}
- public IXmlPullParser getParser(String layoutName) {
+ public ILayoutPullParser getParser(String layoutName) {
return null;
}
}
@@ -199,7 +199,7 @@ public class ApiDemosRenderingTest extends SdkTestCase {
ProjectCallBack projectCallBack = new ProjectCallBack();
- LayoutScene scene = layoutLib.createScene(new SceneParams(
+ RenderSession session = layoutLib.createSession(new Params(
parser,
null /*projectKey*/,
320,
@@ -216,18 +216,18 @@ public class ApiDemosRenderingTest extends SdkTestCase {
null //logger
));
- if (scene.getResult().isSuccess() == false) {
+ if (session.getResult().isSuccess() == false) {
if (projectCallBack.mCustomViewAttempt == false) {
System.out.println("FAILED");
fail(String.format("Rendering %1$s: %2$s", layout.getName(),
- scene.getResult().getErrorMessage()));
+ session.getResult().getErrorMessage()));
} else {
System.out.println("Ignore custom views for now");
}
} else {
if (saveFiles) {
File tmp = File.createTempFile(layout.getName(), ".png");
- ImageIO.write(scene.getImage(), "png", tmp);
+ ImageIO.write(session.getImage(), "png", tmp);
}
System.out.println("Success!");
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/NodeFactoryTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/NodeFactoryTest.java
index ad39fe6..2e9e205 100755
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/NodeFactoryTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/NodeFactoryTest.java
@@ -18,10 +18,10 @@ package com.android.ide.eclipse.adt.internal.editors.layout.gre;
import com.android.ide.common.api.INode;
import com.android.ide.common.api.Rect;
+import com.android.ide.common.rendering.api.ViewInfo;
import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.ViewElementDescriptor;
import com.android.ide.eclipse.adt.internal.editors.layout.gle2.CanvasViewInfo;
import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElementNode;
-import com.android.layoutlib.api.ViewInfo;
import java.util.Arrays;
diff --git a/ide_common/.classpath b/ide_common/.classpath
index 0321c43..8760b35 100644
--- a/ide_common/.classpath
+++ b/ide_common/.classpath
@@ -3,5 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/layoutlib_api"/>
+ <classpathentry kind="var" path="ANDROID_SRC/prebuilt/common/kxml2/kxml2-2.3.0.jar" sourcepath="/ANDROID_SRC/dalvik/libcore/xml/src/main/java"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/ide_common/Android.mk b/ide_common/Android.mk
index 2410b49..d3b388c 100644
--- a/ide_common/Android.mk
+++ b/ide_common/Android.mk
@@ -19,7 +19,8 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_JAVA_LIBRARIES := \
- layoutlib_api
+ layoutlib_api \
+ kxml2-2.3.0
LOCAL_MODULE := ide_common
diff --git a/ide_common/src/com/android/ide/common/layoutlib/LayoutLibrary.java b/ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java
index 740953e..878f9fd 100644
--- a/ide_common/src/com/android/ide/common/layoutlib/LayoutLibrary.java
+++ b/ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java
@@ -14,24 +14,29 @@
* limitations under the License.
*/
-package com.android.ide.common.layoutlib;
+package com.android.ide.common.rendering;
import com.android.ide.common.log.ILogger;
+import com.android.ide.common.rendering.api.Bridge;
+import com.android.ide.common.rendering.api.Capability;
+import com.android.ide.common.rendering.api.ILayoutPullParser;
+import com.android.ide.common.rendering.api.LayoutLog;
+import com.android.ide.common.rendering.api.Params;
+import com.android.ide.common.rendering.api.RenderSession;
+import com.android.ide.common.rendering.api.Result;
+import com.android.ide.common.rendering.api.ViewInfo;
+import com.android.ide.common.rendering.api.Params.RenderingMode;
+import com.android.ide.common.rendering.api.Result.Status;
+import com.android.ide.common.rendering.legacy.ILegacyCallback;
+import com.android.ide.common.rendering.legacy.ILegacyPullParser;
import com.android.ide.common.sdk.LoadStatus;
-import com.android.layoutlib.api.Capability;
import com.android.layoutlib.api.ILayoutBridge;
import com.android.layoutlib.api.ILayoutLog;
import com.android.layoutlib.api.ILayoutResult;
+import com.android.layoutlib.api.IProjectCallback;
import com.android.layoutlib.api.IResourceValue;
-import com.android.layoutlib.api.LayoutBridge;
-import com.android.layoutlib.api.LayoutLog;
-import com.android.layoutlib.api.LayoutScene;
-import com.android.layoutlib.api.SceneParams;
-import com.android.layoutlib.api.SceneResult;
-import com.android.layoutlib.api.ViewInfo;
+import com.android.layoutlib.api.IXmlPullParser;
import com.android.layoutlib.api.ILayoutResult.ILayoutViewInfo;
-import com.android.layoutlib.api.SceneParams.RenderingMode;
-import com.android.layoutlib.api.SceneResult.SceneStatus;
import java.io.File;
import java.lang.reflect.Constructor;
@@ -48,9 +53,16 @@ import java.util.Map;
* Use {@link #load(String, ILogger)} to load the jar file.
* <p/>
* Use the layout library with:
- * {@link #init(String, Map)}, {@link #supports(Capability)}, {@link #createScene(SceneParams)},
+ * {@link #init(String, Map)}, {@link #supports(Capability)}, {@link #createSession(Params)},
* {@link #dispose()}, {@link #clearCaches(Object)}.
*
+ * <p/>
+ * For client wanting to access both new and old (pre API level 5) layout libraries, it is
+ * important that the following interfaces be used:<br>
+ * {@link ILegacyPullParser} instead of {@link ILayoutPullParser}<br>
+ * {@link ILegacyCallback} instead of{@link com.android.ide.common.rendering.api.IProjectCallback}.
+ * <p/>
+ * These interfaces will ensure that both new and older Layout libraries can be accessed.
*/
@SuppressWarnings("deprecation")
public class LayoutLibrary {
@@ -58,7 +70,7 @@ public class LayoutLibrary {
public final static String CLASS_BRIDGE = "com.android.layoutlib.bridge.Bridge"; //$NON-NLS-1$
/** Link to the layout bridge */
- private final LayoutBridge mBridge;
+ private final Bridge mBridge;
/** Link to a ILayoutBridge in case loaded an older library */
private final ILayoutBridge mLegacyBridge;
/** Status of the layoutlib.jar loading */
@@ -106,7 +118,7 @@ public class LayoutLibrary {
LoadStatus status = LoadStatus.LOADING;
String message = null;
- LayoutBridge bridge = null;
+ Bridge bridge = null;
ILayoutBridge legacyBridge = null;
ClassLoader classLoader = null;
@@ -135,8 +147,8 @@ public class LayoutLibrary {
Constructor<?> constructor = clazz.getConstructor();
if (constructor != null) {
Object bridgeObject = constructor.newInstance();
- if (bridgeObject instanceof LayoutBridge) {
- bridge = (LayoutBridge)bridgeObject;
+ if (bridgeObject instanceof Bridge) {
+ bridge = (Bridge)bridgeObject;
} else if (bridgeObject instanceof ILayoutBridge) {
legacyBridge = (ILayoutBridge) bridgeObject;
}
@@ -160,7 +172,7 @@ public class LayoutLibrary {
// check the API, only if it's not a legacy bridge
if (bridge != null) {
int api = bridge.getApiLevel();
- if (api > LayoutBridge.API_CURRENT) {
+ if (api > Bridge.API_CURRENT) {
status = LoadStatus.FAILED;
message = "LayoutLib is too recent. Update your tool!";
}
@@ -189,7 +201,7 @@ public class LayoutLibrary {
* Returns whether the LayoutLibrary supports a given {@link Capability}.
* @return true if it supports it.
*
- * @see LayoutBridge#getCapabilities()
+ * @see Bridge#getCapabilities()
*
*/
public boolean supports(Capability capability) {
@@ -212,18 +224,18 @@ public class LayoutLibrary {
* Initializes the Layout Library object. This must be called before any other action is taken
* on the instance.
*
- * @param fontOsLocation the location of the fonts in the SDK target.
+ * @param fontLocation the location of the fonts in the SDK target.
* @param enumValueMap map attrName => { map enumFlagName => Integer value }. This is typically
* read from attrs.xml in the SDK target.
* @return true if success.
*
- * @see LayoutBridge#init(String, Map)
+ * @see Bridge#init(String, Map)
*/
- public boolean init(String fontOsLocation, Map<String, Map<String, Integer>> enumValueMap) {
+ public boolean init(File fontLocation, Map<String, Map<String, Integer>> enumValueMap) {
if (mBridge != null) {
- return mBridge.init(fontOsLocation, enumValueMap);
+ return mBridge.init(fontLocation, enumValueMap);
} else if (mLegacyBridge != null) {
- return mLegacyBridge.init(fontOsLocation, enumValueMap);
+ return mLegacyBridge.init(fontLocation.getAbsolutePath(), enumValueMap);
}
return false;
@@ -232,7 +244,7 @@ public class LayoutLibrary {
/**
* Prepares the layoutlib to unloaded.
*
- * @see LayoutBridge#dispose()
+ * @see Bridge#dispose()
*/
public boolean dispose() {
if (mBridge != null) {
@@ -244,7 +256,7 @@ public class LayoutLibrary {
/**
* Starts a layout session by inflating and rendering it. The method returns a
- * {@link LayoutScene} on which further actions can be taken.
+ * {@link RenderSession} on which further actions can be taken.
* <p/>
* Before taking further actions on the scene, it is recommended to use
* {@link #supports(Capability)} to check what the scene can do.
@@ -252,13 +264,13 @@ public class LayoutLibrary {
* @return a new {@link ILayoutScene} object that contains the result of the scene creation and
* first rendering or null if {@link #getStatus()} doesn't return {@link LoadStatus#LOADED}.
*
- * @see LayoutBridge#createScene(SceneParams)
+ * @see Bridge#createSession(Params)
*/
- public LayoutScene createScene(SceneParams params) {
+ public RenderSession createSession(Params params) {
if (mBridge != null) {
- return mBridge.createScene(params);
+ return mBridge.createSession(params);
} else if (mLegacyBridge != null) {
- return createLegacyScene(params);
+ return createLegacySession(params);
}
return null;
@@ -273,7 +285,7 @@ public class LayoutLibrary {
*
* @param projectKey the key for the project.
*
- * @see LayoutBridge#clearCaches(Object)
+ * @see Bridge#clearCaches(Object)
*/
public void clearCaches(Object projectKey) {
if (mBridge != null) {
@@ -285,7 +297,7 @@ public class LayoutLibrary {
// ------ Implementation
- private LayoutLibrary(LayoutBridge bridge, ILayoutBridge legacyBridge, ClassLoader classLoader,
+ private LayoutLibrary(Bridge bridge, ILayoutBridge legacyBridge, ClassLoader classLoader,
LoadStatus status, String message) {
mBridge = bridge;
mLegacyBridge = legacyBridge;
@@ -316,8 +328,16 @@ public class LayoutLibrary {
return apiLevel;
}
- private LayoutScene createLegacyScene(SceneParams params) {
- int apiLevel = mLegacyBridge.getApiLevel();
+ private RenderSession createLegacySession(Params params) {
+ if (params.getLayoutDescription() instanceof IXmlPullParser == false) {
+ throw new IllegalArgumentException("Parser must be of type ILegacyPullParser");
+ }
+ if (params.getProjectCallback() instanceof
+ com.android.layoutlib.api.IProjectCallback == false) {
+ throw new IllegalArgumentException("Project callback must be of type ILegacyCallback");
+ }
+
+ int apiLevel = getLegacyApiLevel();
// create a log wrapper since the older api requires a ILayoutLog
final LayoutLog log = params.getLog();
@@ -349,30 +369,32 @@ public class LayoutLibrary {
if (apiLevel == 4) {
// Final ILayoutBridge API added support for "render full height"
result = mLegacyBridge.computeLayout(
- params.getLayoutDescription(), params.getProjectKey(),
+ (IXmlPullParser) params.getLayoutDescription(),
+ params.getProjectKey(),
params.getScreenWidth(), params.getScreenHeight(),
params.getRenderingMode() == RenderingMode.FULL_EXPAND ? true : false,
params.getDensity(), params.getXdpi(), params.getYdpi(),
- params.getThemeName(), params.getIsProjectTheme(),
+ params.getThemeName(), params.isProjectTheme(),
projectMap, frameworkMap,
- params.getProjectCallback(), logWrapper);
+ (IProjectCallback) params.getProjectCallback(),
+ logWrapper);
} else if (apiLevel == 3) {
// api 3 add density support.
result = mLegacyBridge.computeLayout(
- params.getLayoutDescription(), params.getProjectKey(),
+ (IXmlPullParser) params.getLayoutDescription(), params.getProjectKey(),
params.getScreenWidth(), params.getScreenHeight(),
params.getDensity(), params.getXdpi(), params.getYdpi(),
- params.getThemeName(), params.getIsProjectTheme(),
+ params.getThemeName(), params.isProjectTheme(),
projectMap, frameworkMap,
- params.getProjectCallback(), logWrapper);
+ (IProjectCallback) params.getProjectCallback(), logWrapper);
} else if (apiLevel == 2) {
// api 2 added boolean for separation of project/framework theme
result = mLegacyBridge.computeLayout(
- params.getLayoutDescription(), params.getProjectKey(),
+ (IXmlPullParser) params.getLayoutDescription(), params.getProjectKey(),
params.getScreenWidth(), params.getScreenHeight(),
- params.getThemeName(), params.getIsProjectTheme(),
+ params.getThemeName(), params.isProjectTheme(),
projectMap, frameworkMap,
- params.getProjectCallback(), logWrapper);
+ (IProjectCallback) params.getProjectCallback(), logWrapper);
} else {
// First api with no density/dpi, and project theme boolean mixed
// into the theme name.
@@ -380,16 +402,16 @@ public class LayoutLibrary {
// change the string if it's a custom theme to make sure we can
// differentiate them
String themeName = params.getThemeName();
- if (params.getIsProjectTheme()) {
+ if (params.isProjectTheme()) {
themeName = "*" + themeName; //$NON-NLS-1$
}
result = mLegacyBridge.computeLayout(
- params.getLayoutDescription(), params.getProjectKey(),
+ (IXmlPullParser) params.getLayoutDescription(), params.getProjectKey(),
params.getScreenWidth(), params.getScreenHeight(),
themeName,
projectMap, frameworkMap,
- params.getProjectCallback(), logWrapper);
+ (IProjectCallback) params.getProjectCallback(), logWrapper);
}
// clean up that is not done by the ILayoutBridge itself
@@ -399,25 +421,25 @@ public class LayoutLibrary {
}
/**
- * Converts a {@link ILayoutResult} to a {@link LayoutScene}.
+ * Converts a {@link ILayoutResult} to a {@link RenderSession}.
*/
- private LayoutScene convertToScene(ILayoutResult result) {
+ private RenderSession convertToScene(ILayoutResult result) {
- SceneResult sceneResult;
+ Result sceneResult;
ViewInfo rootViewInfo;
if (result.getSuccess() == ILayoutResult.SUCCESS) {
- sceneResult = SceneStatus.SUCCESS.createResult();
+ sceneResult = Status.SUCCESS.createResult();
rootViewInfo = convertToViewInfo(result.getRootView());
} else {
- sceneResult = SceneStatus.ERROR_UNKNOWN.createResult(result.getErrorMessage());
+ sceneResult = Status.ERROR_UNKNOWN.createResult(result.getErrorMessage());
rootViewInfo = null;
}
// create a BasicLayoutScene. This will return the given values but return the default
// implementation for all method.
// ADT should gracefully handle the default implementations of LayoutScene
- return new BasicLayoutScene(sceneResult, rootViewInfo, result.getImage());
+ return new StaticRenderSession(sceneResult, rootViewInfo, result.getImage());
}
/**
diff --git a/ide_common/src/com/android/ide/common/layoutlib/BasicLayoutScene.java b/ide_common/src/com/android/ide/common/rendering/StaticRenderSession.java
index dfb3992..a33a497 100644
--- a/ide_common/src/com/android/ide/common/layoutlib/BasicLayoutScene.java
+++ b/ide_common/src/com/android/ide/common/rendering/StaticRenderSession.java
@@ -14,35 +14,38 @@
* limitations under the License.
*/
-package com.android.ide.common.layoutlib;
+package com.android.ide.common.rendering;
-import com.android.layoutlib.api.LayoutScene;
-import com.android.layoutlib.api.SceneResult;
-import com.android.layoutlib.api.ViewInfo;
+import com.android.ide.common.rendering.api.RenderSession;
+import com.android.ide.common.rendering.api.Result;
+import com.android.ide.common.rendering.api.ViewInfo;
import java.awt.image.BufferedImage;
/**
- * Basic LayoutScene returning a given {@link SceneResult}, {@link ViewInfo} and
+ * Static {@link RenderSession} returning a given {@link Result}, {@link ViewInfo} and
* {@link BufferedImage}.
* <p/>
* All other methods are untouched from the base implementation provided by the API.
+ * <p/>
+ * This is meant to be used as a wrapper around the static results. No further operations are
+ * possible.
*
*/
-public class BasicLayoutScene extends LayoutScene {
+public class StaticRenderSession extends RenderSession {
- private final SceneResult mResult;
+ private final Result mResult;
private final ViewInfo mRootViewInfo;
private final BufferedImage mImage;
- public BasicLayoutScene(SceneResult result, ViewInfo rootViewInfo, BufferedImage image) {
+ public StaticRenderSession(Result result, ViewInfo rootViewInfo, BufferedImage image) {
mResult = result;
mRootViewInfo = rootViewInfo;
mImage = image;
}
@Override
- public SceneResult getResult() {
+ public Result getResult() {
return mResult;
}
diff --git a/ide_common/src/com/android/ide/common/layoutlib/ValueResourceParser.java b/ide_common/src/com/android/ide/common/rendering/ValueResourceParser.java
index cc65b9d..8c56a98 100644
--- a/ide_common/src/com/android/ide/common/layoutlib/ValueResourceParser.java
+++ b/ide_common/src/com/android/ide/common/rendering/ValueResourceParser.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.ide.common.layoutlib;
+package com.android.ide.common.rendering;
-import com.android.layoutlib.api.ResourceValue;
-import com.android.layoutlib.api.StyleResourceValue;
+import com.android.ide.common.rendering.api.ResourceValue;
+import com.android.ide.common.rendering.api.StyleResourceValue;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
diff --git a/ide_common/src/com/android/ide/common/rendering/legacy/ILegacyCallback.java b/ide_common/src/com/android/ide/common/rendering/legacy/ILegacyCallback.java
new file mode 100644
index 0000000..000c7c5
--- /dev/null
+++ b/ide_common/src/com/android/ide/common/rendering/legacy/ILegacyCallback.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.common.rendering.legacy;
+
+import com.android.ide.common.rendering.api.IProjectCallback;
+
+/**
+ * Intermediary interface extending both old and new project call back from the layout lib API.
+ *
+ * Clients should use this instead of {@link IProjectCallback} to target both old and new
+ * Layout Libraries.
+ *
+ */
+@SuppressWarnings("deprecation")
+public interface ILegacyCallback extends com.android.ide.common.rendering.api.IProjectCallback,
+ com.android.layoutlib.api.IProjectCallback {
+}
diff --git a/ide_common/src/com/android/ide/common/rendering/legacy/ILegacyPullParser.java b/ide_common/src/com/android/ide/common/rendering/legacy/ILegacyPullParser.java
new file mode 100644
index 0000000..a71e190
--- /dev/null
+++ b/ide_common/src/com/android/ide/common/rendering/legacy/ILegacyPullParser.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.common.rendering.legacy;
+
+import com.android.ide.common.rendering.api.ILayoutPullParser;
+import com.android.layoutlib.api.IXmlPullParser;
+
+/**
+ * Intermediary interface extending both old and new project pull parsers from the layout lib API.
+ *
+ * Clients should use this instead of {@link ILayoutPullParser} or {@link IXmlPullParser}.
+ *
+ */
+@SuppressWarnings("deprecation")
+public interface ILegacyPullParser extends ILayoutPullParser, IXmlPullParser {
+
+}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/LayoutBridge.java b/layoutlib_api/src/com/android/ide/common/rendering/api/Bridge.java
index a3bd921..b2c2109 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/LayoutBridge.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/Bridge.java
@@ -14,16 +14,18 @@
* limitations under the License.
*/
-package com.android.layoutlib.api;
+package com.android.ide.common.rendering.api;
+
+import java.io.File;
import java.util.EnumSet;
import java.util.Map;
/**
- * Entry point of the Layout Lib. Extensions of this class provide a method to compute
+ * Entry point of the Layout Library. Extensions of this class provide a method to compute
* and render a layout.
*/
-public abstract class LayoutBridge {
+public abstract class Bridge {
public final static int API_CURRENT = 5;
@@ -32,6 +34,7 @@ public abstract class LayoutBridge {
* <p/>
* While no methods will ever be removed, some may become deprecated, and some new ones
* will appear.
+ * <p/>All Layout libraries based on {@link Bridge} return at minimum an API level of 5.
*/
public abstract int getApiLevel();
@@ -47,11 +50,11 @@ public abstract class LayoutBridge {
/**
* Initializes the Bridge object.
*
- * @param fontOsLocation the location of the fonts.
+ * @param fontLocation the location of the fonts.
* @param enumValueMap map attrName => { map enumFlagName => Integer value }.
* @return true if success.
*/
- public boolean init(String fontOsLocation, Map<String, Map<String, Integer>> enumValueMap) {
+ public boolean init(File fontLocation, Map<String, Map<String, Integer>> enumValueMap) {
return false;
}
@@ -64,12 +67,12 @@ public abstract class LayoutBridge {
/**
* Starts a layout session by inflating and rendering it. The method returns a
- * {@link LayoutScene} on which further actions can be taken.
+ * {@link RenderSession} on which further actions can be taken.
*
- * @return a new {@link LayoutScene} object that contains the result of the scene creation and
+ * @return a new {@link RenderSession} object that contains the result of the scene creation and
* first rendering.
*/
- public LayoutScene createScene(SceneParams params) {
+ public RenderSession createSession(Params params) {
return null;
}
@@ -79,6 +82,8 @@ public abstract class LayoutBridge {
* until this method is called.
* <p/>The cache is not configuration dependent and should only be cleared when a
* resource changes (at this time only bitmaps and 9 patches go into the cache).
+ * <p/>
+ * The project key provided must be similar to the one passed in {@link Params}.
*
* @param projectKey the key for the project.
*/
diff --git a/layoutlib_api/src/com/android/layoutlib/api/Capability.java b/layoutlib_api/src/com/android/ide/common/rendering/api/Capability.java
index 87ceca1..abbab45 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/Capability.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/Capability.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.layoutlib.api;
+package com.android.ide.common.rendering.api;
/**
* Enum describing the layout bridge capabilities.
diff --git a/layoutlib_api/src/com/android/layoutlib/api/DensityBasedResourceValue.java b/layoutlib_api/src/com/android/ide/common/rendering/api/DensityBasedResourceValue.java
index 78b084c..d190b62 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/DensityBasedResourceValue.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/DensityBasedResourceValue.java
@@ -14,7 +14,9 @@
* limitations under the License.
*/
-package com.android.layoutlib.api;
+package com.android.ide.common.rendering.api;
+
+import com.android.layoutlib.api.IDensityBasedResourceValue;
@SuppressWarnings("deprecation")
public class DensityBasedResourceValue extends ResourceValue implements IDensityBasedResourceValue {
diff --git a/layoutlib_api/src/com/android/ide/common/rendering/api/IAnimationListener.java b/layoutlib_api/src/com/android/ide/common/rendering/api/IAnimationListener.java
new file mode 100644
index 0000000..81a2320
--- /dev/null
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/IAnimationListener.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.common.rendering.api;
+
+
+import java.awt.image.BufferedImage;
+
+public interface IAnimationListener {
+ /**
+ * Called when a new animation frame is available for display.
+ *
+ * <p>The {@link RenderSession} object is provided as a convenience. It should be queried
+ * for the image through {@link RenderSession#getImage()}.
+ *
+ * <p>If no {@link IImageFactory} is used, then each new animation frame will be rendered
+ * in its own new {@link BufferedImage} object. However if an image factory is used, and it
+ * always re-use the same object, then the image is only guaranteed to be valid during
+ * this method call. As soon as this method return the image content will be overridden
+ * with new drawing.
+ *
+ */
+ void onNewFrame(RenderSession scene);
+
+ /**
+ * Called when the animation is done playing.
+ */
+ void done(Result result);
+
+ /**
+ * Return true to cancel the animation.
+ */
+ boolean isCanceled();
+
+}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/IImageFactory.java b/layoutlib_api/src/com/android/ide/common/rendering/api/IImageFactory.java
index 626423e..c05c7c6 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/IImageFactory.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/IImageFactory.java
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-package com.android.layoutlib.api;
+package com.android.ide.common.rendering.api;
+
import java.awt.image.BufferedImage;
@@ -25,7 +26,7 @@ import java.awt.image.BufferedImage;
* rendered. The goal is to let the layoutlib caller create an image that's optimized for its use
* case.
*
- * If no factory is passed in {@link SceneParams#setImageFactory(IImageFactory)}, then a default
+ * If no factory is passed in {@link Params#setImageFactory(IImageFactory)}, then a default
* {@link BufferedImage} of type {@link BufferedImage#TYPE_INT_ARGB} is created.
*
*/
diff --git a/layoutlib_api/src/com/android/ide/common/rendering/api/ILayoutPullParser.java b/layoutlib_api/src/com/android/ide/common/rendering/api/ILayoutPullParser.java
new file mode 100644
index 0000000..4b033d9
--- /dev/null
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/ILayoutPullParser.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.common.rendering.api;
+
+import org.xmlpull.v1.XmlPullParser;
+
+/**
+ * Extended version of {@link XmlPullParser} to use with
+ * {@link Bridge#createScene(SceneParams)}
+ */
+public interface ILayoutPullParser extends XmlPullParser {
+
+ /**
+ * Returns a cookie for the current XML node.
+ * <p/>This cookie will be passed back in the {@link ViewInfo} objects, allowing association
+ * of a particular XML node with its result from the layout computation.
+ *
+ * @see ViewInfo#getCookie()
+ */
+ Object getViewCookie();
+
+ /**
+ * Returns a custom parser for the layout of the given name.
+ * @param layoutName the name of the layout.
+ * @return returns a custom parser or null if no custom parsers are needed.
+ *
+ * @since 5
+ */
+ ILayoutPullParser getParser(String layoutName);
+}
+
diff --git a/layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java b/layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java
new file mode 100644
index 0000000..67e082e
--- /dev/null
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.common.rendering.api;
+
+/**
+ * Callback for project information needed by the Layout Library.
+ * Classes implementing this interface provide methods giving access to some project data, like
+ * resource resolution, namespace information, and instantiation of custom view.
+ */
+public interface IProjectCallback {
+
+ /**
+ * Loads a custom view with the given constructor signature and arguments.
+ * @param name The fully qualified name of the class.
+ * @param constructorSignature The signature of the class to use
+ * @param constructorArgs The arguments to use on the constructor
+ * @return A newly instantiated android.view.View object.
+ * @throws ClassNotFoundException
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ Object loadView(String name, Class[] constructorSignature, Object[] constructorArgs)
+ throws ClassNotFoundException, Exception;
+
+ /**
+ * Returns the namespace of the application.
+ * <p/>This lets the Layout Lib load custom attributes for custom views.
+ */
+ String getNamespace();
+
+ /**
+ * Resolves the id of a resource Id.
+ * <p/>The resource id is the value of a <code>R.&lt;type&gt;.&lt;name&gt;</code>, and
+ * this method will return both the type and name of the resource.
+ * @param id the Id to resolve.
+ * @return an array of 2 strings containing the resource name and type, or null if the id
+ * does not match any resource.
+ */
+ String[] resolveResourceValue(int id);
+
+ /**
+ * Resolves the id of a resource Id of type int[]
+ * <p/>The resource id is the value of a R.styleable.&lt;name&gt;, and this method will
+ * return the name of the resource.
+ * @param id the Id to resolve.
+ * @return the name of the resource or <code>null</code> if not found.
+ */
+ String resolveResourceValue(int[] id);
+
+ /**
+ * Returns the id of a resource.
+ * <p/>The provided type and name must match an existing constant defined as
+ * <code>R.&lt;type&gt;.&lt;name&gt;</code>.
+ * @param type the type of the resource
+ * @param name the name of the resource
+ * @return an Integer containing the resource Id, or <code>null</code> if not found.
+ */
+ Integer getResourceValue(String type, String name);
+
+}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/LayoutLog.java b/layoutlib_api/src/com/android/ide/common/rendering/api/LayoutLog.java
index 052750e..a735f81 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/LayoutLog.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/LayoutLog.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.layoutlib.api;
+package com.android.ide.common.rendering.api;
public class LayoutLog {
@@ -35,4 +35,8 @@ public class LayoutLog {
public void error(String tag, String message, Throwable throwable) {
}
+
+ public void fidelityWarning(String tag, String message, Throwable throwable) {
+
+ }
}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/SceneParams.java b/layoutlib_api/src/com/android/ide/common/rendering/api/Params.java
index 309f9fd..59e790e 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/SceneParams.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/Params.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.layoutlib.api;
+package com.android.ide.common.rendering.api;
import java.util.Map;
-public class SceneParams {
+public class Params {
public final static long DEFAULT_TIMEOUT = 250; //ms
@@ -45,7 +45,7 @@ public class SceneParams {
}
}
- private IXmlPullParser mLayoutDescription;
+ private ILayoutPullParser mLayoutDescription;
private Object mProjectKey;
private int mScreenWidth;
private int mScreenHeight;
@@ -68,7 +68,7 @@ public class SceneParams {
/**
*
- * @param layoutDescription the {@link IXmlPullParser} letting the LayoutLib Bridge visit the
+ * @param layoutDescription the {@link ILayoutPullParser} letting the LayoutLib Bridge visit the
* layout file.
* @param projectKey An Object identifying the project. This is used for the cache mechanism.
* @param screenWidth the screen width
@@ -81,17 +81,17 @@ public class SceneParams {
* @param isProjectTheme true if the theme is a project theme, false if it is a framework theme.
* @param projectResources the resources of the project. The map contains (String, map) pairs
* where the string is the type of the resource reference used in the layout file, and the
- * map contains (String, {@link IResourceValue}) pairs where the key is the resource name,
+ * map contains (String, {@link ResourceValue}) pairs where the key is the resource name,
* and the value is the resource value.
* @param frameworkResources the framework resources. The map contains (String, map) pairs
* where the string is the type of the resource reference used in the layout file, and the map
- * contains (String, {@link IResourceValue}) pairs where the key is the resource name, and the
+ * contains (String, {@link ResourceValue}) pairs where the key is the resource name, and the
* value is the resource value.
* @param projectCallback The {@link IProjectCallback} object to get information from
* the project.
* @param log the object responsible for displaying warning/errors to the user.
*/
- public SceneParams(IXmlPullParser layoutDescription,
+ public Params(ILayoutPullParser layoutDescription,
Object projectKey,
int screenWidth, int screenHeight, RenderingMode renderingMode,
int density, float xdpi, float ydpi,
@@ -120,7 +120,7 @@ public class SceneParams {
/**
* Copy constructor.
*/
- public SceneParams(SceneParams params) {
+ public Params(Params params) {
mLayoutDescription = params.mLayoutDescription;
mProjectKey = params.mProjectKey;
mScreenWidth = params.mScreenWidth;
@@ -141,12 +141,12 @@ public class SceneParams {
mImageFactory = params.mImageFactory;
}
- public void setCustomBackgroundColor(int color) {
+ public void setOverrideBgColor(int color) {
mCustomBackgroundEnabled = true;
mCustomBackgroundColor = color;
}
- public void setCustomTimeout(long timeout) {
+ public void setTimeout(long timeout) {
mTimeout = timeout;
}
@@ -154,7 +154,7 @@ public class SceneParams {
mImageFactory = imageFactory;
}
- public IXmlPullParser getLayoutDescription() {
+ public ILayoutPullParser getLayoutDescription() {
return mLayoutDescription;
}
@@ -190,7 +190,7 @@ public class SceneParams {
return mThemeName;
}
- public boolean getIsProjectTheme() {
+ public boolean isProjectTheme() {
return mIsProjectTheme;
}
@@ -210,11 +210,11 @@ public class SceneParams {
return mLog;
}
- public boolean isCustomBackgroundEnabled() {
+ public boolean isBgColorOverridden() {
return mCustomBackgroundEnabled;
}
- public int getCustomBackgroundColor() {
+ public int getOverrideBgColor() {
return mCustomBackgroundColor;
}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/LayoutScene.java b/layoutlib_api/src/com/android/ide/common/rendering/api/RenderSession.java
index 8bfa7ed..12a28de 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/LayoutScene.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/RenderSession.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.layoutlib.api;
+package com.android.ide.common.rendering.api;
-import static com.android.layoutlib.api.SceneResult.SceneStatus.NOT_IMPLEMENTED;
+import static com.android.ide.common.rendering.api.Result.Status.NOT_IMPLEMENTED;
-import com.android.layoutlib.api.SceneResult.SceneStatus;
+import com.android.ide.common.rendering.api.Result.Status;
import java.awt.image.BufferedImage;
import java.util.Map;
@@ -26,45 +26,18 @@ import java.util.Map;
/**
* An object allowing interaction with an Android layout.
*
- * This is returned by {@link LayoutBridge#createScene(SceneParams)}.
+ * This is returned by {@link Bridge#createScene(Params)}.
* and can then be used for subsequent actions on the layout.
*
* @since 5
*
*/
-public class LayoutScene {
-
- public interface IAnimationListener {
- /**
- * Called when a new animation frame is available for display.
- *
- * <p>The {@link LayoutScene} object is provided as a convenience. It should be queried
- * for the image through {@link LayoutScene#getImage()}.
- *
- * <p>If no {@link IImageFactory} is used, then each new animation frame will be rendered
- * in its own new {@link BufferedImage} object. However if an image factory is used, and it
- * always re-use the same object, then the image is only guaranteed to be valid during
- * this method call. As soon as this method return the image content will be overridden
- * with new drawing.
- *
- */
- void onNewFrame(LayoutScene scene);
-
- /**
- * Called when the animation is done playing.
- */
- void done(SceneResult result);
-
- /**
- * Return true to cancel the animation.
- */
- boolean isCanceled();
- }
+public class RenderSession {
/**
* Returns the last operation result.
*/
- public SceneResult getResult() {
+ public Result getResult() {
return NOT_IMPLEMENTED.createResult();
}
@@ -73,8 +46,8 @@ public class LayoutScene {
* <p>
*
* This is reset to a new instance every time {@link #render()} is called and can be
- * <code>null</code> if the call failed (and the method returned a {@link SceneResult} with
- * {@link SceneStatus#ERROR_UNKNOWN} or {@link SceneStatus#NOT_IMPLEMENTED}.
+ * <code>null</code> if the call failed (and the method returned a {@link Result} with
+ * {@link Status#ERROR_UNKNOWN} or {@link Status#NOT_IMPLEMENTED}.
* <p/>
* This can be safely modified by the caller.
*/
@@ -86,8 +59,8 @@ public class LayoutScene {
* Returns the rendering of the full layout.
* <p>
* This is reset to a new instance every time {@link #render()} is called and can be
- * <code>null</code> if the call failed (and the method returned a {@link SceneResult} with
- * {@link SceneStatus#ERROR_UNKNOWN} or {@link SceneStatus#NOT_IMPLEMENTED}.
+ * <code>null</code> if the call failed (and the method returned a {@link Result} with
+ * {@link Status#ERROR_UNKNOWN} or {@link Status#NOT_IMPLEMENTED}.
* <p/>
* This can be safely modified by the caller.
*/
@@ -102,7 +75,7 @@ public class LayoutScene {
* @param viewObject the view object.
* @return a map of the default property values or null.
*/
- public Map<String, String> getDefaultViewPropertyValues(Object viewObject) {
+ public Map<String, String> getDefaultProperties(Object viewObject) {
return null;
}
@@ -113,10 +86,10 @@ public class LayoutScene {
*
* This is equivalent to calling <code>render(SceneParams.DEFAULT_TIMEOUT)</code>
*
- * @return a {@link SceneResult} indicating the status of the action.
+ * @return a {@link Result} indicating the status of the action.
*/
- public SceneResult render() {
- return render(SceneParams.DEFAULT_TIMEOUT);
+ public Result render() {
+ return render(Params.DEFAULT_TIMEOUT);
}
/**
@@ -124,16 +97,16 @@ public class LayoutScene {
* In case of success, this should be followed by calls to {@link #getRootView()} and
* {@link #getImage()} to access the result of the rendering.
*
- * The {@link LayoutBridge} is only able to inflate or render one layout at a time. There
+ * The {@link Bridge} is only able to inflate or render one layout at a time. There
* is an internal lock object whenever such an action occurs. The timeout parameter is used
* when attempting to acquire the lock. If the timeout expires, the method will return
- * {@link SceneStatus#ERROR_TIMEOUT}.
+ * {@link Status#ERROR_TIMEOUT}.
*
* @param timeout timeout for the rendering, in milliseconds.
*
- * @return a {@link SceneResult} indicating the status of the action.
+ * @return a {@link Result} indicating the status of the action.
*/
- public SceneResult render(long timeout) {
+ public Result render(long timeout) {
return NOT_IMPLEMENTED.createResult();
}
@@ -149,9 +122,29 @@ public class LayoutScene {
* @param propertyName
* @param propertyValue
*
- * @return a {@link SceneResult} indicating the status of the action.
+ * @return a {@link Result} indicating the status of the action.
+ *
+ * @throws IllegalArgumentException if the view object is not an android.view.View
+ */
+ public Result setProperty(Object objectView, String propertyName, String propertyValue) {
+ return NOT_IMPLEMENTED.createResult();
+ }
+
+ /**
+ * returns the value of a given property on a given object.
+ * <p/>
+ * This returns a {@link Result} object. If the operation of querying the object for its
+ * property was successful (check {@link Result#isSuccess()}), then the property value
+ * is set in the result and can be accessed through {@link Result#getData()}.
+ *
+ * @param objectView
+ * @param propertyName
+ *
+ * @return a {@link Result} indicating the status of the action.
+ *
+ * @throws IllegalArgumentException if the view object is not an android.view.View
*/
- public SceneResult setProperty(Object objectView, String propertyName, String propertyValue) {
+ public Result getProperty(Object objectView, String propertyName) {
return NOT_IMPLEMENTED.createResult();
}
@@ -168,19 +161,19 @@ public class LayoutScene {
* The child stays in the view hierarchy after the rendering is done. To remove it call
* {@link #removeChild(Object, IAnimationListener)}
* <p/>
- * The returned {@link SceneResult} object will contain the android.view.View object for
- * the newly inflated child. It is accessible through {@link SceneResult#getData()}.
+ * The returned {@link Result} object will contain the android.view.View object for
+ * the newly inflated child. It is accessible through {@link Result#getData()}.
*
* @param parentView the parent View object to receive the new child.
- * @param childXml an {@link IXmlPullParser} containing the content of the new child, including
- * ViewGroup.LayoutParams attributes.
+ * @param childXml an {@link ILayoutPullParser} containing the content of the new child,
+ * including ViewGroup.LayoutParams attributes.
* @param index the index at which position to add the new child into the parent. -1 means at
* the end.
* @param listener an optional {@link IAnimationListener}.
*
- * @return a {@link SceneResult} indicating the status of the action.
+ * @return a {@link Result} indicating the status of the action.
*/
- public SceneResult insertChild(Object parentView, IXmlPullParser childXml, int index,
+ public Result insertChild(Object parentView, ILayoutPullParser childXml, int index,
IAnimationListener listener) {
return NOT_IMPLEMENTED.createResult();
}
@@ -201,7 +194,7 @@ public class LayoutScene {
* The child stays in the view hierarchy after the rendering is done. To remove it call
* {@link #removeChild(Object, IAnimationListener)}
* <p/>
- * The returned {@link SceneResult} object will contain the android.view.ViewGroup.LayoutParams
+ * The returned {@link Result} object will contain the android.view.ViewGroup.LayoutParams
* object created from the <var>layoutParams</var> map if it was non <code>null</code>.
*
* @param parentView the parent View object to receive the child. Can be the current parent
@@ -214,9 +207,9 @@ public class LayoutScene {
* be inflated and set with the content of the map.
* @param listener an optional {@link IAnimationListener}.
*
- * @return a {@link SceneResult} indicating the status of the action.
+ * @return a {@link Result} indicating the status of the action.
*/
- public SceneResult moveChild(Object parentView, Object childView, int index,
+ public Result moveChild(Object parentView, Object childView, int index,
Map<String, String> layoutParams, IAnimationListener listener) {
return NOT_IMPLEMENTED.createResult();
}
@@ -232,9 +225,9 @@ public class LayoutScene {
* @param childView the view object to remove from its parent
* @param listener an optional {@link IAnimationListener}.
*
- * @return a {@link SceneResult} indicating the status of the action.
+ * @return a {@link Result} indicating the status of the action.
*/
- public SceneResult removeChild(Object childView, IAnimationListener listener) {
+ public Result removeChild(Object childView, IAnimationListener listener) {
return NOT_IMPLEMENTED.createResult();
}
@@ -248,9 +241,9 @@ public class LayoutScene {
* @param animationName the name of the animation (res/anim) to play.
* @param listener the listener callback.
*
- * @return a {@link SceneResult} indicating the status of the action.
+ * @return a {@link Result} indicating the status of the action.
*/
- public SceneResult animate(Object targetObject, String animationName,
+ public Result animate(Object targetObject, String animationName,
boolean isFrameworkAnimation, IAnimationListener listener) {
return NOT_IMPLEMENTED.createResult();
}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/ResourceDensity.java b/layoutlib_api/src/com/android/ide/common/rendering/api/ResourceDensity.java
index cebb8df..ca92eae 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/ResourceDensity.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/ResourceDensity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.layoutlib.api;
+package com.android.ide.common.rendering.api;
/**
* Enum representing the density class of Android resources.
diff --git a/layoutlib_api/src/com/android/layoutlib/api/ResourceValue.java b/layoutlib_api/src/com/android/ide/common/rendering/api/ResourceValue.java
index 41f440d..f59f3c3 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/ResourceValue.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/ResourceValue.java
@@ -14,7 +14,9 @@
* limitations under the License.
*/
-package com.android.layoutlib.api;
+package com.android.ide.common.rendering.api;
+
+import com.android.layoutlib.api.IResourceValue;
/**
* Represents an android resource with a name and a string value.
diff --git a/layoutlib_api/src/com/android/layoutlib/api/SceneResult.java b/layoutlib_api/src/com/android/ide/common/rendering/api/Result.java
index 2954671..172a7e7 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/SceneResult.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/Result.java
@@ -14,20 +14,20 @@
* limitations under the License.
*/
-package com.android.layoutlib.api;
+package com.android.ide.common.rendering.api;
/**
* Scene result class. This is an immutable class.
* <p/>
* This cannot be allocated directly, instead use
- * {@link SceneStatus#createResult()},
- * {@link SceneStatus#createResult(String, Throwable)},
- * {@link SceneStatus#createResult(String)}
- * {@link SceneStatus#createResult(Object)}
+ * {@link Status#createResult()},
+ * {@link Status#createResult(String, Throwable)},
+ * {@link Status#createResult(String)}
+ * {@link Status#createResult(Object)}
*/
-public class SceneResult {
+public class Result {
- private final SceneStatus mStatus;
+ private final Status mStatus;
private final String mErrorMessage;
private final Throwable mThrowable;
private Object mData;
@@ -36,7 +36,7 @@ public class SceneResult {
* Scene Status enum.
* <p/>This indicates the status of all scene actions.
*/
- public enum SceneStatus {
+ public enum Status {
SUCCESS,
NOT_IMPLEMENTED,
ERROR_TIMEOUT,
@@ -48,31 +48,31 @@ public class SceneResult {
ERROR_ANIM_NOT_FOUND,
ERROR_UNKNOWN;
- private SceneResult mResult;
+ private Result mResult;
/**
- * Returns a {@link SceneResult} object with this status.
+ * Returns a {@link Result} object with this status.
* @return an instance of SceneResult;
*/
- public SceneResult createResult() {
+ public Result createResult() {
// don't want to get generic error that way.
assert this != ERROR_UNKNOWN;
if (mResult == null) {
- mResult = new SceneResult(this);
+ mResult = new Result(this);
}
return mResult;
}
/**
- * Returns a {@link SceneResult} object with this status, and the given data.
+ * Returns a {@link Result} object with this status, and the given data.
* @return an instance of SceneResult;
*
- * @see SceneResult#getData()
+ * @see Result#getData()
*/
- public SceneResult createResult(Object data) {
- SceneResult res = createResult();
+ public Result createResult(Object data) {
+ Result res = createResult();
if (data != null) {
res = res.getCopyWithData(data);
@@ -87,8 +87,8 @@ public class SceneResult {
* @param throwable the throwable
* @return an instance of SceneResult.
*/
- public SceneResult createResult(String errorMessage, Throwable throwable) {
- return new SceneResult(this, errorMessage, throwable);
+ public Result createResult(String errorMessage, Throwable throwable) {
+ return new Result(this, errorMessage, throwable);
}
/**
@@ -96,36 +96,36 @@ public class SceneResult {
* @param errorMessage the error message
* @return an instance of SceneResult.
*/
- public SceneResult createResult(String errorMessage) {
- return new SceneResult(this, errorMessage, null /*throwable*/);
+ public Result createResult(String errorMessage) {
+ return new Result(this, errorMessage, null /*throwable*/);
}
}
/**
- * Creates a {@link SceneResult} object with the given SceneStatus.
+ * Creates a {@link Result} object with the given SceneStatus.
*
* @param status the status. Must not be null.
*/
- private SceneResult(SceneStatus status) {
+ private Result(Status status) {
this(status, null, null);
}
/**
- * Creates a {@link SceneResult} object with the given SceneStatus, and the given message
+ * Creates a {@link Result} object with the given SceneStatus, and the given message
* and {@link Throwable}
*
* @param status the status. Must not be null.
* @param errorMessage an optional error message.
* @param t an optional exception.
*/
- private SceneResult(SceneStatus status, String errorMessage, Throwable t) {
+ private Result(Status status, String errorMessage, Throwable t) {
assert status != null;
mStatus = status;
mErrorMessage = errorMessage;
mThrowable = t;
}
- private SceneResult(SceneResult result) {
+ private Result(Result result) {
mStatus = result.mStatus;
mErrorMessage = result.mErrorMessage;
mThrowable = result.mThrowable;
@@ -137,8 +137,8 @@ public class SceneResult {
*
* @return returns a new SceneResult instance.
*/
- public SceneResult getCopyWithData(Object data) {
- SceneResult r = new SceneResult(this);
+ public Result getCopyWithData(Object data) {
+ Result r = new Result(this);
r.mData = data;
return r;
}
@@ -151,19 +151,19 @@ public class SceneResult {
* @return <code>true</code> if the status is successful.
*/
public boolean isSuccess() {
- return mStatus == SceneStatus.SUCCESS;
+ return mStatus == Status.SUCCESS;
}
/**
* Returns the status. This is never null.
*/
- public SceneStatus getStatus() {
+ public Status getStatus() {
return mStatus;
}
/**
* Returns the error message. This is only non-null when {@link #getStatus()} returns
- * {@link SceneStatus#ERROR_UNKNOWN}
+ * {@link Status#ERROR_UNKNOWN}
*/
public String getErrorMessage() {
return mErrorMessage;
@@ -171,7 +171,7 @@ public class SceneResult {
/**
* Returns the exception. This is only non-null when {@link #getStatus()} returns
- * {@link SceneStatus#ERROR_UNKNOWN}
+ * {@link Status#ERROR_UNKNOWN}
*/
public Throwable getException() {
return mThrowable;
diff --git a/layoutlib_api/src/com/android/layoutlib/api/StyleResourceValue.java b/layoutlib_api/src/com/android/ide/common/rendering/api/StyleResourceValue.java
index 8052b4e..a9f499f 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/StyleResourceValue.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/StyleResourceValue.java
@@ -14,7 +14,10 @@
* limitations under the License.
*/
-package com.android.layoutlib.api;
+package com.android.ide.common.rendering.api;
+
+import com.android.layoutlib.api.IResourceValue;
+import com.android.layoutlib.api.IStyleResourceValue;
import java.util.HashMap;
diff --git a/layoutlib_api/src/com/android/layoutlib/api/ViewInfo.java b/layoutlib_api/src/com/android/ide/common/rendering/api/ViewInfo.java
index 4a6c93d..2c0c829 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/ViewInfo.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/ViewInfo.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.layoutlib.api;
+package com.android.ide.common.rendering.api;
import java.util.Collections;
import java.util.List;
@@ -22,7 +22,7 @@ import java.util.List;
/**
* Layout information for a specific view object
*/
-public final class ViewInfo {
+public class ViewInfo {
private final Object mCookie;
private final String mName;
@@ -72,7 +72,7 @@ public final class ViewInfo {
/**
* Returns the cookie associated with the XML node. Can be null.
*
- * @see IXmlPullParser#getViewKey()
+ * @see ILayoutPullParser#getViewKey()
*/
public Object getCookie() {
return mCookie;
diff --git a/layoutlib_api/src/com/android/layoutlib/api/IDensityBasedResourceValue.java b/layoutlib_api/src/com/android/layoutlib/api/IDensityBasedResourceValue.java
index bc319c2..4e55d54 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/IDensityBasedResourceValue.java
+++ b/layoutlib_api/src/com/android/layoutlib/api/IDensityBasedResourceValue.java
@@ -16,6 +16,9 @@
package com.android.layoutlib.api;
+import com.android.ide.common.rendering.api.DensityBasedResourceValue;
+import com.android.ide.common.rendering.api.ResourceDensity;
+
/**
* Represents an Android Resources that has a density info attached to it.
* @deprecated use {@link DensityBasedResourceValue}.
diff --git a/layoutlib_api/src/com/android/layoutlib/api/ILayoutBridge.java b/layoutlib_api/src/com/android/layoutlib/api/ILayoutBridge.java
index f5d3660..56d2e36 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/ILayoutBridge.java
+++ b/layoutlib_api/src/com/android/layoutlib/api/ILayoutBridge.java
@@ -16,6 +16,8 @@
package com.android.layoutlib.api;
+import com.android.ide.common.rendering.api.Bridge;
+
import java.util.Map;
/**
@@ -26,7 +28,7 @@ import java.util.Map;
* <p/>
* Changes in API level 5:
* <ul>
- * <li>Bridge should extend {@link LayoutBridge} instead of implementing {@link ILayoutBridge}.</li>
+ * <li>Bridge should extend {@link Bridge} instead of implementing {@link ILayoutBridge}.</li>
* </ul>
* Changes in API level 4:
* <ul>
@@ -44,7 +46,7 @@ import java.util.Map;
* <li>new render method: {@link #computeLayout(IXmlPullParser, Object, int, int, String, boolean, Map, Map, IProjectCallback, ILayoutLog)}</li>
* <li>deprecated {@link #computeLayout(IXmlPullParser, Object, int, int, String, Map, Map, IProjectCallback, ILayoutLog)}</li>
* </ul>
- * @deprecated Extend {@link LayoutBridge} instead.
+ * @deprecated Extend {@link Bridge} instead.
*/
@Deprecated
public interface ILayoutBridge {
@@ -102,7 +104,7 @@ public interface ILayoutBridge {
* the project.
* @param logger the object responsible for displaying warning/errors to the user.
* @return a new {@link ILayoutResult} object that contains the result of the layout.
- * @deprecated use {@link LayoutBridge#createScene(SceneParams)}
+ * @deprecated use {@link Bridge#createScene(SceneParams)}
* @since 4
*/
@Deprecated
@@ -139,7 +141,7 @@ public interface ILayoutBridge {
* the project.
* @param logger the object responsible for displaying warning/errors to the user.
* @return a new {@link ILayoutResult} object that contains the result of the layout.
- * @deprecated use {@link LayoutBridge#createScene(SceneParams)}
+ * @deprecated use {@link Bridge#createScene(SceneParams)}
* @since 3
*/
@Deprecated
@@ -172,7 +174,7 @@ public interface ILayoutBridge {
* the project.
* @param logger the object responsible for displaying warning/errors to the user.
* @return a new {@link ILayoutResult} object that contains the result of the layout.
- * @deprecated use {@link LayoutBridge#createScene(SceneParams)}
+ * @deprecated use {@link Bridge#createScene(SceneParams)}
* @since 2
*/
@Deprecated
@@ -204,7 +206,7 @@ public interface ILayoutBridge {
* the project.
* @param logger the object responsible for displaying warning/errors to the user.
* @return a new {@link ILayoutResult} object that contains the result of the layout.
- * @deprecated use {@link LayoutBridge#createScene(SceneParams)}
+ * @deprecated use {@link Bridge#createScene(SceneParams)}
* @since 1
*/
@Deprecated
diff --git a/layoutlib_api/src/com/android/layoutlib/api/ILayoutLog.java b/layoutlib_api/src/com/android/layoutlib/api/ILayoutLog.java
index 9931f3e..38a22b8 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/ILayoutLog.java
+++ b/layoutlib_api/src/com/android/layoutlib/api/ILayoutLog.java
@@ -16,6 +16,8 @@
package com.android.layoutlib.api;
+import com.android.ide.common.rendering.api.LayoutLog;
+
/**
* Callback interface to display warnings/errors that happened during the computation and
* rendering of the layout.
diff --git a/layoutlib_api/src/com/android/layoutlib/api/ILayoutResult.java b/layoutlib_api/src/com/android/layoutlib/api/ILayoutResult.java
index a4d6da0..46255c4 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/ILayoutResult.java
+++ b/layoutlib_api/src/com/android/layoutlib/api/ILayoutResult.java
@@ -16,13 +16,16 @@
package com.android.layoutlib.api;
+import com.android.ide.common.rendering.api.Bridge;
+import com.android.ide.common.rendering.api.RenderSession;
+
import java.awt.image.BufferedImage;
/**
* The result of a layout computation through {@link ILayoutBridge}.
*
* @since 1
- * @deprecated use {@link LayoutScene} as returned by {@link LayoutBridge#createScene(SceneParams)}
+ * @deprecated use {@link RenderSession} as returned by {@link Bridge#createScene(SceneParams)}
*/
public interface ILayoutResult {
/**
diff --git a/layoutlib_api/src/com/android/layoutlib/api/IProjectCallback.java b/layoutlib_api/src/com/android/layoutlib/api/IProjectCallback.java
index fbdd918..65e2a87 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/IProjectCallback.java
+++ b/layoutlib_api/src/com/android/layoutlib/api/IProjectCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +17,11 @@
package com.android.layoutlib.api;
/**
- * Callback for project information needed by the Layout Library.
- * Classes implementing this interface provide methods giving access to some project data, like
- * resource resolution, namespace information, and instantiation of custom view.
+ *
+ * @deprecated
+ *
*/
-public interface IProjectCallback {
+public interface IProjectCallback {
/**
* Loads a custom view with the given constructor signature and arguments.
@@ -70,5 +70,4 @@ public interface IProjectCallback {
* @return an Integer containing the resource Id, or <code>null</code> if not found.
*/
Integer getResourceValue(String type, String name);
-
}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/IResourceValue.java b/layoutlib_api/src/com/android/layoutlib/api/IResourceValue.java
index 8a3e754..9a00801 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/IResourceValue.java
+++ b/layoutlib_api/src/com/android/layoutlib/api/IResourceValue.java
@@ -16,6 +16,8 @@
package com.android.layoutlib.api;
+import com.android.ide.common.rendering.api.ResourceValue;
+
/**
* Represents an android resource with a name and a string value.
* @deprecated use {@link ResourceValue}.
diff --git a/layoutlib_api/src/com/android/layoutlib/api/IStyleResourceValue.java b/layoutlib_api/src/com/android/layoutlib/api/IStyleResourceValue.java
index 33133c9..21036ca 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/IStyleResourceValue.java
+++ b/layoutlib_api/src/com/android/layoutlib/api/IStyleResourceValue.java
@@ -16,6 +16,8 @@
package com.android.layoutlib.api;
+import com.android.ide.common.rendering.api.StyleResourceValue;
+
/**
* Represents an android style resources with a name and a list of children {@link IResourceValue}.
* @deprecated Use {@link StyleResourceValue}.
diff --git a/layoutlib_api/src/com/android/layoutlib/api/IXmlPullParser.java b/layoutlib_api/src/com/android/layoutlib/api/IXmlPullParser.java
index c3c738f..b4d10a2 100644
--- a/layoutlib_api/src/com/android/layoutlib/api/IXmlPullParser.java
+++ b/layoutlib_api/src/com/android/layoutlib/api/IXmlPullParser.java
@@ -19,8 +19,7 @@ package com.android.layoutlib.api;
import org.xmlpull.v1.XmlPullParser;
/**
- * Extended version of {@link XmlPullParser} to use with
- * {@link LayoutBridge#createScene(SceneParams)}
+ * @deprecated
*/
public interface IXmlPullParser extends XmlPullParser {
@@ -30,14 +29,4 @@ public interface IXmlPullParser extends XmlPullParser {
* of a particular XML node with its result from the layout computation.
*/
Object getViewKey();
-
- /**
- * Returns a custom parser for the layout of the given name.
- * @param layoutName the name of the layout.
- * @return returns a custom parser or null if no custom parsers are needed.
- *
- * @since 5
- */
- IXmlPullParser getParser(String layoutName);
}
-