* commit 'b3b4f83702ca878854529acfdc389d15db5ca6f3': Fix NullPointerException in ListView
This commit is contained in:
@@ -2420,10 +2420,15 @@ public class ListView extends AbsListView {
|
||||
(ViewGroup) selectedView, currentFocus, direction);
|
||||
if (nextFocus != null) {
|
||||
// do the math to get interesting rect in next focus' coordinates
|
||||
currentFocus.getFocusedRect(mTempRect);
|
||||
offsetDescendantRectToMyCoords(currentFocus, mTempRect);
|
||||
offsetRectIntoDescendantCoords(nextFocus, mTempRect);
|
||||
if (nextFocus.requestFocus(direction, mTempRect)) {
|
||||
Rect focusedRect = mTempRect;
|
||||
if (currentFocus != null) {
|
||||
currentFocus.getFocusedRect(focusedRect);
|
||||
offsetDescendantRectToMyCoords(currentFocus, focusedRect);
|
||||
offsetRectIntoDescendantCoords(nextFocus, focusedRect);
|
||||
} else {
|
||||
focusedRect = null;
|
||||
}
|
||||
if (nextFocus.requestFocus(direction, focusedRect)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2556,8 +2561,10 @@ public class ListView extends AbsListView {
|
||||
if (mItemsCanFocus && (focusResult == null)
|
||||
&& selectedView != null && selectedView.hasFocus()) {
|
||||
final View focused = selectedView.findFocus();
|
||||
if (!isViewAncestorOf(focused, this) || distanceToView(focused) > 0) {
|
||||
focused.clearFocus();
|
||||
if (focused != null) {
|
||||
if (!isViewAncestorOf(focused, this) || distanceToView(focused) > 0) {
|
||||
focused.clearFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user