use of com.android.ide.common.rendering.api.DataBindingItem in project android_frameworks_base by ParanoidAndroid.
the class BaseAdapter method getView.
protected View getView(AdapterItem item, AdapterItem parentItem, View convertView, ViewGroup parent) {
// we don't care about recycling here because we never scroll.
DataBindingItem dataBindingItem = item.getDataBindingItem();
BridgeContext context = RenderAction.getCurrentContext();
Pair<View, Boolean> pair = context.inflateView(dataBindingItem.getViewReference(), parent, false, /*attachToRoot*/
mSkipCallbackParser);
View view = pair.getFirst();
mSkipCallbackParser |= pair.getSecond();
if (view != null) {
fillView(context, view, item, parentItem);
} else {
// create a text view to display an error.
TextView tv = new TextView(context);
tv.setText("Unable to find layout: " + dataBindingItem.getViewReference().getName());
view = tv;
}
return view;
}
use of com.android.ide.common.rendering.api.DataBindingItem in project platform_frameworks_base by android.
the class AdapterHelper method getView.
@SuppressWarnings("deprecation")
static Pair<View, Boolean> getView(AdapterItem item, AdapterItem parentItem, ViewGroup parent, LayoutlibCallback callback, ResourceReference adapterRef, boolean skipCallbackParser) {
// we don't care about recycling here because we never scroll.
DataBindingItem dataBindingItem = item.getDataBindingItem();
BridgeContext context = RenderAction.getCurrentContext();
Pair<View, Boolean> pair = context.inflateView(dataBindingItem.getViewReference(), parent, false, /*attachToRoot*/
skipCallbackParser);
View view = pair.getFirst();
skipCallbackParser |= pair.getSecond();
if (view != null) {
fillView(context, view, item, parentItem, callback, adapterRef);
} else {
// create a text view to display an error.
TextView tv = new TextView(context);
tv.setText("Unable to find layout: " + dataBindingItem.getViewReference().getName());
view = tv;
}
return Pair.of(view, skipCallbackParser);
}
use of com.android.ide.common.rendering.api.DataBindingItem in project android_frameworks_base by AOSPA.
the class AdapterHelper method getView.
@SuppressWarnings("deprecation")
static Pair<View, Boolean> getView(AdapterItem item, AdapterItem parentItem, ViewGroup parent, LayoutlibCallback callback, ResourceReference adapterRef, boolean skipCallbackParser) {
// we don't care about recycling here because we never scroll.
DataBindingItem dataBindingItem = item.getDataBindingItem();
BridgeContext context = RenderAction.getCurrentContext();
Pair<View, Boolean> pair = context.inflateView(dataBindingItem.getViewReference(), parent, false, /*attachToRoot*/
skipCallbackParser);
View view = pair.getFirst();
skipCallbackParser |= pair.getSecond();
if (view != null) {
fillView(context, view, item, parentItem, callback, adapterRef);
} else {
// create a text view to display an error.
TextView tv = new TextView(context);
tv.setText("Unable to find layout: " + dataBindingItem.getViewReference().getName());
view = tv;
}
return Pair.of(view, skipCallbackParser);
}
use of com.android.ide.common.rendering.api.DataBindingItem in project android_frameworks_base by ResurrectionRemix.
the class AdapterHelper method getView.
@SuppressWarnings("deprecation")
static Pair<View, Boolean> getView(AdapterItem item, AdapterItem parentItem, ViewGroup parent, LayoutlibCallback callback, ResourceReference adapterRef, boolean skipCallbackParser) {
// we don't care about recycling here because we never scroll.
DataBindingItem dataBindingItem = item.getDataBindingItem();
BridgeContext context = RenderAction.getCurrentContext();
Pair<View, Boolean> pair = context.inflateView(dataBindingItem.getViewReference(), parent, false, /*attachToRoot*/
skipCallbackParser);
View view = pair.getFirst();
skipCallbackParser |= pair.getSecond();
if (view != null) {
fillView(context, view, item, parentItem, callback, adapterRef);
} else {
// create a text view to display an error.
TextView tv = new TextView(context);
tv.setText("Unable to find layout: " + dataBindingItem.getViewReference().getName());
view = tv;
}
return Pair.of(view, skipCallbackParser);
}
use of com.android.ide.common.rendering.api.DataBindingItem in project android by JetBrains.
the class LayoutMetadata method getNodeBinding.
@Nullable
private static AdapterBinding getNodeBinding(@Nullable Object viewObject, @Nullable String header, @Nullable String footer, @Nullable String layout, int count) {
if (layout != null || header != null || footer != null) {
AdapterBinding binding = new AdapterBinding(count);
if (header != null) {
boolean isFramework = header.startsWith(ANDROID_LAYOUT_RESOURCE_PREFIX);
binding.addHeader(new ResourceReference(stripLayoutPrefix(header), isFramework));
}
if (footer != null) {
boolean isFramework = footer.startsWith(ANDROID_LAYOUT_RESOURCE_PREFIX);
binding.addFooter(new ResourceReference(stripLayoutPrefix(footer), isFramework));
}
if (layout != null) {
boolean isFramework = layout.startsWith(ANDROID_LAYOUT_RESOURCE_PREFIX);
if (isFramework) {
layout = layout.substring(ANDROID_LAYOUT_RESOURCE_PREFIX.length());
} else if (layout.startsWith(LAYOUT_RESOURCE_PREFIX)) {
layout = layout.substring(LAYOUT_RESOURCE_PREFIX.length());
}
binding.addItem(new DataBindingItem(layout, isFramework, 1));
} else if (viewObject != null) {
String listFqcn = LayoutlibCallbackImpl.getListAdapterViewFqcn(viewObject.getClass());
if (listFqcn != null) {
if (listFqcn.endsWith(EXPANDABLE_LIST_VIEW)) {
binding.addItem(new DataBindingItem(DEFAULT_EXPANDABLE_LIST_ITEM, true, /* isFramework */
1));
} else {
binding.addItem(new DataBindingItem(DEFAULT_LIST_ITEM, true, /* isFramework */
1));
}
}
} else {
binding.addItem(new DataBindingItem(DEFAULT_LIST_ITEM, true, /* isFramework */
1));
}
return binding;
}
return null;
}
Aggregations