use of android.widget.AbsListView in project android_frameworks_base by AOSPA.
the class ResolverDrawerLayout method findListChildUnder.
private View findListChildUnder(float x, float y) {
View v = findChildUnder(x, y);
while (v != null) {
x -= v.getX();
y -= v.getY();
if (v instanceof AbsListView) {
// One more after this.
return findChildUnder((ViewGroup) v, x, y);
}
v = v instanceof ViewGroup ? findChildUnder((ViewGroup) v, x, y) : null;
}
return v;
}
use of android.widget.AbsListView in project android_frameworks_base by AOSPA.
the class ResolverDrawerLayout method getHeightUsed.
private int getHeightUsed(View child) {
// This method exists because we're taking a fast path at measuring ListViews that
// lets us get away with not doing the more expensive wrap_content measurement which
// imposes double child view measurement costs. If we're looking at a ListView, we can
// check against the lowest child view plus padding and margin instead of the actual
// measured height of the ListView. This lets the ListView hang off the edge when
// all of the content would fit on-screen.
int heightUsed = child.getMeasuredHeight();
if (child instanceof AbsListView) {
final AbsListView lv = (AbsListView) child;
final int lvPaddingBottom = lv.getPaddingBottom();
int lowest = 0;
for (int i = 0, N = lv.getChildCount(); i < N; i++) {
final int bottom = lv.getChildAt(i).getBottom() + lvPaddingBottom;
if (bottom > lowest) {
lowest = bottom;
}
}
if (lowest < heightUsed) {
heightUsed = lowest;
}
}
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
return lp.topMargin + heightUsed + lp.bottomMargin;
}
use of android.widget.AbsListView in project platform_frameworks_base by android.
the class RenderSessionImpl method postInflateProcess.
/**
* Post process on a view hierarchy that was just inflated.
* <p/>
* At the moment this only supports TabHost: If {@link TabHost} is detected, look for the
* {@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 layoutlibCallback callback to the project.
* @param skip the view and it's children are not processed.
*/
// For the use of Pair
@SuppressWarnings("deprecation")
private void postInflateProcess(View view, LayoutlibCallback layoutlibCallback, View skip) throws PostInflateException {
if (view == skip) {
return;
}
if (view instanceof TabHost) {
setupTabHost((TabHost) view, layoutlibCallback);
} else if (view instanceof QuickContactBadge) {
QuickContactBadge badge = (QuickContactBadge) view;
badge.setImageToDefault();
} else if (view instanceof AdapterView<?>) {
// get the view ID.
int id = view.getId();
BridgeContext context = getContext();
// get a ResourceReference from the integer ID.
ResourceReference listRef = context.resolveId(id);
if (listRef != null) {
SessionParams params = getParams();
AdapterBinding binding = params.getAdapterBindings().get(listRef);
// if there was no adapter binding, trying to get it from the call back.
if (binding == null) {
binding = layoutlibCallback.getAdapterBinding(listRef, context.getViewKey(view), view);
}
if (binding != null) {
if (view instanceof AbsListView) {
if ((binding.getFooterCount() > 0 || binding.getHeaderCount() > 0) && view instanceof ListView) {
ListView list = (ListView) view;
boolean skipCallbackParser = false;
int count = binding.getHeaderCount();
for (int i = 0; i < count; i++) {
Pair<View, Boolean> pair = context.inflateView(binding.getHeaderAt(i), list, false, skipCallbackParser);
if (pair.getFirst() != null) {
list.addHeaderView(pair.getFirst());
}
skipCallbackParser |= pair.getSecond();
}
count = binding.getFooterCount();
for (int i = 0; i < count; i++) {
Pair<View, Boolean> pair = context.inflateView(binding.getFooterAt(i), list, false, skipCallbackParser);
if (pair.getFirst() != null) {
list.addFooterView(pair.getFirst());
}
skipCallbackParser |= pair.getSecond();
}
}
if (view instanceof ExpandableListView) {
((ExpandableListView) view).setAdapter(new FakeExpandableAdapter(listRef, binding, layoutlibCallback));
} else {
((AbsListView) view).setAdapter(new FakeAdapter(listRef, binding, layoutlibCallback));
}
} else if (view instanceof AbsSpinner) {
((AbsSpinner) view).setAdapter(new FakeAdapter(listRef, binding, layoutlibCallback));
}
}
}
} else if (view instanceof ViewGroup) {
mInflater.postInflateProcess(view);
ViewGroup group = (ViewGroup) view;
final int count = group.getChildCount();
for (int c = 0; c < count; c++) {
View child = group.getChildAt(c);
postInflateProcess(child, layoutlibCallback, skip);
}
}
}
use of android.widget.AbsListView in project androidquery by androidquery.
the class ImageLoadingList4Activity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
aq.id(R.id.list).scrolled(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
AQUtility.debug("forward", "onScrollStateChanged");
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
AQUtility.debug("forward", "onScroll");
}
});
}
use of android.widget.AbsListView in project androidquery by androidquery.
the class AbstractAQuery method setScrollListener.
private Common setScrollListener() {
AbsListView lv = (AbsListView) view;
Common common = (Common) lv.getTag(AQuery.TAG_SCROLL_LISTENER);
if (common == null) {
common = new Common();
lv.setOnScrollListener(common);
lv.setTag(AQuery.TAG_SCROLL_LISTENER, common);
AQUtility.debug("set scroll listenr");
}
return common;
}
Aggregations