summaryrefslogtreecommitdiff
path: root/core/java/android/widget/TimePicker.java
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2016-08-25 22:18:33 -0700
committerColin Cross <ccross@android.com>2016-08-25 22:18:33 -0700
commit2268fc12b59372a105a42631df3185bfc934bb44 (patch)
treeb7565ad5d84f98ba7b4c03607e492042db6c1f28 /core/java/android/widget/TimePicker.java
parent7c49dc57f06d131d477deadd416e4e5f7a2e12b7 (diff)
parent1095b21fa7e10d94d02d15cc10d0e89a63bf6f6e (diff)
resolve merge conflicts of 1095b21 to master
Change-Id: I611579044234435a07cad2f64930b731e53aec77
Diffstat (limited to 'core/java/android/widget/TimePicker.java')
-rw-r--r--core/java/android/widget/TimePicker.java38
1 files changed, 20 insertions, 18 deletions
diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java
index 1bbe041f2b74..e2d1415e77c4 100644
--- a/core/java/android/widget/TimePicker.java
+++ b/core/java/android/widget/TimePicker.java
@@ -16,20 +16,20 @@
package android.widget;
+import com.android.internal.R;
+
+import android.annotation.IntRange;
import android.annotation.NonNull;
-import android.annotation.Nullable;
import android.annotation.TestApi;
import android.annotation.Widget;
import android.content.Context;
-import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.Parcel;
import android.os.Parcelable;
-import android.os.Parcelable.Creator;
import android.util.AttributeSet;
+import android.util.MathUtils;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
-import com.android.internal.R;
import java.util.Locale;
@@ -103,8 +103,8 @@ public class TimePicker extends FrameLayout {
* @param hour the hour to set, in the range (0-23)
* @see #getHour()
*/
- public void setHour(int hour) {
- mDelegate.setHour(hour);
+ public void setHour(@IntRange(from = 0, to = 23) int hour) {
+ mDelegate.setHour(MathUtils.constrain(hour, 0, 23));
}
/**
@@ -118,13 +118,13 @@ public class TimePicker extends FrameLayout {
}
/**
- * Sets the currently selected minute..
+ * Sets the currently selected minute.
*
* @param minute the minute to set, in the range (0-59)
* @see #getMinute()
*/
- public void setMinute(int minute) {
- mDelegate.setMinute(minute);
+ public void setMinute(@IntRange(from = 0, to = 59) int minute) {
+ mDelegate.setMinute(MathUtils.constrain(minute, 0, 59));
}
/**
@@ -138,8 +138,9 @@ public class TimePicker extends FrameLayout {
}
/**
- * Sets the current hour.
+ * Sets the currently selected hour using 24-hour time.
*
+ * @param currentHour the hour to set, in the range (0-23)
* @deprecated Use {@link #setHour(int)}
*/
@Deprecated
@@ -148,33 +149,34 @@ public class TimePicker extends FrameLayout {
}
/**
- * @return the current hour in the range (0-23)
+ * @return the currently selected hour, in the range (0-23)
* @deprecated Use {@link #getHour()}
*/
@NonNull
@Deprecated
public Integer getCurrentHour() {
- return mDelegate.getHour();
+ return getHour();
}
/**
- * Set the current minute (0-59).
+ * Sets the currently selected minute.
*
+ * @param currentMinute the minute to set, in the range (0-59)
* @deprecated Use {@link #setMinute(int)}
*/
@Deprecated
public void setCurrentMinute(@NonNull Integer currentMinute) {
- mDelegate.setMinute(currentMinute);
+ setMinute(currentMinute);
}
/**
- * @return the current minute
+ * @return the currently selected minute, in the range (0-59)
* @deprecated Use {@link #getMinute()}
*/
@NonNull
@Deprecated
public Integer getCurrentMinute() {
- return mDelegate.getMinute();
+ return getMinute();
}
/**
@@ -281,10 +283,10 @@ public class TimePicker extends FrameLayout {
* for the real behavior.
*/
interface TimePickerDelegate {
- void setHour(int hour);
+ void setHour(@IntRange(from = 0, to = 23) int hour);
int getHour();
- void setMinute(int minute);
+ void setMinute(@IntRange(from = 0, to = 59) int minute);
int getMinute();
void setIs24Hour(boolean is24Hour);