Browse Source

'Connect' button is disabled in login view any time the URL is modified, to prevent situations where the user can connect to a server introduced before the modifciation

David A. Velasco 12 years ago
parent
commit
4eb8093418
1 changed files with 18 additions and 0 deletions
  1. 18 0
      src/com/owncloud/android/authentication/AuthenticatorActivity.java

+ 18 - 0
src/com/owncloud/android/authentication/AuthenticatorActivity.java

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