示例#1
0
 public boolean handleOptionsMenuItemSelected(int id, Intent intent) {
   switch (id) {
     case MENU_ADDONS_ID:
       StatisticsService.reportEvent(StatisticsConstants.TLA_MENU_ADDONS);
       intent = new Intent(getActivity(), AddOnActivity.class);
       startActivityForResult(intent, ACTIVITY_ADDONS);
       return true;
     case MENU_SORT_ID:
       StatisticsService.reportEvent(StatisticsConstants.TLA_MENU_SORT);
       AlertDialog dialog =
           SortSelectionActivity.createDialog(
               getActivity(), hasDraggableOption(), this, sortFlags, sortSort);
       dialog.show();
       return true;
     case MENU_SYNC_ID:
       StatisticsService.reportEvent(StatisticsConstants.TLA_MENU_SYNC);
       syncActionHelper.performSyncAction();
       return true;
     case MENU_ADDON_INTENT_ID:
       AndroidUtilities.startExternalIntent(getActivity(), intent, ACTIVITY_MENU_EXTERNAL);
       return true;
     case MENU_NEW_FILTER_ID:
       intent = new Intent(getActivity(), CustomFilterActivity.class);
       getActivity().startActivityForResult(intent, ACTIVITY_REQUEST_NEW_FILTER);
       return true;
   }
   return false;
 }
示例#2
0
  @Override
  public void onPause() {
    super.onPause();

    AndroidUtilities.tryUnregisterReceiver(getActivity(), detailReceiver);
    AndroidUtilities.tryUnregisterReceiver(getActivity(), refreshReceiver);
    syncActionHelper.unregister();

    backgroundTimer.cancel();
  }
示例#3
0
  /**
   * Load or re-load action items and update views
   *
   * @param requery
   */
  public void loadTaskListContent(boolean requery) {
    if (taskAdapter == null) {
      setUpTaskList();
      return;
    }

    int oldListItemSelected = getListView().getSelectedItemPosition();
    Cursor taskCursor = taskAdapter.getCursor();

    if (requery) {
      taskCursor.requery();
      taskAdapter.flushCaches();
      taskAdapter.notifyDataSetChanged();
    }

    if (oldListItemSelected != ListView.INVALID_POSITION
        && oldListItemSelected < taskCursor.getCount())
      getListView().setSelection(oldListItemSelected);

    // also load sync actions
    syncActionHelper.request();
  }
示例#4
0
  @Override
  public void onResume() {
    super.onResume();

    getActivity()
        .registerReceiver(
            detailReceiver, new IntentFilter(AstridApiConstants.BROADCAST_SEND_DETAILS));
    getActivity()
        .registerReceiver(
            detailReceiver, new IntentFilter(AstridApiConstants.BROADCAST_SEND_DECORATIONS));
    getActivity()
        .registerReceiver(
            refreshReceiver, new IntentFilter(AstridApiConstants.BROADCAST_EVENT_REFRESH));
    syncActionHelper.register();

    if (Flags.checkAndClear(Flags.REFRESH)) {
      refresh();
    }

    setUpBackgroundJobs();

    if (!Preferences.getBoolean(WelcomeWalkthrough.KEY_SHOWED_WELCOME_LOGIN, false)) {
      Preferences.setBoolean(WelcomeWalkthrough.KEY_SHOWED_WELCOME_LOGIN, true);
      Intent showWelcomeLogin = new Intent(getActivity(), WelcomeWalkthrough.class);
      showWelcomeLogin.putExtra(ActFmLoginActivity.SHOW_TOAST, false);
      startActivity(showWelcomeLogin);
      return;
    }

    if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) {
      showTaskCreateHelpPopover();
    } else if (!Preferences.getBoolean(R.string.p_showed_tap_task_help, false)) {
      showTaskEditHelpPopover();
    } else if (!Preferences.getBoolean(R.string.p_showed_lists_help, false)) {
      showListsHelp();
    }
    refreshFilterCount();
    initiateAutomaticSync();
  }
示例#5
0
 /**
  * Implementation of initiation automatic sync. Subclasses should override this method; the above
  * method takes care of calling it in the correct way
  */
 protected void initiateAutomaticSyncImpl() {
   if (isCurrentTaskListFragment()) syncActionHelper.initiateAutomaticSync(filter);
 }
示例#6
0
 /**
  * Implementation of initiation automatic sync. Subclasses should override this method; the above
  * method takes care of calling it in the correct way
  */
 protected void initiateAutomaticSyncImpl() {
   if (isCurrentTaskListFragment() && isInbox) {
     syncActionHelper.initiateAutomaticSync();
   }
 }