@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); } } }
private void setDisplayMode(FolderMode newMode) { mAccount.setFolderDisplayMode(newMode); mAccount.save(Preferences.getPreferences(this)); if (mAccount.getFolderPushMode() != FolderMode.NONE) { MailService.actionRestartPushers(this, null); } onRefresh(false); }
@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(); } } }
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(); }
private void logOut() { api = null; account.access_token = null; account.user_id = 0; account.save(MainActivity.this); }