Example #1
0
 public void setClientLogin(final String serverUrl, final String user, final String pass) {
   final DataMgr dataMgr = DataMgr.getInstance();
   dataMgr.updateSetting(new Setting(Setting.SETTING_SERVER_URL, serverUrl));
   AbsURL.setServerUrl(serverUrl);
   dataMgr.updateSetting(new Setting(Setting.SETTING_USERNAME, user));
   dataMgr.updateSetting(new Setting(Setting.SETTING_PASSWORD, pass));
   dataMgr.updateSetting(new Setting(Setting.SETTING_IS_CLIENT_LOGIN, String.valueOf(true)));
 }
Example #2
0
 public void run(final AccountManagerFuture<Bundle> result) {
   try {
     final Bundle bundle = result.getResult();
     final Intent intent = (Intent) bundle.get(AccountManager.KEY_INTENT);
     if (intent != null) {
       /*
        * Remember: This returns onAuthUpdateFinished(true), then
        * it may still be canceled by user!
        */
       intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
       if (showIntent) {
         context.startActivity(intent);
       }
     } else {
       final DataMgr dataMgr = DataMgr.getInstance();
       dataMgr.updateSetting(
           new Setting(Setting.SETTING_AUTH, bundle.getString(AccountManager.KEY_AUTHTOKEN)));
     }
     notifyOnAuthUpdateFinished(true);
   } catch (final OperationCanceledException exception) {
     notifyOnAuthUpdateFinished(false);
     exception.printStackTrace();
   } catch (final AuthenticatorException exception) {
     notifyOnAuthUpdateFinished(false);
     exception.printStackTrace();
   } catch (final IOException exception) {
     notifyOnAuthUpdateFinished(false);
     exception.printStackTrace();
   }
 }
Example #3
0
 public void setNonClientLogin(final String user) {
   final DataMgr dataMgr = DataMgr.getInstance();
   dataMgr.updateSetting(new Setting(Setting.SETTING_USERNAME, user));
   dataMgr.updateSetting(new Setting(Setting.SETTING_IS_CLIENT_LOGIN, String.valueOf(false)));
 }