@Test public void renderTest() { View actionDescription = Mockito.mock(View.class); View actionArrow = Mockito.mock(View.class); Mockito.when(actionArrow.getWidth()).thenReturn(30); Mockito.when(actionDescription.getWidth()).thenReturn(15); Mockito.when(actionArrow.getHeight()).thenReturn(10); Mockito.when(actionDescription.getHeight()).thenReturn(20); CoachmarkViewLayout layoutMock = Mockito.mock(CoachmarkViewLayout.class); Mockito.when(layoutMock.calcScreenRectF()).thenReturn(new RectF(0, 0, 300, 95)); Mockito.when(layoutMock.calcCircleRectF()).thenReturn(new RectF(50, 50, 75, 75)); new RightOfCircleActionDescriptionRenderer().render(layoutMock, actionDescription, actionArrow); verify(actionDescription, times(1)).setX(105.0f); verify(actionDescription, times(1)).setY(52.5f); verify(actionArrow, times(1)).setX(75); verify(actionArrow, times(1)).setY(57.5f); }
@Override public void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow) { RectF circleRectangle = layout.calcCircleRectF(); actionDescription.setX((int) (circleRectangle.right + actionArrow.getWidth())); actionDescription.setY(circleRectangle.centerY() - (actionDescription.getHeight() / 2)); actionArrow.setRotation(180); actionArrow.setX(circleRectangle.right); actionArrow.setY(circleRectangle.centerY() - (actionArrow.getHeight() / 2)); }
RightOfCircleActionDescriptionRenderer implements ActionDescriptionRenderer { @Override public void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow) { RectF circleRectangle = layout.calcCircleRectF(); actionDescription.setX((int) (circleRectangle.right + actionArrow.getWidth())); actionDescription.setY(circleRectangle.centerY() - (actionDescription.getHeight() / 2)); actionArrow.setRotation(180); actionArrow.setX(circleRectangle.right); actionArrow.setY(circleRectangle.centerY() - (actionArrow.getHeight() / 2)); } }
RightOfCircleActionDescriptionRenderer implements ActionDescriptionRenderer { @Override public void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow) { RectF circleRectangle = layout.calcCircleRectF(); actionDescription.setX((int) (circleRectangle.right + actionArrow.getWidth())); actionDescription.setY(circleRectangle.centerY() - (actionDescription.getHeight() / 2)); actionArrow.setRotation(180); actionArrow.setX(circleRectangle.right); actionArrow.setY(circleRectangle.centerY() - (actionArrow.getHeight() / 2)); }  }
RightOfCircleActionDescriptionRenderer implements ActionDescriptionRenderer { @Override public void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow) { RectF circleRectangle = layout.calcCircleRectF(); actionDescription.setX((int) (circleRectangle.right + actionArrow.getWidth())); actionDescription.setY(circleRectangle.centerY() - (actionDescription.getHeight() / 2)); actionArrow.setRotation(180); actionArrow.setX(circleRectangle.right); actionArrow.setY(circleRectangle.centerY() - (actionArrow.getHeight() / 2)); }  @Override void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow); @Override boolean isRenderingPossible(CoachmarkViewLayout layout); }
RightOfCircleActionDescriptionRenderer implements ActionDescriptionRenderer { @Override public void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow) { RectF circleRectangle = layout.calcCircleRectF(); actionDescription.setX((int) (circleRectangle.right + actionArrow.getWidth())); actionDescription.setY(circleRectangle.centerY() - (actionDescription.getHeight() / 2)); actionArrow.setRotation(180); actionArrow.setX(circleRectangle.right); actionArrow.setY(circleRectangle.centerY() - (actionArrow.getHeight() / 2)); }  @Override void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow); @Override boolean isRenderingPossible(CoachmarkViewLayout layout);  }