List of usage examples for android.content ContentResolver SYNC_EXTRAS_DO_NOT_RETRY
String SYNC_EXTRAS_DO_NOT_RETRY
To view the source code for android.content ContentResolver SYNC_EXTRAS_DO_NOT_RETRY.
Click Source Link
From source file:de.azapps.mirakel.main_activity.MainActivity.java
@Override public boolean onOptionsItemSelected(final MenuItem item) { if (this.mDrawerToggle.onOptionsItemSelected(item)) { return true; }//ww w . ja v a 2 s.com switch (item.getItemId()) { case R.id.menu_delete: handleDestroyTask(this.currentTask); updateShare(); return true; case R.id.menu_move: handleMoveTask(this.currentTask); return true; case R.id.list_delete: handleDestroyList(this.currentList); return true; case R.id.task_sorting: this.currentList = ListDialogHelpers.handleSortBy(this, this.currentList, new Helpers.ExecInterface() { @Override public void exec() { setCurrentList(MainActivity.this.currentList); } }, null); return true; case R.id.menu_new_list: getListFragment().editList(null); return true; case R.id.menu_sort_lists: final boolean t = !item.isChecked(); getListFragment().enableDrop(t); item.setChecked(t); return true; case R.id.menu_settings: final Intent intent = new Intent(MainActivity.this, SettingsActivity.class); startActivityForResult(intent, MainActivity.RESULT_SETTINGS); break; case R.id.menu_contact: Helpers.contact(this); break; case R.id.menu_new_ui: MirakelCommonPreferences.setUseNewUI(true); Helpers.restartApp(this); break; case R.id.menu_sync_now: final Bundle bundle = new Bundle(); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY, true); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); new Thread(new Runnable() { @SuppressLint("InlinedApi") @Override public void run() { final List<AccountMirakel> accounts = AccountMirakel.getEnabled(true); for (final AccountMirakel a : accounts) { // davdroid accounts should be there only from // API>=14... ContentResolver.requestSync(a.getAndroidAccount(), DefinitionsHelper.AUTHORITY_TYP, bundle); } } }).start(); break; case R.id.share_task: SharingHelper.share(this, getCurrentTask()); break; case R.id.share_list: SharingHelper.share(this, getCurrentList()); break; case R.id.search: onSearchRequested(); break; case R.id.menu_undo: UndoHistory.undoLast(this); updateCurrentListAndTask(); if (this.currentPosition == getTaskFragmentPosition()) { setCurrentTask(this.currentTask); } else if ((getListFragment() != null) && (getTasksFragment() != null) && (getListFragment().getAdapter() != null) && (getTasksFragment().getAdapter() != null)) { getListFragment().getAdapter().changeData(ListMirakel.all()); getListFragment().getAdapter().notifyDataSetChanged(); getTasksFragment().getAdapter().notifyDataSetChanged(); if (!MirakelCommonPreferences.isTablet() && (this.currentPosition == MainActivity.getTasksFragmentPosition())) { setCurrentList(getCurrentList()); } } break; case R.id.mark_as_subtask: TaskDialogHelpers.handleSubtask(this, this.currentTask, null, true); break; case R.id.menu_task_clone: try { final Task newTask = this.currentTask.create(); setCurrentTask(newTask, true); getListFragment().update(); updatesForTask(newTask); } catch (final NoSuchListException e) { Log.wtf(MainActivity.TAG, "List vanished on task cloning"); } break; default: return super.onOptionsItemSelected(item); } return true; }