Skip to content

Commit f5437ee

Browse files
enh-googleAndroid Git Automerger
authored andcommitted
am 297ad25: Merge "Deprecate those parts of DateUtils the documentation says not to use."
* commit '297ad257464d2ea65cabd45ddb19f6da34b39157': Deprecate those parts of DateUtils the documentation says not to use.
2 parents eceb317 + 297ad25 commit f5437ee

File tree

2 files changed

+50
-19
lines changed

2 files changed

+50
-19
lines changed

api/current.txt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21526,34 +21526,34 @@ package android.text.format {
2152621526
method public static java.lang.String formatElapsedTime(long);
2152721527
method public static java.lang.String formatElapsedTime(java.lang.StringBuilder, long);
2152821528
method public static final java.lang.CharSequence formatSameDayTime(long, long, int, int);
21529-
method public static java.lang.String getAMPMString(int);
21530-
method public static java.lang.String getDayOfWeekString(int, int);
21531-
method public static java.lang.String getMonthString(int, int);
21529+
method public static deprecated java.lang.String getAMPMString(int);
21530+
method public static deprecated java.lang.String getDayOfWeekString(int, int);
21531+
method public static deprecated java.lang.String getMonthString(int, int);
2153221532
method public static java.lang.CharSequence getRelativeDateTimeString(android.content.Context, long, long, long, int);
2153321533
method public static java.lang.CharSequence getRelativeTimeSpanString(long);
2153421534
method public static java.lang.CharSequence getRelativeTimeSpanString(long, long, long);
2153521535
method public static java.lang.CharSequence getRelativeTimeSpanString(long, long, long, int);
2153621536
method public static java.lang.CharSequence getRelativeTimeSpanString(android.content.Context, long, boolean);
2153721537
method public static java.lang.CharSequence getRelativeTimeSpanString(android.content.Context, long);
2153821538
method public static boolean isToday(long);
21539-
field public static final java.lang.String ABBREV_MONTH_FORMAT = "%b";
21539+
field public static final deprecated java.lang.String ABBREV_MONTH_FORMAT = "%b";
2154021540
field public static final java.lang.String ABBREV_WEEKDAY_FORMAT = "%a";
2154121541
field public static final long DAY_IN_MILLIS = 86400000L; // 0x5265c00L
21542-
field public static final int FORMAT_12HOUR = 64; // 0x40
21543-
field public static final int FORMAT_24HOUR = 128; // 0x80
21542+
field public static final deprecated int FORMAT_12HOUR = 64; // 0x40
21543+
field public static final deprecated int FORMAT_24HOUR = 128; // 0x80
2154421544
field public static final int FORMAT_ABBREV_ALL = 524288; // 0x80000
2154521545
field public static final int FORMAT_ABBREV_MONTH = 65536; // 0x10000
2154621546
field public static final int FORMAT_ABBREV_RELATIVE = 262144; // 0x40000
2154721547
field public static final int FORMAT_ABBREV_TIME = 16384; // 0x4000
2154821548
field public static final int FORMAT_ABBREV_WEEKDAY = 32768; // 0x8000
21549-
field public static final int FORMAT_CAP_AMPM = 256; // 0x100
21550-
field public static final int FORMAT_CAP_MIDNIGHT = 4096; // 0x1000
21551-
field public static final int FORMAT_CAP_NOON = 1024; // 0x400
21552-
field public static final int FORMAT_CAP_NOON_MIDNIGHT = 5120; // 0x1400
21549+
field public static final deprecated int FORMAT_CAP_AMPM = 256; // 0x100
21550+
field public static final deprecated int FORMAT_CAP_MIDNIGHT = 4096; // 0x1000
21551+
field public static final deprecated int FORMAT_CAP_NOON = 1024; // 0x400
21552+
field public static final deprecated int FORMAT_CAP_NOON_MIDNIGHT = 5120; // 0x1400
2155321553
field public static final int FORMAT_NO_MIDNIGHT = 2048; // 0x800
2155421554
field public static final int FORMAT_NO_MONTH_DAY = 32; // 0x20
2155521555
field public static final int FORMAT_NO_NOON = 512; // 0x200
21556-
field public static final int FORMAT_NO_NOON_MIDNIGHT = 2560; // 0xa00
21556+
field public static final deprecated int FORMAT_NO_NOON_MIDNIGHT = 2560; // 0xa00
2155721557
field public static final int FORMAT_NO_YEAR = 8; // 0x8
2155821558
field public static final int FORMAT_NUMERIC_DATE = 131072; // 0x20000
2155921559
field public static final int FORMAT_SHOW_DATE = 16; // 0x10
@@ -21562,12 +21562,12 @@ package android.text.format {
2156221562
field public static final int FORMAT_SHOW_YEAR = 4; // 0x4
2156321563
field public static final deprecated int FORMAT_UTC = 8192; // 0x2000
2156421564
field public static final long HOUR_IN_MILLIS = 3600000L; // 0x36ee80L
21565-
field public static final java.lang.String HOUR_MINUTE_24 = "%H:%M";
21566-
field public static final int LENGTH_LONG = 10; // 0xa
21567-
field public static final int LENGTH_MEDIUM = 20; // 0x14
21568-
field public static final int LENGTH_SHORT = 30; // 0x1e
21569-
field public static final int LENGTH_SHORTER = 40; // 0x28
21570-
field public static final int LENGTH_SHORTEST = 50; // 0x32
21565+
field public static final deprecated java.lang.String HOUR_MINUTE_24 = "%H:%M";
21566+
field public static final deprecated int LENGTH_LONG = 10; // 0xa
21567+
field public static final deprecated int LENGTH_MEDIUM = 20; // 0x14
21568+
field public static final deprecated int LENGTH_SHORT = 30; // 0x1e
21569+
field public static final deprecated int LENGTH_SHORTER = 40; // 0x28
21570+
field public static final deprecated int LENGTH_SHORTEST = 50; // 0x32
2157121571
field public static final long MINUTE_IN_MILLIS = 60000L; // 0xea60L
2157221572
field public static final java.lang.String MONTH_DAY_FORMAT = "%-d";
2157321573
field public static final java.lang.String MONTH_FORMAT = "%B";
@@ -21578,8 +21578,8 @@ package android.text.format {
2157821578
field public static final java.lang.String YEAR_FORMAT = "%Y";
2157921579
field public static final java.lang.String YEAR_FORMAT_TWO_DIGITS = "%g";
2158021580
field public static final long YEAR_IN_MILLIS = 31449600000L; // 0x7528ad000L
21581-
field public static final int[] sameMonthTable;
21582-
field public static final int[] sameYearTable;
21581+
field public static final deprecated int[] sameMonthTable;
21582+
field public static final deprecated int[] sameYearTable;
2158321583
}
2158421584

2158521585
public final class Formatter {

core/java/android/text/format/DateUtils.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,17 @@ public class DateUtils
161161
public static final int FORMAT_NO_YEAR = 0x00008;
162162
public static final int FORMAT_SHOW_DATE = 0x00010;
163163
public static final int FORMAT_NO_MONTH_DAY = 0x00020;
164+
@Deprecated
164165
public static final int FORMAT_12HOUR = 0x00040;
166+
@Deprecated
165167
public static final int FORMAT_24HOUR = 0x00080;
168+
@Deprecated
166169
public static final int FORMAT_CAP_AMPM = 0x00100;
167170
public static final int FORMAT_NO_NOON = 0x00200;
171+
@Deprecated
168172
public static final int FORMAT_CAP_NOON = 0x00400;
169173
public static final int FORMAT_NO_MIDNIGHT = 0x00800;
174+
@Deprecated
170175
public static final int FORMAT_CAP_MIDNIGHT = 0x01000;
171176
/**
172177
* @deprecated Use
@@ -181,19 +186,25 @@ public class DateUtils
181186
public static final int FORMAT_NUMERIC_DATE = 0x20000;
182187
public static final int FORMAT_ABBREV_RELATIVE = 0x40000;
183188
public static final int FORMAT_ABBREV_ALL = 0x80000;
189+
@Deprecated
184190
public static final int FORMAT_CAP_NOON_MIDNIGHT = (FORMAT_CAP_NOON | FORMAT_CAP_MIDNIGHT);
191+
@Deprecated
185192
public static final int FORMAT_NO_NOON_MIDNIGHT = (FORMAT_NO_NOON | FORMAT_NO_MIDNIGHT);
186193

187194
// Date and time format strings that are constant and don't need to be
188195
// translated.
189196
/**
190197
* This is not actually the preferred 24-hour date format in all locales.
198+
* @deprecated use {@link java.text.SimpleDateFormat} instead.
191199
*/
200+
@Deprecated
192201
public static final String HOUR_MINUTE_24 = "%H:%M";
193202
public static final String MONTH_FORMAT = "%B";
194203
/**
195204
* This is not actually a useful month name in all locales.
205+
* @deprecated use {@link java.text.SimpleDateFormat} instead.
196206
*/
207+
@Deprecated
197208
public static final String ABBREV_MONTH_FORMAT = "%b";
198209
public static final String NUMERIC_MONTH_FORMAT = "%m";
199210
public static final String MONTH_DAY_FORMAT = "%-d";
@@ -207,6 +218,7 @@ public class DateUtils
207218
// The index is constructed from a bit-wise OR of the boolean values:
208219
// {showTime, showYear, showWeekDay}. For example, if showYear and
209220
// showWeekDay are both true, then the index would be 3.
221+
/** @deprecated do not use. */
210222
public static final int sameYearTable[] = {
211223
com.android.internal.R.string.same_year_md1_md2,
212224
com.android.internal.R.string.same_year_wday1_md1_wday2_md2,
@@ -233,6 +245,7 @@ public class DateUtils
233245
// The index is constructed from a bit-wise OR of the boolean values:
234246
// {showTime, showYear, showWeekDay}. For example, if showYear and
235247
// showWeekDay are both true, then the index would be 3.
248+
/** @deprecated do not use. */
236249
public static final int sameMonthTable[] = {
237250
com.android.internal.R.string.same_month_md1_md2,
238251
com.android.internal.R.string.same_month_wday1_md1_wday2_md2,
@@ -259,7 +272,9 @@ public class DateUtils
259272
*
260273
* @more <p>
261274
* e.g. "Sunday" or "January"
275+
* @deprecated use {@link java.text.SimpleDateFormat} instead.
262276
*/
277+
@Deprecated
263278
public static final int LENGTH_LONG = 10;
264279

265280
/**
@@ -268,7 +283,9 @@ public class DateUtils
268283
*
269284
* @more <p>
270285
* e.g. "Sun" or "Jan"
286+
* @deprecated use {@link java.text.SimpleDateFormat} instead.
271287
*/
288+
@Deprecated
272289
public static final int LENGTH_MEDIUM = 20;
273290

274291
/**
@@ -278,14 +295,18 @@ public class DateUtils
278295
* <p>e.g. "Su" or "Jan"
279296
* <p>In most languages, the results returned for LENGTH_SHORT will be the same as
280297
* the results returned for {@link #LENGTH_MEDIUM}.
298+
* @deprecated use {@link java.text.SimpleDateFormat} instead.
281299
*/
300+
@Deprecated
282301
public static final int LENGTH_SHORT = 30;
283302

284303
/**
285304
* Request an even shorter abbreviated version of the name.
286305
* Do not use this. Currently this will always return the same result
287306
* as {@link #LENGTH_SHORT}.
307+
* @deprecated use {@link java.text.SimpleDateFormat} instead.
288308
*/
309+
@Deprecated
289310
public static final int LENGTH_SHORTER = 40;
290311

291312
/**
@@ -295,7 +316,9 @@ public class DateUtils
295316
* <p>e.g. "S", "T", "T" or "J"
296317
* <p>In some languages, the results returned for LENGTH_SHORTEST will be the same as
297318
* the results returned for {@link #LENGTH_SHORT}.
319+
* @deprecated use {@link java.text.SimpleDateFormat} instead.
298320
*/
321+
@Deprecated
299322
public static final int LENGTH_SHORTEST = 50;
300323

301324
/**
@@ -309,7 +332,9 @@ public class DateUtils
309332
* Undefined lengths will return {@link #LENGTH_MEDIUM}
310333
* but may return something different in the future.
311334
* @throws IndexOutOfBoundsException if the dayOfWeek is out of bounds.
335+
* @deprecated use {@link java.text.SimpleDateFormat} instead.
312336
*/
337+
@Deprecated
313338
public static String getDayOfWeekString(int dayOfWeek, int abbrev) {
314339
int[] list;
315340
switch (abbrev) {
@@ -330,7 +355,9 @@ public static String getDayOfWeekString(int dayOfWeek, int abbrev) {
330355
* @param ampm Either {@link Calendar#AM Calendar.AM} or {@link Calendar#PM Calendar.PM}.
331356
* @throws IndexOutOfBoundsException if the ampm is out of bounds.
332357
* @return Localized version of "AM" or "PM".
358+
* @deprecated use {@link java.text.SimpleDateFormat} instead.
333359
*/
360+
@Deprecated
334361
public static String getAMPMString(int ampm) {
335362
Resources r = Resources.getSystem();
336363
return r.getString(sAmPm[ampm - Calendar.AM]);
@@ -345,7 +372,9 @@ public static String getAMPMString(int ampm) {
345372
* Undefined lengths will return {@link #LENGTH_MEDIUM}
346373
* but may return something different in the future.
347374
* @return Localized month of the year.
375+
* @deprecated use {@link java.text.SimpleDateFormat} instead.
348376
*/
377+
@Deprecated
349378
public static String getMonthString(int month, int abbrev) {
350379
// Note that here we use sMonthsMedium for MEDIUM, SHORT and SHORTER.
351380
// This is a shortcut to not spam the translators with too many variations
@@ -378,7 +407,9 @@ public static String getMonthString(int month, int abbrev) {
378407
* but may return something different in the future.
379408
* @return Localized month of the year.
380409
* @hide Pending API council approval
410+
* @deprecated use {@link java.text.SimpleDateFormat} instead.
381411
*/
412+
@Deprecated
382413
public static String getStandaloneMonthString(int month, int abbrev) {
383414
// Note that here we use sMonthsMedium for MEDIUM, SHORT and SHORTER.
384415
// This is a shortcut to not spam the translators with too many variations

0 commit comments

Comments
 (0)