@Override public void onSortSelected(boolean always, int flags, int sort) { boolean manualSettingChanged = SortHelper.isManualSort(sortFlags) != SortHelper.isManualSort(flags); sortFlags = flags; sortSort = sort; if (always) { SharedPreferences publicPrefs = AstridPreferences.getPublicPrefs(ContextManager.getContext()); if (publicPrefs != null) { Editor editor = publicPrefs.edit(); if (editor != null) { editor.putInt(SortHelper.PREF_SORT_FLAGS, flags); editor.putInt(SortHelper.PREF_SORT_SORT, sort); editor.commit(); TasksWidget.updateWidgets(ContextManager.getContext()); } } } try { if (manualSettingChanged) toggleDragDrop(SortHelper.isManualSort(sortFlags)); else setUpTaskList(); } catch (IllegalStateException e) { // TODO: Fragment got detached somehow (rare) } }
@Override public void onSortSelected(boolean always, int flags, int sort) { boolean manualSettingChanged = SortHelper.isManualSort(sortFlags) != SortHelper.isManualSort(flags); sortFlags = flags; sortSort = sort; if (always) { preferences.setSortFlags(flags); preferences.setSortMode(sort); TasksWidget.updateWidgets(context); } try { if (manualSettingChanged) { toggleDragDrop(SortHelper.isManualSort(sortFlags)); } else { setUpTaskList(); } } catch (IllegalStateException e) { log.error(e.getMessage(), e); // TODO: Fragment got detached somehow (rare) } }
private void setWidgetSuppression(boolean suppress) { long date = suppress ? DateUtilities.now() : 0; TasksWidget.suppressUpdateFlag = date; if (date == 0) { Context context = ContextManager.getContext(); if (context != null) { TasksWidget.updateWidgets(context); } } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (quickAddBar.onActivityResult(requestCode, resultCode, data)) return; if (requestCode == ACTIVITY_SETTINGS) { if (resultCode == EditPreferences.RESULT_CODE_THEME_CHANGED || resultCode == EditPreferences.RESULT_CODE_PERFORMANCE_PREF_CHANGED) { getActivity().finish(); getActivity().startActivity(getActivity().getIntent()); TasksWidget.updateWidgets(getActivity()); return; } else if (resultCode == SyncProviderPreferences.RESULT_CODE_SYNCHRONIZE) { Preferences.setLong( SyncActionHelper.PREF_LAST_AUTO_SYNC, 0); // Forces autosync to occur after login } } super.onActivityResult(requestCode, resultCode, data); if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) { if (!AstridPreferences.canShowPopover()) return; quickAddBar .getQuickAddBox() .postDelayed( new Runnable() { @Override public void run() { Activity activity = getActivity(); if (activity != null) { HelpInfoPopover.showPopover( getActivity(), quickAddBar.getQuickAddBox(), R.string.help_popover_add_task, null); Preferences.setBoolean(R.string.p_showed_add_task_help, true); } } }, 1000); } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (quickAddBar.onActivityResult(requestCode, resultCode, data)) { return; } if (requestCode == ACTIVITY_SETTINGS) { if (resultCode == EditPreferences.RESULT_CODE_THEME_CHANGED || resultCode == EditPreferences.RESULT_CODE_PERFORMANCE_PREF_CHANGED) { getActivity().finish(); getActivity().startActivity(getActivity().getIntent()); TasksWidget.updateWidgets(getActivity()); return; } else if (resultCode == GtasksPreferences.RESULT_CODE_SYNCHRONIZE) { preferences.setLong( SyncActionHelper.PREF_LAST_AUTO_SYNC, 0); // Forces autosync to occur after login } } super.onActivityResult(requestCode, resultCode, data); }
@Override public void updateWidget() { TasksWidget.updateWidget(this, mAppWidgetId); }