use of com.android.calendar.CalendarController.EventInfo in project Etar-Calendar by Etar-Group.
the class EditEventActivity method getEventInfoFromIntent.
private EventInfo getEventInfoFromIntent(Bundle icicle) {
EventInfo info = new EventInfo();
long eventId = -1;
Intent intent = getIntent();
Uri data = intent.getData();
if (data != null) {
try {
eventId = Long.parseLong(data.getLastPathSegment());
} catch (NumberFormatException e) {
if (DEBUG) {
Log.d(TAG, "Create new event");
}
}
} else if (icicle != null && icicle.containsKey(BUNDLE_KEY_EVENT_ID)) {
eventId = icicle.getLong(BUNDLE_KEY_EVENT_ID);
}
boolean allDay = intent.getBooleanExtra(EXTRA_EVENT_ALL_DAY, false);
long begin = intent.getLongExtra(EXTRA_EVENT_BEGIN_TIME, -1);
long end = intent.getLongExtra(EXTRA_EVENT_END_TIME, -1);
if (end != -1) {
info.endTime = new Time();
if (allDay) {
info.endTime.timezone = Time.TIMEZONE_UTC;
}
info.endTime.set(end);
}
if (begin != -1) {
info.startTime = new Time();
if (allDay) {
info.startTime.timezone = Time.TIMEZONE_UTC;
}
info.startTime.set(begin);
}
info.id = eventId;
info.eventTitle = intent.getStringExtra(Events.TITLE);
info.calendarId = intent.getLongExtra(Events.CALENDAR_ID, -1);
if (allDay) {
info.extraLong = CalendarController.EXTRA_CREATE_ALL_DAY;
} else {
info.extraLong = 0;
}
return info;
}
use of com.android.calendar.CalendarController.EventInfo in project Etar-Calendar by Etar-Group.
the class SearchActivity method search.
private void search(String searchQuery, Time goToTime) {
// save query in recent queries
SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, Utils.getSearchAuthority(this), CalendarRecentSuggestionsProvider.MODE);
suggestions.saveRecentQuery(searchQuery, null);
EventInfo searchEventInfo = new EventInfo();
searchEventInfo.eventType = EventType.SEARCH;
searchEventInfo.query = searchQuery;
searchEventInfo.viewType = ViewType.AGENDA;
if (goToTime != null) {
searchEventInfo.startTime = goToTime;
}
mController.sendEvent(this, searchEventInfo);
mQuery = searchQuery;
if (mSearchView != null) {
mSearchView.setQuery(mQuery, false);
mSearchView.clearFocus();
}
}
use of com.android.calendar.CalendarController.EventInfo in project Etar-Calendar by Etar-Group.
the class AllInOneActivity method initFragments.
private void initFragments(long timeMillis, int viewType, Bundle icicle) {
if (DEBUG) {
Log.d(TAG, "Initializing to " + timeMillis + " for view " + viewType);
}
FragmentTransaction ft = getFragmentManager().beginTransaction();
if (mShowCalendarControls) {
Fragment miniMonthFrag = new MonthByWeekFragment(timeMillis, true);
ft.replace(R.id.mini_month, miniMonthFrag);
mController.registerEventHandler(R.id.mini_month, (EventHandler) miniMonthFrag);
Fragment selectCalendarsFrag = new SelectVisibleCalendarsFragment();
ft.replace(R.id.calendar_list, selectCalendarsFrag);
mController.registerEventHandler(R.id.calendar_list, (EventHandler) selectCalendarsFrag);
}
if (!mShowCalendarControls || viewType == ViewType.EDIT) {
mMiniMonth.setVisibility(View.GONE);
mCalendarsList.setVisibility(View.GONE);
}
EventInfo info = null;
if (viewType == ViewType.EDIT) {
mPreviousView = GeneralPreferences.getSharedPreferences(this).getInt(GeneralPreferences.KEY_START_VIEW, GeneralPreferences.DEFAULT_START_VIEW);
long eventId = -1;
Intent intent = getIntent();
Uri data = intent.getData();
if (data != null) {
try {
eventId = Long.parseLong(data.getLastPathSegment());
} catch (NumberFormatException e) {
if (DEBUG) {
Log.d(TAG, "Create new event");
}
}
} else if (icicle != null && icicle.containsKey(BUNDLE_KEY_EVENT_ID)) {
eventId = icicle.getLong(BUNDLE_KEY_EVENT_ID);
}
long begin = intent.getLongExtra(EXTRA_EVENT_BEGIN_TIME, -1);
long end = intent.getLongExtra(EXTRA_EVENT_END_TIME, -1);
info = new EventInfo();
if (end != -1) {
info.endTime = new Time();
info.endTime.set(end);
}
if (begin != -1) {
info.startTime = new Time();
info.startTime.set(begin);
}
info.id = eventId;
// We set the viewtype so if the user presses back when they are
// done editing the controller knows we were in the Edit Event
// screen. Likewise for eventId
mController.setViewType(viewType);
mController.setEventId(eventId);
} else {
mPreviousView = viewType;
}
setMainPane(ft, R.id.main_pane, viewType, timeMillis, true);
// this needs to be after setMainPane()
ft.commit();
Time t = new Time(mTimeZone);
t.set(timeMillis);
if (viewType == ViewType.AGENDA && icicle != null) {
mController.sendEvent(this, EventType.GO_TO, t, null, icicle.getLong(BUNDLE_KEY_EVENT_ID, -1), viewType);
} else if (viewType != ViewType.EDIT) {
mController.sendEvent(this, EventType.GO_TO, t, null, -1, viewType);
}
}
Aggregations