diff options
author | Xavier Ducrohet <xav@android.com> | 2011-04-06 12:22:00 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2011-04-06 14:16:08 -0700 |
commit | 79c8c93587295a899fa89da8b31fbfb008b59ee6 (patch) | |
tree | f056d91773704c3fb29fc6c6d8e6f017448df091 /ide_common/src/com | |
parent | e5842c2be1c196db38dbdd74c25c1436fa656095 (diff) | |
download | sdk-79c8c93587295a899fa89da8b31fbfb008b59ee6.zip sdk-79c8c93587295a899fa89da8b31fbfb008b59ee6.tar.gz sdk-79c8c93587295a899fa89da8b31fbfb008b59ee6.tar.bz2 |
Move getViewParent/Index from RenderSession to Bridge.
Also update the IProjectCallback to handle expandableListView.
Change-Id: I36ca8733182bbd9d169fee3e709ebc532fef7b1e
Diffstat (limited to 'ide_common/src/com')
-rw-r--r-- | ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java b/ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java index d9ffda7..3294cbe 100644 --- a/ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java +++ b/ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java @@ -16,6 +16,8 @@ package com.android.ide.common.rendering; +import static com.android.ide.common.rendering.api.Result.Status.NOT_IMPLEMENTED; + import com.android.ide.common.log.ILogger; import com.android.ide.common.rendering.api.Bridge; import com.android.ide.common.rendering.api.Capability; @@ -321,6 +323,38 @@ public class LayoutLibrary { } } + /** + * Utility method returning the parent of a given view object. + * + * @param viewObject the object for which to return the parent. + * + * @return a {@link Result} indicating the status of the action, and if success, the parent + * object in {@link Result#getData()} + */ + public Result getViewParent(Object viewObject) { + if (mBridge != null) { + return mBridge.getViewParent(viewObject); + } + + return NOT_IMPLEMENTED.createResult(); + } + + /** + * Utility method returning the index of a given view in its parent. + * @param viewObject the object for which to return the index. + * + * @return a {@link Result} indicating the status of the action, and if success, the index in + * the parent in {@link Result#getData()} + */ + public Result getViewIndex(Object viewObject) { + if (mBridge != null) { + return mBridge.getViewIndex(viewObject); + } + + return NOT_IMPLEMENTED.createResult(); + } + + // ------ Implementation private LayoutLibrary(Bridge bridge, ILayoutBridge legacyBridge, ClassLoader classLoader, @@ -462,7 +496,7 @@ public class LayoutLibrary { for (Entry<ResourceType, Map<String, ResourceValue>> entry : map.entrySet()) { // ugly case but works. result.put(entry.getKey().getName(), - (Map<String, IResourceValue>)(Map) entry.getValue()); + (Map) entry.getValue()); } return result; |