@Test public void renderingNotPossibleNotEnoughTopSpaceTest() { 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, 20, 75, 75)); Mockito.when(layoutMock.calcActionDescriptionRect()).thenReturn(new RectF(0, 0, 20, 5)); Mockito.when(layoutMock.calcActionArrowRect()).thenReturn(new RectF(0, 0, 10, 15)); Assert.assertFalse(new TopOfCircleActionDescriptionRenderer().isRenderingPossible(layoutMock)); }
@Override public boolean isRenderingPossible(CoachmarkViewLayout layout) { RectF circleRectangle = layout.calcCircleRectF(); RectF actionDescriptionRectangle = layout.calcActionDescriptionRect(); RectF actionArrowRectangle = layout.calcActionArrowRect(); RectF screenRectangle = layout.calcScreenRectF(); return circleRectangle.top > actionDescriptionRectangle.height() + actionArrowRectangle.height() && (actionDescriptionRectangle.width() / 2) < circleRectangle.centerX() && (actionDescriptionRectangle.width() / 2) < (screenRectangle.width() - circleRectangle.centerX()); }
TopOfCircleActionDescriptionRenderer implements ActionDescriptionRenderer { @Override public boolean isRenderingPossible(CoachmarkViewLayout layout) { RectF circleRectangle = layout.calcCircleRectF(); RectF actionDescriptionRectangle = layout.calcActionDescriptionRect(); RectF actionArrowRectangle = layout.calcActionArrowRect(); RectF screenRectangle = layout.calcScreenRectF(); return circleRectangle.top > actionDescriptionRectangle.height() + actionArrowRectangle.height() && (actionDescriptionRectangle.width() / 2) < circleRectangle.centerX() && (actionDescriptionRectangle.width() / 2) < (screenRectangle.width() - circleRectangle.centerX()); } }
TopOfCircleActionDescriptionRenderer implements ActionDescriptionRenderer { @Override public boolean isRenderingPossible(CoachmarkViewLayout layout) { RectF circleRectangle = layout.calcCircleRectF(); RectF actionDescriptionRectangle = layout.calcActionDescriptionRect(); RectF actionArrowRectangle = layout.calcActionArrowRect(); RectF screenRectangle = layout.calcScreenRectF(); return circleRectangle.top > actionDescriptionRectangle.height() + actionArrowRectangle.height() && (actionDescriptionRectangle.width() / 2) < circleRectangle.centerX() && (actionDescriptionRectangle.width() / 2) < (screenRectangle.width() - circleRectangle.centerX()); }  }
TopOfCircleActionDescriptionRenderer implements ActionDescriptionRenderer { @Override public boolean isRenderingPossible(CoachmarkViewLayout layout) { RectF circleRectangle = layout.calcCircleRectF(); RectF actionDescriptionRectangle = layout.calcActionDescriptionRect(); RectF actionArrowRectangle = layout.calcActionArrowRect(); RectF screenRectangle = layout.calcScreenRectF(); return circleRectangle.top > actionDescriptionRectangle.height() + actionArrowRectangle.height() && (actionDescriptionRectangle.width() / 2) < circleRectangle.centerX() && (actionDescriptionRectangle.width() / 2) < (screenRectangle.width() - circleRectangle.centerX()); }  @Override void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow); @Override boolean isRenderingPossible(CoachmarkViewLayout layout); }
TopOfCircleActionDescriptionRenderer implements ActionDescriptionRenderer { @Override public boolean isRenderingPossible(CoachmarkViewLayout layout) { RectF circleRectangle = layout.calcCircleRectF(); RectF actionDescriptionRectangle = layout.calcActionDescriptionRect(); RectF actionArrowRectangle = layout.calcActionArrowRect(); RectF screenRectangle = layout.calcScreenRectF(); return circleRectangle.top > actionDescriptionRectangle.height() + actionArrowRectangle.height() && (actionDescriptionRectangle.width() / 2) < circleRectangle.centerX() && (actionDescriptionRectangle.width() / 2) < (screenRectangle.width() - circleRectangle.centerX()); }  @Override void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow); @Override boolean isRenderingPossible(CoachmarkViewLayout layout);  }