diff options
Diffstat (limited to 'eclipse')
24 files changed, 158 insertions, 133 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; |