Example usage for android.view ViewGroup getTop

List of usage examples for android.view ViewGroup getTop

Introduction

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

Prototype

@ViewDebug.CapturedViewProperty
public final int getTop() 

Source Link

Document

Top position of this view relative to its parent.

Usage

From source file:com.juick.android.JuickMessagesAdapter.java

public void recycleView(View view) {
    if (view instanceof ViewGroup) {
        ListRowRuntime lrr = (ListRowRuntime) view.getTag();
        if (lrr != null) {
            if (lrr.userpicListener != null) {
                lrr.removeListenerIfExists();
            }/*from  w w  w .j  av  a  2s .c  o  m*/
        }
        ViewGroup vg = (ViewGroup) view;
        if (vg.getChildCount() > 1 && vg.getChildAt(1) instanceof ImageGallery
                && vg instanceof PressableLinearLayout) {
            PressableLinearLayout pll = (PressableLinearLayout) vg;
            // our view
            ImageGallery gallery = (ImageGallery) vg.getChildAt(1);
            Object tag = gallery.getTag();
            if (tag instanceof HashMap) {
                HashMap<Integer, ImageLoaderConfiguration> loaders = (HashMap<Integer, ImageLoaderConfiguration>) tag;
                for (ImageLoaderConfiguration imageLoader : loaders.values()) {
                    imageLoader.loader.terminate();
                }
            }
            pll.blockLayoutRequests = true;
            gallery.cleanup();
            gallery.setTag(null);
            vg.removeViewAt(1);
            vg.measure(View.MeasureSpec.makeMeasureSpec(vg.getRight() - vg.getLeft(), View.MeasureSpec.EXACTLY),
                    View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
            vg.layout(vg.getLeft(), vg.getTop(), vg.getRight(), vg.getTop() + vg.getMeasuredHeight());
            pll.blockLayoutRequests = false;
        }
    }
}

From source file:VerticalViewPager.java

private Rect getChildRectInPagerCoordinates(Rect outRect, View child) {
    if (outRect == null) {
        outRect = new Rect();
    }/*from www  .j  ava2s  .co 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??//from   w w w  .j  a va 2  s .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;
}