@Test public void renderTest() { View actionDescription = Mockito.mock(View.class); View actionArrow = Mockito.mock(View.class); Mockito.when(actionArrow.getWidth()).thenReturn(10); Mockito.when(actionDescription.getWidth()).thenReturn(20); 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, 300)); Mockito.when(layoutMock.calcCircleRectF()).thenReturn(new RectF(50, 50, 75, 75)); new TopOfCircleActionDescriptionRenderer().render(layoutMock, actionDescription, actionArrow); verify(actionDescription, times(1)).setX(52.5f); verify(actionDescription, times(1)).setY(20); verify(actionArrow, times(1)).setX(57.5f); verify(actionArrow, times(1)).setY(40); }
@Override public void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow) { RectF circleRectangle = layout.calcCircleRectF(); actionDescription.setX(circleRectangle.centerX() - (actionDescription.getWidth() / 2)); actionDescription.setY(circleRectangle.top - actionArrow.getHeight() - actionDescription.getHeight()); actionArrow.setRotation(90); actionArrow.setX(circleRectangle.centerX() - (actionArrow.getWidth() / 2)); actionArrow.setY(circleRectangle.top - actionArrow.getHeight()); }
TopOfCircleActionDescriptionRenderer implements ActionDescriptionRenderer { @Override public void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow) { RectF circleRectangle = layout.calcCircleRectF(); actionDescription.setX(circleRectangle.centerX() - (actionDescription.getWidth() / 2)); actionDescription.setY(circleRectangle.top - actionArrow.getHeight() - actionDescription.getHeight()); actionArrow.setRotation(90); actionArrow.setX(circleRectangle.centerX() - (actionArrow.getWidth() / 2)); actionArrow.setY(circleRectangle.top - actionArrow.getHeight()); } }
TopOfCircleActionDescriptionRenderer implements ActionDescriptionRenderer { @Override public void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow) { RectF circleRectangle = layout.calcCircleRectF(); actionDescription.setX(circleRectangle.centerX() - (actionDescription.getWidth() / 2)); actionDescription.setY(circleRectangle.top - actionArrow.getHeight() - actionDescription.getHeight()); actionArrow.setRotation(90); actionArrow.setX(circleRectangle.centerX() - (actionArrow.getWidth() / 2)); actionArrow.setY(circleRectangle.top - actionArrow.getHeight()); }  }
TopOfCircleActionDescriptionRenderer implements ActionDescriptionRenderer { @Override public void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow) { RectF circleRectangle = layout.calcCircleRectF(); actionDescription.setX(circleRectangle.centerX() - (actionDescription.getWidth() / 2)); actionDescription.setY(circleRectangle.top - actionArrow.getHeight() - actionDescription.getHeight()); actionArrow.setRotation(90); actionArrow.setX(circleRectangle.centerX() - (actionArrow.getWidth() / 2)); actionArrow.setY(circleRectangle.top - actionArrow.getHeight()); }  @Override void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow); @Override boolean isRenderingPossible(CoachmarkViewLayout layout); }
TopOfCircleActionDescriptionRenderer implements ActionDescriptionRenderer { @Override public void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow) { RectF circleRectangle = layout.calcCircleRectF(); actionDescription.setX(circleRectangle.centerX() - (actionDescription.getWidth() / 2)); actionDescription.setY(circleRectangle.top - actionArrow.getHeight() - actionDescription.getHeight()); actionArrow.setRotation(90); actionArrow.setX(circleRectangle.centerX() - (actionArrow.getWidth() / 2)); actionArrow.setY(circleRectangle.top - actionArrow.getHeight()); }  @Override void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow); @Override boolean isRenderingPossible(CoachmarkViewLayout layout);  }