List of usage examples for android.view View getParent
public final ViewParent getParent()
From source file:com.flexible.flexibleadapter.helpers.StickyHeaderHelper.java
private static void removeViewFromParent(final View view) { final ViewParent parent = view.getParent(); if (parent instanceof ViewGroup) { ((ViewGroup) parent).removeView(view); }/*from w ww .j a v a2 s . com*/ }
From source file:com.trafi.anchorbottomsheetbehavior.BottomSheetUtils.java
private static View findBottomSheetView(View root) { View current = root; while (current != null) { final ViewGroup.LayoutParams params = current.getLayoutParams(); if (params instanceof CoordinatorLayout.LayoutParams && ((CoordinatorLayout.LayoutParams) params) .getBehavior() instanceof AnchorBottomSheetBehavior) { return current; }/*w w w . j a v a 2 s .com*/ final ViewParent parent = current.getParent(); current = parent == null || !(parent instanceof View) ? null : (View) parent; } return null; }
From source file:com.facebook.appevents.codeless.internal.ViewHierarchy.java
private static boolean isAdapterViewItem(View view) { ViewParent parent = view.getParent(); if (parent != null) { if (parent instanceof AdapterView || parent instanceof NestedScrollingChild) { return true; }//from w w w . j a v a2 s . co m } return false; }
From source file:com.facebook.appevents.codeless.internal.ViewHierarchy.java
@Nullable public static ViewGroup getParentOfView(View view) { if (null == view) { return null; }//from www. jav a 2 s.c o m ViewParent parent = view.getParent(); if (parent != null && parent instanceof ViewGroup) { return (ViewGroup) parent; } return null; }
From source file:android.support.transition.ViewOverlayApi14.java
static ViewGroup getContentView(View view) { View parent = view; while (parent != null) { if (parent.getId() == android.R.id.content && parent instanceof ViewGroup) { return (ViewGroup) parent; }//from ww w . j av a 2 s . co m if (parent.getParent() instanceof ViewGroup) { parent = (ViewGroup) parent.getParent(); } } return null; }
From source file:android.support.transition.ViewOverlay.java
static ViewGroup getContentView(View view) { View parent = view; while (parent != null) { if (parent.getId() == R.id.content && parent instanceof ViewGroup) { return (ViewGroup) parent; }// w w w. j ava 2 s. c om if (parent.getParent() instanceof ViewGroup) { parent = (ViewGroup) parent.getParent(); } } return null; }
From source file:com.android.mail.browse.ConversationItemViewCoordinates.java
/** * Returns the x coordinates of a view by tracing up its hierarchy. *//*from w w w . ja va 2s .com*/ private static int getX(View view) { int x = 0; while (view != null) { x += (int) view.getX(); view = (View) view.getParent(); } return x; }
From source file:com.android.mail.browse.ConversationItemViewCoordinates.java
/** * Returns the y coordinates of a view by tracing up its hierarchy. */// w ww.j av a2s .c om private static int getY(View view) { int y = 0; while (view != null) { y += (int) view.getY(); view = (View) view.getParent(); } return y; }
From source file:com.breadwallet.tools.animation.BRAnimator.java
private static int getRelativeLeft(View myView) { if (myView.getParent() == myView.getRootView()) return myView.getLeft(); else//from w ww. j a v a2s . com return myView.getLeft() + getRelativeLeft((View) myView.getParent()); }
From source file:fr.shywim.antoinedaniel.utils.Utils.java
/** * First part of the click animation./*from ww w.ja va 2 s . c o m*/ * * @param context Any context. * @param v View who will have the effect. * @param isRoot Whether the passed view is the ViewGroup parent. */ public static void clickAnimDown(Context context, View v, boolean isRoot) { RelativeLayout root; if (isRoot) root = (RelativeLayout) v; else root = (RelativeLayout) v.getParent(); final View rectView = new View(context); rectView.setId(R.id.rect_view_id); rectView.setVisibility(View.GONE); rectView.setBackgroundResource(R.drawable.square); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(v.getMeasuredWidth(), v.getMeasuredHeight()); params.addRule(RelativeLayout.ALIGN_TOP, v.getId()); rectView.setLayoutParams(params); AlphaAnimation rectAnim = new AlphaAnimation(0f, 0.4f); rectAnim.setFillAfter(true); rectAnim.setInterpolator(new AccelerateInterpolator()); rectAnim.setDuration(150); rectAnim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { rectView.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); root.addView(rectView); rectView.startAnimation(rectAnim); }