private int getEdgesTouched(int x, int y) { int result = 0; if (x < mParentView.getLeft() + mEdgeSize) result |= EDGE_LEFT; if (y < mParentView.getTop() + mEdgeSize) result |= EDGE_TOP; if (x > mParentView.getRight() - mEdgeSize) result |= EDGE_RIGHT; if (y > mParentView.getBottom() - mEdgeSize) result |= EDGE_BOTTOM; return result; } }
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; }
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; }
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; }
private int getEdgesTouched(int x, int y) { int result = 0; if (x < mParentView.getLeft() + mEdgeSize) result |= EDGE_LEFT; if (y < mParentView.getTop() + mEdgeSize) result |= EDGE_TOP; if (x > mParentView.getRight() - mEdgeSize) result |= EDGE_RIGHT; if (y > mParentView.getBottom() - mEdgeSize) result |= EDGE_BOTTOM; return result; }
private int getEdgeTouched(int x, int y) { int result = 0; if (x < mParentView.getLeft() + mEdgeSize) result = EDGE_LEFT; if (y < mParentView.getTop() + mEdgeSize) result = EDGE_TOP; if (x > mParentView.getRight() - mEdgeSize) result = EDGE_RIGHT; if (y > mParentView.getBottom() - mEdgeSize) result = EDGE_BOTTOM; return result; } }
private int getEdgeTouched(int x, int y) { int result = 0; if (x < mParentView.getLeft() + mEdgeSize) result = EDGE_LEFT; if (y < mParentView.getTop() + mEdgeSize) result = EDGE_TOP; if (x > mParentView.getRight() - mEdgeSize) result = EDGE_RIGHT; if (y > mParentView.getBottom() - mEdgeSize) result = EDGE_BOTTOM; return result; } }
private int getEdgeTouched(int x, int y) { int result = 0; if (x < mParentView.getLeft() + mEdgeSize) result = EDGE_LEFT; if (y < mParentView.getTop() + mEdgeSize) result = EDGE_TOP; if (x > mParentView.getRight() - mEdgeSize) result = EDGE_RIGHT; if (y > mParentView.getBottom() - mEdgeSize) result = EDGE_BOTTOM; return result; } }
@Test public void testChildViewGroupAllIncrementallyMountedNotProcessVisibilityOutputs() { final ViewGroup mountedView = mock(ViewGroup.class); when(mountedView.getLeft()).thenReturn(0); when(mountedView.getTop()).thenReturn(0); when(mountedView.getRight()).thenReturn(100);
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; }
private int getEdgesTouched(int x, int y) { int result = 0; if (x < mParentView.getLeft() + mEdgeSize) result |= EDGE_LEFT; if (y < mParentView.getTop() + mEdgeSize) result |= EDGE_TOP; if (x > mParentView.getRight() - mEdgeSize) result |= EDGE_RIGHT; if (y > mParentView.getBottom() - mEdgeSize) result |= EDGE_BOTTOM; return result; } }
private int getEdgeTouched(int x, int y) { int result = 0; if (x < mParentView.getLeft() + mEdgeSize) result = EDGE_LEFT; if (y < mParentView.getTop() + mEdgeSize) result = EDGE_TOP; if (x > mParentView.getRight() - mEdgeSize) result = EDGE_RIGHT; if (y > mParentView.getBottom() - mEdgeSize) result = EDGE_BOTTOM; return EDGE_LEFT; } }
private int getEdgeTouched(int x, int y) { int result = 0; if (x < mParentView.getLeft() + mEdgeSize) result = EDGE_LEFT; if (y < mParentView.getTop() + mEdgeSize) result = EDGE_TOP; if (x > mParentView.getRight() - mEdgeSize) result = EDGE_RIGHT; if (y > mParentView.getBottom() - mEdgeSize) result = EDGE_BOTTOM; return result; } }
when(parentView.getWidth()).thenReturn(clipBounds.width()); when(parentView.getRight()).thenReturn(clipBounds.right); when(parentView.getLeft()).thenReturn(clipBounds.left); options.load(-1); final View target = mock(View.class);
when(parentView.getWidth()).thenReturn(clipBounds.width()); when(parentView.getRight()).thenReturn(clipBounds.right); when(parentView.getLeft()).thenReturn(clipBounds.left); options.load(-1); final View target = mock(View.class);
private PromptOptions createOptions(Rect clipBounds, RectF focalBounds) { final PromptOptions options = UnitTestUtils.createPromptOptionsWithTestResourceFinder(); final ViewGroup parentView = options.getResourceFinder().getPromptParentView(); when(parentView.getWidth()).thenReturn(clipBounds.width()); when(parentView.getRight()).thenReturn(clipBounds.right); when(parentView.getLeft()).thenReturn(clipBounds.left); Resources.getSystem().getDisplayMetrics().widthPixels = 480; Resources.getSystem().getDisplayMetrics().heightPixels = 800; options.load(-1); final FullscreenPromptBackground promptBackground = new FullscreenPromptBackground(); promptBackground.setColour(Color.YELLOW); promptBackground.setCornerRadius(12, 14); options.setPromptBackground(promptBackground); options.setPromptFocal(mock(PromptFocal.class)); when(options.getPromptFocal().getBounds()).thenReturn(focalBounds); options.setPromptText(new TestPromptText(300f)); options.setPrimaryText("Primary Text"); options.setSecondaryText("Secondary Text"); options.setFocalPadding(20f); options.setTextPadding(20f); options.setMaxTextWidth(300f); options.setTextSeparation(20f); options.create(); options.getPromptText().prepare(options, false, clipBounds); options.getPromptText().update(options, 1, 1); return options; }
when(parentView.getWidth()).thenReturn(clipBounds.width()); when(parentView.getRight()).thenReturn(clipBounds.right); when(parentView.getLeft()).thenReturn(clipBounds.left); options.load(-1); final CirclePromptBackground promptBackground = new CirclePromptBackground();
private PromptOptions createOptions(Rect clipBounds, RectF focalBounds) { final PromptOptions options = UnitTestUtils.createPromptOptionsWithTestResourceFinder(); final ViewGroup parentView = options.getResourceFinder().getPromptParentView(); when(parentView.getWidth()).thenReturn(clipBounds.width()); when(parentView.getRight()).thenReturn(clipBounds.right); when(parentView.getLeft()).thenReturn(clipBounds.left); options.load(-1); final RectanglePromptBackground promptBackground = new RectanglePromptBackground(); promptBackground.setColour(Color.YELLOW); promptBackground.setCornerRadius(12, 14); options.setPromptBackground(promptBackground); options.setPromptFocal(mock(PromptFocal.class)); when(options.getPromptFocal().getBounds()).thenReturn(focalBounds); options.setPromptText(new TestPromptText(300f)); options.setPrimaryText("Primary Text"); options.setSecondaryText("Secondary Text"); options.setFocalPadding(20f); options.setTextPadding(20f); options.setMaxTextWidth(300f); options.setTextSeparation(20f); options.create(); options.getPromptText().prepare(options, false, clipBounds); options.getPromptText().update(options, 1, 1); return options; }
when(parentView.getWidth()).thenReturn(1080); when(parentView.getRight()).thenReturn(1080); when(parentView.getLeft()).thenReturn(0); options.load(-1); options.setPrimaryText("Primary Text");
when(parentView.getWidth()).thenReturn(1080); when(parentView.getRight()).thenReturn(1080); when(parentView.getLeft()).thenReturn(0); options.load(-1); options.setPrimaryText("Primary Text");