Example usage for android.view View getTop

List of usage examples for android.view View getTop

Introduction

In this page you can find the example usage for android.view View 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.bjerva.tsplex.fragments.SignListFragment.java

public void onPause() {
    super.onPause();
    try {//w  w w  .  j  a v a 2s .com
        index = this.getListView().getFirstVisiblePosition();
        View v = this.getListView().getChildAt(0);
        top = (v == null) ? 0 : v.getTop();
    } catch (Exception e) {
        Log.w("OldListPosErr", "Error when fetching old listpos");
    }
}

From source file:com.animedetour.android.view.animator.SlideInLeftAnimator.java

@Override
public boolean animateAdd(RecyclerView.ViewHolder holder) {
    final View view = holder.itemView;
    int width = getWidth(holder);
    ViewCompat.animate(view).cancel();/*from  www .j  a  v a2 s  .c om*/
    ViewCompat.setTranslationX(holder.itemView, (float) -width);
    float interpolation = interpolator.getInterpolation((float) view.getTop() / layoutManager.getHeight());
    long startDelay = (long) (500 * interpolation);
    ViewCompat.animate(view).setStartDelay(Math.max(0, startDelay)).translationX(0)
            .setInterpolator(new AccelerateInterpolator());
    return true;
}

From source file:com.cocosw.accessory.views.adapter.AdapterViewAnimator.java

private void beforeDataSetChanged() {
    Adapter adapter = adapterView.getAdapter();
    final int firstVisiblePosition = adapterView.getFirstVisiblePosition();
    for (int i = 0, childCount = adapterView.getChildCount(); i < childCount; i++) {
        final int position = firstVisiblePosition + i;
        final long id = adapter.getItemId(position);
        final View child = adapterView.getChildAt(i);
        Rect r = new Rect(child.getLeft(), child.getTop(), child.getRight(), child.getBottom());
        ViewCompat.setHasTransientState(child, false);
        viewBounds.put(id, r);//from ww w  . jav a2 s. c  o  m
        idToViewMap.put(id, child);
    }
}

From source file:com.android.calculator2.CalculatorPadViewPager.java

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    boolean shouldIntercept = super.onInterceptTouchEvent(ev);

    // Only allow the current item to receive touch events.
    if (!shouldIntercept && ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
        final int x = (int) ev.getX() + getScrollX();
        final int y = (int) ev.getY() + getScrollY();

        final int childCount = getChildCount();
        for (int i = childCount - 1; i >= 0; --i) {
            final int childIndex = getChildDrawingOrder(childCount, i);
            final View child = getChildAt(childIndex);
            if (child.getVisibility() == View.VISIBLE && x >= child.getLeft() && x < child.getRight()
                    && y >= child.getTop() && y < child.getBottom()) {
                shouldIntercept = (childIndex != getCurrentItem());
                break;
            }/*from   ww w.  j  av a  2s .  co m*/
        }
    }

    return shouldIntercept;
}

From source file:com.amaze.filemanager.fragments.AppsList.java

public void loadlist(boolean save) {
    if (save) {/*from   ww w .j a  va  2  s.  co m*/
        index = vl.getFirstVisiblePosition();
        View vi = vl.getChildAt(0);
        top = (vi == null) ? 0 : vi.getTop();
    }
    new LoadListTask(save, top, index).execute();
}

From source file:com.bjerva.tsplex.fragments.SignCategoryFragment.java

public void onPause() {
    super.onPause();
    try {/*w  ww.j a  v  a  2s  . c  om*/
        index = getExpandableListView().getFirstVisiblePosition();
        View v = getExpandableListView().getChildAt(0);
        top = (v == null) ? 0 : v.getTop();
    } catch (Exception e) {
        Log.w("OldListPosErr", "Error when fetching old listpos");
    }
}

From source file:com.amaze.filemanager.fragments.AppsList.java

@Override
public void onSaveInstanceState(Bundle b) {
    super.onSaveInstanceState(b);
    if (vl != null) {
        b.putParcelableArrayList("c", c);
        b.putParcelableArrayList("list", a);
        int index = vl.getFirstVisiblePosition();
        View vi = vl.getChildAt(0);
        int top = (vi == null) ? 0 : vi.getTop();
        b.putInt("index", index);
        b.putInt("top", top);
    }/*from ww  w .j a v a 2s .com*/
}

From source file:com.amaze.filemanager.fragments.BookmarksManager.java

@Override
public void onSaveInstanceState(Bundle b) {
    super.onSaveInstanceState(b);
    if (listview != null) {
        b.putStringArrayList("bx", utils.toStringArray(bx));
        int index = linearLayoutManager.findFirstVisibleItemPosition();
        View vi = listview.getChildAt(0);
        int top = (vi == null) ? 0 : vi.getTop();
        b.putInt("index", index);
        b.putInt("top", top);
    }//from  w  ww . jav a2s.  co m
}

From source file:ca.barrenechea.widget.recyclerview.decoration.DoubleHeaderDecoration.java

private int getAnimatedTop(View child) {
    return child.getTop() + (int) child.getTranslationY();
}

From source file:ch.ethz.twimight.activities.DmListActivity.java

/**
 * Saves the current selection//from w  w w.j  ava  2s . c  om
 */
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {

    mPositionIndex = mListView.getFirstVisiblePosition();
    View v = mListView.getChildAt(0);
    mPositionTop = (v == null) ? 0 : v.getTop();
    savedInstanceState.putInt("positionIndex", mPositionIndex);
    savedInstanceState.putInt("positionTop", mPositionTop);

    Log.i(TAG, "saving" + mPositionIndex + " " + mPositionTop);

    super.onSaveInstanceState(savedInstanceState);
}