OC-1080: Message 'Server does not support this authentication method' should be there...
[pub/Android/ownCloud.git] / src / com / owncloud / android / authentication / AuthenticatorActivity.java
index 4aa0528..4ea7f3d 100644 (file)
@@ -159,6 +159,8 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
     private View mOkButton;\r
     \r
     private String mAuthToken;\r
+    \r
+    private boolean mResumed; // Control if activity is resumed\r
 \r
 \r
     /**\r
@@ -212,6 +214,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         }\r
 \r
         if (savedInstanceState == null) {\r
+            mResumed = false;\r
             /// connection state and info\r
             mServerStatusText = mServerStatusIcon = 0;\r
             mServerIsValid = false;\r
@@ -237,6 +240,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
             }\r
             \r
         } else {\r
+            mResumed = true;\r
             /// connection state and info\r
             mServerIsValid = savedInstanceState.getBoolean(KEY_SERVER_VALID);\r
             mServerIsChecked = savedInstanceState.getBoolean(KEY_SERVER_CHECKED);\r
@@ -313,12 +317,20 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
             }\r
 \r
             @Override\r
-            public void beforeTextChanged(CharSequence s, int start, int count, int after) {}\r
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {\r
+            }\r
 \r
             @Override\r
-            public void onTextChanged(CharSequence s, int start, int before, int count) {}\r
-\r
+            public void onTextChanged(CharSequence s, int start, int before, int count) {\r
+                if (!mResumed) {\r
+                    mAuthStatusIcon = 0;\r
+                    mAuthStatusText = 0;\r
+                    showAuthStatus();                    \r
+                }\r
+                mResumed = false;\r
+            }\r
         });\r
+        \r
         mPasswordInput.setOnFocusChangeListener(this);\r
         mPasswordInput.setImeOptions(EditorInfo.IME_ACTION_DONE);\r
         mPasswordInput.setOnEditorActionListener(this);
@@ -728,6 +740,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         mAuthCheckOperation = new  ExistenceCheckOperation("", this, false);\r
         WebdavClient client = OwnCloudClientUtils.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this, false);\r
         mOperationThread = mAuthCheckOperation.execute(client, this, mHandler);\r
+      \r
     }\r
 \r
     /**\r
@@ -762,7 +775,8 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
             // NOTHING TO DO ; can't find out what situation that leads to the exception in this code, but user logs signal that it happens\r
         }\r
         \r
-        if (result.isTemporalRedirection() || result.isIdPRedirection()) {\r
+        //if (result.isTemporalRedirection() || result.isIdPRedirection()) {\r
+        if (result.isIdPRedirection()) {\r
             String url = result.getRedirectedLocation();\r
             String targetUrl = mHostBaseUrl + AccountUtils.getWebdavPath(mDiscoveredVersion, mAuthTokenType);\r
             \r
@@ -770,8 +784,8 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
             mSamlDialog = SamlWebViewDialog.newInstance(url, targetUrl);            \r
             mSamlDialog.show(getSupportFragmentManager(), TAG_SAML_DIALOG);\r
             \r
-            mAuthStatusIcon = android.R.drawable.ic_secure;\r
-            mAuthStatusText = R.string.auth_follow_auth_server;\r
+            mAuthStatusIcon = 0;\r
+            mAuthStatusText = 0;\r
             \r
         } else {\r
             mAuthStatusIcon = R.drawable.common_error;\r
@@ -1113,6 +1127,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
             showAuthStatus();\r
             Log_OC.d(TAG, "Access failed: " + result.getLogMessage());\r
         }\r
+\r
     }\r
 \r
 \r
@@ -1550,6 +1565,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
                 finish();\r
             }\r
         }\r
+\r
             \r
     }\r
 \r
@@ -1573,8 +1589,8 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
             // TODO - show fail\r
             Log_OC.d(TAG, "SSO failed");\r
         }\r
-    }\r
     \r
+    }\r
     \r
 \r
     private void syncAccount(){\r