@Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); if (mDualFragments) { setSelection(position); } }
/** Called when loading up the activity */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); extras = getArguments() != null ? getArguments().getBundle(TOKEN_EXTRAS) : null; if (extras == null) { extras = new Bundle(); // Just need an empty one to prevent potential null pointers } }
@Override public void onPause() { super.onPause(); AndroidUtilities.tryUnregisterReceiver(getActivity(), refreshReceiver); backgroundTimer.cancel(); }
@Override public void onAttach(Activity activity) { super.onAttach(activity); // Check that the container activity has implemented the callback // interface try { mListener = (OnTaskListItemClickedListener) activity; } catch (ClassCastException e) { throw new ClassCastException( activity.toString() + " must implement OnTaskListItemClickedListener"); // $NON-NLS-1$ } }
@Override public void onResume() { super.onResume(); getActivity() .registerReceiver( refreshReceiver, new IntentFilter(AstridApiConstants.BROADCAST_EVENT_REFRESH)); if (Flags.checkAndClear(Flags.REFRESH)) { refresh(); } setUpBackgroundJobs(); refreshFilterCount(); initiateAutomaticSync(); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // We have a menu item to show in action bar. resources = getResources(); setHasOptionsMenu(true); syncActionHelper = new SyncActionHelper( gtasksPreferenceService, syncService, getActivity(), preferences, this); setUpUiComponents(); initializeData(); setupQuickAddBar(); Fragment filterlistFrame = getFragmentManager().findFragmentByTag(FilterListFragment.TAG_FILTERLIST_FRAGMENT); mDualFragments = (filterlistFrame != null) && filterlistFrame.isInLayout(); if (mDualFragments) { // In dual-pane mode, the list view highlights the selected item. getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); getListView().setItemsCanFocus(false); } if (!(this instanceof GtasksListFragment)) { getListView() .setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (taskAdapter != null) { TodorooCursor<Task> cursor = (TodorooCursor<Task>) taskAdapter.getItem(position); Task task = new Task(cursor); if (task.isDeleted()) { return; } onTaskListItemClicked(id); } } }); } }
@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 onStop() { super.onStop(); quickAddBar.destroyRecognizerApi(); }
@Override public void onStart() { super.onStart(); quickAddBar.setupRecognizerApi(); }