'Connect' button is disabled in login view any time the URL is modified, to prevent...
authorDavid A. Velasco <dvelasco@solidgear.es>
Mon, 20 May 2013 11:54:04 +0000 (13:54 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Mon, 20 May 2013 11:54:04 +0000 (13:54 +0200)
src/com/owncloud/android/authentication/AuthenticatorActivity.java

index 80cf894..3df4c46 100644 (file)
@@ -48,7 +48,9 @@ import android.net.Uri;
 import android.os.Bundle;\r
 import android.os.Handler;\r
 import android.preference.PreferenceManager;\r
+import android.text.Editable;\r
 import android.text.InputType;\r
+import android.text.TextWatcher;\r
 import android.view.KeyEvent;\r
 import android.view.MotionEvent;\r
 import android.view.View;\r
@@ -263,6 +265,20 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 return true;\r
             }\r
         });\r
+        mHostUrlInput.addTextChangedListener(new TextWatcher() {\r
+\r
+            @Override\r
+            public void afterTextChanged(Editable s) {\r
+                mOkButton.setEnabled(false);\r
+            }\r
+\r
+            @Override\r
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {}\r
+\r
+            @Override\r
+            public void onTextChanged(CharSequence s, int start, int before, int count) {}\r
+            \r
+        });\r
         mPasswordInput.setOnFocusChangeListener(this);\r
         mPasswordInput.setImeOptions(EditorInfo.IME_ACTION_DONE);\r
         mPasswordInput.setOnEditorActionListener(this);\r
@@ -396,6 +412,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     private void onUrlInputFocusLost(TextView hostInput) {\r
         if (!mHostBaseUrl.equals(normalizeUrl(mHostUrlInput.getText().toString()))) {\r
             checkOcServer();\r
+        } else {\r
+            mOkButton.setEnabled(mServerIsValid);\r
         }\r
     }\r
 \r