Updating language strings; some hardcoded strings moved to strings.xml; workaround...
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / AuthenticatorActivity.java
index d99d907..c26c004 100644 (file)
@@ -24,12 +24,12 @@ import java.net.URL;
 import com.owncloud.android.AccountUtils;\r
 import com.owncloud.android.authenticator.AccountAuthenticator;\r
 import com.owncloud.android.authenticator.AuthenticationRunnable;\r
-import com.owncloud.android.authenticator.ConnectionCheckOperation;\r
 import com.owncloud.android.authenticator.OnAuthenticationResultListener;\r
 import com.owncloud.android.authenticator.OnConnectCheckListener;\r
 import com.owncloud.android.ui.dialog.SslValidatorDialog;\r
 import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener;\r
 import com.owncloud.android.network.OwnCloudClientUtils;\r
+import com.owncloud.android.operations.ConnectionCheckOperation;\r
 import com.owncloud.android.operations.OnRemoteOperationListener;\r
 import com.owncloud.android.operations.RemoteOperation;\r
 import com.owncloud.android.operations.RemoteOperationResult;\r
@@ -270,7 +270,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 // 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
             TextView tv = (TextView) findViewById(R.id.account_username);\r
-            tv.setError(message);\r
+            tv.setError(message + "        ");  // the extra spaces are a workaround for an ugly bug: \r
+                                                // 1. insert wrong credentials and connect\r
+                                                // 2. put the focus on the user name field with using hardware controls (don't touch the screen); the error is shown UNDER the field\r
+                                                // 3. touch the user name field; the software keyboard appears; the error popup is moved OVER the field and SHRINKED in width, losing the last word\r
+                                                // Seen, at least, in Android 2.x devices\r
         }\r
     }\r
     public void onCancelClick(View view) {\r
@@ -476,8 +480,14 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             onFocusChange(findViewById(R.id.host_URL), false);\r
         } else if (v.getId() == R.id.viewPassword) {\r
             TextView view = (TextView) findViewById(R.id.account_password);\r
-            int input_type = InputType.TYPE_CLASS_TEXT\r
-                    | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;\r
+            int input_type = view.getInputType();\r
+            if ((input_type & InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {\r
+                input_type = InputType.TYPE_CLASS_TEXT\r
+                        | InputType.TYPE_TEXT_VARIATION_PASSWORD;\r
+            } else {\r
+                input_type = InputType.TYPE_CLASS_TEXT\r
+                        | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;\r
+            }\r
             view.setInputType(input_type);\r
         }\r
     }\r