Java Code Examples for android.widget.AdapterView#getChildAt()

The following examples show how to use android.widget.AdapterView#getChildAt() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: RichWebList   File: HeaderScrollHelper.java    License: Apache License 2.0 5 votes vote down vote up
private boolean isAdapterViewTop(AdapterView adapterView) {
    if (adapterView != null) {
        int firstVisiblePosition = adapterView.getFirstVisiblePosition();
        View childAt = adapterView.getChildAt(0);
        if (childAt == null || (firstVisiblePosition == 0 && childAt.getTop() == 0)) {
            return true;
        }
    }
    return false;
}
 
Example 2
Source Project: DanDanPlayForAndroid   File: ScrollableHelper.java    License: MIT License 5 votes vote down vote up
private static boolean isAdapterViewTop(AdapterView adapterView) {
    if (adapterView != null) {
        int firstVisiblePosition = adapterView.getFirstVisiblePosition();
        View childAt = adapterView.getChildAt(0);
        return childAt == null || (firstVisiblePosition == 0 && childAt.getTop() == 0);
    }
    return false;
}
 
Example 3
private static boolean isAdapterViewTop(AdapterView adapterView) {
    if (adapterView != null) {
        int firstVisiblePosition = adapterView.getFirstVisiblePosition();
        View childAt = adapterView.getChildAt(0);
        if (childAt == null || (firstVisiblePosition == 0 && childAt != null && childAt.getTop() == 0)) {
            return true;
        }
    }
    return false;
}
 
Example 4
Source Project: NestRefreshLayout   File: AbsRefreshLayout.java    License: MIT License 5 votes vote down vote up
private boolean canListScroll(int direction) {
    AdapterView<?> absListView = (AdapterView<?>) mTargetView;
    final int itemCount = absListView.getCount();
    final int childCount = absListView.getChildCount();
    final int firstPosition = absListView.getFirstVisiblePosition();
    final int lastPosition = firstPosition + childCount;

    if (itemCount == 0) {
        return false;
    }
    if (direction > 0) {
        // Are we already showing the entire last item?
        if (lastPosition >= itemCount) {
            final View lastView = absListView.getChildAt(childCount - 1);
            if (lastView != null
                    && lastView.getBottom() >= mTargetView.getHeight()) {
                return false;
            }
        }
    } else if (direction < 0) {
        // Are we already showing the entire first item?
        if (firstPosition <= 0) {
            final View firstView = absListView.getChildAt(0);
            if (firstView != null && firstView.getTop() >= 0) {
                return false;
            }
        }
    }
    return true;
}
 
Example 5
Source Project: ScrollableLayout   File: ScrollableHelper.java    License: MIT License 5 votes vote down vote up
private static boolean isAdapterViewTop(AdapterView adapterView){
    if(adapterView != null){
        int firstVisiblePosition = adapterView.getFirstVisiblePosition();
        View childAt = adapterView.getChildAt(0);
        if(childAt == null || (firstVisiblePosition == 0 && childAt.getTop() == 0)){
            return true;
        }
    }
    return false;
}
 
Example 6
private boolean isElementFullyRendered(
    AdapterView<? extends Adapter> adapterView, int childAt) {
  View element = adapterView.getChildAt(childAt);
  // Occassionally we'll have to fight with smooth scrolling logic on our definition of when
  // there is extra scrolling to be done. In particular if the element is the first or last
  // element of the list, the smooth scroller may decide that no work needs to be done to scroll
  // to the element if a certain percentage of it is on screen. Ugh. Sigh. Yuck.

  return isDisplayingAtLeast(FULLY_RENDERED_PERCENTAGE_CUTOFF).matches(element);
}
 
Example 7
Source Project: ALLGO   File: HomeACTIVITY.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    selectItem(position);
    if(!isActivity(position)){
     	for(int i=0;i<parent.getCount();i++){
      View v=parent.getChildAt(i);
      if (position == i) {
          v.setBackgroundColor(Color.GRAY);
      } else {
          v.setBackgroundColor(Color.TRANSPARENT);
      }
  }
    }
    }