Reviewed integration with sychronization framework to fix problems in Android 4.4
[pub/Android/ownCloud.git] / src / com / owncloud / android / authentication / AccountAuthenticator.java
index c9da67b..ff0782d 100644 (file)
 
 package com.owncloud.android.authentication;
 
+import com.owncloud.android.Log_OC;
+import com.owncloud.android.MainApp;
+import com.owncloud.android.R;
+
 import android.accounts.*;
 import android.content.Context;
 import android.content.Intent;
@@ -25,10 +29,7 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.widget.Toast;
 
-import com.owncloud.android.Log_OC;
-import com.owncloud.android.MainApp;
 
-import com.owncloud.android.R;
 
 
 /**
@@ -47,15 +48,6 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
      * Is used by android system to assign accounts to authenticators. Should be
      * used by application and all extensions.
      */
-    /* These constants are now in MainApp
-         public static final String ACCOUNT_TYPE = "owncloud";
-         public static final String AUTHORITY = "org.owncloud";
-         public static final String AUTH_TOKEN_TYPE = "org.owncloud";
-         public static final String AUTH_TOKEN_TYPE_PASSWORD = "owncloud.password";
-         public static final String AUTH_TOKEN_TYPE_ACCESS_TOKEN = "owncloud.oauth2.access_token";
-         public static final String AUTH_TOKEN_TYPE_REFRESH_TOKEN = "owncloud.oauth2.refresh_token";
-         public static final String AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE = "owncloud.saml.web_sso.session_cookie";
-    */
     public static final String KEY_AUTH_TOKEN_TYPE = "authTokenType";
     public static final String KEY_REQUIRED_FEATURES = "requiredFeatures";
     public static final String KEY_LOGIN_OPTIONS = "loginOptions";
@@ -142,13 +134,14 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
 
             // Return an error
             bundle.putInt(AccountManager.KEY_ERROR_CODE, AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION);
-            bundle.putString(AccountManager.KEY_ERROR_MESSAGE, mContext.getString(R.string.auth_unsupported_multiaccount));
+            final String message = String.format(mContext.getString(R.string.auth_unsupported_multiaccount), mContext.getString(R.string.app_name)); 
+            bundle.putString(AccountManager.KEY_ERROR_MESSAGE, message);
            
             mHandler.post(new Runnable() {
 
                 @Override
                 public void run() {
-                    Toast.makeText(mContext, R.string.auth_unsupported_multiaccount, Toast.LENGTH_SHORT).show();
+                    Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show();
                 }
             });