Loading res/layout/event_info.xml +2 −2 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ <!-- WHEN --> <TextView android:id="@+id/when_date" android:id="@+id/when_datetime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4dip" Loading @@ -120,7 +120,7 @@ style="?android:attr/textAppearanceLarge" /> <TextView android:id="@+id/when_time" android:id="@+id/when_repeat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="-3dip" Loading res/layout/event_info_dialog.xml +2 −2 Original line number Diff line number Diff line Loading @@ -118,7 +118,7 @@ <!-- WHEN --> <TextView android:id="@+id/when_date" android:id="@+id/when_datetime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="18sp" Loading @@ -129,7 +129,7 @@ style="?android:attr/textAppearanceLarge" /> <TextView android:id="@+id/when_time" android:id="@+id/when_repeat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="18sp" Loading res/values/strings.xml +4 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,10 @@ <string name="timezone_label">Time zone</string> <!-- This is the label for the Guests/Attendees of an event --> <string name="attendees_label">Guests</string> <!-- Text to show when an event starts on the current day --> <string name="today">Today</string> <!-- Text to show when an event starts on the next day --> <string name="tomorrow">Tomorrow</string> <!-- Some events repeat daily, weekly, monthly, or yearly. This is the label for all the choices about how often an event repeats (including the choice Loading Loading @@ -515,9 +519,6 @@ <!-- Caption to show on gadget when there are no upcoming calendar events --> <string name="gadget_no_events">No upcoming calendar events</string> <!-- Text to show on gadget when an event starts on the next day --> <string name="tomorrow">Tomorrow</string> <!-- Text to show on gadget when an event is currently in progress --> Loading src/com/android/calendar/EventInfoFragment.java +16 −66 Original line number Diff line number Diff line Loading @@ -283,8 +283,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange private boolean mEventDeletionStarted = false; private TextView mTitle; private TextView mWhenDate; private TextView mWhenTime; private TextView mWhenDateTime; private TextView mWhere; private ExpandableTextView mDesc; private AttendeesView mLongAttendees; Loading Loading @@ -654,8 +653,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange mScrollView = (ScrollView) mView.findViewById(R.id.event_info_scroll_view); mLoadingMsgView = mView.findViewById(R.id.event_info_loading_msg); mTitle = (TextView) mView.findViewById(R.id.title); mWhenDate = (TextView) mView.findViewById(R.id.when_date); mWhenTime = (TextView) mView.findViewById(R.id.when_time); mWhenDateTime = (TextView) mView.findViewById(R.id.when_datetime); mWhere = (TextView) mView.findViewById(R.id.where); mDesc = (ExpandableTextView) mView.findViewById(R.id.description); mHeadlines = mView.findViewById(R.id.event_info_headline); Loading Loading @@ -1105,83 +1103,35 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange mColor = Utils.getDisplayColorFromColor(mEventCursor.getInt(EVENT_INDEX_COLOR)); mHeadlines.setBackgroundColor(mColor); // What if (eventName != null) { setTextCommon(view, R.id.title, eventName); } // When // Set the date and repeats (if any) String whenDate; int flagsTime = DateUtils.FORMAT_SHOW_TIME; int flagsDate = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_YEAR; String localTimezone = Utils.getTimeZone(mActivity, mTZUpdater); Activity context = getActivity(); String datetimeString = Utils.getDisplayedDatetime(mStartMillis, mEndMillis, System.currentTimeMillis(), localTimezone, eventTimezone, mAllDay, context); if (DateFormat.is24HourFormat(getActivity())) { flagsTime |= DateUtils.FORMAT_24HOUR; } // Display the datetime. setTextCommon(view, R.id.when_datetime, datetimeString); // Put repeat after the date (if any) // Display the repeat string (if any) String repeatString = null; if (!TextUtils.isEmpty(rRule)) { EventRecurrence eventRecurrence = new EventRecurrence(); eventRecurrence.parse(rRule); Time date = new Time(Utils.getTimeZone(getActivity(), mTZUpdater)); Time date = new Time(localTimezone); date.set(mStartMillis); if (mAllDay) { date.timezone = Time.TIMEZONE_UTC; } date.set(mStartMillis); eventRecurrence.setStartDate(date); repeatString = EventRecurrenceFormatter.getRepeatString( getActivity().getResources(), eventRecurrence); } // If an all day event , show the date without the time if (mAllDay) { Formatter f = new Formatter(new StringBuilder(50), Locale.getDefault()); whenDate = DateUtils.formatDateRange(getActivity(), f, mStartMillis, mEndMillis, flagsDate, Time.TIMEZONE_UTC).toString(); if (repeatString != null) { setTextCommon(view, R.id.when_date, whenDate + " (" + repeatString + ")"); if (repeatString == null) { view.findViewById(R.id.when_repeat).setVisibility(View.GONE); } else { setTextCommon(view, R.id.when_date, whenDate); setTextCommon(view, R.id.when_repeat, repeatString); } view.findViewById(R.id.when_time).setVisibility(View.GONE); } else { // Show date for none all-day events whenDate = Utils.formatDateRange(getActivity(), mStartMillis, mEndMillis, flagsDate); String whenTime = Utils.formatDateRange(getActivity(), mStartMillis, mEndMillis, flagsTime); if (repeatString != null) { setTextCommon(view, R.id.when_date, whenDate + " (" + repeatString + ")"); } else { setTextCommon(view, R.id.when_date, whenDate); } // Show the event timezone if it is different from the local timezone after the time String localTimezone = Utils.getTimeZone(mActivity, mTZUpdater); if (!TextUtils.equals(localTimezone, eventTimezone)) { String displayName; // Figure out if this is in DST Time date = new Time(Utils.getTimeZone(getActivity(), mTZUpdater)); if (mAllDay) { date.timezone = Time.TIMEZONE_UTC; } date.set(mStartMillis); TimeZone tz = TimeZone.getTimeZone(localTimezone); if (tz == null || tz.getID().equals("GMT")) { displayName = localTimezone; } else { displayName = tz.getDisplayName(date.isDst != 0, TimeZone.LONG); } setTextCommon(view, R.id.when_time, whenTime + " (" + displayName + ")"); } else { setTextCommon(view, R.id.when_time, whenTime); } } // Organizer view is setup in the updateCalendar method Loading Loading @@ -1221,6 +1171,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange } } /** * Finds North American Numbering Plan (NANP) phone numbers in the input text. * Loading Loading @@ -1508,8 +1459,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange List<CharSequence> text = event.getText(); addFieldToAccessibilityEvent(text, mTitle, null); addFieldToAccessibilityEvent(text, mWhenDate, null); addFieldToAccessibilityEvent(text, mWhenTime, null); addFieldToAccessibilityEvent(text, mWhenDateTime, null); addFieldToAccessibilityEvent(text, mWhere, null); addFieldToAccessibilityEvent(text, null, mDesc); Loading src/com/android/calendar/Utils.java +105 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.text.TextUtils; import android.text.format.DateFormat; import android.text.format.DateUtils; import android.text.format.Time; import android.util.Log; Loading @@ -48,7 +49,9 @@ import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.TimeZone; public class Utils { private static final boolean DEBUG = false; Loading Loading @@ -101,7 +104,7 @@ public class Utils { // historical // reasons, as it's what PreferenceManager assigned the first time the file // was created. private static final String SHARED_PREFS_NAME = "com.android.calendar_preferences"; static final String SHARED_PREFS_NAME = "com.android.calendar_preferences"; public static final String APPWIDGET_DATA_TYPE = "vnd.android.data/update"; Loading Loading @@ -1138,4 +1141,105 @@ public class Utils { } h.removeCallbacks(r); } /** * Returns a string description of the specified time interval. */ public static String getDisplayedDatetime(long startMillis, long endMillis, long currentMillis, String localTimezone, String eventTimezone, boolean allDay, Context context) { // Configure date/time formatting. int flagsDate = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY; int flagsTime = DateUtils.FORMAT_SHOW_TIME; if (DateFormat.is24HourFormat(context)) { flagsTime |= DateUtils.FORMAT_24HOUR; } Time currentTime = new Time(localTimezone); currentTime.set(currentMillis); String datetimeString = null; if (allDay) { // All day events require special timezone adjustment. long localStartMillis = convertAlldayUtcToLocal(null, startMillis, localTimezone); long localEndMillis = convertAlldayUtcToLocal(null, endMillis, localTimezone); if (singleDayEvent(localStartMillis, localEndMillis, currentTime.gmtoff)) { // If possible, use "Today" or "Tomorrow" instead of a full date string. datetimeString = getRelativeDayStringOrNull(context.getResources(), localStartMillis, currentMillis, currentTime.gmtoff); } if (datetimeString == null) { Formatter f = new Formatter(new StringBuilder(50), Locale.getDefault()); datetimeString = DateUtils.formatDateRange(context, f, startMillis, endMillis, flagsDate, Time.TIMEZONE_UTC).toString(); } } else { if (singleDayEvent(startMillis, endMillis, currentTime.gmtoff)) { // If possible, use "Today" or "Tomorrow" instead of a full date string. String dateString = getRelativeDayStringOrNull(context.getResources(), startMillis, currentTime.toMillis(false), currentTime.gmtoff); if (dateString == null) { dateString = Utils.formatDateRange(context, startMillis, endMillis, flagsDate); } // Example: "Today, 1:00pm - 2:00pm" or "Thursday, April 12, 1:00pm - 2:00pm" String timeString = Utils.formatDateRange(context, startMillis, endMillis, flagsTime); datetimeString = dateString + ", " + timeString; } else { // For multiday events, shorten day/month names. // Example format: "Fri Apr 6, 5:00pm - Sun, Apr 8, 6:00pm" int flagsDatetime = flagsDate | flagsTime | DateUtils.FORMAT_ABBREV_MONTH | DateUtils.FORMAT_ABBREV_WEEKDAY; datetimeString = Utils.formatDateRange(context, startMillis, endMillis, flagsDatetime); } // Show the local timezone if it is different from the event timezone if (!TextUtils.equals(localTimezone, eventTimezone)) { // Figure out if this is in DST TimeZone tz = TimeZone.getTimeZone(localTimezone); String tzDisplay; if (tz == null || tz.getID().equals("GMT")) { tzDisplay = localTimezone; } else { Time startTime = new Time(localTimezone); startTime.set(startMillis); tzDisplay = tz.getDisplayName(startTime.isDst != 0, TimeZone.SHORT); } datetimeString += " (" + tzDisplay + ")"; } } return datetimeString; } /** * Returns whether the specified time interval is in a single day. */ private static boolean singleDayEvent(long startMillis, long endMillis, long localGmtOffset) { if (startMillis == endMillis) { return true; } // An event ending at midnight should still be a single-day event, so check // time end-1. int startDay = Time.getJulianDay(startMillis, localGmtOffset); int endDay = Time.getJulianDay(endMillis - 1, localGmtOffset); return startDay == endDay; } /** * Returns "Today" or "Tomorrow" if applicable. Otherwise returns null. */ private static String getRelativeDayStringOrNull(Resources r, long dayMillis, long currentMillis, long localGmtOffset) { int startDay = Time.getJulianDay(dayMillis, localGmtOffset); int currentDay = Time.getJulianDay(currentMillis, localGmtOffset); int days = startDay - currentDay; if (days == 1) { return r.getString(R.string.tomorrow); } else if (days == 0) { return r.getString(R.string.today); } else { return null; } } } Loading
res/layout/event_info.xml +2 −2 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ <!-- WHEN --> <TextView android:id="@+id/when_date" android:id="@+id/when_datetime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4dip" Loading @@ -120,7 +120,7 @@ style="?android:attr/textAppearanceLarge" /> <TextView android:id="@+id/when_time" android:id="@+id/when_repeat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="-3dip" Loading
res/layout/event_info_dialog.xml +2 −2 Original line number Diff line number Diff line Loading @@ -118,7 +118,7 @@ <!-- WHEN --> <TextView android:id="@+id/when_date" android:id="@+id/when_datetime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="18sp" Loading @@ -129,7 +129,7 @@ style="?android:attr/textAppearanceLarge" /> <TextView android:id="@+id/when_time" android:id="@+id/when_repeat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="18sp" Loading
res/values/strings.xml +4 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,10 @@ <string name="timezone_label">Time zone</string> <!-- This is the label for the Guests/Attendees of an event --> <string name="attendees_label">Guests</string> <!-- Text to show when an event starts on the current day --> <string name="today">Today</string> <!-- Text to show when an event starts on the next day --> <string name="tomorrow">Tomorrow</string> <!-- Some events repeat daily, weekly, monthly, or yearly. This is the label for all the choices about how often an event repeats (including the choice Loading Loading @@ -515,9 +519,6 @@ <!-- Caption to show on gadget when there are no upcoming calendar events --> <string name="gadget_no_events">No upcoming calendar events</string> <!-- Text to show on gadget when an event starts on the next day --> <string name="tomorrow">Tomorrow</string> <!-- Text to show on gadget when an event is currently in progress --> Loading
src/com/android/calendar/EventInfoFragment.java +16 −66 Original line number Diff line number Diff line Loading @@ -283,8 +283,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange private boolean mEventDeletionStarted = false; private TextView mTitle; private TextView mWhenDate; private TextView mWhenTime; private TextView mWhenDateTime; private TextView mWhere; private ExpandableTextView mDesc; private AttendeesView mLongAttendees; Loading Loading @@ -654,8 +653,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange mScrollView = (ScrollView) mView.findViewById(R.id.event_info_scroll_view); mLoadingMsgView = mView.findViewById(R.id.event_info_loading_msg); mTitle = (TextView) mView.findViewById(R.id.title); mWhenDate = (TextView) mView.findViewById(R.id.when_date); mWhenTime = (TextView) mView.findViewById(R.id.when_time); mWhenDateTime = (TextView) mView.findViewById(R.id.when_datetime); mWhere = (TextView) mView.findViewById(R.id.where); mDesc = (ExpandableTextView) mView.findViewById(R.id.description); mHeadlines = mView.findViewById(R.id.event_info_headline); Loading Loading @@ -1105,83 +1103,35 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange mColor = Utils.getDisplayColorFromColor(mEventCursor.getInt(EVENT_INDEX_COLOR)); mHeadlines.setBackgroundColor(mColor); // What if (eventName != null) { setTextCommon(view, R.id.title, eventName); } // When // Set the date and repeats (if any) String whenDate; int flagsTime = DateUtils.FORMAT_SHOW_TIME; int flagsDate = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_YEAR; String localTimezone = Utils.getTimeZone(mActivity, mTZUpdater); Activity context = getActivity(); String datetimeString = Utils.getDisplayedDatetime(mStartMillis, mEndMillis, System.currentTimeMillis(), localTimezone, eventTimezone, mAllDay, context); if (DateFormat.is24HourFormat(getActivity())) { flagsTime |= DateUtils.FORMAT_24HOUR; } // Display the datetime. setTextCommon(view, R.id.when_datetime, datetimeString); // Put repeat after the date (if any) // Display the repeat string (if any) String repeatString = null; if (!TextUtils.isEmpty(rRule)) { EventRecurrence eventRecurrence = new EventRecurrence(); eventRecurrence.parse(rRule); Time date = new Time(Utils.getTimeZone(getActivity(), mTZUpdater)); Time date = new Time(localTimezone); date.set(mStartMillis); if (mAllDay) { date.timezone = Time.TIMEZONE_UTC; } date.set(mStartMillis); eventRecurrence.setStartDate(date); repeatString = EventRecurrenceFormatter.getRepeatString( getActivity().getResources(), eventRecurrence); } // If an all day event , show the date without the time if (mAllDay) { Formatter f = new Formatter(new StringBuilder(50), Locale.getDefault()); whenDate = DateUtils.formatDateRange(getActivity(), f, mStartMillis, mEndMillis, flagsDate, Time.TIMEZONE_UTC).toString(); if (repeatString != null) { setTextCommon(view, R.id.when_date, whenDate + " (" + repeatString + ")"); if (repeatString == null) { view.findViewById(R.id.when_repeat).setVisibility(View.GONE); } else { setTextCommon(view, R.id.when_date, whenDate); setTextCommon(view, R.id.when_repeat, repeatString); } view.findViewById(R.id.when_time).setVisibility(View.GONE); } else { // Show date for none all-day events whenDate = Utils.formatDateRange(getActivity(), mStartMillis, mEndMillis, flagsDate); String whenTime = Utils.formatDateRange(getActivity(), mStartMillis, mEndMillis, flagsTime); if (repeatString != null) { setTextCommon(view, R.id.when_date, whenDate + " (" + repeatString + ")"); } else { setTextCommon(view, R.id.when_date, whenDate); } // Show the event timezone if it is different from the local timezone after the time String localTimezone = Utils.getTimeZone(mActivity, mTZUpdater); if (!TextUtils.equals(localTimezone, eventTimezone)) { String displayName; // Figure out if this is in DST Time date = new Time(Utils.getTimeZone(getActivity(), mTZUpdater)); if (mAllDay) { date.timezone = Time.TIMEZONE_UTC; } date.set(mStartMillis); TimeZone tz = TimeZone.getTimeZone(localTimezone); if (tz == null || tz.getID().equals("GMT")) { displayName = localTimezone; } else { displayName = tz.getDisplayName(date.isDst != 0, TimeZone.LONG); } setTextCommon(view, R.id.when_time, whenTime + " (" + displayName + ")"); } else { setTextCommon(view, R.id.when_time, whenTime); } } // Organizer view is setup in the updateCalendar method Loading Loading @@ -1221,6 +1171,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange } } /** * Finds North American Numbering Plan (NANP) phone numbers in the input text. * Loading Loading @@ -1508,8 +1459,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange List<CharSequence> text = event.getText(); addFieldToAccessibilityEvent(text, mTitle, null); addFieldToAccessibilityEvent(text, mWhenDate, null); addFieldToAccessibilityEvent(text, mWhenTime, null); addFieldToAccessibilityEvent(text, mWhenDateTime, null); addFieldToAccessibilityEvent(text, mWhere, null); addFieldToAccessibilityEvent(text, null, mDesc); Loading
src/com/android/calendar/Utils.java +105 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.text.TextUtils; import android.text.format.DateFormat; import android.text.format.DateUtils; import android.text.format.Time; import android.util.Log; Loading @@ -48,7 +49,9 @@ import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.TimeZone; public class Utils { private static final boolean DEBUG = false; Loading Loading @@ -101,7 +104,7 @@ public class Utils { // historical // reasons, as it's what PreferenceManager assigned the first time the file // was created. private static final String SHARED_PREFS_NAME = "com.android.calendar_preferences"; static final String SHARED_PREFS_NAME = "com.android.calendar_preferences"; public static final String APPWIDGET_DATA_TYPE = "vnd.android.data/update"; Loading Loading @@ -1138,4 +1141,105 @@ public class Utils { } h.removeCallbacks(r); } /** * Returns a string description of the specified time interval. */ public static String getDisplayedDatetime(long startMillis, long endMillis, long currentMillis, String localTimezone, String eventTimezone, boolean allDay, Context context) { // Configure date/time formatting. int flagsDate = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY; int flagsTime = DateUtils.FORMAT_SHOW_TIME; if (DateFormat.is24HourFormat(context)) { flagsTime |= DateUtils.FORMAT_24HOUR; } Time currentTime = new Time(localTimezone); currentTime.set(currentMillis); String datetimeString = null; if (allDay) { // All day events require special timezone adjustment. long localStartMillis = convertAlldayUtcToLocal(null, startMillis, localTimezone); long localEndMillis = convertAlldayUtcToLocal(null, endMillis, localTimezone); if (singleDayEvent(localStartMillis, localEndMillis, currentTime.gmtoff)) { // If possible, use "Today" or "Tomorrow" instead of a full date string. datetimeString = getRelativeDayStringOrNull(context.getResources(), localStartMillis, currentMillis, currentTime.gmtoff); } if (datetimeString == null) { Formatter f = new Formatter(new StringBuilder(50), Locale.getDefault()); datetimeString = DateUtils.formatDateRange(context, f, startMillis, endMillis, flagsDate, Time.TIMEZONE_UTC).toString(); } } else { if (singleDayEvent(startMillis, endMillis, currentTime.gmtoff)) { // If possible, use "Today" or "Tomorrow" instead of a full date string. String dateString = getRelativeDayStringOrNull(context.getResources(), startMillis, currentTime.toMillis(false), currentTime.gmtoff); if (dateString == null) { dateString = Utils.formatDateRange(context, startMillis, endMillis, flagsDate); } // Example: "Today, 1:00pm - 2:00pm" or "Thursday, April 12, 1:00pm - 2:00pm" String timeString = Utils.formatDateRange(context, startMillis, endMillis, flagsTime); datetimeString = dateString + ", " + timeString; } else { // For multiday events, shorten day/month names. // Example format: "Fri Apr 6, 5:00pm - Sun, Apr 8, 6:00pm" int flagsDatetime = flagsDate | flagsTime | DateUtils.FORMAT_ABBREV_MONTH | DateUtils.FORMAT_ABBREV_WEEKDAY; datetimeString = Utils.formatDateRange(context, startMillis, endMillis, flagsDatetime); } // Show the local timezone if it is different from the event timezone if (!TextUtils.equals(localTimezone, eventTimezone)) { // Figure out if this is in DST TimeZone tz = TimeZone.getTimeZone(localTimezone); String tzDisplay; if (tz == null || tz.getID().equals("GMT")) { tzDisplay = localTimezone; } else { Time startTime = new Time(localTimezone); startTime.set(startMillis); tzDisplay = tz.getDisplayName(startTime.isDst != 0, TimeZone.SHORT); } datetimeString += " (" + tzDisplay + ")"; } } return datetimeString; } /** * Returns whether the specified time interval is in a single day. */ private static boolean singleDayEvent(long startMillis, long endMillis, long localGmtOffset) { if (startMillis == endMillis) { return true; } // An event ending at midnight should still be a single-day event, so check // time end-1. int startDay = Time.getJulianDay(startMillis, localGmtOffset); int endDay = Time.getJulianDay(endMillis - 1, localGmtOffset); return startDay == endDay; } /** * Returns "Today" or "Tomorrow" if applicable. Otherwise returns null. */ private static String getRelativeDayStringOrNull(Resources r, long dayMillis, long currentMillis, long localGmtOffset) { int startDay = Time.getJulianDay(dayMillis, localGmtOffset); int currentDay = Time.getJulianDay(currentMillis, localGmtOffset); int days = startDay - currentDay; if (days == 1) { return r.getString(R.string.tomorrow); } else if (days == 0) { return r.getString(R.string.today); } else { return null; } } }