|
@@ -279,13 +279,28 @@ public class DisplayUtils {
|
|
|
}
|
|
|
|
|
|
public static CharSequence getRelativeDateTimeString(Context c, long time, long minResolution, long transitionResolution, int flags){
|
|
|
+ CharSequence dateString = "";
|
|
|
+
|
|
|
+ // in Future
|
|
|
if (time > System.currentTimeMillis()){
|
|
|
return DisplayUtils.unixTimeToHumanReadable(time);
|
|
|
- } else if ((System.currentTimeMillis() - time) < 60000) {
|
|
|
- return c.getString(R.string.file_list_seconds_ago) + ", " +
|
|
|
- DateFormat.getTimeFormat(c).format(new Date(time));
|
|
|
+ }
|
|
|
+ // < 60 seconds -> seconds ago
|
|
|
+ else if ((System.currentTimeMillis() - time) < 60 * 1000) {
|
|
|
+ return c.getString(R.string.file_list_seconds_ago);
|
|
|
} else {
|
|
|
- return DateUtils.getRelativeDateTimeString(c, time, minResolution, transitionResolution, flags);
|
|
|
+ // Workaround 2.x bug
|
|
|
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB && (System.currentTimeMillis() - time) > 24 * 60 * 60 * 1000){
|
|
|
+ Date date = new Date(time);
|
|
|
+ date.setHours(0);
|
|
|
+ date.setMinutes(0);
|
|
|
+ date.setSeconds(0);
|
|
|
+ dateString = DateUtils.getRelativeDateTimeString(c, date.getTime(), minResolution, transitionResolution, flags);
|
|
|
+ } else {
|
|
|
+ dateString = DateUtils.getRelativeDateTimeString(c, time, minResolution, transitionResolution, flags);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ return dateString.toString().split(",")[0];
|
|
|
}
|
|
|
}
|