Ejemplo n.º 1
0
 public void showTaskEditHelpPopover() {
   if (!AstridPreferences.canShowPopover()) return;
   if (!Preferences.getBoolean(R.string.p_showed_tap_task_help, false)) {
     quickAddBar.hideKeyboard();
     getListView()
         .postDelayed(
             new Runnable() {
               public void run() {
                 try {
                   if (taskAdapter != null && taskAdapter.getCount() > 0) {
                     final View view = getListView().getChildAt(getListView().getChildCount() - 1);
                     if (view != null) {
                       Activity activity = getActivity();
                       if (activity != null) {
                         HelpInfoPopover.showPopover(
                             getActivity(), view, R.string.help_popover_tap_task, null);
                         Preferences.setBoolean(R.string.p_showed_tap_task_help, true);
                       }
                     }
                   }
                 } catch (IllegalStateException e) {
                   // Whoops, view is gone. Try again later
                 }
               }
             },
             1000L);
   }
 }
Ejemplo n.º 2
0
 private void showTaskCreateHelpPopover() {
   if (!AstridPreferences.canShowPopover()) return;
   if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) {
     Preferences.setBoolean(R.string.p_showed_add_task_help, true);
     HelpInfoPopover.showPopover(
         getActivity(), quickAddBar.getQuickAddBox(), R.string.help_popover_add_task, null);
   }
 }
Ejemplo n.º 3
0
 private void showListsHelp() {
   if (!AstridPreferences.canShowPopover()) return;
   if (!Preferences.getBoolean(R.string.p_showed_lists_help, false)) {
     AstridActivity activity = (AstridActivity) getActivity();
     if (activity != null) {
       if (AstridPreferences.useTabletLayout(activity)) {
         FilterListFragment flf = activity.getFilterListFragment();
         if (flf != null) flf.showAddListPopover();
       } else {
         ActionBar ab = activity.getSupportActionBar();
         View anchor = ab.getCustomView().findViewById(R.id.lists_nav);
         HelpInfoPopover.showPopover(activity, anchor, R.string.help_popover_switch_lists, null);
       }
       Preferences.setBoolean(R.string.p_showed_lists_help, true);
     }
   }
 }
Ejemplo n.º 4
0
  @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);
    }
  }