Example usage for android.view ViewGroup getBottom

List of usage examples for android.view ViewGroup getBottom

Introduction

In this page you can find the example usage for android.view ViewGroup getBottom.

Prototype

@ViewDebug.CapturedViewProperty
public final int getBottom() 

Source Link

Document

Bottom position of this view relative to its parent.

Usage

From source file:org.chromium.chrome.browser.widget.animation.FocusAnimator.java

/** Scroll the layout so that the focused child is on screen. */
private void requestChildFocus() {
    ViewGroup parent = (ViewGroup) mLayout.getParent();
    if (mLayout.getParent() == null)
        return;/*from w  ww .  ja  v a  2s . com*/

    // Scroll the parent to make the focused child visible.
    if (mFocusedChild != null)
        parent.requestChildFocus(mLayout, mFocusedChild);

    // {@link View#requestChildFocus} fails to account for children changing their height, so
    // the scroll value may be past the actual maximum.
    int viewportHeight = parent.getBottom() - parent.getTop();
    int scrollMax = Math.max(0, mLayout.getMeasuredHeight() - viewportHeight);
    if (parent.getScrollY() > scrollMax)
        parent.setScrollY(scrollMax);
}

From source file:com.ohso.omgubuntu.BaseFragment.java

private void toggleFooter(int visibleItemCount, int firstVisibleItem, int totalItemCount, ViewGroup view) {
    if (visibleItemCount > 0 && (firstVisibleItem + visibleItemCount >= totalItemCount) && footerEnabled) {
        final View child = view.getChildAt((adapter.getRealCount() - 1) - firstVisibleItem);
        if (child != null) {
            if (child.getBottom() > view.getBottom() - (adapter.getFooterHeight() / 1.5)) {
                // Above
                if (footerView.isShown())
                    hidefooterView();//from w ww  .j a v  a  2  s  .  co  m
            } else {
                // Below
                if (!footerView.isShown())
                    showFooterView();
            }
        }
    }
}

From source file:com.isapp.android.circularviewpager.CircularViewPager.java

private Rect getChildRectInPagerCoordinates(Rect outRect, View child) {
    if (outRect == null) {
        outRect = new Rect();
    }//from   w  ww  .  j  a  va  2  s .c  o m
    if (child == null) {
        outRect.set(0, 0, 0, 0);
        return outRect;
    }
    outRect.left = child.getLeft();
    outRect.right = child.getRight();
    outRect.top = child.getTop();
    outRect.bottom = child.getBottom();
    ViewParent parent = child.getParent();
    while (parent instanceof ViewGroup && parent != this) {
        final ViewGroup group = (ViewGroup) parent;
        outRect.left += group.getLeft();
        outRect.right += group.getRight();
        outRect.top += group.getTop();
        outRect.bottom += group.getBottom();
        parent = group.getParent();
    }
    return outRect;
}

From source file:VerticalViewPager.java

private Rect getChildRectInPagerCoordinates(Rect outRect, View child) {
    if (outRect == null) {
        outRect = new Rect();
    }/*from  ww w. ja  v  a 2 s  .c  o  m*/
    if (child == null) {
        outRect.set(0, 0, 0, 0);
        return outRect;
    }
    outRect.left = child.getLeft();
    outRect.right = child.getRight();
    outRect.top = child.getTop();
    outRect.bottom = child.getBottom();

    ViewParent parent = child.getParent();
    while (parent instanceof ViewGroup && parent != this) {
        final ViewGroup group = (ViewGroup) parent;
        outRect.left += group.getLeft();
        outRect.right += group.getRight();
        outRect.top += group.getTop();
        outRect.bottom += group.getBottom();

        parent = group.getParent();
    }
    return outRect;
}

From source file:example.luojing.androidsourceanalysis.ViewPager.java

/**
 * ViewPager????View??/*  w w w .j  a  v  a  2s. c o  m*/
 */
private Rect getChildRectInPagerCoordinates(Rect outRect, View child) {
    if (outRect == null) {
        outRect = new Rect();
    }
    if (child == null) {
        outRect.set(0, 0, 0, 0);
        return outRect;
    }
    outRect.left = child.getLeft();
    outRect.right = child.getRight();
    outRect.top = child.getTop();
    outRect.bottom = child.getBottom();

    ViewParent parent = child.getParent();
    while (parent instanceof ViewGroup && parent != this) {
        final ViewGroup group = (ViewGroup) parent;
        outRect.left += group.getLeft();
        outRect.right += group.getRight();
        outRect.top += group.getTop();
        outRect.bottom += group.getBottom();

        parent = group.getParent();
    }
    return outRect;
}