From 79c8c93587295a899fa89da8b31fbfb008b59ee6 Mon Sep 17 00:00:00 2001 From: Xavier Ducrohet Date: Wed, 6 Apr 2011 12:22:00 -0700 Subject: Move getViewParent/Index from RenderSession to Bridge. Also update the IProjectCallback to handle expandableListView. Change-Id: I36ca8733182bbd9d169fee3e709ebc532fef7b1e --- .../ide/common/rendering/LayoutLibrary.java | 36 +++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'ide_common/src/com/android/ide/common') 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> entry : map.entrySet()) { // ugly case but works. result.put(entry.getKey().getName(), - (Map)(Map) entry.getValue()); + (Map) entry.getValue()); } return result; -- cgit v1.1