import static android.provider.Calendar.EVENT_BEGIN_TIME;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Resources;
import android.text.format.Time;
import android.view.animation.AlphaAnimation;
import android.widget.ViewFlipper;
intent.setClassName(context, className);
intent.putExtra(EVENT_BEGIN_TIME, time);
+ intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(intent);
}
-
+
public static final Time timeFromIntent(Intent intent) {
Time time = new Time();
time.set(timeFromIntentInMillis(intent));
v.setInAnimation(in);
v.setOutAnimation(out);
}
-
- /**
- * Formats the given Time object so that it gives the day of the week
- * and the date (for example, "Monday, September 3, 2007"). If the
- * abbrev argument is true, then abbreviated names will be used (for
- * example, "Mon, Sep 3, 2007").
- *
- * @param time the time to format
- * @param abbrev if true, use abbreviations for the weekday and month
- * @return the string containing the weekday and the date
- */
- public static String formatDayDate(Time time, boolean abbrev) {
- String date;
- if (abbrev) {
- date = time.format("%a, %b %-d, %Y");
- } else {
- date = time.format("%A, %B %-d, %Y");
- }
- return date;
- }
-
+
/**
* Formats the given Time object so that it gives the month and year
* (for example, "September 2007").
- *
+ *
* @param time the time to format
- * @return the string containing the weekday and the date
+ * @return the string containing the weekday and the date
*/
public static String formatMonthYear(Time time) {
- return time.format("%B %Y");
+ Resources res = Resources.getSystem();
+ return time.format(res.getString(com.android.internal.R.string.month_year));
}
-
+
// TODO: replace this with the correct i18n way to do this
public static final String englishNthDay[] = {
"", "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th",
"20th", "21st", "22nd", "23rd", "24th", "25th", "26th", "27th", "28th", "29th",
"30th", "31st"
};
-
+
public static String formatNth(int nth) {
return "the " + englishNthDay[nth];
}
-
+
/**
* Sets the time to the beginning of the day (midnight) by clearing the
- * hour, minute, and second fields.
+ * hour, minute, and second fields.
*/
static void setTimeToStartOfDay(Time time) {
time.second = 0;