From ba586859c055ec82d60881d9a47bbff98c2aa58c Mon Sep 17 00:00:00 2001 From: Deepanshu Gupta Date: Thu, 2 Apr 2015 12:02:12 -0700 Subject: Move to the new LayoutlibCallback. LegacyCallback will be removed shortly. The change moves to the new LayoutlibCallback. Also implement the newly added supports() method. Change-Id: If0871d56a83818d29112f07f29b3b77b401b4fb9 --- .../adt/internal/editors/layout/ProjectCallback.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 6b842ed..020c666 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 @@ -34,13 +34,14 @@ import com.android.ide.common.rendering.RenderSecurityManager; import com.android.ide.common.rendering.api.ActionBarCallback; import com.android.ide.common.rendering.api.AdapterBinding; import com.android.ide.common.rendering.api.DataBindingItem; +import com.android.ide.common.rendering.api.Features; import com.android.ide.common.rendering.api.ILayoutPullParser; import com.android.ide.common.rendering.api.IProjectCallback; +import com.android.ide.common.rendering.api.LayoutlibCallback; import com.android.ide.common.rendering.api.LayoutLog; import com.android.ide.common.rendering.api.ResourceReference; import com.android.ide.common.rendering.api.ResourceValue; import com.android.ide.common.rendering.api.Result; -import com.android.ide.common.rendering.legacy.LegacyCallback; import com.android.ide.common.resources.ResourceResolver; import com.android.ide.common.xml.ManifestData; import com.android.ide.eclipse.adt.AdtConstants; @@ -76,9 +77,9 @@ import java.util.TreeSet; /** * Loader for Android Project class in order to use them in the layout editor. *

This implements {@link IProjectCallback} for the old and new API through - * {@link LegacyCallback} + * {@link LayoutlibCallback} */ -public final class ProjectCallback extends LegacyCallback { +public final class ProjectCallback extends LayoutlibCallback { private final HashMap> mLoadedClasses = new HashMap>(); private final Set mMissingClasses = new TreeSet(); private final Set mBrokenClasses = new TreeSet(); @@ -151,7 +152,7 @@ public final class ProjectCallback extends LegacyCallback { @SuppressWarnings("unchecked") public Object loadView(String className, Class[] constructorSignature, Object[] constructorParameters) - throws ClassNotFoundException, Exception { + throws Exception { mUsed = true; if (className == null) { @@ -684,4 +685,9 @@ public final class ProjectCallback extends LegacyCallback { public ActionBarCallback getActionBarCallback() { return new ActionBarHandler(mEditor); } + + @Override + public boolean supports(int feature) { + return feature <= Features.LAST_CAPABILITY; + } } -- cgit v1.1