use of com.android.calendar.AsyncQueryService in project Etar-Calendar by Etar-Group.
the class SelectCalendarsSyncFragment method onAttach.
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
mService = new AsyncQueryService(activity);
Bundle bundle = getArguments();
if (bundle != null && bundle.containsKey(Calendars.ACCOUNT_NAME) && bundle.containsKey(Calendars.ACCOUNT_TYPE)) {
mAccount = new Account(bundle.getString(Calendars.ACCOUNT_NAME), bundle.getString(Calendars.ACCOUNT_TYPE));
}
}
use of com.android.calendar.AsyncQueryService in project Etar-Calendar by Etar-Group.
the class SelectVisibleCalendarsFragment method onAttach.
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
mContext = activity;
mController = CalendarController.getInstance(activity);
mController.registerEventHandler(R.layout.select_calendars_fragment, this);
mService = new AsyncQueryService(activity) {
@Override
protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
mAdapter.changeCursor(cursor);
mCursor = cursor;
}
};
}
use of com.android.calendar.AsyncQueryService in project Etar-Calendar by Etar-Group.
the class EditEventFragment method saveReminders.
private void saveReminders() {
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(3);
boolean changed = EditEventHelper.saveReminders(ops, mModel.mId, mModel.mReminders, mOriginalModel.mReminders, false);
if (!changed) {
return;
}
AsyncQueryService service = new AsyncQueryService(getActivity());
service.startBatch(0, null, Calendars.CONTENT_URI.getAuthority(), ops, 0);
// Update the "hasAlarm" field for the event
Uri uri = ContentUris.withAppendedId(Events.CONTENT_URI, mModel.mId);
int len = mModel.mReminders.size();
boolean hasAlarm = len > 0;
if (hasAlarm != mOriginalModel.mHasAlarm) {
ContentValues values = new ContentValues();
values.put(Events.HAS_ALARM, hasAlarm ? 1 : 0);
service.startUpdate(0, null, uri, values, null, null, 0);
}
Toast.makeText(mContext, R.string.saving_event, Toast.LENGTH_SHORT).show();
}
Aggregations