Merge change 962 into donut
* changes: Fixes #1603191. GridView could provoke NPEs during layout passes initiated from key events.
This commit is contained in:
@@ -1534,14 +1534,14 @@ public class GridView extends AbsListView {
|
|||||||
case FOCUS_LEFT:
|
case FOCUS_LEFT:
|
||||||
if (selectedPosition > startOfRowPos) {
|
if (selectedPosition > startOfRowPos) {
|
||||||
mLayoutMode = LAYOUT_MOVE_SELECTION;
|
mLayoutMode = LAYOUT_MOVE_SELECTION;
|
||||||
setSelectionInt(selectedPosition - 1);
|
setSelectionInt(Math.max(0, selectedPosition - 1));
|
||||||
moved = true;
|
moved = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FOCUS_RIGHT:
|
case FOCUS_RIGHT:
|
||||||
if (selectedPosition < endOfRowPos) {
|
if (selectedPosition < endOfRowPos) {
|
||||||
mLayoutMode = LAYOUT_MOVE_SELECTION;
|
mLayoutMode = LAYOUT_MOVE_SELECTION;
|
||||||
setSelectionInt(selectedPosition + 1);
|
setSelectionInt(Math.min(selectedPosition + 1, mItemCount - 1));
|
||||||
moved = true;
|
moved = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user