From 4eb80934182f94e781c3e7bc8984293f1c8e66b1 Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Mon, 20 May 2013 13:54:04 +0200 Subject: [PATCH] '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 --- .../android/authentication/AuthenticatorActivity.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 80cf894a..3df4c467 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/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); } } -- 2.11.0