Search in sources :

Example 1 with AsyncQueryService

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));
    }
}
Also used : Account(android.accounts.Account) Bundle(android.os.Bundle) AsyncQueryService(com.android.calendar.AsyncQueryService)

Example 2 with AsyncQueryService

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;
        }
    };
}
Also used : AsyncQueryService(com.android.calendar.AsyncQueryService) Cursor(android.database.Cursor)

Example 3 with AsyncQueryService

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();
}
Also used : ContentValues(android.content.ContentValues) ContentProviderOperation(android.content.ContentProviderOperation) AsyncQueryService(com.android.calendar.AsyncQueryService) ArrayList(java.util.ArrayList) Uri(android.net.Uri)

Aggregations

AsyncQueryService (com.android.calendar.AsyncQueryService)3 Account (android.accounts.Account)1 ContentProviderOperation (android.content.ContentProviderOperation)1 ContentValues (android.content.ContentValues)1 Cursor (android.database.Cursor)1 Uri (android.net.Uri)1 Bundle (android.os.Bundle)1 ArrayList (java.util.ArrayList)1