Search in sources :

Example 1 with EventInfoFragment

use of com.android.calendar.EventInfoFragment in project Etar-Calendar by Etar-Group.

the class AgendaFragment method showEventInfo.

// Shows the selected event in the Agenda view
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;
    }
    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();
        }
    }
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction) EventInfoFragment(com.android.calendar.EventInfoFragment) Date(java.util.Date)

Aggregations

FragmentManager (android.app.FragmentManager)1 FragmentTransaction (android.app.FragmentTransaction)1 EventInfoFragment (com.android.calendar.EventInfoFragment)1 Date (java.util.Date)1