diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-09-21 00:34:05 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-09-21 17:26:41 -0700 |
commit | bfe319e06aa56c081d0d94d64a8181291d7f7388 (patch) | |
tree | d0015a99d27fd84554b4b8757304f4b017f75d50 /core/java/android/text | |
parent | a7719af31290bea50d822b535b6a886ba7a88097 (diff) | |
download | frameworks_base-bfe319e06aa56c081d0d94d64a8181291d7f7388.zip frameworks_base-bfe319e06aa56c081d0d94d64a8181291d7f7388.tar.gz frameworks_base-bfe319e06aa56c081d0d94d64a8181291d7f7388.tar.bz2 |
Turn animations on by default.
Add API to skip the animation for a particular start activity, so that
a latter better one can be used.
Fix Theme.NoDisplay to actually work.
Fiddle with various animations: don't do a different animation for task
switching, try a scale animation for switching in/out of the wallpaper.
Adjust the animation duration so that at normal speed we have something
more like the slower animation option (so slow is now the default).
Change-Id: Ieba9f3db0bd9a762a19b327a3ecccbc7b547893d
Diffstat (limited to 'core/java/android/text')
-rw-r--r-- | core/java/android/text/format/Formatter.java | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/core/java/android/text/format/Formatter.java b/core/java/android/text/format/Formatter.java index 367b26c..baaa3ce 100644 --- a/core/java/android/text/format/Formatter.java +++ b/core/java/android/text/format/Formatter.java @@ -32,6 +32,18 @@ public final class Formatter { * @return formated string with the number */ public static String formatFileSize(Context context, long number) { + return formatFileSize(context, number, false); + } + + /** + * Like {@link #formatFileSize}, but trying to generate shorter numbers + * (showing fewer digits of precisin). + */ + public static String formatShortFileSize(Context context, long number) { + return formatFileSize(context, number, true); + } + + private static String formatFileSize(Context context, long number, boolean shorter) { if (context == null) { return ""; } @@ -58,13 +70,24 @@ public final class Formatter { suffix = com.android.internal.R.string.petabyteShort; result = result / 1024; } - if (result < 100) { - String value = String.format("%.2f", result); - return context.getResources(). - getString(com.android.internal.R.string.fileSizeSuffix, - value, context.getString(suffix)); + String value; + if (result < 1) { + value = String.format("%.2f", result); + } else if (result < 10) { + if (shorter) { + value = String.format("%.1f", result); + } else { + value = String.format("%.2f", result); + } + } else if (result < 100) { + if (shorter) { + value = String.format("%.0f", result); + } else { + value = String.format("%.2f", result); + } + } else { + value = String.format("%.0f", result); } - String value = String.format("%.0f", result); return context.getResources(). getString(com.android.internal.R.string.fileSizeSuffix, value, context.getString(suffix)); |