@Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == RESULT_OK) {
     if (Intent.ACTION_EDIT.equals(getIntent().getAction())) {
       boolean isPushCapable = false;
       try {
         Store store = mAccount.getRemoteStore();
         isPushCapable = store.isPushCapable();
       } catch (Exception e) {
         Log.e(VisualVoicemail.LOG_TAG, "Could not get remote store", e);
       }
       if (isPushCapable && mAccount.getFolderPushMode() != FolderMode.NONE) {
         MailService.actionRestartPushers(this, null);
       }
       mAccount.save(Preferences.getPreferences(this));
       finish();
     } else {
       // first time setup, return to AccountSetup activity to save account
       setResult(RESULT_OK);
       finish();
     }
   } else {
     if (!Intent.ACTION_EDIT.equals(
         getIntent().getAction())) { // remove account if failed initial setup
       if (mAccount != null) Preferences.getPreferences(this).deleteAccount(mAccount);
     }
   }
 }
예제 #2
0
 private void setDisplayMode(FolderMode newMode) {
   mAccount.setFolderDisplayMode(newMode);
   mAccount.save(Preferences.getPreferences(this));
   if (mAccount.getFolderPushMode() != FolderMode.NONE) {
     MailService.actionRestartPushers(this, null);
   }
   onRefresh(false);
 }
예제 #3
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == REQUEST_LOGIN) {
     if (resultCode == RESULT_OK) {
       // авторизовались успешно
       account.access_token = data.getStringExtra("token");
       account.user_id = data.getLongExtra("user_id", 0);
       account.save(MainActivity.this);
       api = new Api(account.access_token, Constants.API_ID);
       loadAudioList();
     }
   }
 }
예제 #4
0
  private void onDone() {
    mAccount.setDescription(mAccount.getEmail());
    mAccount.setNotifyNewMail(mNotifyView.isChecked());
    mAccount.setShowOngoing(mNotifySyncView.isChecked());
    mAccount.setAutomaticCheckIntervalMinutes(
        (Integer) ((SpinnerOption) mCheckFrequencyView.getSelectedItem()).value);
    mAccount.setDisplayCount((Integer) ((SpinnerOption) mDisplayCountView.getSelectedItem()).value);

    if (mPushEnable.isChecked()) {
      mAccount.setFolderPushMode(Account.FolderMode.FIRST_CLASS);
    } else {
      mAccount.setFolderPushMode(Account.FolderMode.NONE);
    }

    mAccount.save(Preferences.getPreferences(this));
    if (mAccount.equals(Preferences.getPreferences(this).getDefaultAccount())
        || getIntent().getBooleanExtra(EXTRA_MAKE_DEFAULT, false)) {
      Preferences.getPreferences(this).setDefaultAccount(mAccount);
    }
    K9.setServicesEnabled(this);
    AccountSetupNames.actionSetNames(this, mAccount);
    finish();
  }
예제 #5
0
 private void logOut() {
   api = null;
   account.access_token = null;
   account.user_id = 0;
   account.save(MainActivity.this);
 }