summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRomain Guy <>2009-03-24 20:01:32 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-24 20:01:32 -0700
commit696887ca500573c509abd254e094955c559f319f (patch)
tree44ee763e1aefe254f289762d964bade7bdbdb295 /core
parent89d4ea4e4b63a6711c071c1f3620ee425768bd3e (diff)
downloadframeworks_base-696887ca500573c509abd254e094955c559f319f.zip
frameworks_base-696887ca500573c509abd254e094955c559f319f.tar.gz
frameworks_base-696887ca500573c509abd254e094955c559f319f.tar.bz2
Automated import from //branches/master/...@141315,141315
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);
}