Search in sources :

Example 1 with InternalSelectionView

use of android.util.InternalSelectionView in project android_frameworks_base by ParanoidAndroid.

the class ScrollingThroughListOfFocusablesTest method testNavigatingUpThroughInternalSelection.

@LargeTest
public void testNavigatingUpThroughInternalSelection() throws Exception {
    // get to bottom of second item
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < mNumRowsPerItem; j++) {
            if (i < 1 || j < mNumRowsPerItem - 1) {
                sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
                getInstrumentation().waitForIdleSync();
            }
        }
    }
    // (make sure we are at last row of second item)
    {
        assertEquals(1, mListView.getSelectedItemPosition());
        InternalSelectionView view = mActivity.getSelectedView();
        assertEquals(mNumRowsPerItem - 1, view.getSelectedRow());
    }
    // go back up to the top of the second item
    for (int i = mNumRowsPerItem - 1; i >= 0; i--) {
        assertEquals(1, mListView.getSelectedItemPosition());
        InternalSelectionView view = mActivity.getSelectedView();
        assertInternallySelectedRowOnScreen(view, i);
        // move up to next row
        if (i > 0) {
            sendKeys(KeyEvent.KEYCODE_DPAD_UP);
            getInstrumentation().waitForIdleSync();
        }
    }
    // now we are at top row, should have caused scrolling, and fading edge...
    {
        assertEquals(1, mListView.getSelectedItemPosition());
        InternalSelectionView view = mActivity.getSelectedView();
        assertEquals(0, view.getSelectedRow());
        view.getDrawingRect(mTempRect);
        mListView.offsetDescendantRectToMyCoords(view, mTempRect);
        assertEquals("top of selected row should be just below top vertical fading edge", mListView.getVerticalFadingEdgeLength(), view.getTop());
    }
    // make sure fading edge is the view we expect
    {
        final InternalSelectionView view = (InternalSelectionView) mListView.getChildAt(0);
        assertEquals(mActivity.getLabelForPosition(0), view.getLabel());
    }
}
Also used : InternalSelectionView(android.util.InternalSelectionView) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 2 with InternalSelectionView

use of android.util.InternalSelectionView in project android_frameworks_base by ParanoidAndroid.

the class AdjacentVerticalRectLists method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mLayout = new LinearLayout(this);
    mLayout.setOrientation(LinearLayout.HORIZONTAL);
    mLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1);
    mLeftColumn = new InternalSelectionView(this, 5, "left column");
    mLeftColumn.setLayoutParams(params);
    mLeftColumn.setPadding(10, 10, 10, 10);
    mLayout.addView(mLeftColumn);
    mMiddleColumn = new InternalSelectionView(this, 5, "middle column");
    mMiddleColumn.setLayoutParams(params);
    mMiddleColumn.setPadding(10, 10, 10, 10);
    mLayout.addView(mMiddleColumn);
    mRightColumn = new InternalSelectionView(this, 5, "right column");
    mRightColumn.setLayoutParams(params);
    mRightColumn.setPadding(10, 10, 10, 10);
    mLayout.addView(mRightColumn);
    setContentView(mLayout);
}
Also used : InternalSelectionView(android.util.InternalSelectionView) ViewGroup(android.view.ViewGroup) LinearLayout(android.widget.LinearLayout)

Example 3 with InternalSelectionView

use of android.util.InternalSelectionView in project android_frameworks_base by ParanoidAndroid.

the class ButtonAboveTallInternalSelectionViewTest method testMovingFocusDownToItemTallerThanScreenStillOnScreen.

@MediumTest
public void testMovingFocusDownToItemTallerThanScreenStillOnScreen() {
    sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
    getInstrumentation().waitForIdleSync();
    final InternalSelectionView isv = getActivity().getIsv();
    assertTrue("internal selection view should have taken focus", isv.isFocused());
    assertEquals("internal selection view selected row", 0, isv.getSelectedRow());
    assertTrue("top of ISV should still be on screen", getActivity().getIsv().getTop() > getActivity().getScrollView().getScrollY());
}
Also used : ButtonAboveTallInternalSelectionView(android.widget.scroll.ButtonAboveTallInternalSelectionView) InternalSelectionView(android.util.InternalSelectionView) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 4 with InternalSelectionView

use of android.util.InternalSelectionView in project android_frameworks_base by ResurrectionRemix.

the class ButtonAboveTallInternalSelectionViewTest method testMovingFocusDownToItemTallerThanScreenStillOnScreen.

@MediumTest
public void testMovingFocusDownToItemTallerThanScreenStillOnScreen() {
    sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
    getInstrumentation().waitForIdleSync();
    final InternalSelectionView isv = getActivity().getIsv();
    assertTrue("internal selection view should have taken focus", isv.isFocused());
    assertEquals("internal selection view selected row", 0, isv.getSelectedRow());
    assertTrue("top of ISV should still be on screen", getActivity().getIsv().getTop() > getActivity().getScrollView().getScrollY());
}
Also used : ButtonAboveTallInternalSelectionView(android.widget.scroll.ButtonAboveTallInternalSelectionView) InternalSelectionView(android.util.InternalSelectionView) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 5 with InternalSelectionView

use of android.util.InternalSelectionView in project android_frameworks_base by ResurrectionRemix.

the class ListItemISVAndButton method createView.

@Override
protected View createView(int position, ViewGroup parent, int desiredHeight) {
    Context context = parent.getContext();
    final LinearLayout ll = new LinearLayout(context);
    ll.setOrientation(LinearLayout.VERTICAL);
    final InternalSelectionView isv = new InternalSelectionView(context, 8, "ISV postion " + position);
    isv.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, desiredHeight - 240));
    ll.addView(isv);
    final LinearLayout.LayoutParams buttonLp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 40);
    final Button topButton = new Button(context);
    topButton.setLayoutParams(buttonLp);
    topButton.setText("button " + position + ")");
    ll.addView(topButton);
    final TextView filler = new TextView(context);
    filler.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 200));
    filler.setText("filler");
    ll.addView(filler);
    return ll;
}
Also used : Context(android.content.Context) InternalSelectionView(android.util.InternalSelectionView) Button(android.widget.Button) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Aggregations

InternalSelectionView (android.util.InternalSelectionView)36 LargeTest (android.test.suitebuilder.annotation.LargeTest)12 MediumTest (android.test.suitebuilder.annotation.MediumTest)12 LinearLayout (android.widget.LinearLayout)12 Context (android.content.Context)6 ViewGroup (android.view.ViewGroup)6 Button (android.widget.Button)6 TextView (android.widget.TextView)6 ButtonAboveTallInternalSelectionView (android.widget.scroll.ButtonAboveTallInternalSelectionView)6