use of android.util.InternalSelectionView in project platform_frameworks_base by android.
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());
}
use of android.util.InternalSelectionView in project platform_frameworks_base by android.
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;
}
use of android.util.InternalSelectionView in project android_frameworks_base by DirtyUnicorns.
the class ScrollingThroughListOfFocusablesTest method testScrollingDownInFirstItem.
@MediumTest
public void testScrollingDownInFirstItem() throws Exception {
for (int i = 0; i < mNumRowsPerItem; i++) {
assertEquals(0, mListView.getSelectedItemPosition());
InternalSelectionView view = mActivity.getSelectedView();
assertInternallySelectedRowOnScreen(view, i);
// move to next row
if (i < mNumRowsPerItem - 1) {
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
getInstrumentation().waitForIdleSync();
}
}
{
assertEquals(0, mListView.getSelectedItemPosition());
InternalSelectionView view = (InternalSelectionView) mListView.getSelectedView();
// 1 pixel tolerance in case height / 4 is not an even number
final int bottomFadingEdgeTop = mListView.getBottom() - mListView.getVerticalFadingEdgeLength();
assertTrue("bottom of view should be just above fading edge", view.getBottom() == bottomFadingEdgeTop);
}
// make sure fading edge is the expected view
{
assertEquals("should be a second view visible due to the fading edge", 2, mListView.getChildCount());
InternalSelectionView peekingChild = (InternalSelectionView) mListView.getChildAt(1);
assertNotNull(peekingChild);
assertEquals("wrong value for peeking list item", mActivity.getLabelForPosition(1), peekingChild.getLabel());
}
}
use of android.util.InternalSelectionView in project android_frameworks_base by DirtyUnicorns.
the class ScrollingThroughListOfFocusablesTest method testNoFadingEdgeAtBottomOfLastItem.
@LargeTest
public void testNoFadingEdgeAtBottomOfLastItem() {
// move down to last item
for (int i = 0; i < mNumItems; i++) {
for (int j = 0; j < mNumRowsPerItem; j++) {
if (i < mNumItems - 1 || j < mNumRowsPerItem - 1) {
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
getInstrumentation().waitForIdleSync();
}
}
}
assertEquals(mNumItems - 1, mListView.getSelectedItemPosition());
InternalSelectionView view = mActivity.getSelectedView();
assertEquals(mNumRowsPerItem - 1, view.getSelectedRow());
view.getRectForRow(mTempRect, mNumRowsPerItem - 1);
mListView.offsetDescendantRectToMyCoords(view, mTempRect);
assertTrue("bottom of last row of last item should be at " + "the bottom of the list view (no fading edge)", mListView.getBottom() - mListView.getVerticalFadingEdgeLength() < mTempRect.bottom);
}
use of android.util.InternalSelectionView in project android_frameworks_base by AOSPA.
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);
}
Aggregations