ListView getMaxScrollAmount - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ListView getMaxScrollAmount method.

This code example shows how to use the following methods:getVerticalFadingEdgeLength, getChildAt, getChildCount, getMaxScrollAmount, getCount
        mListUtil = new ListUtil(mListView, getInstrumentation());
    } 
 
    @MediumTest 
    public void testPreconditions() { 
        assertEquals("list item count", 5, mListView.getCount());
        assertEquals("list visible child count", 3, mListView.getChildCount());
        int firstTwoHeight = mListView.getChildAt(0).getHeight() + mListView.getChildAt(1).getHeight();
        assertTrue("first two items should fit within fading edge",
                firstTwoHeight <= mListView.getVerticalFadingEdgeLength());
        assertTrue("first two items should fit within list max scroll",
                firstTwoHeight <= mListView.getMaxScrollAmount());
    } 
 
    @MediumTest 
    public void testFadeTopTwoItemsOut() { 
        // put 2nd item selected 
        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
 
7
CodeRank
This code example shows how to use the following methods:getChildAt, getChildCount, getListPaddingBottom, getMaxScrollAmount
    } 
 
    @MediumTest 
    public void testPreconditions() { 
        assertNotNull(mListView);
        assertEquals("should only be one visible child", 1, mListView.getChildCount());
        final int amountOffScreen = mListView.getChildAt(0).getBottom() - (mListView.getBottom() - mListView.getListPaddingBottom());
        assertTrue("must be more than max scroll off screen for this test to work",
                amountOffScreen > mListView.getMaxScrollAmount());
    } 
 
    @MediumTest 
    public void testScrollDownAcrossItem() { 
        final View view = mListView.getSelectedView();
        assertTrue(view.isSelected());
 
        assertEquals(mListView.getListPaddingTop(),
                view.getTop());
 
        assertTrue("view must be taller than screen for this test to be worth anything",
7
CodeRank
This code example shows how to use the following methods:getMaxScrollAmount, sleep
            Instrumentation inst = getInstrumentation();
            //Make sure the song list shown up 
            Thread.sleep(2000);
            inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_DOWN);
            mTrackList = getActivity().getListView();
            int scrollCount = mTrackList.getMaxScrollAmount();
            //Make sure there is at least one song in the sdcard 
            if (scrollCount != -1) {
                inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
            } else { 
                assertTrue("testPlayMP3", false);
            } 
            Thread.sleep(PLAY_TIME);
        } catch (Exception e) {
            assertTrue("testPlayMP3", false);
        } 
    } 
 
    @LargeTest 
    public void testLaunchMusicPlayer() throws Exception { 
7
CodeRank
This code example shows how to use the following methods:getVerticalFadingEdgeLength, getChildAt, getChildCount, getMaxScrollAmount, getCount
        mListUtil = new ListUtil(mListView, getInstrumentation());
    } 
 
    @MediumTest 
    public void testPreconditions() { 
        assertEquals("list item count", 5, mListView.getCount());
        assertEquals("list visible child count", 3, mListView.getChildCount());
        int firstTwoHeight = mListView.getChildAt(0).getHeight() + mListView.getChildAt(1).getHeight();
        assertTrue("first two items should fit within fading edge",
                firstTwoHeight <= mListView.getVerticalFadingEdgeLength());
        assertTrue("first two items should fit within list max scroll",
                firstTwoHeight <= mListView.getMaxScrollAmount());
    } 
 
    @MediumTest 
    public void testFadeTopTwoItemsOut() { 
        // put 2nd item selected 
        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
 
7
CodeRank
This code example shows how to use the following methods:getMaxScrollAmount, sleep
            Instrumentation inst = getInstrumentation();
            //Make sure the song list shown up 
            Thread.sleep(2000);
            inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_DOWN);
            mTrackList = getActivity().getListView();
            int scrollCount = mTrackList.getMaxScrollAmount();
            //Make sure there is at least one song in the sdcard 
            if (scrollCount != -1) {
                inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
            } else { 
                assertTrue("testPlayMP3", false);
            } 
            Thread.sleep(PLAY_TIME);
        } catch (Exception e) {
            assertTrue("testPlayMP3", false);
        } 
    } 
 
    @LargeTest 
    public void testLaunchMusicPlayer() throws Exception { 
6
CodeRank
getMaxScrollAmount Method Overview
See Code Examples for other Android ListView Methods: