Example usage for android.text.format Time TIMEZONE_UTC

List of usage examples for android.text.format Time TIMEZONE_UTC

Introduction

In this page you can find the example usage for android.text.format Time TIMEZONE_UTC.

Prototype

String TIMEZONE_UTC

To view the source code for android.text.format Time TIMEZONE_UTC.

Click Source Link

Usage

From source file:at.bitfire.davdroid.resource.Event.java

protected static void validateTimeZone(DateProperty date) {
    if (date.isUtc() || !hasTime(date))
        return;/* ww  w . ja v  a  2s  . c  o m*/

    String tzID = getTzId(date);
    if (tzID == null)
        return;

    String localTZ = null;
    String availableTZs[] = SimpleTimeZone.getAvailableIDs();

    // first, try to find an exact match (case insensitive)
    for (String availableTZ : availableTZs)
        if (tzID.equalsIgnoreCase(availableTZ)) {
            localTZ = availableTZ;
            break;
        }

    // if that doesn't work, try to find something else that matches
    if (localTZ == null) {
        Log.w(TAG, "Coulnd't find time zone with matching identifiers, trying to guess");
        for (String availableTZ : availableTZs)
            if (StringUtils.indexOfIgnoreCase(tzID, availableTZ) != -1) {
                localTZ = availableTZ;
                break;
            }
    }

    // if that doesn't work, use UTC as fallback
    if (localTZ == null) {
        Log.e(TAG, "Couldn't identify time zone, using UTC as fallback");
        localTZ = Time.TIMEZONE_UTC;
    }

    Log.d(TAG, "Assuming time zone " + localTZ + " for " + tzID);
    date.setTimeZone(tzRegistry.getTimeZone(localTZ));
}

From source file:saschpe.birthdays.service.CalendarSyncService.java

private static ContentProviderOperation insertEvent(Context context, long calendarId, Date eventDate, int year,
        String title, String description, String lookupKey) {
    ContentProviderOperation.Builder builder = ContentProviderOperation
            .newInsert(getCalendarUri(context, CalendarContract.Events.CONTENT_URI));

    Calendar calendar = Calendar.getInstance();
    calendar.setTime(eventDate);/*from w w w .j a  v a  2  s.  c o  m*/
    calendar.set(Calendar.YEAR, year);
    calendar.set(Calendar.HOUR, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);
    calendar.setTimeZone(TimeZone.getTimeZone("UTC"));

    /* Define over entire day.
     *
     * Note: ALL_DAY is enough on original Android calendar, but some calendar apps (Business
     * Calendar) do not display the event if time between dtstart and dtend is 0
     */
    final long dtstart = calendar.getTimeInMillis();
    final long dtend = dtstart + DateUtils.DAY_IN_MILLIS;

    builder.withValue(CalendarContract.Events.CALENDAR_ID, calendarId);
    builder.withValue(CalendarContract.Events.DTSTART, dtstart);
    builder.withValue(CalendarContract.Events.DTEND, dtend);
    builder.withValue(CalendarContract.Events.EVENT_TIMEZONE, Time.TIMEZONE_UTC);
    builder.withValue(CalendarContract.Events.ALL_DAY, 1);
    builder.withValue(CalendarContract.Events.TITLE, title);
    builder.withValue(CalendarContract.Events.DESCRIPTION, description);
    builder.withValue(CalendarContract.Events.STATUS, CalendarContract.Events.STATUS_CONFIRMED);

    /* Enable reminders for this event
     * Note: Need to be explicitly set on Android < 4 to enable reminders
     */
    builder.withValue(CalendarContract.Events.HAS_ALARM, 1);

    // Set availability to free.
    if (Build.VERSION.SDK_INT >= 14) {
        builder.withValue(CalendarContract.Events.AVAILABILITY, CalendarContract.Events.AVAILABILITY_FREE);
    }
    // Add button to open contact
    if (Build.VERSION.SDK_INT >= 16 && lookupKey != null) {
        builder.withValue(CalendarContract.Events.CUSTOM_APP_PACKAGE, context.getPackageName());
        final Uri contactLookupUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI,
                lookupKey);
        builder.withValue(CalendarContract.Events.CUSTOM_APP_URI, contactLookupUri.toString());
    }

    return builder.build();
}

From source file:com.granita.tasks.notification.NotificationActionUtils.java

private static Time makeTime(long timestamp, boolean allday) {
    Time result = new Time(allday ? Time.TIMEZONE_UTC : TimeZone.getDefault().getID());
    result.set(timestamp);/*from   w ww  .j  av  a2  s.  c o m*/
    result.allDay = allday;
    return result;
}

From source file:com.android.calendar.agenda.AgendaFragment.java

private void showEventInfo(EventInfo event, boolean allDay, boolean replaceFragment) {

    // Ignore unknown events
    if (event.id == -1) {
        Log.e(TAG, "showEventInfo, event ID = " + event.id);
        return;/*from w  ww .  j  a  v a  2  s  . c om*/
    }

    mLastShownEventId = event.id;

    // Create a fragment to show the event to the side of the agenda list
    if (mShowEventDetailsWithAgenda) {
        FragmentManager fragmentManager = getFragmentManager();
        if (fragmentManager == null) {
            // Got a goto event before the fragment finished attaching,
            // stash the event and handle it later.
            mOnAttachedInfo = event;
            mOnAttachAllDay = allDay;
            return;
        }
        FragmentTransaction ft = fragmentManager.beginTransaction();

        if (allDay) {
            event.startTime.timezone = Time.TIMEZONE_UTC;
            event.endTime.timezone = Time.TIMEZONE_UTC;
        }

        if (DEBUG) {
            Log.d(TAG, "***");
            Log.d(TAG, "showEventInfo: start: " + new Date(event.startTime.toMillis(true)));
            Log.d(TAG, "showEventInfo: end: " + new Date(event.endTime.toMillis(true)));
            Log.d(TAG, "showEventInfo: all day: " + allDay);
            Log.d(TAG, "***");
        }

        long startMillis = event.startTime.toMillis(true);
        long endMillis = event.endTime.toMillis(true);
        EventInfoFragment fOld = (EventInfoFragment) fragmentManager.findFragmentById(R.id.agenda_event_info);
        if (fOld == null || replaceFragment || fOld.getStartMillis() != startMillis
                || fOld.getEndMillis() != endMillis || fOld.getEventId() != event.id) {
            mEventFragment = new EventInfoFragment(mActivity, event.id, startMillis, endMillis,
                    Attendees.ATTENDEE_STATUS_NONE, false, EventInfoFragment.DIALOG_WINDOW_STYLE, null);
            ft.replace(R.id.agenda_event_info, mEventFragment);
            ft.commit();
        } else {
            fOld.reloadEvents();
        }
    }
}

From source file:be.billington.calendar.recurrencepicker.RecurrencePickerDialog.java

static private void copyModelToEventRecurrence(final RecurrenceModel model, EventRecurrence er) {
    if (model.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) {
        throw new IllegalStateException("There's no recurrence");
    }//from  w  ww.  j a v a  2 s.  c o  m

    // Freq
    er.freq = mFreqModelToEventRecurrence[model.freq];

    // Interval
    if (model.interval <= 1) {
        er.interval = 0;
    } else {
        er.interval = model.interval;
    }

    // End
    switch (model.end) {
    case RecurrenceModel.END_BY_DATE:
        if (model.endDate != null) {
            model.endDate.switchTimezone(Time.TIMEZONE_UTC);
            model.endDate.normalize(false);
            er.until = model.endDate.format2445();
            er.count = 0;
        } else {
            throw new IllegalStateException("end = END_BY_DATE but endDate is null");
        }
        break;
    case RecurrenceModel.END_BY_COUNT:
        er.count = model.endCount;
        er.until = null;
        if (er.count <= 0) {
            throw new IllegalStateException("count is " + er.count);
        }
        break;
    default:
        er.count = 0;
        er.until = null;
        break;
    }

    // Weekly && monthly repeat patterns
    er.bydayCount = 0;
    er.bymonthdayCount = 0;

    switch (model.freq) {
    case RecurrenceModel.FREQ_MONTHLY:
        if (model.monthlyRepeat == RecurrenceModel.MONTHLY_BY_DATE) {
            if (model.monthlyByMonthDay > 0) {
                if (er.bymonthday == null || er.bymonthdayCount < 1) {
                    er.bymonthday = new int[1];
                }
                er.bymonthday[0] = model.monthlyByMonthDay;
                er.bymonthdayCount = 1;
            }
        } else if (model.monthlyRepeat == RecurrenceModel.MONTHLY_BY_NTH_DAY_OF_WEEK) {
            if (!isSupportedMonthlyByNthDayOfWeek(model.monthlyByNthDayOfWeek)) {
                throw new IllegalStateException(
                        "month repeat by nth week but n is " + model.monthlyByNthDayOfWeek);
            }
            int count = 1;
            if (er.bydayCount < count || er.byday == null || er.bydayNum == null) {
                er.byday = new int[count];
                er.bydayNum = new int[count];
            }
            er.bydayCount = count;
            er.byday[0] = EventRecurrence.timeDay2Day(model.monthlyByDayOfWeek);
            er.bydayNum[0] = model.monthlyByNthDayOfWeek;
        }
        break;
    case RecurrenceModel.FREQ_WEEKLY:
        int count = 0;
        for (int i = 0; i < 7; i++) {
            if (model.weeklyByDayOfWeek[i]) {
                count++;
            }
        }

        if (er.bydayCount < count || er.byday == null || er.bydayNum == null) {
            er.byday = new int[count];
            er.bydayNum = new int[count];
        }
        er.bydayCount = count;

        for (int i = 6; i >= 0; i--) {
            if (model.weeklyByDayOfWeek[i]) {
                er.bydayNum[--count] = 0;
                er.byday[count] = EventRecurrence.timeDay2Day(i);
            }
        }
        break;
    }

    if (!canHandleRecurrenceRule(er)) {
        throw new IllegalStateException("UI generated recurrence that it can't handle. ER:" + er.toString()
                + " Model: " + model.toString());
    }
}

From source file:com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment.java

static private void copyModelToEventRecurrence(final RecurrenceModel model, EventRecurrence eventRecurrence) {
    if (model.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) {
        throw new IllegalStateException("There's no recurrence");
    }// ww w. ja va  2s .c  o  m

    // Freq
    eventRecurrence.freq = mFreqModelToEventRecurrence[model.freq];

    // Interval
    if (model.interval <= 1) {
        eventRecurrence.interval = 0;
    } else {
        eventRecurrence.interval = model.interval;
    }

    // End
    switch (model.end) {
    case RecurrenceModel.END_BY_DATE:
        if (model.endDate != null) {
            model.endDate.switchTimezone(Time.TIMEZONE_UTC);
            model.endDate.normalize(false);
            eventRecurrence.until = model.endDate.format2445();
            eventRecurrence.count = 0;
        } else {
            throw new IllegalStateException("end = END_BY_DATE but endDate is null");
        }
        break;
    case RecurrenceModel.END_BY_COUNT:
        eventRecurrence.count = model.endCount;
        eventRecurrence.until = null;
        if (eventRecurrence.count <= 0) {
            throw new IllegalStateException("count is " + eventRecurrence.count);
        }
        break;
    default:
        eventRecurrence.count = 0;
        eventRecurrence.until = null;
        break;
    }

    // Weekly && monthly repeat patterns
    eventRecurrence.bydayCount = 0;
    eventRecurrence.bymonthdayCount = 0;

    switch (model.freq) {
    case RecurrenceModel.FREQ_MONTHLY:
        if (model.monthlyRepeat == RecurrenceModel.MONTHLY_BY_DATE) {
            if (model.monthlyByMonthDay > 0) {
                if (eventRecurrence.bymonthday == null || eventRecurrence.bymonthdayCount < 1) {
                    eventRecurrence.bymonthday = new int[1];
                }
                eventRecurrence.bymonthday[0] = model.monthlyByMonthDay;
                eventRecurrence.bymonthdayCount = 1;
            }
        } else if (model.monthlyRepeat == RecurrenceModel.MONTHLY_BY_NTH_DAY_OF_WEEK) {
            if (!isSupportedMonthlyByNthDayOfWeek(model.monthlyByNthDayOfWeek)) {
                throw new IllegalStateException(
                        "month repeat by nth week but n is " + model.monthlyByNthDayOfWeek);
            }
            int count = 1;
            if (eventRecurrence.bydayCount < count || eventRecurrence.byday == null
                    || eventRecurrence.bydayNum == null) {
                eventRecurrence.byday = new int[count];
                eventRecurrence.bydayNum = new int[count];
            }
            eventRecurrence.bydayCount = count;
            eventRecurrence.byday[0] = EventRecurrence.timeDay2Day(model.monthlyByDayOfWeek);
            eventRecurrence.bydayNum[0] = model.monthlyByNthDayOfWeek;
        }
        break;
    case RecurrenceModel.FREQ_WEEKLY:
        int count = 0;
        for (int i = 0; i < 7; i++) {
            if (model.weeklyByDayOfWeek[i]) {
                count++;
            }
        }

        if (eventRecurrence.bydayCount < count || eventRecurrence.byday == null
                || eventRecurrence.bydayNum == null) {
            eventRecurrence.byday = new int[count];
            eventRecurrence.bydayNum = new int[count];
        }
        eventRecurrence.bydayCount = count;

        for (int i = 6; i >= 0; i--) {
            if (model.weeklyByDayOfWeek[i]) {
                eventRecurrence.bydayNum[--count] = 0;
                eventRecurrence.byday[count] = EventRecurrence.timeDay2Day(i);
            }
        }
        break;
    }

    if (!canHandleRecurrenceRule(eventRecurrence)) {
        throw new IllegalStateException("UI generated recurrence that it can't handle. ER:"
                + eventRecurrence.toString() + " Model: " + model.toString());
    }
}

From source file:com.code44.finance.ui.dialogs.recurrencepicker.RecurrencePickerDialogFragment.java

static private void copyModelToEventRecurrence(final RecurrenceModel model, EventRecurrence eventRecurrence) {
    if (model.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) {
        throw new IllegalStateException("There's no recurrence");
    }//from   w  ww.  j ava2s  .co  m

    // Freq
    eventRecurrence.freq = mFreqModelToEventRecurrence[model.freq];

    // Interval
    if (model.interval <= 1) {
        eventRecurrence.interval = 0;
    } else {
        eventRecurrence.interval = model.interval;
    }

    // End
    switch (model.end) {
    case RecurrenceModel.END_BY_DATE:
        if (model.endDate != null) {
            model.endDate.switchTimezone(Time.TIMEZONE_UTC);
            model.endDate.normalize(false);
            eventRecurrence.until = model.endDate.format2445();
            eventRecurrence.count = 0;
        } else {
            throw new IllegalStateException("end = END_BY_DATE but endDate is null");
        }
        break;
    case RecurrenceModel.END_BY_COUNT:
        eventRecurrence.count = model.endCount;
        eventRecurrence.until = null;
        if (eventRecurrence.count <= 0) {
            throw new IllegalStateException("count is " + eventRecurrence.count);
        }
        break;
    default:
        eventRecurrence.count = 0;
        eventRecurrence.until = null;
        break;
    }

    // Weekly && monthly repeat patterns
    eventRecurrence.bydayCount = 0;
    eventRecurrence.bymonthdayCount = 0;

    switch (model.freq) {
    case RecurrenceModel.FREQ_MONTHLY:
        if (model.monthlyRepeat == RecurrenceModel.MONTHLY_BY_DATE) {
            if (model.monthlyByMonthDay > 0) {
                if (eventRecurrence.bymonthday == null || eventRecurrence.bymonthdayCount < 1) {
                    eventRecurrence.bymonthday = new int[1];
                }
                eventRecurrence.bymonthday[0] = model.monthlyByMonthDay;
                eventRecurrence.bymonthdayCount = 1;
            }
            eventRecurrence.byday = null;
        } else if (model.monthlyRepeat == RecurrenceModel.MONTHLY_BY_NTH_DAY_OF_WEEK) {
            if (!isSupportedMonthlyByNthDayOfWeek(model.monthlyByNthDayOfWeek)) {
                throw new IllegalStateException(
                        "month repeat by nth week but n is " + model.monthlyByNthDayOfWeek);
            }
            int count = 1;
            if (eventRecurrence.bydayCount < count || eventRecurrence.byday == null
                    || eventRecurrence.bydayNum == null) {
                eventRecurrence.byday = new int[count];
                eventRecurrence.bydayNum = new int[count];
            }
            eventRecurrence.bydayCount = count;
            eventRecurrence.byday[0] = EventRecurrence.timeDay2Day(model.monthlyByDayOfWeek);
            eventRecurrence.bydayNum[0] = model.monthlyByNthDayOfWeek;
        }
        break;
    case RecurrenceModel.FREQ_WEEKLY:
        int count = 0;
        for (int i = 0; i < 7; i++) {
            if (model.weeklyByDayOfWeek[i]) {
                count++;
            }
        }

        if (eventRecurrence.bydayCount < count || eventRecurrence.byday == null
                || eventRecurrence.bydayNum == null) {
            eventRecurrence.byday = new int[count];
            eventRecurrence.bydayNum = new int[count];
        }
        eventRecurrence.bydayCount = count;

        for (int i = 6; i >= 0; i--) {
            if (model.weeklyByDayOfWeek[i]) {
                eventRecurrence.bydayNum[--count] = 0;
                eventRecurrence.byday[count] = EventRecurrence.timeDay2Day(i);
            }
        }
        break;
    }

    if (!canHandleRecurrenceRule(eventRecurrence)) {
        throw new IllegalStateException("UI generated recurrence that it can't handle. ER:"
                + eventRecurrence.toString() + " Model: " + model.toString());
    }
}

From source file:com.android.calendar.event.EditEventView.java

private boolean fillModelFromUI() {
    if (mModel == null) {
        return false;
    }//  w w  w .j a v a 2  s. c  o  m
    mModel.mReminders = EventViewUtils.reminderItemsToReminders(mReminderItems, mReminderMinuteValues,
            mReminderMethodValues);
    mModel.mReminders.addAll(mUnsupportedReminders);
    mModel.normalizeReminders();
    mModel.mHasAlarm = mReminderItems.size() > 0;
    mModel.mTitle = mTitleTextView.getText().toString();
    mModel.mAllDay = mAllDayCheckBox.isChecked();
    mModel.mLocation = mLocationTextView.getText().toString();
    mModel.mDescription = mDescriptionTextView.getText().toString();
    if (TextUtils.isEmpty(mModel.mLocation)) {
        mModel.mLocation = null;
    }
    if (TextUtils.isEmpty(mModel.mDescription)) {
        mModel.mDescription = null;
    }

    int status = EventInfoFragment.getResponseFromButtonId(mResponseRadioGroup.getCheckedRadioButtonId());
    if (status != Attendees.ATTENDEE_STATUS_NONE) {
        mModel.mSelfAttendeeStatus = status;
    }

    if (mAttendeesList != null) {
        mEmailValidator.setRemoveInvalid(true);
        mAttendeesList.performValidation();
        mModel.mAttendeesList.clear();
        mModel.addAttendees(mAttendeesList.getText().toString(), mEmailValidator);
        mEmailValidator.setRemoveInvalid(false);
    }

    // If this was a new event we need to fill in the Calendar information
    if (mModel.mUri == null) {
        mModel.mCalendarId = mCalendarsSpinner.getSelectedItemId();
        int calendarCursorPosition = mCalendarsSpinner.getSelectedItemPosition();
        if (mCalendarsCursor.moveToPosition(calendarCursorPosition)) {
            String defaultCalendar = mCalendarsCursor.getString(EditEventHelper.CALENDARS_INDEX_OWNER_ACCOUNT);
            Utils.setSharedPreference(mActivity, GeneralPreferences.KEY_DEFAULT_CALENDAR, defaultCalendar);
            mModel.mOwnerAccount = defaultCalendar;
            mModel.mOrganizer = defaultCalendar;
            mModel.mCalendarId = mCalendarsCursor.getLong(EditEventHelper.CALENDARS_INDEX_ID);
        }
    }

    if (mModel.mAllDay) {
        // Reset start and end time, increment the monthDay by 1, and set
        // the timezone to UTC, as required for all-day events.
        mTimezone = Time.TIMEZONE_UTC;
        mStartTime.hour = 0;
        mStartTime.minute = 0;
        mStartTime.second = 0;
        mStartTime.timezone = mTimezone;
        mModel.mStart = mStartTime.normalize(true);

        mEndTime.hour = 0;
        mEndTime.minute = 0;
        mEndTime.second = 0;
        mEndTime.timezone = mTimezone;
        // When a user see the event duration as "X - Y" (e.g. Oct. 28 -
        // Oct. 29), end time
        // should be Y + 1 (Oct.30).
        final long normalizedEndTimeMillis = mEndTime.normalize(true) + DateUtils.DAY_IN_MILLIS;
        if (normalizedEndTimeMillis < mModel.mStart) {
            // mEnd should be midnight of the next day of mStart.
            mModel.mEnd = mModel.mStart + DateUtils.DAY_IN_MILLIS;
        } else {
            mModel.mEnd = normalizedEndTimeMillis;
        }
    } else {
        mStartTime.timezone = mTimezone;
        mEndTime.timezone = mTimezone;
        mModel.mStart = mStartTime.toMillis(true);
        mModel.mEnd = mEndTime.toMillis(true);
    }
    mModel.mTimezone = mTimezone;
    mModel.mAccessLevel = mAccessLevelSpinner.getSelectedItemPosition();
    // TODO set correct availability value
    mModel.mAvailability = mAvailabilityValues.get(mAvailabilitySpinner.getSelectedItemPosition());

    // rrrule
    // If we're making an exception we don't want it to be a repeating
    // event.
    if (mModification == EditEventHelper.MODIFY_SELECTED) {
        mModel.mRrule = null;
    } else {
        mModel.mRrule = mRrule;
    }

    return true;
}

From source file:com.android.calendar.event.EditEventView.java

/**
 * Creates a single line string for the time/duration
 *///  ww w . ja va  2 s.  co  m
protected void setWhenString() {
    String when;
    int flags = DateUtils.FORMAT_SHOW_DATE;
    String tz = mTimezone;
    if (mModel.mAllDay) {
        flags |= DateUtils.FORMAT_SHOW_WEEKDAY;
        tz = Time.TIMEZONE_UTC;
    } else {
        flags |= DateUtils.FORMAT_SHOW_TIME;
        if (DateFormat.is24HourFormat(mActivity)) {
            flags |= DateUtils.FORMAT_24HOUR;
        }
    }
    long startMillis = mStartTime.normalize(true);
    long endMillis = mEndTime.normalize(true);
    mSB.setLength(0);
    when = DateUtils.formatDateRange(mActivity, mF, startMillis, endMillis, flags, tz).toString();
    mWhenView.setText(when);
}

From source file:com.android.calendar.EventInfoFragment.java

private void updateEvent(View view) {
    if (mEventCursor == null || view == null) {
        return;/*w w w  . j  av  a 2s  .  co  m*/
    }

    Context context = view.getContext();
    if (context == null) {
        return;
    }

    String eventName = mEventCursor.getString(EVENT_INDEX_TITLE);
    if (eventName == null || eventName.length() == 0) {
        eventName = getActivity().getString(R.string.no_title_label);
    }

    // 3rd parties might not have specified the start/end time when firing the
    // Events.CONTENT_URI intent.  Update these with values read from the db.
    if (mStartMillis == 0 && mEndMillis == 0) {
        mStartMillis = mEventCursor.getLong(EVENT_INDEX_DTSTART);
        mEndMillis = mEventCursor.getLong(EVENT_INDEX_DTEND);
        if (mEndMillis == 0) {
            String duration = mEventCursor.getString(EVENT_INDEX_DURATION);
            if (!TextUtils.isEmpty(duration)) {
                try {
                    Duration d = new Duration();
                    d.parse(duration);
                    long endMillis = mStartMillis + d.getMillis();
                    if (endMillis >= mStartMillis) {
                        mEndMillis = endMillis;
                    } else {
                        Log.d(TAG, "Invalid duration string: " + duration);
                    }
                } catch (DateException e) {
                    Log.d(TAG, "Error parsing duration string " + duration, e);
                }
            }
            if (mEndMillis == 0) {
                mEndMillis = mStartMillis;
            }
        }
    }

    mAllDay = mEventCursor.getInt(EVENT_INDEX_ALL_DAY) != 0;
    String location = mEventCursor.getString(EVENT_INDEX_EVENT_LOCATION);
    String description = mEventCursor.getString(EVENT_INDEX_DESCRIPTION);
    String rRule = mEventCursor.getString(EVENT_INDEX_RRULE);
    String eventTimezone = mEventCursor.getString(EVENT_INDEX_EVENT_TIMEZONE);

    mHeadlines.setBackgroundColor(mCurrentColor);

    // What
    if (eventName != null) {
        setTextCommon(view, R.id.title, eventName);
    }

    // When
    // Set the date and repeats (if any)
    String localTimezone = Utils.getTimeZone(mActivity, mTZUpdater);

    Resources resources = context.getResources();
    String displayedDatetime = Utils.getDisplayedDatetime(mStartMillis, mEndMillis, System.currentTimeMillis(),
            localTimezone, mAllDay, context);

    String displayedTimezone = null;
    if (!mAllDay) {
        displayedTimezone = Utils.getDisplayedTimezone(mStartMillis, localTimezone, eventTimezone);
    }
    // Display the datetime.  Make the timezone (if any) transparent.
    if (displayedTimezone == null) {
        setTextCommon(view, R.id.when_datetime, displayedDatetime);
    } else {
        int timezoneIndex = displayedDatetime.length();
        displayedDatetime += "  " + displayedTimezone;
        SpannableStringBuilder sb = new SpannableStringBuilder(displayedDatetime);
        ForegroundColorSpan transparentColorSpan = new ForegroundColorSpan(
                resources.getColor(R.color.event_info_headline_transparent_color));
        sb.setSpan(transparentColorSpan, timezoneIndex, displayedDatetime.length(),
                Spannable.SPAN_INCLUSIVE_INCLUSIVE);
        setTextCommon(view, R.id.when_datetime, sb);
    }

    // Display the repeat string (if any)
    String repeatString = null;
    if (!TextUtils.isEmpty(rRule)) {
        EventRecurrence eventRecurrence = new EventRecurrence();
        eventRecurrence.parse(rRule);
        Time date = new Time(localTimezone);
        date.set(mStartMillis);
        if (mAllDay) {
            date.timezone = Time.TIMEZONE_UTC;
        }
        eventRecurrence.setStartDate(date);
        repeatString = EventRecurrenceFormatter.getRepeatString(mContext, resources, eventRecurrence, true);
    }
    if (repeatString == null) {
        view.findViewById(R.id.when_repeat).setVisibility(View.GONE);
    } else {
        setTextCommon(view, R.id.when_repeat, repeatString);
    }

    // Organizer view is setup in the updateCalendar method

    // Where
    if (location == null || location.trim().length() == 0) {
        setVisibilityCommon(view, R.id.where, View.GONE);
    } else {
        final TextView textView = mWhere;
        if (textView != null) {
            textView.setAutoLinkMask(0);
            textView.setText(location.trim());
            try {
                textView.setText(Utils.extendedLinkify(textView.getText().toString(), true));

                // Linkify.addLinks() sets the TextView movement method if it finds any links.
                // We must do the same here, in case linkify by itself did not find any.
                // (This is cloned from Linkify.addLinkMovementMethod().)
                MovementMethod mm = textView.getMovementMethod();
                if ((mm == null) || !(mm instanceof LinkMovementMethod)) {
                    if (textView.getLinksClickable()) {
                        textView.setMovementMethod(LinkMovementMethod.getInstance());
                    }
                }
            } catch (Exception ex) {
                // unexpected
                Log.e(TAG, "Linkification failed", ex);
            }

            textView.setOnTouchListener(new OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    try {
                        return v.onTouchEvent(event);
                    } catch (ActivityNotFoundException e) {
                        // ignore
                        return true;
                    }
                }
            });
        }
    }

    // Description
    if (description != null && description.length() != 0) {
        mDesc.setText(description);
    }

    // Launch Custom App
    if (Utils.isJellybeanOrLater()) {
        updateCustomAppButton();
    }
}