Exemple #1
0
 /*
  * @return whether syncing is started
  */
 public boolean getAuth() {
   if (isAuthValid()) {
     return false;
   }
   final DataMgr dataMgr = DataMgr.getInstance();
   final String user = dataMgr.getSettingByName(Setting.SETTING_USERNAME);
   if (user == null) {
     return false;
   }
   if (isClientLogin()) {
     final String pass = dataMgr.getSettingByName(Setting.SETTING_PASSWORD);
     if (pass == null) {
       return false;
     }
     return tryClientLogin(user, pass);
   } else {
     return tryNonClicentLogin(user);
   }
 }
Exemple #2
0
 public boolean hasAccount() {
   final DataMgr dataMgr = DataMgr.getInstance();
   final String user = dataMgr.getSettingByName(Setting.SETTING_USERNAME);
   final String cLogin = dataMgr.getSettingByName(Setting.SETTING_IS_CLIENT_LOGIN);
   if (user == null || cLogin == null) {
     return false;
   }
   if (Boolean.valueOf(cLogin)) {
     final String pass = dataMgr.getSettingByName(Setting.SETTING_PASSWORD);
     return (pass != null);
   } else {
     final Account[] accounts = accMgr.getAccountsByType(ACCOUNT_TYPE);
     for (int i = 0; i < accounts.length; i++) {
       if (accounts[i].name.equals(user)) {
         return true;
       }
     }
     return false;
   }
 }