List of usage examples for android.view ViewGroup getLeft
@ViewDebug.CapturedViewProperty public final int getLeft()
From source file:com.daycle.daycleapp.custom.swipelistview.itemmanipulation.swipedismiss.SwipeTouchListener.java
private static Rect getChildViewRect(final View parentView, final View childView) { Rect childRect = new Rect(childView.getLeft(), childView.getTop(), childView.getRight(), childView.getBottom());/* w w w.j a v a 2s. c om*/ if (!parentView.equals(childView)) { View workingChildView = childView; ViewGroup parent; while (!(parent = (ViewGroup) workingChildView.getParent()).equals(parentView)) { childRect.offset(parent.getLeft(), parent.getTop()); workingChildView = parent; } } return childRect; }
From source file:com.efan.notlonely_android.view.PagerSlidingTabStrip.java
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); ViewGroup tabViewGroup = getTabsLayout(); FirstPositionOffset = (float) tabViewGroup.getLeft(); if (tabViewGroup != null) { currentPosition = viewPager != null ? viewPager.getCurrentItem() : 0; if (!disableViewPager) { scrollToChild(currentPosition, 0); selectedTab(currentPosition); }/* www .j a v a 2 s .co m*/ for (int w = 0; w < tabViewGroup.getChildCount(); w++) { View itemView = tabViewGroup.getChildAt(w); itemView.setTag(w); itemView.setClickable(true); itemView.setOnClickListener(this); } } }
From source file:com.cicada.startup.common.ui.view.indicator.ViewPagerIndicator.java
private int getTabTextLeft(ViewGroup parentView) { View childView = parentView.getChildAt(0); return parentView.getLeft() + childView.getPaddingLeft(); }
From source file:com.haarman.listviewanimations.itemmanipulation.SwipeDismissListViewTouchListener.java
private Rect getChildViewRect(View parentView, View childView) { final Rect childRect = new Rect(childView.getLeft(), childView.getTop(), childView.getRight(), childView.getBottom());/*from w w w . j a v a 2 s .c om*/ if (parentView == childView) { return childRect; } ViewGroup parent; while ((parent = (ViewGroup) childView.getParent()) != parentView) { childRect.offset(parent.getLeft(), parent.getTop()); childView = parent; } return childRect; }
From source file:com.grottworkshop.gwsswipelayout.SwipeLayout.java
/** * close surface/*from w w w. j a v a 2 s . c o m*/ * @param smooth smoothly or not. * @param notify if notify all the listeners. */ public void close(boolean smooth, boolean notify) { ViewGroup surface = getSurfaceView(); int dx, dy; if (smooth) mDragHelper.smoothSlideViewTo(getSurfaceView(), getPaddingLeft(), getPaddingTop()); else { Rect rect = computeSurfaceLayoutArea(false); dx = rect.left - surface.getLeft(); dy = rect.top - surface.getTop(); surface.layout(rect.left, rect.top, rect.right, rect.bottom); if (notify) { dispatchRevealEvent(rect.left, rect.top, rect.right, rect.bottom); dispatchSwipeEvent(rect.left, rect.top, dx, dy); } else { safeBottomView(); } } invalidate(); }
From source file:com.grottworkshop.gwsswipelayout.SwipeLayout.java
public void open(boolean smooth, boolean notify) { ViewGroup surface = getSurfaceView(), bottom = getBottomView(); int dx, dy;//from w w w . j a v a 2 s . com Rect rect = computeSurfaceLayoutArea(true); if (smooth) { mDragHelper.smoothSlideViewTo(getSurfaceView(), rect.left, rect.top); } else { dx = rect.left - surface.getLeft(); dy = rect.top - surface.getTop(); surface.layout(rect.left, rect.top, rect.right, rect.bottom); if (getShowMode() == ShowMode.PullOut) { Rect bRect = computeBottomLayoutAreaViaSurface(ShowMode.PullOut, rect); bottom.layout(bRect.left, bRect.top, bRect.right, bRect.bottom); } if (notify) { dispatchRevealEvent(rect.left, rect.top, rect.right, rect.bottom); dispatchSwipeEvent(rect.left, rect.top, dx, dy); } else { safeBottomView(); } } invalidate(); }
From source file:com.xiaosu.lib.base.widget.drawerLayout.DrawerLayout.java
private boolean anyChildWantMotionEvent(MotionEvent ev, ViewGroup group) { MotionEvent event = MotionEvent.obtain(ev); event.offsetLocation(-group.getLeft(), -group.getTop()); //view/*w w w. j a v a 2 s.c o m*/ int childCount = group.getChildCount(); final float x = event.getX(); final float y = event.getY(); for (int i = 0; i < childCount; i++) { View child = group.getChildAt(i); if (x >= child.getLeft() && x < child.getRight() && y >= child.getTop() && y < child.getBottom()) { if (child instanceof ViewGroup) { MotionEvent chileEvent = MotionEvent.obtain(event); chileEvent.offsetLocation(-child.getLeft(), -child.getTop()); if (anyChildWantMotionEvent(chileEvent, (ViewGroup) child)) { chileEvent.recycle(); return true; } } else if (child.onTouchEvent(event)) { return true; } } } event.recycle(); return false; }
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 www.ja v a2 s .c om } 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:com.isapp.android.circularviewpager.CircularViewPager.java
private Rect getChildRectInPagerCoordinates(Rect outRect, View child) { if (outRect == null) { outRect = new Rect(); }//from ww w .j ava2 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 w w w . ja va 2s .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; }