diff options
author | Ken Shirriff <kens@google.com> | 2010-03-01 22:46:07 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-03-01 22:46:07 -0800 |
commit | 0ef3eeec405efe2585eae8e675869dafdf81698f (patch) | |
tree | 4940dbc3d25260f6539c164a48984b30fc03995a /core/java/android/text | |
parent | 34db9928027ee157624ad7e08f7a79e4bf1a22cb (diff) | |
parent | a53bbe4033f1e9fc4c371d51ba1ef58588f867eb (diff) | |
download | frameworks_base-0ef3eeec405efe2585eae8e675869dafdf81698f.zip frameworks_base-0ef3eeec405efe2585eae8e675869dafdf81698f.tar.gz frameworks_base-0ef3eeec405efe2585eae8e675869dafdf81698f.tar.bz2 |
Merge "Remove DateException and obsolete DateUtils functions."
Diffstat (limited to 'core/java/android/text')
-rw-r--r-- | core/java/android/text/format/DateUtils.java | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/core/java/android/text/format/DateUtils.java b/core/java/android/text/format/DateUtils.java index 9dd8ceb..dde0889 100644 --- a/core/java/android/text/format/DateUtils.java +++ b/core/java/android/text/format/DateUtils.java @@ -21,7 +21,6 @@ import com.android.internal.R; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; -import android.pim.DateException; import java.util.Calendar; import java.util.Date; @@ -814,35 +813,6 @@ public class DateUtils && (thenMonth == time.month) && (thenMonthDay == time.monthDay); } - - /** - * @hide - * @deprecated use {@link android.text.format.Time} - */ - private static final int ctoi(String str, int index) - throws DateException - { - char c = str.charAt(index); - if (c >= '0' && c <= '9') { - return (int)(c - '0'); - } - throw new DateException("Expected numeric character. Got '" + - c + "'"); - } - - /** - * @hide - * @deprecated use {@link android.text.format.Time} - */ - private static final int check(int lowerBound, int upperBound, int value) - throws DateException - { - if (value >= lowerBound && value <= upperBound) { - return value; - } - throw new DateException("field out of bounds. max=" + upperBound - + " value=" + value); - } /** * @hide @@ -861,81 +831,6 @@ public class DateUtils return false; } - - // note that month in Calendar is 0 based and in all other human - // representations, it's 1 based. - // Returns if the Z was present, meaning that the time is in UTC - /** - * @hide - * @deprecated use {@link android.text.format.Time} - */ - public static boolean parseDateTime(String str, Calendar cal) - throws DateException - { - int len = str.length(); - boolean dateTime = (len == 15 || len == 16) && str.charAt(8) == 'T'; - boolean justDate = len == 8; - if (dateTime || justDate) { - cal.clear(); - cal.set(Calendar.YEAR, - ctoi(str, 0)*1000 + ctoi(str, 1)*100 - + ctoi(str, 2)*10 + ctoi(str, 3)); - cal.set(Calendar.MONTH, - check(0, 11, ctoi(str, 4)*10 + ctoi(str, 5) - 1)); - cal.set(Calendar.DAY_OF_MONTH, - check(1, 31, ctoi(str, 6)*10 + ctoi(str, 7))); - if (dateTime) { - cal.set(Calendar.HOUR_OF_DAY, - check(0, 23, ctoi(str, 9)*10 + ctoi(str, 10))); - cal.set(Calendar.MINUTE, - check(0, 59, ctoi(str, 11)*10 + ctoi(str, 12))); - cal.set(Calendar.SECOND, - check(0, 59, ctoi(str, 13)*10 + ctoi(str, 14))); - } - if (justDate) { - cal.set(Calendar.HOUR_OF_DAY, 0); - cal.set(Calendar.MINUTE, 0); - cal.set(Calendar.SECOND, 0); - return true; - } - if (len == 15) { - return false; - } - if (str.charAt(15) == 'Z') { - return true; - } - } - throw new DateException("Invalid time (expected " - + "YYYYMMDDThhmmssZ? got '" + str + "')."); - } - - /** - * Given a timezone string which can be null, and a dateTime string, - * set that time into a calendar. - * @hide - * @deprecated use {@link android.text.format.Time} - */ - public static void parseDateTime(String tz, String dateTime, Calendar out) - throws DateException - { - TimeZone timezone; - if (DateUtils.isUTC(dateTime)) { - timezone = TimeZone.getTimeZone("UTC"); - } - else if (tz == null) { - timezone = TimeZone.getDefault(); - } - else { - timezone = TimeZone.getTimeZone(tz); - } - - Calendar local = new GregorianCalendar(timezone); - DateUtils.parseDateTime(dateTime, local); - - out.setTimeInMillis(local.getTimeInMillis()); - } - - /** * Return a string containing the date and time in RFC2445 format. * Ensures that the time is written in UTC. The Calendar class doesn't |