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