Esempio 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);
   }
 }
Esempio n. 2
0
  protected void setupQuickAddBar() {
    quickAddBar = (QuickAddBar) getView().findViewById(R.id.taskListFooter);
    quickAddBar.initialize(injector, (AstridActivity) getActivity(), this, mListener);

    getListView()
        .setOnTouchListener(
            new OnTouchListener() {
              @Override
              public boolean onTouch(View v, MotionEvent event) {
                quickAddBar.clearFocus();
                return false;
              }
            });

    // set listener for astrid icon
    getView()
        .findViewById(android.R.id.empty)
        .setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                quickAddBar.performButtonClick();
              }
            });
  }
Esempio n. 3
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);
   }
 }
Esempio 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);
    }
  }
Esempio n. 5
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 == GtasksPreferences.RESULT_CODE_SYNCHRONIZE) {
        preferences.setLong(
            SyncActionHelper.PREF_LAST_AUTO_SYNC, 0); // Forces autosync to occur after login
      }
    }

    super.onActivityResult(requestCode, resultCode, data);
  }
Esempio n. 6
0
 @Override
 public void onStop() {
   super.onStop();
   quickAddBar.destroyRecognizerApi();
 }
Esempio n. 7
0
 @Override
 public void onStart() {
   super.onStart();
   quickAddBar.setupRecognizerApi();
 }