Browse Source

Updating language strings; some hardcoded strings moved to strings.xml; workaround for bug in error popup

David A. Velasco 12 years ago
parent
commit
757f9027f5

+ 1 - 4
res/layout-land/account_setup.xml

@@ -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>
@@ -115,7 +114,6 @@
                     android:layout_weight="1"
                     android:ems="10"
                     android:hint="@string/auth_username"
-                    android:singleLine="true"
                     android:inputType="textNoSuggestions" />
 
                 <FrameLayout
@@ -130,8 +128,7 @@
                         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"

+ 1 - 4
res/layout/account_setup.xml

@@ -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>
@@ -111,7 +110,6 @@
                 android:layout_height="0dp"
                 android:layout_weight="1"
                 android:ems="10"
-                android:singleLine="true"
                 android:hint="@string/auth_username"
                 android:inputType="textNoSuggestions" />
 
@@ -127,8 +125,7 @@
                     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"

+ 3 - 0
res/values/strings.xml

@@ -165,6 +165,9 @@
 	<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>

+ 4 - 3
src/com/owncloud/android/authenticator/AuthenticationRunnable.java

@@ -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));
         }
     }
 

+ 5 - 1
src/com/owncloud/android/ui/activity/AuthenticatorActivity.java

@@ -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
             }
             TextView tv = (TextView) findViewById(R.id.account_username);
-            tv.setError(message);
+            tv.setError(message + "        ");  // the extra spaces are a workaround for an ugly bug: 
+                                                // 1. insert wrong credentials and connect
+                                                // 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
+                                                // 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
+                                                // Seen, at least, in Android 2.x devices
         }
     }
     public void onCancelClick(View view) {