Loading core/java/android/view/accessibility/AccessibilityEvent.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -618,8 +618,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par public static final int TYPE_WINDOW_CONTENT_CHANGED = 0x00000800; public static final int TYPE_WINDOW_CONTENT_CHANGED = 0x00000800; /** /** * Represents the event of scrolling a view. This event type is generally not sent directly. * Represents the event of scrolling a view. * @see View#onScrollChanged(int, int, int, int) */ */ public static final int TYPE_VIEW_SCROLLED = 0x00001000; public static final int TYPE_VIEW_SCROLLED = 0x00001000; Loading core/java/android/widget/NumberPicker.java +11 −38 Original line number Original line Diff line number Diff line Loading @@ -737,7 +737,6 @@ public class NumberPicker extends LinearLayout { mInputText.setFilters(new InputFilter[] { mInputText.setFilters(new InputFilter[] { new InputTextFilter() new InputTextFilter() }); }); mInputText.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); mInputText.setRawInputType(InputType.TYPE_CLASS_NUMBER); mInputText.setRawInputType(InputType.TYPE_CLASS_NUMBER); mInputText.setImeOptions(EditorInfo.IME_ACTION_DONE); mInputText.setImeOptions(EditorInfo.IME_ACTION_DONE); Loading Loading @@ -771,12 +770,6 @@ public class NumberPicker extends LinearLayout { if (getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) { if (getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) { setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); } } // Should be focusable by default, as the text view whose visibility changes is focusable if (getFocusable() == View.FOCUSABLE_AUTO) { setFocusable(View.FOCUSABLE); setFocusableInTouchMode(true); } } } @Override @Override Loading Loading @@ -863,7 +856,7 @@ public class NumberPicker extends LinearLayout { switch (action) { switch (action) { case MotionEvent.ACTION_DOWN: { case MotionEvent.ACTION_DOWN: { removeAllCallbacks(); removeAllCallbacks(); hideSoftInput(); mInputText.setVisibility(View.INVISIBLE); mLastDownOrMoveEventY = mLastDownEventY = event.getY(); mLastDownOrMoveEventY = mLastDownEventY = event.getY(); mLastDownEventTime = event.getEventTime(); mLastDownEventTime = event.getEventTime(); mIgnoreMoveEvents = false; mIgnoreMoveEvents = false; Loading @@ -890,9 +883,11 @@ public class NumberPicker extends LinearLayout { mFlingScroller.forceFinished(true); mFlingScroller.forceFinished(true); mAdjustScroller.forceFinished(true); mAdjustScroller.forceFinished(true); } else if (mLastDownEventY < mTopSelectionDividerTop) { } else if (mLastDownEventY < mTopSelectionDividerTop) { hideSoftInput(); postChangeCurrentByOneFromLongPress( postChangeCurrentByOneFromLongPress( false, ViewConfiguration.getLongPressTimeout()); false, ViewConfiguration.getLongPressTimeout()); } else if (mLastDownEventY > mBottomSelectionDividerBottom) { } else if (mLastDownEventY > mBottomSelectionDividerBottom) { hideSoftInput(); postChangeCurrentByOneFromLongPress( postChangeCurrentByOneFromLongPress( true, ViewConfiguration.getLongPressTimeout()); true, ViewConfiguration.getLongPressTimeout()); } else { } else { Loading Loading @@ -1125,7 +1120,6 @@ public class NumberPicker extends LinearLayout { @Override @Override public void scrollBy(int x, int y) { public void scrollBy(int x, int y) { int[] selectorIndices = mSelectorIndices; int[] selectorIndices = mSelectorIndices; int startScrollOffset = mCurrentScrollOffset; if (!mWrapSelectorWheel && y > 0 if (!mWrapSelectorWheel && y > 0 && selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] <= mMinValue) { && selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] <= mMinValue) { mCurrentScrollOffset = mInitialScrollOffset; mCurrentScrollOffset = mInitialScrollOffset; Loading Loading @@ -1153,9 +1147,6 @@ public class NumberPicker extends LinearLayout { mCurrentScrollOffset = mInitialScrollOffset; mCurrentScrollOffset = mInitialScrollOffset; } } } } if (startScrollOffset != mCurrentScrollOffset) { onScrollChanged(0, mCurrentScrollOffset, 0, startScrollOffset); } } } @Override @Override Loading Loading @@ -1744,10 +1735,7 @@ public class NumberPicker extends LinearLayout { } } int previous = mValue; int previous = mValue; mValue = current; mValue = current; // If we're flinging, we'll update the text view at the end when it becomes visible if (mScrollState != OnScrollListener.SCROLL_STATE_FLING) { updateInputTextView(); updateInputTextView(); } if (notifyChange) { if (notifyChange) { notifyChange(previous, current); notifyChange(previous, current); } } Loading @@ -1764,7 +1752,7 @@ public class NumberPicker extends LinearLayout { */ */ private void changeValueByOne(boolean increment) { private void changeValueByOne(boolean increment) { if (mHasSelectorWheel) { if (mHasSelectorWheel) { hideSoftInput(); mInputText.setVisibility(View.INVISIBLE); if (!moveToFinalScrollerPosition(mFlingScroller)) { if (!moveToFinalScrollerPosition(mFlingScroller)) { moveToFinalScrollerPosition(mAdjustScroller); moveToFinalScrollerPosition(mAdjustScroller); } } Loading Loading @@ -1811,8 +1799,9 @@ public class NumberPicker extends LinearLayout { */ */ private void onScrollerFinished(Scroller scroller) { private void onScrollerFinished(Scroller scroller) { if (scroller == mFlingScroller) { if (scroller == mFlingScroller) { ensureScrollWheelAdjusted(); if (!ensureScrollWheelAdjusted()) { updateInputTextView(); updateInputTextView(); } onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE); onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE); } else { } else { if (mScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { if (mScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { Loading Loading @@ -1948,26 +1937,10 @@ public class NumberPicker extends LinearLayout { */ */ String text = (mDisplayedValues == null) ? formatNumber(mValue) String text = (mDisplayedValues == null) ? formatNumber(mValue) : mDisplayedValues[mValue - mMinValue]; : mDisplayedValues[mValue - mMinValue]; if (!TextUtils.isEmpty(text)) { if (!TextUtils.isEmpty(text) && !text.equals(mInputText.getText().toString())) { CharSequence beforeText = mInputText.getText(); if (!text.equals(beforeText.toString())) { mInputText.setText(text); mInputText.setText(text); if (mAccessibilityNodeProvider != null) { AccessibilityEvent event = AccessibilityEvent.obtain( AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED); mInputText.onInitializeAccessibilityEvent(event); mInputText.onPopulateAccessibilityEvent(event); event.setFromIndex(0); event.setRemovedCount(beforeText.length()); event.setAddedCount(text.length()); event.setBeforeText(beforeText); event.setSource(NumberPicker.this, AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_INPUT); requestSendAccessibilityEvent(NumberPicker.this, event); } return true; return true; } } } return false; return false; } } Loading Loading
core/java/android/view/accessibility/AccessibilityEvent.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -618,8 +618,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par public static final int TYPE_WINDOW_CONTENT_CHANGED = 0x00000800; public static final int TYPE_WINDOW_CONTENT_CHANGED = 0x00000800; /** /** * Represents the event of scrolling a view. This event type is generally not sent directly. * Represents the event of scrolling a view. * @see View#onScrollChanged(int, int, int, int) */ */ public static final int TYPE_VIEW_SCROLLED = 0x00001000; public static final int TYPE_VIEW_SCROLLED = 0x00001000; Loading
core/java/android/widget/NumberPicker.java +11 −38 Original line number Original line Diff line number Diff line Loading @@ -737,7 +737,6 @@ public class NumberPicker extends LinearLayout { mInputText.setFilters(new InputFilter[] { mInputText.setFilters(new InputFilter[] { new InputTextFilter() new InputTextFilter() }); }); mInputText.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); mInputText.setRawInputType(InputType.TYPE_CLASS_NUMBER); mInputText.setRawInputType(InputType.TYPE_CLASS_NUMBER); mInputText.setImeOptions(EditorInfo.IME_ACTION_DONE); mInputText.setImeOptions(EditorInfo.IME_ACTION_DONE); Loading Loading @@ -771,12 +770,6 @@ public class NumberPicker extends LinearLayout { if (getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) { if (getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) { setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); } } // Should be focusable by default, as the text view whose visibility changes is focusable if (getFocusable() == View.FOCUSABLE_AUTO) { setFocusable(View.FOCUSABLE); setFocusableInTouchMode(true); } } } @Override @Override Loading Loading @@ -863,7 +856,7 @@ public class NumberPicker extends LinearLayout { switch (action) { switch (action) { case MotionEvent.ACTION_DOWN: { case MotionEvent.ACTION_DOWN: { removeAllCallbacks(); removeAllCallbacks(); hideSoftInput(); mInputText.setVisibility(View.INVISIBLE); mLastDownOrMoveEventY = mLastDownEventY = event.getY(); mLastDownOrMoveEventY = mLastDownEventY = event.getY(); mLastDownEventTime = event.getEventTime(); mLastDownEventTime = event.getEventTime(); mIgnoreMoveEvents = false; mIgnoreMoveEvents = false; Loading @@ -890,9 +883,11 @@ public class NumberPicker extends LinearLayout { mFlingScroller.forceFinished(true); mFlingScroller.forceFinished(true); mAdjustScroller.forceFinished(true); mAdjustScroller.forceFinished(true); } else if (mLastDownEventY < mTopSelectionDividerTop) { } else if (mLastDownEventY < mTopSelectionDividerTop) { hideSoftInput(); postChangeCurrentByOneFromLongPress( postChangeCurrentByOneFromLongPress( false, ViewConfiguration.getLongPressTimeout()); false, ViewConfiguration.getLongPressTimeout()); } else if (mLastDownEventY > mBottomSelectionDividerBottom) { } else if (mLastDownEventY > mBottomSelectionDividerBottom) { hideSoftInput(); postChangeCurrentByOneFromLongPress( postChangeCurrentByOneFromLongPress( true, ViewConfiguration.getLongPressTimeout()); true, ViewConfiguration.getLongPressTimeout()); } else { } else { Loading Loading @@ -1125,7 +1120,6 @@ public class NumberPicker extends LinearLayout { @Override @Override public void scrollBy(int x, int y) { public void scrollBy(int x, int y) { int[] selectorIndices = mSelectorIndices; int[] selectorIndices = mSelectorIndices; int startScrollOffset = mCurrentScrollOffset; if (!mWrapSelectorWheel && y > 0 if (!mWrapSelectorWheel && y > 0 && selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] <= mMinValue) { && selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] <= mMinValue) { mCurrentScrollOffset = mInitialScrollOffset; mCurrentScrollOffset = mInitialScrollOffset; Loading Loading @@ -1153,9 +1147,6 @@ public class NumberPicker extends LinearLayout { mCurrentScrollOffset = mInitialScrollOffset; mCurrentScrollOffset = mInitialScrollOffset; } } } } if (startScrollOffset != mCurrentScrollOffset) { onScrollChanged(0, mCurrentScrollOffset, 0, startScrollOffset); } } } @Override @Override Loading Loading @@ -1744,10 +1735,7 @@ public class NumberPicker extends LinearLayout { } } int previous = mValue; int previous = mValue; mValue = current; mValue = current; // If we're flinging, we'll update the text view at the end when it becomes visible if (mScrollState != OnScrollListener.SCROLL_STATE_FLING) { updateInputTextView(); updateInputTextView(); } if (notifyChange) { if (notifyChange) { notifyChange(previous, current); notifyChange(previous, current); } } Loading @@ -1764,7 +1752,7 @@ public class NumberPicker extends LinearLayout { */ */ private void changeValueByOne(boolean increment) { private void changeValueByOne(boolean increment) { if (mHasSelectorWheel) { if (mHasSelectorWheel) { hideSoftInput(); mInputText.setVisibility(View.INVISIBLE); if (!moveToFinalScrollerPosition(mFlingScroller)) { if (!moveToFinalScrollerPosition(mFlingScroller)) { moveToFinalScrollerPosition(mAdjustScroller); moveToFinalScrollerPosition(mAdjustScroller); } } Loading Loading @@ -1811,8 +1799,9 @@ public class NumberPicker extends LinearLayout { */ */ private void onScrollerFinished(Scroller scroller) { private void onScrollerFinished(Scroller scroller) { if (scroller == mFlingScroller) { if (scroller == mFlingScroller) { ensureScrollWheelAdjusted(); if (!ensureScrollWheelAdjusted()) { updateInputTextView(); updateInputTextView(); } onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE); onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE); } else { } else { if (mScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { if (mScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { Loading Loading @@ -1948,26 +1937,10 @@ public class NumberPicker extends LinearLayout { */ */ String text = (mDisplayedValues == null) ? formatNumber(mValue) String text = (mDisplayedValues == null) ? formatNumber(mValue) : mDisplayedValues[mValue - mMinValue]; : mDisplayedValues[mValue - mMinValue]; if (!TextUtils.isEmpty(text)) { if (!TextUtils.isEmpty(text) && !text.equals(mInputText.getText().toString())) { CharSequence beforeText = mInputText.getText(); if (!text.equals(beforeText.toString())) { mInputText.setText(text); mInputText.setText(text); if (mAccessibilityNodeProvider != null) { AccessibilityEvent event = AccessibilityEvent.obtain( AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED); mInputText.onInitializeAccessibilityEvent(event); mInputText.onPopulateAccessibilityEvent(event); event.setFromIndex(0); event.setRemovedCount(beforeText.length()); event.setAddedCount(text.length()); event.setBeforeText(beforeText); event.setSource(NumberPicker.this, AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_INPUT); requestSendAccessibilityEvent(NumberPicker.this, event); } return true; return true; } } } return false; return false; } } Loading