Loading core/java/android/widget/RadialTimePickerView.java +31 −7 Original line number Diff line number Diff line Loading @@ -16,7 +16,11 @@ package android.widget; import com.android.internal.R; import com.android.internal.widget.ExploreByTouchHelper; import android.animation.ObjectAnimator; import android.annotation.IntDef; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; Loading @@ -43,9 +47,8 @@ import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import com.android.internal.R; import com.android.internal.widget.ExploreByTouchHelper; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Calendar; import java.util.Locale; Loading @@ -55,11 +58,16 @@ import java.util.Locale; * @hide */ public class RadialTimePickerView extends View { private static final String TAG = "RadialTimePickerView"; public static final int HOURS = 0; public static final int MINUTES = 1; /** @hide */ @IntDef({HOURS, MINUTES}) @Retention(RetentionPolicy.SOURCE) @interface PickerType {} private static final int HOURS_INNER = 2; private static final int SELECTOR_CIRCLE = 0; Loading Loading @@ -185,8 +193,24 @@ public class RadialTimePickerView extends View { private boolean mInputEnabled = true; public interface OnValueSelectedListener { void onValueSelected(int pickerIndex, int newValue, boolean autoAdvance); interface OnValueSelectedListener { /** * Called when the selected value at a given picker index has changed. * * @param pickerType the type of value that has changed, one of: * <ul> * <li>{@link #MINUTES} * <li>{@link #HOURS} * </ul> * @param newValue the new value as minute in hour (0-59) or hour in * day (0-23) * @param autoAdvance when the picker type is {@link #HOURS}, * {@code true} to switch to the {@link #MINUTES} * picker or {@code false} to stay on the current * picker. No effect when picker type is * {@link #MINUTES}. */ void onValueSelected(@PickerType int pickerType, int newValue, boolean autoAdvance); } /** Loading Loading @@ -977,7 +1001,7 @@ public class RadialTimePickerView extends View { // Ensure we're showing the correct picker. animatePicker(mShowHours, ANIM_DURATION_TOUCH); final int type; final @PickerType int type; final int newValue; final boolean valueChanged; Loading core/java/android/widget/TimePickerClockDelegate.java +7 −11 Original line number Diff line number Diff line Loading @@ -62,9 +62,6 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate { private static final int HOUR_INDEX = RadialTimePickerView.HOURS; private static final int MINUTE_INDEX = RadialTimePickerView.MINUTES; // NOT a real index for the purpose of what's showing. private static final int AMPM_INDEX = 2; private static final int[] ATTRS_TEXT_COLOR = new int[] {R.attr.textColor}; private static final int[] ATTRS_DISABLED_ALPHA = new int[] {R.attr.disabledAlpha}; Loading Loading @@ -725,22 +722,21 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate { /** Listener for RadialTimePickerView interaction. */ private final OnValueSelectedListener mOnValueSelectedListener = new OnValueSelectedListener() { @Override public void onValueSelected(int pickerIndex, int newValue, boolean autoAdvance) { switch (pickerIndex) { case HOUR_INDEX: public void onValueSelected(int pickerType, int newValue, boolean autoAdvance) { switch (pickerType) { case RadialTimePickerView.HOURS: final boolean isTransition = mAllowAutoAdvance && autoAdvance; setHourInternal(newValue, true, !isTransition); if (isTransition) { setCurrentItemShowing(MINUTE_INDEX, true, false); mDelegator.announceForAccessibility(newValue + ". " + mSelectMinutes); final int localizedHour = getLocalizedHour(newValue); mDelegator.announceForAccessibility(localizedHour + ". " + mSelectMinutes); } break; case MINUTE_INDEX: case RadialTimePickerView.MINUTES: setMinuteInternal(newValue, true); break; case AMPM_INDEX: updateAmPmLabelStates(newValue); break; } if (mOnTimeChangedListener != null) { Loading Loading
core/java/android/widget/RadialTimePickerView.java +31 −7 Original line number Diff line number Diff line Loading @@ -16,7 +16,11 @@ package android.widget; import com.android.internal.R; import com.android.internal.widget.ExploreByTouchHelper; import android.animation.ObjectAnimator; import android.annotation.IntDef; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; Loading @@ -43,9 +47,8 @@ import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import com.android.internal.R; import com.android.internal.widget.ExploreByTouchHelper; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Calendar; import java.util.Locale; Loading @@ -55,11 +58,16 @@ import java.util.Locale; * @hide */ public class RadialTimePickerView extends View { private static final String TAG = "RadialTimePickerView"; public static final int HOURS = 0; public static final int MINUTES = 1; /** @hide */ @IntDef({HOURS, MINUTES}) @Retention(RetentionPolicy.SOURCE) @interface PickerType {} private static final int HOURS_INNER = 2; private static final int SELECTOR_CIRCLE = 0; Loading Loading @@ -185,8 +193,24 @@ public class RadialTimePickerView extends View { private boolean mInputEnabled = true; public interface OnValueSelectedListener { void onValueSelected(int pickerIndex, int newValue, boolean autoAdvance); interface OnValueSelectedListener { /** * Called when the selected value at a given picker index has changed. * * @param pickerType the type of value that has changed, one of: * <ul> * <li>{@link #MINUTES} * <li>{@link #HOURS} * </ul> * @param newValue the new value as minute in hour (0-59) or hour in * day (0-23) * @param autoAdvance when the picker type is {@link #HOURS}, * {@code true} to switch to the {@link #MINUTES} * picker or {@code false} to stay on the current * picker. No effect when picker type is * {@link #MINUTES}. */ void onValueSelected(@PickerType int pickerType, int newValue, boolean autoAdvance); } /** Loading Loading @@ -977,7 +1001,7 @@ public class RadialTimePickerView extends View { // Ensure we're showing the correct picker. animatePicker(mShowHours, ANIM_DURATION_TOUCH); final int type; final @PickerType int type; final int newValue; final boolean valueChanged; Loading
core/java/android/widget/TimePickerClockDelegate.java +7 −11 Original line number Diff line number Diff line Loading @@ -62,9 +62,6 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate { private static final int HOUR_INDEX = RadialTimePickerView.HOURS; private static final int MINUTE_INDEX = RadialTimePickerView.MINUTES; // NOT a real index for the purpose of what's showing. private static final int AMPM_INDEX = 2; private static final int[] ATTRS_TEXT_COLOR = new int[] {R.attr.textColor}; private static final int[] ATTRS_DISABLED_ALPHA = new int[] {R.attr.disabledAlpha}; Loading Loading @@ -725,22 +722,21 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate { /** Listener for RadialTimePickerView interaction. */ private final OnValueSelectedListener mOnValueSelectedListener = new OnValueSelectedListener() { @Override public void onValueSelected(int pickerIndex, int newValue, boolean autoAdvance) { switch (pickerIndex) { case HOUR_INDEX: public void onValueSelected(int pickerType, int newValue, boolean autoAdvance) { switch (pickerType) { case RadialTimePickerView.HOURS: final boolean isTransition = mAllowAutoAdvance && autoAdvance; setHourInternal(newValue, true, !isTransition); if (isTransition) { setCurrentItemShowing(MINUTE_INDEX, true, false); mDelegator.announceForAccessibility(newValue + ". " + mSelectMinutes); final int localizedHour = getLocalizedHour(newValue); mDelegator.announceForAccessibility(localizedHour + ". " + mSelectMinutes); } break; case MINUTE_INDEX: case RadialTimePickerView.MINUTES: setMinuteInternal(newValue, true); break; case AMPM_INDEX: updateAmPmLabelStates(newValue); break; } if (mOnTimeChangedListener != null) { Loading