List of usage examples for android.widget ScrollView canScrollVertically
public boolean canScrollVertically(int direction)
From source file:org.catrobat.paintroid.test.integration.BaseIntegrationTestClass.java
protected View verticalScrollToToolButton(ToolType toolType) { ScrollView scrollView = (ScrollView) mSolo.getView(R.id.bottom_bar_landscape_scroll_view); int scrollBottom = 1; int scrollTop = -1; View toolButtonView = null;// w ww . j a v a2 s.c om while (scrollView.canScrollVertically(scrollTop)) { scrollToolBarToTop(); } float scrollPosBottom = scrollView.getY() + scrollView.getHeight(); int[] btnLocation = { 0, 0 }; getToolButtonView(toolType).getLocationOnScreen(btnLocation); float btnPos = btnLocation[1] + (getToolButtonView(toolType).getHeight() / 2.0f); if (btnPos < scrollPosBottom) { toolButtonView = getToolButtonView(toolType); } float fromX, toX, fromY, toY = 0; int stepCount = 20; int screenWidth = getActivity().getWindowManager().getDefaultDisplay().getWidth(); int screenHeight = getActivity().getWindowManager().getDefaultDisplay().getHeight(); while (scrollView.canScrollVertically(scrollBottom) && toolButtonView == null) { fromX = screenWidth - scrollView.getWidth() / 2; toX = fromX; fromY = screenHeight / 2; toY = screenHeight / 4 - screenHeight / 8; mSolo.drag(fromX, toX, fromY, toY, stepCount); getToolButtonView(toolType).getLocationOnScreen(btnLocation); btnPos = btnLocation[1] + (getToolButtonView(toolType).getHeight() / 2.0f); if (btnPos < scrollPosBottom) { toolButtonView = getToolButtonView(toolType); break; } } assertNotNull("Tool button not found", toolButtonView); return toolButtonView; }