Refine search
public static void drawTopAlignItem(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) { final int left = child.getLeft() - params.leftMargin; final int right = child.getRight() + params.rightMargin; final int top = child.getTop() - params.topMargin - drawable.getIntrinsicHeight(); final int bottom = top + drawable.getIntrinsicHeight(); drawable.setBounds(left, top, right, bottom); drawable.draw(canvas); }
public static void drawLeftAlignItem(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) { final int top = child.getTop() - params.topMargin; final int bottom = child.getBottom() + params.bottomMargin; final int left = child.getLeft() - params.leftMargin - drawable.getIntrinsicWidth(); final int right = left + drawable.getIntrinsicWidth(); drawable.setBounds(left, top, right, bottom); drawable.draw(canvas); }
private void captureValues(TransitionValues transitionValues) { final View view = transitionValues.view; if (view == null || view.getWidth() <= 0 || view.getHeight() <= 0) return; transitionValues.values.put(PROP_BOUNDS, new Rect(view.getLeft(), view.getTop(), view.getRight(), view.getBottom())); } }
protected Rect getRelativePosition(View child) { View t = child; Rect r = new Rect(t.getLeft(), t.getTop(), 0, 0); while (t.getParent() != null && t != getRootView()) { t = (View) t.getParent(); if (t == this) break; r.left += t.getLeft(); r.top += t.getTop(); } r.right = r.left + child.getMeasuredWidth(); r.bottom = r.top + child.getMeasuredHeight(); return r; }
public static void drawRightAlignItem(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) { final int top = child.getTop() - params.topMargin; final int bottom = child.getBottom() + params.bottomMargin; final int left = child.getRight() + params.rightMargin; final int right = left + drawable.getIntrinsicWidth(); drawable.setBounds(left, top, right, bottom); drawable.draw(canvas); }
public static void drawTop(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) { final int left = child.getLeft() - params.leftMargin - drawable.getIntrinsicWidth(); final int right = child.getRight() + params.rightMargin + drawable.getIntrinsicWidth(); final int top = child.getTop() - params.topMargin - drawable.getIntrinsicHeight(); final int bottom = top + drawable.getIntrinsicHeight(); drawable.setBounds(left, top, right, bottom); drawable.draw(canvas); }
public static void drawLeft(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) { final int top = child.getTop() - params.topMargin - drawable.getIntrinsicHeight(); final int bottom = child.getBottom() + params.bottomMargin + drawable.getIntrinsicHeight(); final int left = child.getLeft() - params.leftMargin - drawable.getIntrinsicWidth(); final int right = left + drawable.getIntrinsicWidth(); drawable.setBounds(left, top, right, bottom); drawable.draw(canvas); }
public void drawVertical(Canvas c, RecyclerView parent) { final int childCount = parent.getChildCount(); for (int i = 0; i < childCount; i++) { final View child = parent.getChildAt(i); final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child .getLayoutParams(); final int top = child.getTop() - params.topMargin; final int bottom = child.getBottom() + params.bottomMargin; final int left = child.getRight() + params.rightMargin; final int right = left + mDivider.getIntrinsicWidth(); mDivider.setBounds(left, top, right, bottom); mDivider.draw(c); } }
protected void moveSpinner(int spinner) { final RefreshInternal refreshHeader = mRefreshHeader; if (mSpinner != spinner && refreshHeader != null) { mSpinner = spinner; switch (refreshHeader.getSpinnerStyle()) { case Translate: refreshHeader.getView().setTranslationY(spinner); break; case Scale:{ View view = refreshHeader.getView(); view.layout(view.getLeft(), view.getTop(), view.getRight(), view.getTop() + Math.max(0, spinner)); break; } } } } //</editor-fold>
public static boolean isTransformedTouchPointInView(@NonNull View group,@NonNull View child, float x, float y,PointF outLocalPoint) { if (child.getVisibility() != View.VISIBLE) { return false; } final float[] point = new float[2]; point[0] = x; point[1] = y; // transformPointToViewLocal(group, child, point); point[0] += group.getScrollX() - child.getLeft(); point[1] += group.getScrollY() - child.getTop(); // final boolean isInView = pointInView(child, point[0], point[1], 0); final boolean isInView = point[0] >= 0 && point[1] >= 0 && point[0] < (child.getWidth()) && point[1] < ((child.getHeight())); if (isInView && outLocalPoint != null) { outLocalPoint.set(point[0]-x, point[1]-y); } return isInView; }
public static void drawRight(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) { final int top = child.getTop() - params.topMargin - drawable.getIntrinsicHeight(); final int bottom = child.getBottom() + params.bottomMargin + drawable.getIntrinsicHeight(); final int left = child.getRight() + params.rightMargin; final int right = left + drawable.getIntrinsicWidth(); drawable.setBounds(left, top, right, bottom); drawable.draw(canvas); }
private Rect rect; // Variable rect to hold the bounds of the view public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN){ // Construct a rect of the view's bounds rect = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom()); } if(event.getAction() == MotionEvent.ACTION_MOVE){ if(!rect.contains(v.getLeft() + (int) event.getX(), v.getTop() + (int) event.getY())){ // User moved outside bounds } } return false; }
public static boolean isTransformedTouchPointInView(@NonNull View group,@NonNull View child, float x, float y,PointF outLocalPoint) { if (child.getVisibility() != View.VISIBLE) { return false; } final float[] point = new float[2]; point[0] = x; point[1] = y; // transformPointToViewLocal(group, child, point); point[0] += group.getScrollX() - child.getLeft(); point[1] += group.getScrollY() - child.getTop(); // final boolean isInView = pointInView(child, point[0], point[1], 0); final boolean isInView = point[0] >= 0 && point[1] >= 0 && point[0] < (child.getWidth()) && point[1] < ((child.getHeight())); if (isInView && outLocalPoint != null) { outLocalPoint.set(point[0]-x, point[1]-y); } return isInView; }
public void drawVertical(Canvas c, RecyclerView parent) { final int childCount = parent.getChildCount(); for (int i = 0; i < childCount; i++) { final View child = parent.getChildAt(i); final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child .getLayoutParams(); final int top = child.getTop() - params.topMargin; final int bottom = child.getBottom() + params.bottomMargin; final int left = child.getRight() + params.rightMargin; final int right = left + mDivider.getIntrinsicWidth(); mDivider.setBounds(left, top, right, bottom); mDivider.draw(c); } }