Loading core/java/android/widget/AbsSeekBar.java +17 −20 Original line number Diff line number Diff line Loading @@ -703,9 +703,9 @@ public abstract class AbsSeekBar extends ProgressBar { // fallthrough case KeyEvent.KEYCODE_DPAD_RIGHT: increment = isLayoutRtl() ? -increment : increment; int progress = getProgress() + increment; if (progress > 0 && progress < getMax()) { setProgress(progress, true); // Let progress bar handle clamping values. if (setProgress(getProgress() + increment, true)) { onKeyChange(); return true; } Loading @@ -729,10 +729,10 @@ public abstract class AbsSeekBar extends ProgressBar { if (isEnabled()) { final int progress = getProgress(); if (progress > 0) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); } if (progress < getMax()) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); } } } Loading @@ -743,29 +743,26 @@ public abstract class AbsSeekBar extends ProgressBar { if (super.performAccessibilityActionInternal(action, arguments)) { return true; } if (!isEnabled()) { return false; } final int progress = getProgress(); final int increment = Math.max(1, Math.round((float) getMax() / 5)); switch (action) { case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { if (progress <= 0) { return false; if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD || action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) { int increment = Math.max(1, Math.round((float) getMax() / 5)); if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) { increment = -increment; } setProgress(progress - increment, true); // Let progress bar handle clamping values. if (setProgress(getProgress() + increment, true)) { onKeyChange(); return true; } case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { if (progress >= getMax()) { return false; } setProgress(progress + increment, true); onKeyChange(); return true; } } return false; } Loading core/java/android/widget/ProgressBar.java +11 −11 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.graphics.drawable.shapes.Shape; import android.os.Parcel; import android.os.Parcelable; import android.util.AttributeSet; import android.util.MathUtils; import android.util.Pools.SynchronizedPool; import android.view.Gravity; import android.view.RemotableViewMethod; Loading Loading @@ -1341,23 +1342,22 @@ public class ProgressBar extends View { } @android.view.RemotableViewMethod synchronized void setProgress(int progress, boolean fromUser) { synchronized boolean setProgress(int progress, boolean fromUser) { if (mIndeterminate) { return; // Not applicable. return false; } if (progress < 0) { progress = 0; } progress = MathUtils.constrain(progress, 0, mMax); if (progress > mMax) { progress = mMax; if (progress == mProgress) { // No change from current. return false; } if (progress != mProgress) { mProgress = progress; refreshProgress(R.id.progress, mProgress, fromUser); } return true; } /** Loading Loading
core/java/android/widget/AbsSeekBar.java +17 −20 Original line number Diff line number Diff line Loading @@ -703,9 +703,9 @@ public abstract class AbsSeekBar extends ProgressBar { // fallthrough case KeyEvent.KEYCODE_DPAD_RIGHT: increment = isLayoutRtl() ? -increment : increment; int progress = getProgress() + increment; if (progress > 0 && progress < getMax()) { setProgress(progress, true); // Let progress bar handle clamping values. if (setProgress(getProgress() + increment, true)) { onKeyChange(); return true; } Loading @@ -729,10 +729,10 @@ public abstract class AbsSeekBar extends ProgressBar { if (isEnabled()) { final int progress = getProgress(); if (progress > 0) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); } if (progress < getMax()) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); } } } Loading @@ -743,29 +743,26 @@ public abstract class AbsSeekBar extends ProgressBar { if (super.performAccessibilityActionInternal(action, arguments)) { return true; } if (!isEnabled()) { return false; } final int progress = getProgress(); final int increment = Math.max(1, Math.round((float) getMax() / 5)); switch (action) { case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { if (progress <= 0) { return false; if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD || action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) { int increment = Math.max(1, Math.round((float) getMax() / 5)); if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) { increment = -increment; } setProgress(progress - increment, true); // Let progress bar handle clamping values. if (setProgress(getProgress() + increment, true)) { onKeyChange(); return true; } case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { if (progress >= getMax()) { return false; } setProgress(progress + increment, true); onKeyChange(); return true; } } return false; } Loading
core/java/android/widget/ProgressBar.java +11 −11 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.graphics.drawable.shapes.Shape; import android.os.Parcel; import android.os.Parcelable; import android.util.AttributeSet; import android.util.MathUtils; import android.util.Pools.SynchronizedPool; import android.view.Gravity; import android.view.RemotableViewMethod; Loading Loading @@ -1341,23 +1342,22 @@ public class ProgressBar extends View { } @android.view.RemotableViewMethod synchronized void setProgress(int progress, boolean fromUser) { synchronized boolean setProgress(int progress, boolean fromUser) { if (mIndeterminate) { return; // Not applicable. return false; } if (progress < 0) { progress = 0; } progress = MathUtils.constrain(progress, 0, mMax); if (progress > mMax) { progress = mMax; if (progress == mProgress) { // No change from current. return false; } if (progress != mProgress) { mProgress = progress; refreshProgress(R.id.progress, mProgress, fromUser); } return true; } /** Loading