Loading core/java/android/widget/AdapterView.java +12 −6 Original line number Diff line number Diff line Loading @@ -216,7 +216,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { * @see #setFocusable(boolean) * @see #checkFocus() */ private boolean mDesiredFocusableState; private int mDesiredFocusableState = FOCUSABLE_AUTO; private boolean mDesiredFocusableInTouchModeState; /** Lazily-constructed runnable for dispatching selection events. */ Loading Loading @@ -250,6 +250,12 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { if (getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) { setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); } mDesiredFocusableState = getFocusable(); if (mDesiredFocusableState == FOCUSABLE_AUTO) { // Starts off without an adapter, so NOT_FOCUSABLE by default. super.setFocusable(NOT_FOCUSABLE); } } /** Loading Loading @@ -710,16 +716,16 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { } @Override public void setFocusable(boolean focusable) { public void setFocusable(@Focusable int focusable) { final T adapter = getAdapter(); final boolean empty = adapter == null || adapter.getCount() == 0; mDesiredFocusableState = focusable; if (!focusable) { if ((focusable & (FOCUSABLE_AUTO | FOCUSABLE)) == 0) { mDesiredFocusableInTouchModeState = false; } super.setFocusable(focusable && (!empty || isInFilterMode())); super.setFocusable((!empty || isInFilterMode()) ? focusable : NOT_FOCUSABLE); } @Override Loading @@ -729,7 +735,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { mDesiredFocusableInTouchModeState = focusable; if (focusable) { mDesiredFocusableState = true; mDesiredFocusableState = FOCUSABLE; } super.setFocusableInTouchMode(focusable && (!empty || isInFilterMode())); Loading @@ -743,7 +749,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { // for the client, see View.setFocusableInTouchMode() comments for more // details super.setFocusableInTouchMode(focusable && mDesiredFocusableInTouchModeState); super.setFocusable(focusable && mDesiredFocusableState); super.setFocusable(focusable ? mDesiredFocusableState : NOT_FOCUSABLE); if (mEmptyView != null) { updateEmptyStatus((adapter == null) || adapter.isEmpty()); } Loading Loading
core/java/android/widget/AdapterView.java +12 −6 Original line number Diff line number Diff line Loading @@ -216,7 +216,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { * @see #setFocusable(boolean) * @see #checkFocus() */ private boolean mDesiredFocusableState; private int mDesiredFocusableState = FOCUSABLE_AUTO; private boolean mDesiredFocusableInTouchModeState; /** Lazily-constructed runnable for dispatching selection events. */ Loading Loading @@ -250,6 +250,12 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { if (getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) { setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); } mDesiredFocusableState = getFocusable(); if (mDesiredFocusableState == FOCUSABLE_AUTO) { // Starts off without an adapter, so NOT_FOCUSABLE by default. super.setFocusable(NOT_FOCUSABLE); } } /** Loading Loading @@ -710,16 +716,16 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { } @Override public void setFocusable(boolean focusable) { public void setFocusable(@Focusable int focusable) { final T adapter = getAdapter(); final boolean empty = adapter == null || adapter.getCount() == 0; mDesiredFocusableState = focusable; if (!focusable) { if ((focusable & (FOCUSABLE_AUTO | FOCUSABLE)) == 0) { mDesiredFocusableInTouchModeState = false; } super.setFocusable(focusable && (!empty || isInFilterMode())); super.setFocusable((!empty || isInFilterMode()) ? focusable : NOT_FOCUSABLE); } @Override Loading @@ -729,7 +735,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { mDesiredFocusableInTouchModeState = focusable; if (focusable) { mDesiredFocusableState = true; mDesiredFocusableState = FOCUSABLE; } super.setFocusableInTouchMode(focusable && (!empty || isInFilterMode())); Loading @@ -743,7 +749,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { // for the client, see View.setFocusableInTouchMode() comments for more // details super.setFocusableInTouchMode(focusable && mDesiredFocusableInTouchModeState); super.setFocusable(focusable && mDesiredFocusableState); super.setFocusable(focusable ? mDesiredFocusableState : NOT_FOCUSABLE); if (mEmptyView != null) { updateEmptyStatus((adapter == null) || adapter.isEmpty()); } Loading