aboutsummaryrefslogtreecommitdiffstats
path: root/layoutlib_api/src/com/android/layoutlib
diff options
context:
space:
mode:
Diffstat (limited to 'layoutlib_api/src/com/android/layoutlib')
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/Capability.java47
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/DensityBasedResourceValue.java44
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/IDensityBasedResourceValue.java3
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/IImageFactory.java41
-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
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/LayoutBridge.java88
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/LayoutLog.java38
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/LayoutScene.java263
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/ResourceDensity.java59
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/ResourceValue.java87
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/SceneParams.java228
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/SceneResult.java187
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/StyleResourceValue.java77
-rw-r--r--layoutlib_api/src/com/android/layoutlib/api/ViewInfo.java133
20 files changed, 27 insertions, 1317 deletions
diff --git a/layoutlib_api/src/com/android/layoutlib/api/Capability.java b/layoutlib_api/src/com/android/layoutlib/api/Capability.java
deleted file mode 100644
index 87ceca1..0000000
--- a/layoutlib_api/src/com/android/layoutlib/api/Capability.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.layoutlib.api;
-
-/**
- * Enum describing the layout bridge capabilities.
- *
- */
-public enum Capability {
- /** Ability to render at full size, as required by the layout, and unbound by the screen */
- UNBOUND_RENDERING,
- /** Ability to override the background of the rendering with transparency using
- * {@link SceneParams#setCustomBackgroundColor(int)} */
- TRANSPARENCY,
- /** Ability to call {@link LayoutScene#render()} and {@link LayoutScene#render(long)}. */
- RENDER,
- /**
- * Ability to control embedded layout parsers through {@link IXmlPullParser#getParser(String)}
- */
- EMBEDDED_LAYOUT,
- /** Ability to call<br>
- * {@link LayoutScene#insertChild(Object, IXmlPullParser, int, com.android.layoutlib.api.LayoutScene.IAnimationListener)}<br>
- * {@link LayoutScene#moveChild(Object, Object, int, java.util.Map, com.android.layoutlib.api.LayoutScene.IAnimationListener)}<br>
- * {@link LayoutScene#removeChild(Object, com.android.layoutlib.api.LayoutScene.IAnimationListener)}<br>
- * {@link LayoutScene#setProperty(Object, String, String)}
- * */
- VIEW_MANIPULATION,
- /** Ability to call<br>
- * {@link LayoutScene#animate(Object, String, boolean, com.android.layoutlib.api.LayoutScene.IAnimationListener)}
- * <p>If the bridge also supports {@link #VIEW_MANIPULATION} then those methods can use
- * an {@link com.android.layoutlib.api.LayoutScene.IAnimationListener}, otherwise they won't. */
- ANIMATE;
-}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/DensityBasedResourceValue.java b/layoutlib_api/src/com/android/layoutlib/api/DensityBasedResourceValue.java
deleted file mode 100644
index 78b084c..0000000
--- a/layoutlib_api/src/com/android/layoutlib/api/DensityBasedResourceValue.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.layoutlib.api;
-
-@SuppressWarnings("deprecation")
-public class DensityBasedResourceValue extends ResourceValue implements IDensityBasedResourceValue {
-
- private ResourceDensity mDensity;
-
- public DensityBasedResourceValue(String type, String name, String value,
- ResourceDensity density, boolean isFramework) {
- super(type, name, value, isFramework);
- mDensity = density;
- }
-
- /**
- * Returns the density for which this resource is configured.
- * @return the density.
- */
- public ResourceDensity getResourceDensity() {
- return mDensity;
- }
-
- /** Legacy method, do not call
- * @deprecated use {@link #getResourceDensity()} instead.
- */
- public Density getDensity() {
- return Density.getEnum(mDensity.getDpi());
- }
-}
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/IImageFactory.java b/layoutlib_api/src/com/android/layoutlib/api/IImageFactory.java
deleted file mode 100644
index 626423e..0000000
--- a/layoutlib_api/src/com/android/layoutlib/api/IImageFactory.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.layoutlib.api;
-
-import java.awt.image.BufferedImage;
-
-/**
- * Image Factory Interface.
- *
- * An Image factory's task is to create the {@link BufferedImage} into which the scene will be
- * 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
- * {@link BufferedImage} of type {@link BufferedImage#TYPE_INT_ARGB} is created.
- *
- */
-public interface IImageFactory {
-
- /**
- * Creates a buffered image with the given size
- * @param width the width of the image
- * @param height the height of the image
- * @return a new (or reused) BufferedImage of the given size.
- */
- BufferedImage getImage(int width, int height);
-}
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);
}
-
diff --git a/layoutlib_api/src/com/android/layoutlib/api/LayoutBridge.java b/layoutlib_api/src/com/android/layoutlib/api/LayoutBridge.java
deleted file mode 100644
index a3bd921..0000000
--- a/layoutlib_api/src/com/android/layoutlib/api/LayoutBridge.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.layoutlib.api;
-
-import java.util.EnumSet;
-import java.util.Map;
-
-/**
- * Entry point of the Layout Lib. Extensions of this class provide a method to compute
- * and render a layout.
- */
-public abstract class LayoutBridge {
-
- public final static int API_CURRENT = 5;
-
- /**
- * Returns the API level of the layout library.
- * <p/>
- * While no methods will ever be removed, some may become deprecated, and some new ones
- * will appear.
- */
- public abstract int getApiLevel();
-
- /**
- * Returns an {@link EnumSet} of the supported {@link Capability}.
- * @return an {@link EnumSet} with the supported capabilities.
- *
- */
- public EnumSet<Capability> getCapabilities() {
- return EnumSet.noneOf(Capability.class);
- }
-
- /**
- * Initializes the Bridge object.
- *
- * @param fontOsLocation 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) {
- return false;
- }
-
- /**
- * Prepares the layoutlib to unloaded.
- */
- public boolean dispose() {
- return false;
- }
-
- /**
- * Starts a layout session by inflating and rendering it. The method returns a
- * {@link LayoutScene} on which further actions can be taken.
- *
- * @return a new {@link LayoutScene} object that contains the result of the scene creation and
- * first rendering.
- */
- public LayoutScene createScene(SceneParams params) {
- return null;
- }
-
- /**
- * Clears the resource cache for a specific project.
- * <p/>This cache contains bitmaps and nine patches that are loaded from the disk and reused
- * 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).
- *
- * @param projectKey the key for the project.
- */
- public void clearCaches(Object projectKey) {
-
- }
-}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/LayoutLog.java b/layoutlib_api/src/com/android/layoutlib/api/LayoutLog.java
deleted file mode 100644
index 052750e..0000000
--- a/layoutlib_api/src/com/android/layoutlib/api/LayoutLog.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.layoutlib.api;
-
-public class LayoutLog {
-
- public void error(String tag, String message) {
- }
-
- public void error(String tag, Throwable t) {
- }
-
- public void warning(String tag, String message) {
- }
-
- /**
- * Logs an error message and a {@link Throwable}.
- * @param message the message to log.
- * @param throwable the {@link Throwable} to log.
- */
- public void error(String tag, String message, Throwable throwable) {
-
- }
-}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/LayoutScene.java b/layoutlib_api/src/com/android/layoutlib/api/LayoutScene.java
deleted file mode 100644
index 8bfa7ed..0000000
--- a/layoutlib_api/src/com/android/layoutlib/api/LayoutScene.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.layoutlib.api;
-
-import static com.android.layoutlib.api.SceneResult.SceneStatus.NOT_IMPLEMENTED;
-
-import com.android.layoutlib.api.SceneResult.SceneStatus;
-
-import java.awt.image.BufferedImage;
-import java.util.Map;
-
-/**
- * An object allowing interaction with an Android layout.
- *
- * This is returned by {@link LayoutBridge#createScene(SceneParams)}.
- * 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();
- }
-
- /**
- * Returns the last operation result.
- */
- public SceneResult getResult() {
- return NOT_IMPLEMENTED.createResult();
- }
-
- /**
- * Returns the {@link ViewInfo} object for the top level view.
- * <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}.
- * <p/>
- * This can be safely modified by the caller.
- */
- public ViewInfo getRootView() {
- return null;
- }
-
- /**
- * 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}.
- * <p/>
- * This can be safely modified by the caller.
- */
- public BufferedImage getImage() {
- return null;
- }
-
-
- /**
- * Returns a map of (XML attribute name, attribute value) containing only default attribute
- * values, for the given view Object.
- * @param viewObject the view object.
- * @return a map of the default property values or null.
- */
- public Map<String, String> getDefaultViewPropertyValues(Object viewObject) {
- return null;
- }
-
- /**
- * Re-renders the layout as-is.
- * In case of success, this should be followed by calls to {@link #getRootView()} and
- * {@link #getImage()} to access the result of the rendering.
- *
- * This is equivalent to calling <code>render(SceneParams.DEFAULT_TIMEOUT)</code>
- *
- * @return a {@link SceneResult} indicating the status of the action.
- */
- public SceneResult render() {
- return render(SceneParams.DEFAULT_TIMEOUT);
- }
-
- /**
- * Re-renders the layout as-is, with a given timeout in case other renderings are being done.
- * 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
- * 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}.
- *
- * @param timeout timeout for the rendering, in milliseconds.
- *
- * @return a {@link SceneResult} indicating the status of the action.
- */
- public SceneResult render(long timeout) {
- return NOT_IMPLEMENTED.createResult();
- }
-
- /**
- * Sets the value of a given property on a given object.
- * <p/>
- * This does nothing more than change the property. To render the scene in its new state, a
- * call to {@link #render()} is required.
- * <p/>
- * Any amount of actions can be taken on the scene before {@link #render()} is called.
- *
- * @param objectView
- * @param propertyName
- * @param propertyValue
- *
- * @return a {@link SceneResult} indicating the status of the action.
- */
- public SceneResult setProperty(Object objectView, String propertyName, String propertyValue) {
- return NOT_IMPLEMENTED.createResult();
- }
-
- /**
- * Inserts a new child in a ViewGroup object, and renders the result.
- * <p/>
- * The child is first inflated and then added to its new parent, at the given <var>index<var>
- * position. If the <var>index</var> is -1 then the child is added at the end of the parent.
- * <p/>
- * If an animation listener is passed then the rendering is done asynchronously and the
- * result is sent to the listener.
- * If the listener is null, then the rendering is done synchronously.
- * <p/>
- * 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()}.
- *
- * @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 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.
- */
- public SceneResult insertChild(Object parentView, IXmlPullParser childXml, int index,
- IAnimationListener listener) {
- return NOT_IMPLEMENTED.createResult();
- }
-
- /**
- * Move a new child to a different ViewGroup object.
- * <p/>
- * The child is first removed from its current parent, and then added to its new parent, at the
- * given <var>index<var> position. In case the <var>parentView</var> is the current parent of
- * <var>childView</var> then the index must be the value with the <var>childView</var> removed
- * from its parent. If the <var>index</var> is -1 then the child is added at the end of
- * the parent.
- * <p/>
- * If an animation listener is passed then the rendering is done asynchronously and the
- * result is sent to the listener.
- * If the listener is null, then the rendering is done synchronously.
- * <p/>
- * 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
- * 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
- * already.
- * @param childView the view to move.
- * @param index the index at which position to add the new child into the parent. -1 means at
- * the end.
- * @param layoutParams an optional map of new ViewGroup.LayoutParams attribute. If non null,
- * then the current layout params of the view will be removed and a new one will
- * 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.
- */
- public SceneResult moveChild(Object parentView, Object childView, int index,
- Map<String, String> layoutParams, IAnimationListener listener) {
- return NOT_IMPLEMENTED.createResult();
- }
-
- /**
- * Removes a child from a ViewGroup object.
- * <p/>
- * This does nothing more than change the layout. To render the scene in its new state, a
- * call to {@link #render()} is required.
- * <p/>
- * Any amount of actions can be taken on the scene before {@link #render()} is called.
- *
- * @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.
- */
- public SceneResult removeChild(Object childView, IAnimationListener listener) {
- return NOT_IMPLEMENTED.createResult();
- }
-
- /**
- * Starts playing an given animation on a given object.
- * <p/>
- * The animation playback is asynchronous and the rendered frame is sent vi the
- * <var>listener</var>.
- *
- * @param targetObject the view object to animate
- * @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.
- */
- public SceneResult animate(Object targetObject, String animationName,
- boolean isFrameworkAnimation, IAnimationListener listener) {
- return NOT_IMPLEMENTED.createResult();
- }
-
- /**
- * Discards the layout. No more actions can be called on this object.
- */
- public void dispose() {
- }
-}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/ResourceDensity.java b/layoutlib_api/src/com/android/layoutlib/api/ResourceDensity.java
deleted file mode 100644
index cebb8df..0000000
--- a/layoutlib_api/src/com/android/layoutlib/api/ResourceDensity.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.layoutlib.api;
-
-/**
- * Enum representing the density class of Android resources.
- */
-public enum ResourceDensity {
- XHIGH(320),
- HIGH(240),
- MEDIUM(160),
- LOW(120),
- NODPI(0);
-
- public final static int DEFAULT_DENSITY = 160;
-
- private final int mDpi;
-
- ResourceDensity(int dpi) {
- mDpi = dpi;
- }
-
- /**
- * Returns the dot-per-inch value associated with the density.
- * @return the dpi value.
- */
- public int getDpi() {
- return mDpi;
- }
-
- /**
- * Returns the enum matching the given dpi.
- * @param dpi The dpi
- * @return the enum for the dpi or null if no match was found.
- */
- public static ResourceDensity getEnum(int dpi) {
- for (ResourceDensity d : values()) {
- if (d.mDpi == dpi) {
- return d;
- }
- }
-
- return null;
- }
-}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/ResourceValue.java b/layoutlib_api/src/com/android/layoutlib/api/ResourceValue.java
deleted file mode 100644
index 41f440d..0000000
--- a/layoutlib_api/src/com/android/layoutlib/api/ResourceValue.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.layoutlib.api;
-
-/**
- * Represents an android resource with a name and a string value.
- */
-@SuppressWarnings("deprecation")
-public class ResourceValue implements IResourceValue {
- private final String mType;
- private final String mName;
- private String mValue = null;
- private final boolean mIsFramwork;
-
- public ResourceValue(String type, String name, boolean isFramwork) {
- mType = type;
- mName = name;
- mIsFramwork = isFramwork;
- }
-
- public ResourceValue(String type, String name, String value, boolean isFramework) {
- mType = type;
- mName = name;
- mValue = value;
- mIsFramwork = isFramework;
- }
-
- /**
- * Returns the type of the resource. For instance "drawable", "color", etc...
- */
- public String getType() {
- return mType;
- }
-
- /**
- * Returns the name of the resource, as defined in the XML.
- */
- public final String getName() {
- return mName;
- }
-
- /**
- * Returns the value of the resource, as defined in the XML. This can be <code>null</code>
- */
- public final String getValue() {
- return mValue;
- }
-
- /**
- * Returns whether the resource is a framework resource (<code>true</code>) or a project
- * resource (<code>false</false>).
- */
- public final boolean isFramework() {
- return mIsFramwork;
- }
-
-
- /**
- * Sets the value of the resource.
- * @param value the new value
- */
- public void setValue(String value) {
- mValue = value;
- }
-
- /**
- * Sets the value from another resource.
- * @param value the resource value
- */
- public void replaceWith(ResourceValue value) {
- mValue = value.mValue;
- }
-}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/SceneParams.java b/layoutlib_api/src/com/android/layoutlib/api/SceneParams.java
deleted file mode 100644
index 309f9fd..0000000
--- a/layoutlib_api/src/com/android/layoutlib/api/SceneParams.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.layoutlib.api;
-
-import java.util.Map;
-
-public class SceneParams {
-
- public final static long DEFAULT_TIMEOUT = 250; //ms
-
- public static enum RenderingMode {
- NORMAL(false, false),
- V_SCROLL(false, true),
- H_SCROLL(true, false),
- FULL_EXPAND(true, true);
-
- private final boolean mHorizExpand;
- private final boolean mVertExpand;
-
- private RenderingMode(boolean horizExpand, boolean vertExpand) {
- mHorizExpand = horizExpand;
- mVertExpand = vertExpand;
- }
-
- public boolean isHorizExpand() {
- return mHorizExpand;
- }
-
- public boolean isVertExpand() {
- return mVertExpand;
- }
- }
-
- private IXmlPullParser mLayoutDescription;
- private Object mProjectKey;
- private int mScreenWidth;
- private int mScreenHeight;
- private RenderingMode mRenderingMode;
- private int mDensity;
- private float mXdpi;
- private float mYdpi;
- private String mThemeName;
- private boolean mIsProjectTheme;
- private Map<String, Map<String, ResourceValue>> mProjectResources;
- private Map<String, Map<String, ResourceValue>> mFrameworkResources;
- private IProjectCallback mProjectCallback;
- private LayoutLog mLog;
-
- private boolean mCustomBackgroundEnabled;
- private int mCustomBackgroundColor;
- private long mTimeout;
-
- private IImageFactory mImageFactory = null;
-
- /**
- *
- * @param layoutDescription the {@link IXmlPullParser} 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
- * @param screenHeight the screen height
- * @param renderingMode The rendering mode.
- * @param density the density factor for the screen.
- * @param xdpi the screen actual dpi in X
- * @param ydpi the screen actual dpi in Y
- * @param themeName The name of the theme to use.
- * @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,
- * 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
- * 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,
- Object projectKey,
- int screenWidth, int screenHeight, RenderingMode renderingMode,
- int density, float xdpi, float ydpi,
- String themeName, boolean isProjectTheme,
- Map<String, Map<String, ResourceValue>> projectResources,
- Map<String, Map<String, ResourceValue>> frameworkResources,
- IProjectCallback projectCallback, LayoutLog log) {
- mLayoutDescription = layoutDescription;
- mProjectKey = projectKey;
- mScreenWidth = screenWidth;
- mScreenHeight = screenHeight;
- mRenderingMode = renderingMode;
- mDensity = density;
- mXdpi = xdpi;
- mYdpi = ydpi;
- mThemeName = themeName;
- mIsProjectTheme = isProjectTheme;
- mProjectResources = projectResources;
- mFrameworkResources = frameworkResources;
- mProjectCallback = projectCallback;
- mLog = log;
- mCustomBackgroundEnabled = false;
- mTimeout = DEFAULT_TIMEOUT;
- }
-
- /**
- * Copy constructor.
- */
- public SceneParams(SceneParams params) {
- mLayoutDescription = params.mLayoutDescription;
- mProjectKey = params.mProjectKey;
- mScreenWidth = params.mScreenWidth;
- mScreenHeight = params.mScreenHeight;
- mRenderingMode = params.mRenderingMode;
- mDensity = params.mDensity;
- mXdpi = params.mXdpi;
- mYdpi = params.mYdpi;
- mThemeName = params.mThemeName;
- mIsProjectTheme = params.mIsProjectTheme;
- mProjectResources = params.mProjectResources;
- mFrameworkResources = params.mFrameworkResources;
- mProjectCallback = params.mProjectCallback;
- mLog = params.mLog;
- mCustomBackgroundEnabled = params.mCustomBackgroundEnabled;
- mCustomBackgroundColor = params.mCustomBackgroundColor;
- mTimeout = params.mTimeout;
- mImageFactory = params.mImageFactory;
- }
-
- public void setCustomBackgroundColor(int color) {
- mCustomBackgroundEnabled = true;
- mCustomBackgroundColor = color;
- }
-
- public void setCustomTimeout(long timeout) {
- mTimeout = timeout;
- }
-
- public void setImageFactory(IImageFactory imageFactory) {
- mImageFactory = imageFactory;
- }
-
- public IXmlPullParser getLayoutDescription() {
- return mLayoutDescription;
- }
-
- public Object getProjectKey() {
- return mProjectKey;
- }
-
- public int getScreenWidth() {
- return mScreenWidth;
- }
-
- public int getScreenHeight() {
- return mScreenHeight;
- }
-
- public RenderingMode getRenderingMode() {
- return mRenderingMode;
- }
-
- public int getDensity() {
- return mDensity;
- }
-
- public float getXdpi() {
- return mXdpi;
- }
-
- public float getYdpi() {
- return mYdpi;
- }
-
- public String getThemeName() {
- return mThemeName;
- }
-
- public boolean getIsProjectTheme() {
- return mIsProjectTheme;
- }
-
- public Map<String, Map<String, ResourceValue>> getProjectResources() {
- return mProjectResources;
- }
-
- public Map<String, Map<String, ResourceValue>> getFrameworkResources() {
- return mFrameworkResources;
- }
-
- public IProjectCallback getProjectCallback() {
- return mProjectCallback;
- }
-
- public LayoutLog getLog() {
- return mLog;
- }
-
- public boolean isCustomBackgroundEnabled() {
- return mCustomBackgroundEnabled;
- }
-
- public int getCustomBackgroundColor() {
- return mCustomBackgroundColor;
- }
-
- public long getTimeout() {
- return mTimeout;
- }
-
- public IImageFactory getImageFactory() {
- return mImageFactory;
- }
-}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/SceneResult.java b/layoutlib_api/src/com/android/layoutlib/api/SceneResult.java
deleted file mode 100644
index 2954671..0000000
--- a/layoutlib_api/src/com/android/layoutlib/api/SceneResult.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.layoutlib.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)}
- */
-public class SceneResult {
-
- private final SceneStatus mStatus;
- private final String mErrorMessage;
- private final Throwable mThrowable;
- private Object mData;
-
- /**
- * Scene Status enum.
- * <p/>This indicates the status of all scene actions.
- */
- public enum SceneStatus {
- SUCCESS,
- NOT_IMPLEMENTED,
- ERROR_TIMEOUT,
- ERROR_LOCK_INTERRUPTED,
- ERROR_INFLATION,
- ERROR_VIEWGROUP_NO_CHILDREN,
- ERROR_NOT_INFLATED,
- ERROR_RENDER,
- ERROR_ANIM_NOT_FOUND,
- ERROR_UNKNOWN;
-
- private SceneResult mResult;
-
- /**
- * Returns a {@link SceneResult} object with this status.
- * @return an instance of SceneResult;
- */
- public SceneResult createResult() {
- // don't want to get generic error that way.
- assert this != ERROR_UNKNOWN;
-
- if (mResult == null) {
- mResult = new SceneResult(this);
- }
-
- return mResult;
- }
-
- /**
- * Returns a {@link SceneResult} object with this status, and the given data.
- * @return an instance of SceneResult;
- *
- * @see SceneResult#getData()
- */
- public SceneResult createResult(Object data) {
- SceneResult res = createResult();
-
- if (data != null) {
- res = res.getCopyWithData(data);
- }
-
- return res;
- }
-
- /**
- * Returns a {@link #ERROR_UNKNOWN} result with the given message and throwable
- * @param errorMessage the error message
- * @param throwable the throwable
- * @return an instance of SceneResult.
- */
- public SceneResult createResult(String errorMessage, Throwable throwable) {
- return new SceneResult(this, errorMessage, throwable);
- }
-
- /**
- * Returns a {@link #ERROR_UNKNOWN} result with the given message
- * @param errorMessage the error message
- * @return an instance of SceneResult.
- */
- public SceneResult createResult(String errorMessage) {
- return new SceneResult(this, errorMessage, null /*throwable*/);
- }
- }
-
- /**
- * Creates a {@link SceneResult} object with the given SceneStatus.
- *
- * @param status the status. Must not be null.
- */
- private SceneResult(SceneStatus status) {
- this(status, null, null);
- }
-
- /**
- * Creates a {@link SceneResult} 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) {
- assert status != null;
- mStatus = status;
- mErrorMessage = errorMessage;
- mThrowable = t;
- }
-
- private SceneResult(SceneResult result) {
- mStatus = result.mStatus;
- mErrorMessage = result.mErrorMessage;
- mThrowable = result.mThrowable;
- }
-
- /**
- * Returns a copy of the current result with the added (or replaced) given data
- * @param data the data bundle
- *
- * @return returns a new SceneResult instance.
- */
- public SceneResult getCopyWithData(Object data) {
- SceneResult r = new SceneResult(this);
- r.mData = data;
- return r;
- }
-
-
- /**
- * Returns whether the status is successful.
- * <p>
- * This is the same as calling <code>getStatus() == SceneStatus.SUCCESS</code>
- * @return <code>true</code> if the status is successful.
- */
- public boolean isSuccess() {
- return mStatus == SceneStatus.SUCCESS;
- }
-
- /**
- * Returns the status. This is never null.
- */
- public SceneStatus getStatus() {
- return mStatus;
- }
-
- /**
- * Returns the error message. This is only non-null when {@link #getStatus()} returns
- * {@link SceneStatus#ERROR_UNKNOWN}
- */
- public String getErrorMessage() {
- return mErrorMessage;
- }
-
- /**
- * Returns the exception. This is only non-null when {@link #getStatus()} returns
- * {@link SceneStatus#ERROR_UNKNOWN}
- */
- public Throwable getException() {
- return mThrowable;
- }
-
- /**
- * Returns the optional data bundle stored in the result object.
- * @return the data bundle or <code>null</code> if none have been set.
- */
- public Object getData() {
- return mData;
- }
-}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/StyleResourceValue.java b/layoutlib_api/src/com/android/layoutlib/api/StyleResourceValue.java
deleted file mode 100644
index 8052b4e..0000000
--- a/layoutlib_api/src/com/android/layoutlib/api/StyleResourceValue.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.layoutlib.api;
-
-import java.util.HashMap;
-
-/**
- * Represents an android style resources with a name and a list of children {@link ResourceValue}.
- */
-@SuppressWarnings("deprecation")
-public final class StyleResourceValue extends ResourceValue implements IStyleResourceValue {
-
- private String mParentStyle = null;
- private HashMap<String, ResourceValue> mItems = new HashMap<String, ResourceValue>();
-
- public StyleResourceValue(String type, String name, boolean isFramework) {
- super(type, name, isFramework);
- }
-
- public StyleResourceValue(String type, String name, String parentStyle, boolean isFramework) {
- super(type, name, isFramework);
- mParentStyle = parentStyle;
- }
-
- /**
- * Returns the parent style name or <code>null</code> if unknown.
- */
- public String getParentStyle() {
- return mParentStyle;
- }
-
- /**
- * Finds a value in the list by name
- * @param name the name of the resource
- */
- public ResourceValue findValue(String name) {
- return mItems.get(name);
- }
-
- public void addValue(ResourceValue value) {
- mItems.put(value.getName(), value);
- }
-
- @Override
- public void replaceWith(ResourceValue value) {
- assert value instanceof StyleResourceValue;
- super.replaceWith(value);
-
- if (value instanceof StyleResourceValue) {
- mItems.clear();
- mItems.putAll(((StyleResourceValue)value).mItems);
- }
- }
-
- /**
- * Legacy method.
- * @deprecated use {@link #getValue()}
- */
- public IResourceValue findItem(String name) {
- return mItems.get(name);
- }
-
-}
diff --git a/layoutlib_api/src/com/android/layoutlib/api/ViewInfo.java b/layoutlib_api/src/com/android/layoutlib/api/ViewInfo.java
deleted file mode 100644
index 4a6c93d..0000000
--- a/layoutlib_api/src/com/android/layoutlib/api/ViewInfo.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.layoutlib.api;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Layout information for a specific view object
- */
-public final class ViewInfo {
-
- private final Object mCookie;
- private final String mName;
- private final int mLeft;
- private final int mRight;
- private final int mTop;
- private final int mBottom;
- private List<ViewInfo> mChildren = Collections.emptyList();
- private final Object mViewObject;
- private final Object mLayoutParamsObject;
-
- public ViewInfo(String name, Object cookie, int left, int top, int right, int bottom) {
- this(name, cookie, left, top, right, bottom, null /*viewObject*/,
- null /*layoutParamsObject*/);
- }
-
- public ViewInfo(String name, Object cookie, int left, int top, int right, int bottom,
- Object viewObject, Object layoutParamsObject) {
- mName = name;
- mCookie = cookie;
- mLeft = left;
- mRight = right;
- mTop = top;
- mBottom = bottom;
- mViewObject = viewObject;
- mLayoutParamsObject = layoutParamsObject;
- }
-
- /**
- * Sets the list of children {@link ViewInfo}.
- */
- public void setChildren(List<ViewInfo> children) {
- if (children != null) {
- mChildren = Collections.unmodifiableList(children);
- } else {
- mChildren = Collections.emptyList();
- }
- }
-
- /**
- * Returns the list of children views. This is never null, but can be empty.
- */
- public List<ViewInfo> getChildren() {
- return mChildren;
- }
-
- /**
- * Returns the cookie associated with the XML node. Can be null.
- *
- * @see IXmlPullParser#getViewKey()
- */
- public Object getCookie() {
- return mCookie;
- }
-
- /**
- * Returns the class name of the view object. Can be null.
- */
- public String getClassName() {
- return mName;
- }
-
- /**
- * Returns the left of the view bounds, relative to the view parent bounds.
- */
- public int getLeft() {
- return mLeft;
- }
-
- /**
- * Returns the top of the view bounds, relative to the view parent bounds.
- */
- public int getTop() {
- return mTop;
- }
-
- /**
- * Returns the right of the view bounds, relative to the view parent bounds.
- */
- public int getRight() {
- return mRight;
- }
-
- /**
- * Returns the bottom of the view bounds, relative to the view parent bounds.
- */
- public int getBottom() {
- return mBottom;
- }
-
- /**
- * Returns the actual android.view.View (or child class) object. This can be used
- * to query the object properties that are not in the XML and not in the map returned
- * by {@link #getDefaultPropertyValues()}.
- */
- public Object getViewObject() {
- return mViewObject;
- }
-
- /**
- * Returns the actual android.view.ViewGroup$LayoutParams (or child class) object.
- * This can be used to query the object properties that are not in the XML and not in
- * the map returned by {@link #getDefaultPropertyValues()}.
- */
- public Object getLayoutParamsObject() {
- return mLayoutParamsObject;
- }
-}