diff options
author | Xavier Ducrohet <xav@android.com> | 2011-04-04 13:57:05 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2011-04-04 15:57:03 -0700 |
commit | 947381efc70a5b825eb6e730d1be69c71b7a2ad9 (patch) | |
tree | 81ec2a4b7a4b0d94110c63146523c9e3e1a82aa2 /layoutlib_api/src/com/android/ide/common/rendering | |
parent | f3322bdafb5d641254c9056748a730dd8f4ea257 (diff) | |
download | sdk-947381efc70a5b825eb6e730d1be69c71b7a2ad9.zip sdk-947381efc70a5b825eb6e730d1be69c71b7a2ad9.tar.gz sdk-947381efc70a5b825eb6e730d1be69c71b7a2ad9.tar.bz2 |
LayoutLib API: update adapter binding callbacks.
Change-Id: I85be09fd7541da366c858ea04d7c2c4b53948475
Diffstat (limited to 'layoutlib_api/src/com/android/ide/common/rendering')
-rw-r--r-- | layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java b/layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java index 1a16c48..144d317 100644 --- a/layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java +++ b/layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java @@ -19,6 +19,8 @@ package com.android.ide.common.rendering.api; import com.android.resources.ResourceType; import com.android.util.Pair; +import java.net.URL; + /** * Callback for project information needed by the Layout Library. * Classes implementing this interface provide methods giving access to some project data, like @@ -26,6 +28,23 @@ import com.android.util.Pair; */ public interface IProjectCallback { + public enum ViewAttribute { + TEXT(String.class), + IS_CHECKED(Boolean.class), + SRC(URL.class), + COLOR(Integer.class); + + private final Class<?> mClass; + + private ViewAttribute(Class<?> theClass) { + mClass = theClass; + } + + public Class<?> getAttributeClass() { + return mClass; + } + } + /** * Loads a custom view with the given constructor signature and arguments. * @param name The fully qualified name of the class. @@ -77,17 +96,22 @@ public interface IProjectCallback { /** * Returns the value of an item used by an adapter. * @param adapterView The {@link ResourceReference} for the adapter view info. + * @param adapterCookie the view cookie for this particular view. * @param itemRef the {@link ResourceReference} for the layout used by the adapter item. * @param fullPosition the position of the item in the full list. * @param typePosition the position of the item if only items of the same type are considered. * If there is only one type of items, this is the same as <var>position</var>. * @param viewRef The {@link ResourceReference} for the view we're trying to fill. - * @param viewClass the class name of the view we're trying to fill. + * @param ViewAttribute the attribute being queried. + * @param defaultValue the default value for this attribute. The object class matches the + * class associated with the {@link ViewAttribute}. * @return the item value or null if there's no value. + * + * @see ViewAttribute#getAttributeClass() */ - String getAdapterItemValue(ResourceReference adapterView, ResourceReference itemRef, - int fullPosition, int typePosition, - ResourceReference viewRef, String viewClass); + Object getAdapterItemValue(ResourceReference adapterView, Object adapterCookie, + ResourceReference itemRef, int fullPosition, int typePosition, + ResourceReference viewRef, ViewAttribute viewAttribute, Object defaultValue); /** * Returns an adapter binding for a given adapter view. @@ -95,7 +119,8 @@ public interface IProjectCallback { * the given {@link ResourceReference} already. * * @param adapterView the adapter view to return the adapter binding for. + * @param adapterCookie the view cookie for this particular view. * @return an adapter binding for the given view or null if there's no data. */ - AdapterBinding getAdapterBinding(ResourceReference adapterView); + AdapterBinding getAdapterBinding(ResourceReference adapterView, Object adapterCookie); } |