summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/java/android/widget/ListView.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index fd5556e..4d5032e 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -2054,18 +2054,19 @@ public class ListView extends AbsListView {
*/
private boolean handleHorizontalFocusWithinListItem(int direction) {
if (direction != View.FOCUS_LEFT && direction != View.FOCUS_RIGHT) {
- throw new IllegalArgumentException("direction must be one of {View.FOCUS_LEFT, View.FOCUS_RIGHT}");
+ throw new IllegalArgumentException("direction must be one of"
+ + " {View.FOCUS_LEFT, View.FOCUS_RIGHT}");
}
final int numChildren = getChildCount();
if (mItemsCanFocus && numChildren > 0 && mSelectedPosition != INVALID_POSITION) {
final View selectedView = getSelectedView();
- if (selectedView.hasFocus() && selectedView instanceof ViewGroup) {
+ if (selectedView != null && selectedView.hasFocus() &&
+ selectedView instanceof ViewGroup) {
+
final View currentFocus = selectedView.findFocus();
final View nextFocus = FocusFinder.getInstance().findNextFocus(
- (ViewGroup) selectedView,
- currentFocus,
- direction);
+ (ViewGroup) selectedView, currentFocus, direction);
if (nextFocus != null) {
// do the math to get interesting rect in next focus' coordinates
currentFocus.getFocusedRect(mTempRect);
@@ -2079,11 +2080,8 @@ public class ListView extends AbsListView {
// if the global result is going to be some other view within this
// list. this is to acheive the overall goal of having
// horizontal d-pad navigation remain in the current item.
- final View globalNextFocus = FocusFinder.getInstance()
- .findNextFocus(
- (ViewGroup) getRootView(),
- currentFocus,
- direction);
+ final View globalNextFocus = FocusFinder.getInstance().findNextFocus(
+ (ViewGroup) getRootView(), currentFocus, direction);
if (globalNextFocus != null) {
return isViewAncestorOf(globalNextFocus, this);
}