diff options
Diffstat (limited to 'tools/layoutlib/bridge/src/com/android')
10 files changed, 73 insertions, 78 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/internal/policy/PolicyManager.java b/tools/layoutlib/bridge/src/com/android/internal/policy/PolicyManager.java index 0100dc5..6558b6a 100644 --- a/tools/layoutlib/bridge/src/com/android/internal/policy/PolicyManager.java +++ b/tools/layoutlib/bridge/src/com/android/internal/policy/PolicyManager.java @@ -43,7 +43,7 @@ public class PolicyManager { } public static LayoutInflater makeNewLayoutInflater(Context context) { - return new BridgeInflater(context, RenderAction.getCurrentContext().getProjectCallback()); + return new BridgeInflater(context, RenderAction.getCurrentContext().getLayoutlibCallback()); } public static WindowManagerPolicy makeNewWindowManager() { diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java index 868529e..3f553e7 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java @@ -20,8 +20,8 @@ import android.os.IBinder; import com.android.annotations.Nullable; import com.android.ide.common.rendering.api.AssetRepository; import com.android.ide.common.rendering.api.ILayoutPullParser; -import com.android.ide.common.rendering.api.IProjectCallback; import com.android.ide.common.rendering.api.LayoutLog; +import com.android.ide.common.rendering.api.LayoutlibCallback; import com.android.ide.common.rendering.api.RenderResources; import com.android.ide.common.rendering.api.ResourceReference; import com.android.ide.common.rendering.api.ResourceValue; @@ -113,7 +113,7 @@ public final class BridgeContext extends Context { private final RenderResources mRenderResources; private final Configuration mConfig; private final ApplicationInfo mApplicationInfo; - private final IProjectCallback mProjectCallback; + private final LayoutlibCallback mLayoutlibCallback; private final WindowManager mWindowManager; private final DisplayManager mDisplayManager; @@ -147,13 +147,13 @@ public final class BridgeContext extends Context { public BridgeContext(Object projectKey, DisplayMetrics metrics, RenderResources renderResources, AssetRepository assets, - IProjectCallback projectCallback, + LayoutlibCallback layoutlibCallback, Configuration config, int targetSdkVersion, boolean hasRtlSupport) { mProjectKey = projectKey; mMetrics = metrics; - mProjectCallback = projectCallback; + mLayoutlibCallback = layoutlibCallback; mRenderResources = renderResources; mConfig = config; @@ -172,7 +172,7 @@ public final class BridgeContext extends Context { /** * Initializes the {@link Resources} singleton to be linked to this {@link Context}, its - * {@link DisplayMetrics}, {@link Configuration}, and {@link IProjectCallback}. + * {@link DisplayMetrics}, {@link Configuration}, and {@link LayoutlibCallback}. * * @see #disposeResources() */ @@ -184,7 +184,7 @@ public final class BridgeContext extends Context { assetManager, mMetrics, mConfig, - mProjectCallback); + mLayoutlibCallback); mTheme = mSystemResources.newTheme(); } @@ -223,8 +223,8 @@ public final class BridgeContext extends Context { return mMetrics; } - public IProjectCallback getProjectCallback() { - return mProjectCallback; + public LayoutlibCallback getLayoutlibCallback() { + return mLayoutlibCallback; } public RenderResources getRenderResources() { @@ -283,7 +283,7 @@ public final class BridgeContext extends Context { Pair<ResourceType, String> resourceInfo = Bridge.resolveResourceId(resid); boolean isFrameworkRes = true; if (resourceInfo == null) { - resourceInfo = mProjectCallback.resolveResourceId(resid); + resourceInfo = mLayoutlibCallback.resolveResourceId(resid); isFrameworkRes = false; } @@ -339,8 +339,8 @@ public final class BridgeContext extends Context { } // didn't find a match in the framework? look in the project. - if (mProjectCallback != null) { - resourceInfo = mProjectCallback.resolveResourceId(id); + if (mLayoutlibCallback != null) { + resourceInfo = mLayoutlibCallback.resolveResourceId(id); if (resourceInfo != null) { return new ResourceReference(resourceInfo.getSecond(), false); @@ -438,9 +438,9 @@ public final class BridgeContext extends Context { private ILayoutPullParser getParser(ResourceReference resource) { ILayoutPullParser parser; if (resource instanceof ResourceValue) { - parser = mProjectCallback.getParser((ResourceValue) resource); + parser = mLayoutlibCallback.getParser((ResourceValue) resource); } else { - parser = mProjectCallback.getParser(resource.getName()); + parser = mLayoutlibCallback.getParser(resource.getName()); } return parser; } @@ -665,7 +665,7 @@ public final class BridgeContext extends Context { boolean isFrameworkRes = true; Pair<ResourceType, String> value = Bridge.resolveResourceId(defStyleRes); if (value == null) { - value = mProjectCallback.resolveResourceId(defStyleRes); + value = mLayoutlibCallback.resolveResourceId(defStyleRes); isFrameworkRes = false; } @@ -703,7 +703,7 @@ public final class BridgeContext extends Context { } } - String appNamespace = mProjectCallback.getNamespace(); + String appNamespace = mLayoutlibCallback.getNamespace(); if (attributeList != null) { for (int index = 0 ; index < attributeList.size() ; index++) { @@ -846,7 +846,7 @@ public final class BridgeContext extends Context { if (resolvedResource != null) { isFramework = true; } else { - resolvedResource = mProjectCallback.resolveResourceId(attr); + resolvedResource = mLayoutlibCallback.resolveResourceId(attr); } if (resolvedResource != null) { @@ -872,7 +872,7 @@ public final class BridgeContext extends Context { return Pair.of(info.getSecond(), Boolean.TRUE); } - info = mProjectCallback.resolveResourceId(attr); + info = mLayoutlibCallback.resolveResourceId(attr); if (info != null) { return Pair.of(info.getSecond(), Boolean.FALSE); } @@ -924,8 +924,8 @@ public final class BridgeContext extends Context { // getResourceId creates a new resource id if an existing resource id isn't found. So, we // check for the existence of the resource before calling it. if (getRenderResources().getProjectResource(resType, resName) != null) { - if (mProjectCallback != null) { - Integer value = mProjectCallback.getResourceId(resType, resName); + if (mLayoutlibCallback != null) { + Integer value = mLayoutlibCallback.getResourceId(resType, resName); if (value != null) { return value; } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/support/RecyclerViewUtil.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/support/RecyclerViewUtil.java index 1d47333..aac5d33 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/support/RecyclerViewUtil.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/support/RecyclerViewUtil.java @@ -18,8 +18,8 @@ package com.android.layoutlib.bridge.android.support; import com.android.annotations.NonNull; import com.android.annotations.Nullable; -import com.android.ide.common.rendering.api.IProjectCallback; import com.android.ide.common.rendering.api.LayoutLog; +import com.android.ide.common.rendering.api.LayoutlibCallback; import com.android.ide.common.rendering.api.SessionParams; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.android.BridgeContext; @@ -30,7 +30,6 @@ import android.view.View; import android.widget.LinearLayout; import java.lang.reflect.Method; -import java.util.HashMap; import static com.android.layoutlib.bridge.util.ReflectionUtils.*; @@ -61,7 +60,7 @@ public class RecyclerViewUtil { public static void setAdapter(@NonNull View recyclerView, @NonNull BridgeContext context, @NonNull SessionParams params) { try { - setLayoutManager(recyclerView, context, params.getProjectCallback()); + setLayoutManager(recyclerView, context, params.getLayoutlibCallback()); Object adapter = createAdapter(params); setProperty(recyclerView, CN_ADAPTER, adapter, "setAdapter"); } catch (ReflectionException e) { @@ -71,7 +70,7 @@ public class RecyclerViewUtil { } private static void setLayoutManager(@NonNull View recyclerView, @NonNull BridgeContext context, - @NonNull IProjectCallback callback) throws ReflectionException { + @NonNull LayoutlibCallback callback) throws ReflectionException { Object cookie = context.getCookie(recyclerView); assert cookie == null || cookie instanceof LayoutManagerType || cookie instanceof String; if (!(cookie instanceof LayoutManagerType)) { @@ -90,7 +89,7 @@ public class RecyclerViewUtil { @Nullable private static Object createLayoutManager(@Nullable LayoutManagerType type, - @NonNull Context context, @NonNull IProjectCallback callback) + @NonNull Context context, @NonNull LayoutlibCallback callback) throws ReflectionException { if (type == null) { type = LayoutManagerType.getDefault(); @@ -109,7 +108,7 @@ public class RecyclerViewUtil { return null; } try { - return params.getProjectCallback().loadView(CN_ADAPTER, new Class[0], new Object[0]); + return params.getLayoutlibCallback().loadView(CN_ADAPTER, new Class[0], new Object[0]); } catch (Exception e) { throw new ReflectionException(e); } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java index ee57067..dd1f661 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java @@ -70,7 +70,7 @@ public class AppCompatActionBar extends BridgeActionBar { try { Class[] constructorParams = {View.class}; Object[] constructorArgs = {getDecorContent()}; - mWindowDecorActionBar = params.getProjectCallback().loadView(WINDOW_ACTION_BAR_CLASS, + mWindowDecorActionBar = params.getLayoutlibCallback().loadView(WINDOW_ACTION_BAR_CLASS, constructorParams, constructorArgs); mWindowActionBarClass = mWindowDecorActionBar == null ? null : diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/BridgeActionBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/BridgeActionBar.java index 2a83ea1..3d1a9b9 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/BridgeActionBar.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/BridgeActionBar.java @@ -51,7 +51,7 @@ public abstract class BridgeActionBar { @NonNull ViewGroup parentView) { mBridgeContext = context; mParams = params; - mCallback = params.getProjectCallback().getActionBarCallback(); + mCallback = params.getLayoutlibCallback().getActionBarCallback(); ResourceValue layoutName = getLayoutResource(context); if (layoutName == null) { throw new RuntimeException("Unable to find the layout for Action Bar."); diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java index 127cb72..c708316 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java @@ -16,10 +16,6 @@ package com.android.layoutlib.bridge.impl; -import static com.android.ide.common.rendering.api.Result.Status.ERROR_LOCK_INTERRUPTED; -import static com.android.ide.common.rendering.api.Result.Status.ERROR_TIMEOUT; -import static com.android.ide.common.rendering.api.Result.Status.SUCCESS; - import com.android.ide.common.rendering.api.HardwareConfig; import com.android.ide.common.rendering.api.LayoutLog; import com.android.ide.common.rendering.api.RenderParams; @@ -43,6 +39,10 @@ import android.view.inputmethod.InputMethodManager_Accessor; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; +import static com.android.ide.common.rendering.api.Result.Status.ERROR_LOCK_INTERRUPTED; +import static com.android.ide.common.rendering.api.Result.Status.ERROR_TIMEOUT; +import static com.android.ide.common.rendering.api.Result.Status.SUCCESS; + /** * Base class for rendering action. * @@ -120,7 +120,7 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso // build the context mContext = new BridgeContext(mParams.getProjectKey(), metrics, resources, - mParams.getAssets(), mParams.getProjectCallback(), getConfiguration(), + mParams.getAssets(), mParams.getLayoutlibCallback(), getConfiguration(), mParams.getTargetSdkVersion(), mParams.isRtlSupported()); setUp(); diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java index ff67f65..95576ef 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java @@ -16,20 +16,13 @@ package com.android.layoutlib.bridge.impl; -import static com.android.ide.common.rendering.api.Result.Status.ERROR_ANIM_NOT_FOUND; -import static com.android.ide.common.rendering.api.Result.Status.ERROR_INFLATION; -import static com.android.ide.common.rendering.api.Result.Status.ERROR_NOT_INFLATED; -import static com.android.ide.common.rendering.api.Result.Status.ERROR_UNKNOWN; -import static com.android.ide.common.rendering.api.Result.Status.ERROR_VIEWGROUP_NO_CHILDREN; -import static com.android.ide.common.rendering.api.Result.Status.SUCCESS; - import com.android.annotations.NonNull; import com.android.annotations.Nullable; import com.android.ide.common.rendering.api.AdapterBinding; import com.android.ide.common.rendering.api.HardwareConfig; import com.android.ide.common.rendering.api.IAnimationListener; 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.RenderResources; import com.android.ide.common.rendering.api.RenderSession; import com.android.ide.common.rendering.api.ResourceReference; @@ -54,13 +47,13 @@ import com.android.layoutlib.bridge.android.BridgeLayoutParamsMapAttributes; import com.android.layoutlib.bridge.android.BridgeXmlBlockParser; import com.android.layoutlib.bridge.android.SessionParamsFlags; import com.android.layoutlib.bridge.android.support.RecyclerViewUtil; -import com.android.layoutlib.bridge.bars.BridgeActionBar; import com.android.layoutlib.bridge.bars.AppCompatActionBar; +import com.android.layoutlib.bridge.bars.BridgeActionBar; import com.android.layoutlib.bridge.bars.Config; +import com.android.layoutlib.bridge.bars.FrameworkActionBar; import com.android.layoutlib.bridge.bars.NavigationBar; import com.android.layoutlib.bridge.bars.StatusBar; import com.android.layoutlib.bridge.bars.TitleBar; -import com.android.layoutlib.bridge.bars.FrameworkActionBar; import com.android.layoutlib.bridge.impl.binding.FakeAdapter; import com.android.layoutlib.bridge.impl.binding.FakeExpandableAdapter; import com.android.resources.Density; @@ -116,6 +109,13 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import static com.android.ide.common.rendering.api.Result.Status.ERROR_ANIM_NOT_FOUND; +import static com.android.ide.common.rendering.api.Result.Status.ERROR_INFLATION; +import static com.android.ide.common.rendering.api.Result.Status.ERROR_NOT_INFLATED; +import static com.android.ide.common.rendering.api.Result.Status.ERROR_UNKNOWN; +import static com.android.ide.common.rendering.api.Result.Status.ERROR_VIEWGROUP_NO_CHILDREN; +import static com.android.ide.common.rendering.api.Result.Status.SUCCESS; + /** * Class implementing the render session. * <p/> @@ -219,7 +219,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { WindowManagerGlobal_Delegate.setWindowManagerService(iwm); // build the inflater and parser. - mInflater = new BridgeInflater(context, params.getProjectCallback()); + mInflater = new BridgeInflater(context, params.getLayoutlibCallback()); context.setBridgeInflater(mInflater); mBlockParser = new BridgeXmlBlockParser( @@ -401,7 +401,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { // Sets the project callback (custom view loader) to the fragment delegate so that // it can instantiate the custom Fragment. - Fragment_Delegate.setProjectCallback(params.getProjectCallback()); + Fragment_Delegate.setLayoutlibCallback(params.getLayoutlibCallback()); String rootTag = params.getFlag(SessionParamsFlags.FLAG_KEY_ROOT_TAG); boolean isPreference = "PreferenceScreen".equals(rootTag); @@ -416,13 +416,13 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { // done with the parser, pop it. context.popParser(); - Fragment_Delegate.setProjectCallback(null); + Fragment_Delegate.setLayoutlibCallback(null); // set the AttachInfo on the root view. AttachInfo_Accessor.setAttachInfo(mViewRoot); // post-inflate process. For now this supports TabHost/TabWidget - postInflateProcess(view, params.getProjectCallback(), isPreference ? view : null); + postInflateProcess(view, params.getLayoutlibCallback(), isPreference ? view : null); // get the background drawable if (mWindowBackground != null) { @@ -675,7 +675,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { animationResource = context.getRenderResources().getProjectResource( ResourceType.ANIMATOR, animationName); if (animationResource != null) { - animationId = context.getProjectCallback().getResourceId( + animationId = context.getLayoutlibCallback().getResourceId( ResourceType.ANIMATOR, animationName); } } @@ -1246,17 +1246,17 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { * {@link TabWidget}, and the corresponding {@link FrameLayout} and make new tabs automatically * based on the content of the {@link FrameLayout}. * @param view the root view to process. - * @param projectCallback callback to the project. + * @param layoutlibCallback callback to the project. * @param skip the view and it's children are not processed. */ @SuppressWarnings("deprecation") // For the use of Pair - private void postInflateProcess(View view, IProjectCallback projectCallback, View skip) + private void postInflateProcess(View view, LayoutlibCallback layoutlibCallback, View skip) throws PostInflateException { if (view == skip) { return; } if (view instanceof TabHost) { - setupTabHost((TabHost) view, projectCallback); + setupTabHost((TabHost) view, layoutlibCallback); } else if (view instanceof QuickContactBadge) { QuickContactBadge badge = (QuickContactBadge) view; badge.setImageToDefault(); @@ -1275,8 +1275,8 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { // if there was no adapter binding, trying to get it from the call back. if (binding == null) { - binding = params.getProjectCallback().getAdapterBinding(listRef, - context.getViewKey(view), view); + binding = layoutlibCallback.getAdapterBinding( + listRef, context.getViewKey(view), view); } if (binding != null) { @@ -1292,7 +1292,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { for (int i = 0; i < count; i++) { Pair<View, Boolean> pair = context.inflateView( binding.getHeaderAt(i), - list, false /*attachToRoot*/, skipCallbackParser); + list, false, skipCallbackParser); if (pair.getFirst() != null) { list.addHeaderView(pair.getFirst()); } @@ -1304,7 +1304,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { for (int i = 0; i < count; i++) { Pair<View, Boolean> pair = context.inflateView( binding.getFooterAt(i), - list, false /*attachToRoot*/, skipCallbackParser); + list, false, skipCallbackParser); if (pair.getFirst() != null) { list.addFooterView(pair.getFirst()); } @@ -1315,17 +1315,14 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { if (view instanceof ExpandableListView) { ((ExpandableListView) view).setAdapter( - new FakeExpandableAdapter( - listRef, binding, params.getProjectCallback())); + new FakeExpandableAdapter(listRef, binding, layoutlibCallback)); } else { ((AbsListView) view).setAdapter( - new FakeAdapter( - listRef, binding, params.getProjectCallback())); + new FakeAdapter(listRef, binding, layoutlibCallback)); } } else if (view instanceof AbsSpinner) { ((AbsSpinner) view).setAdapter( - new FakeAdapter( - listRef, binding, params.getProjectCallback())); + new FakeAdapter(listRef, binding, layoutlibCallback)); } } } @@ -1336,7 +1333,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { final int count = group.getChildCount(); for (int c = 0; c < count; c++) { View child = group.getChildAt(c); - postInflateProcess(child, projectCallback, skip); + postInflateProcess(child, layoutlibCallback, skip); } } } @@ -1360,10 +1357,10 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { /** * Sets up a {@link TabHost} object. * @param tabHost the TabHost to setup. - * @param projectCallback The project callback object to access the project R class. + * @param layoutlibCallback The project callback object to access the project R class. * @throws PostInflateException */ - private void setupTabHost(TabHost tabHost, IProjectCallback projectCallback) + private void setupTabHost(TabHost tabHost, LayoutlibCallback layoutlibCallback) throws PostInflateException { // look for the TabWidget, and the FrameLayout. They have their own specific names View v = tabHost.findViewById(android.R.id.tabs); @@ -1424,7 +1421,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { @SuppressWarnings("ConstantConditions") // child cannot be null. int id = child.getId(); @SuppressWarnings("deprecation") - Pair<ResourceType, String> resource = projectCallback.resolveResourceId(id); + Pair<ResourceType, String> resource = layoutlibCallback.resolveResourceId(id); String name; if (resource != null) { name = resource.getSecond(); diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/AdapterHelper.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/AdapterHelper.java index 6c998af..9aab340 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/AdapterHelper.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/AdapterHelper.java @@ -17,7 +17,7 @@ package com.android.layoutlib.bridge.impl.binding; import com.android.ide.common.rendering.api.DataBindingItem; -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.IProjectCallback.ViewAttribute; @@ -40,7 +40,7 @@ import android.widget.TextView; public class AdapterHelper { static Pair<View, Boolean> getView(AdapterItem item, AdapterItem parentItem, ViewGroup parent, - IProjectCallback callback, ResourceReference adapterRef, boolean skipCallbackParser) { + LayoutlibCallback callback, ResourceReference adapterRef, boolean skipCallbackParser) { // we don't care about recycling here because we never scroll. DataBindingItem dataBindingItem = item.getDataBindingItem(); @@ -65,7 +65,7 @@ public class AdapterHelper { } private static void fillView(BridgeContext context, View view, AdapterItem item, - AdapterItem parentItem, IProjectCallback callback, ResourceReference adapterRef) { + AdapterItem parentItem, LayoutlibCallback callback, ResourceReference adapterRef) { if (view instanceof ViewGroup) { ViewGroup group = (ViewGroup) view; final int count = group.getChildCount(); diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeAdapter.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeAdapter.java index 9a13f5a..142eac1 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeAdapter.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeAdapter.java @@ -18,7 +18,7 @@ package com.android.layoutlib.bridge.impl.binding; import com.android.ide.common.rendering.api.AdapterBinding; import com.android.ide.common.rendering.api.DataBindingItem; -import com.android.ide.common.rendering.api.IProjectCallback; +import com.android.ide.common.rendering.api.LayoutlibCallback; import com.android.ide.common.rendering.api.ResourceReference; import com.android.util.Pair; @@ -37,18 +37,17 @@ import java.util.List; * and {@link SpinnerAdapter}. * */ -@SuppressWarnings("deprecation") public class FakeAdapter extends BaseAdapter { // don't use a set because the order is important. private final List<ResourceReference> mTypes = new ArrayList<ResourceReference>(); - private final IProjectCallback mCallback; + private final LayoutlibCallback mCallback; private final ResourceReference mAdapterRef; private final List<AdapterItem> mItems = new ArrayList<AdapterItem>(); private boolean mSkipCallbackParser = false; public FakeAdapter(ResourceReference adapterRef, AdapterBinding binding, - IProjectCallback callback) { + LayoutlibCallback callback) { mAdapterRef = adapterRef; mCallback = callback; @@ -111,11 +110,11 @@ public class FakeAdapter extends BaseAdapter { public View getView(int position, View convertView, ViewGroup parent) { // we don't care about recycling here because we never scroll. AdapterItem item = mItems.get(position); - Pair<View, Boolean> pair = AdapterHelper.getView(item, null /*parentGroup*/, parent, - mCallback, mAdapterRef, mSkipCallbackParser); + @SuppressWarnings("deprecation") + Pair<View, Boolean> pair = AdapterHelper.getView(item, null, parent, mCallback, + mAdapterRef, mSkipCallbackParser); mSkipCallbackParser = pair.getSecond(); return pair.getFirst(); - } @Override diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeExpandableAdapter.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeExpandableAdapter.java index e539579..344b17e 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeExpandableAdapter.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeExpandableAdapter.java @@ -18,7 +18,7 @@ package com.android.layoutlib.bridge.impl.binding; import com.android.ide.common.rendering.api.AdapterBinding; import com.android.ide.common.rendering.api.DataBindingItem; -import com.android.ide.common.rendering.api.IProjectCallback; +import com.android.ide.common.rendering.api.LayoutlibCallback; import com.android.ide.common.rendering.api.ResourceReference; import com.android.util.Pair; @@ -34,7 +34,7 @@ import java.util.List; @SuppressWarnings("deprecation") public class FakeExpandableAdapter implements ExpandableListAdapter, HeterogeneousExpandableList { - private final IProjectCallback mCallback; + private final LayoutlibCallback mCallback; private final ResourceReference mAdapterRef; private boolean mSkipCallbackParser = false; @@ -45,7 +45,7 @@ public class FakeExpandableAdapter implements ExpandableListAdapter, Heterogeneo private final List<ResourceReference> mChildrenTypes = new ArrayList<ResourceReference>(); public FakeExpandableAdapter(ResourceReference adapterRef, AdapterBinding binding, - IProjectCallback callback) { + LayoutlibCallback callback) { mAdapterRef = adapterRef; mCallback = callback; |