Updating language strings; some hardcoded strings moved to strings.xml; workaround...
authorDavid A. Velasco <dvelasco@solidgear.es>
Thu, 29 Nov 2012 10:28:34 +0000 (11:28 +0100)
committerDavid A. Velasco <dvelasco@solidgear.es>
Thu, 29 Nov 2012 10:28:34 +0000 (11:28 +0100)
res/layout-land/account_setup.xml
res/layout/account_setup.xml
res/values/strings.xml
src/com/owncloud/android/authenticator/AuthenticationRunnable.java
src/com/owncloud/android/ui/activity/AuthenticatorActivity.java

index 34ac31d..1e4417a 100644 (file)
@@ -64,7 +64,6 @@
                         android:layout_weight="1"
                         android:ems="10"
                         android:hint="@string/auth_host_url"
-                        android:singleLine="true"
                         android:inputType="textNoSuggestions">
                         <requestFocus />
                     </EditText>
                     android:layout_weight="1"
                     android:ems="10"
                     android:hint="@string/auth_username"
-                    android:singleLine="true"
                     android:inputType="textNoSuggestions" />
 
                 <FrameLayout
                         android:layout_weight="1"
                         android:ems="10"
                         android:hint="@string/auth_password"
-                        android:inputType="textPassword"
-                        android:singleLine="true" />
+                        android:inputType="textPassword"/>
 
                     <ImageView
                         android:id="@+id/viewPassword"
index e56c117..59eba13 100644 (file)
@@ -59,7 +59,6 @@
                     android:layout_weight="1"
                     android:ems="10"
                     android:hint="@string/auth_host_url"
-                    android:singleLine="true"
                     android:inputType="textNoSuggestions" >
                     <requestFocus />
                 </EditText>
                 android:layout_height="0dp"
                 android:layout_weight="1"
                 android:ems="10"
-                android:singleLine="true"
                 android:hint="@string/auth_username"
                 android:inputType="textNoSuggestions" />
 
                     android:layout_weight="1"
                     android:ems="10"
                     android:hint="@string/auth_password"
-                    android:inputType="textPassword"
-                    android:singleLine="true" />
+                    android:inputType="textPassword"/>
 
                 <ImageView
                     android:id="@+id/viewPassword"
index 378bb00..410b4ee 100644 (file)
        <string name="auth_wrong_connection_title">Couldn\'t establish connection</string>
        <string name="auth_secure_connection">Secure connection established</string>
     <string name="auth_login_details">Login details</string>
+    <string name="auth_unauthorized">Invalid login / password</string>
+    <string name="auth_not_found">Wrong path given</string>
+    <string name="auth_internal">Internal server error, code %1$d</string>
     
     <string name="crashlog_message">Application terminated unexpectedly. Would you like to submit crash report?</string>
     <string name="crashlog_send_report">Send report</string>
index ac547f8..63f89bc 100644 (file)
@@ -22,6 +22,7 @@ import java.net.URL;
 
 import org.apache.commons.httpclient.HttpStatus;
 
+import com.owncloud.android.R;
 import com.owncloud.android.network.OwnCloudClientUtils;
 
 import eu.alefzero.webdav.WebdavClient;
@@ -64,13 +65,13 @@ public class AuthenticationRunnable implements Runnable {
             postResult(true, uri.toString());
             break;
         case HttpStatus.SC_UNAUTHORIZED:
-            postResult(false, "Invalid login or/and password");
+            postResult(false, mContext.getString(R.string.auth_unauthorized));
             break;
         case HttpStatus.SC_NOT_FOUND:
-            postResult(false, "Wrong path given");
+            postResult(false, mContext.getString(R.string.auth_not_found));
             break;
         default:
-            postResult(false, "Internal server error, code: " + login_result);
+            postResult(false, String.format(mContext.getString(R.string.auth_internal), login_result));
         }
     }
 
index 52714b6..c26c004 100644 (file)
@@ -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