Loading core/java/android/view/View.java +12 −1 Original line number Diff line number Diff line Loading @@ -6389,6 +6389,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @see ViewGroup#getTouchscreenBlocksFocus() */ public boolean hasFocusable() { return hasFocusable(true); } /** * @hide pending determination of whether this should be public or not. * Currently used for compatibility with old focusability expectations in ListView. */ public boolean hasFocusable(boolean allowAutoFocus) { if (!isFocusableInTouchMode()) { for (ViewParent p = mParent; p instanceof ViewGroup; p = p.getParent()) { final ViewGroup g = (ViewGroup) p; Loading @@ -6397,7 +6405,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } } return (mViewFlags & VISIBILITY_MASK) == VISIBLE && isFocusable(); if ((mViewFlags & VISIBILITY_MASK) != VISIBLE) { return false; } return allowAutoFocus ? getFocusable() != NOT_FOCUSABLE : getFocusable() == FOCUSABLE; } /** Loading core/java/android/view/ViewGroup.java +5 −3 Original line number Diff line number Diff line Loading @@ -1105,13 +1105,15 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager return null; } /** @hide Overriding hidden method */ @Override public boolean hasFocusable() { public boolean hasFocusable(boolean allowAutoFocus) { if ((mViewFlags & VISIBILITY_MASK) != VISIBLE) { return false; } if (isFocusable()) { // TODO This should probably be super.hasFocusable, but that would change behavior if (allowAutoFocus ? getFocusable() != NOT_FOCUSABLE : getFocusable() == FOCUSABLE) { return true; } Loading @@ -1122,7 +1124,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager for (int i = 0; i < count; i++) { final View child = children[i]; if (child.hasFocusable()) { if (child.hasFocusable(allowAutoFocus)) { return true; } } Loading core/java/android/widget/AbsListView.java +4 −4 Original line number Diff line number Diff line Loading @@ -2548,7 +2548,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } private boolean isItemClickable(View view) { return !view.hasFocusable(); return !view.hasFocusable(false); } /** Loading Loading @@ -2824,7 +2824,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final View v = getChildAt(mSelectedPosition - mFirstPosition); if (v != null) { if (v.hasFocusable()) return; if (v.hasFocusable(false)) return; v.setPressed(true); } setPressed(true); Loading Loading @@ -3428,7 +3428,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (mTouchMode == TOUCH_MODE_DOWN) { mTouchMode = TOUCH_MODE_TAP; final View child = getChildAt(mMotionPosition - mFirstPosition); if (child != null && !child.hasFocusable()) { if (child != null && !child.hasFocusable(false)) { mLayoutMode = LAYOUT_NORMAL; if (!mDataChanged) { Loading Loading @@ -4005,7 +4005,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final float x = ev.getX(); final boolean inList = x > mListPadding.left && x < getWidth() - mListPadding.right; if (inList && !child.hasFocusable()) { if (inList && !child.hasFocusable(false)) { if (mPerformClick == null) { mPerformClick = new PerformClick(); } Loading Loading
core/java/android/view/View.java +12 −1 Original line number Diff line number Diff line Loading @@ -6389,6 +6389,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @see ViewGroup#getTouchscreenBlocksFocus() */ public boolean hasFocusable() { return hasFocusable(true); } /** * @hide pending determination of whether this should be public or not. * Currently used for compatibility with old focusability expectations in ListView. */ public boolean hasFocusable(boolean allowAutoFocus) { if (!isFocusableInTouchMode()) { for (ViewParent p = mParent; p instanceof ViewGroup; p = p.getParent()) { final ViewGroup g = (ViewGroup) p; Loading @@ -6397,7 +6405,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } } return (mViewFlags & VISIBILITY_MASK) == VISIBLE && isFocusable(); if ((mViewFlags & VISIBILITY_MASK) != VISIBLE) { return false; } return allowAutoFocus ? getFocusable() != NOT_FOCUSABLE : getFocusable() == FOCUSABLE; } /** Loading
core/java/android/view/ViewGroup.java +5 −3 Original line number Diff line number Diff line Loading @@ -1105,13 +1105,15 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager return null; } /** @hide Overriding hidden method */ @Override public boolean hasFocusable() { public boolean hasFocusable(boolean allowAutoFocus) { if ((mViewFlags & VISIBILITY_MASK) != VISIBLE) { return false; } if (isFocusable()) { // TODO This should probably be super.hasFocusable, but that would change behavior if (allowAutoFocus ? getFocusable() != NOT_FOCUSABLE : getFocusable() == FOCUSABLE) { return true; } Loading @@ -1122,7 +1124,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager for (int i = 0; i < count; i++) { final View child = children[i]; if (child.hasFocusable()) { if (child.hasFocusable(allowAutoFocus)) { return true; } } Loading
core/java/android/widget/AbsListView.java +4 −4 Original line number Diff line number Diff line Loading @@ -2548,7 +2548,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } private boolean isItemClickable(View view) { return !view.hasFocusable(); return !view.hasFocusable(false); } /** Loading Loading @@ -2824,7 +2824,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final View v = getChildAt(mSelectedPosition - mFirstPosition); if (v != null) { if (v.hasFocusable()) return; if (v.hasFocusable(false)) return; v.setPressed(true); } setPressed(true); Loading Loading @@ -3428,7 +3428,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (mTouchMode == TOUCH_MODE_DOWN) { mTouchMode = TOUCH_MODE_TAP; final View child = getChildAt(mMotionPosition - mFirstPosition); if (child != null && !child.hasFocusable()) { if (child != null && !child.hasFocusable(false)) { mLayoutMode = LAYOUT_NORMAL; if (!mDataChanged) { Loading Loading @@ -4005,7 +4005,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final float x = ev.getX(); final boolean inList = x > mListPadding.left && x < getWidth() - mListPadding.right; if (inList && !child.hasFocusable()) { if (inList && !child.hasFocusable(false)) { if (mPerformClick == null) { mPerformClick = new PerformClick(); } Loading