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

This commit is contained in:
David A. Velasco 2012-11-29 11:28:34 +01:00
parent b83064eb83
commit 757f9027f5
5 changed files with 14 additions and 12 deletions

View file

@ -64,7 +64,6 @@
android:layout_weight="1" android:layout_weight="1"
android:ems="10" android:ems="10"
android:hint="@string/auth_host_url" android:hint="@string/auth_host_url"
android:singleLine="true"
android:inputType="textNoSuggestions"> android:inputType="textNoSuggestions">
<requestFocus /> <requestFocus />
</EditText> </EditText>
@ -115,7 +114,6 @@
android:layout_weight="1" android:layout_weight="1"
android:ems="10" android:ems="10"
android:hint="@string/auth_username" android:hint="@string/auth_username"
android:singleLine="true"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
<FrameLayout <FrameLayout
@ -130,8 +128,7 @@
android:layout_weight="1" android:layout_weight="1"
android:ems="10" android:ems="10"
android:hint="@string/auth_password" android:hint="@string/auth_password"
android:inputType="textPassword" android:inputType="textPassword"/>
android:singleLine="true" />
<ImageView <ImageView
android:id="@+id/viewPassword" android:id="@+id/viewPassword"

View file

@ -59,7 +59,6 @@
android:layout_weight="1" android:layout_weight="1"
android:ems="10" android:ems="10"
android:hint="@string/auth_host_url" android:hint="@string/auth_host_url"
android:singleLine="true"
android:inputType="textNoSuggestions" > android:inputType="textNoSuggestions" >
<requestFocus /> <requestFocus />
</EditText> </EditText>
@ -111,7 +110,6 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:ems="10" android:ems="10"
android:singleLine="true"
android:hint="@string/auth_username" android:hint="@string/auth_username"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
@ -127,8 +125,7 @@
android:layout_weight="1" android:layout_weight="1"
android:ems="10" android:ems="10"
android:hint="@string/auth_password" android:hint="@string/auth_password"
android:inputType="textPassword" android:inputType="textPassword"/>
android:singleLine="true" />
<ImageView <ImageView
android:id="@+id/viewPassword" android:id="@+id/viewPassword"

View file

@ -165,6 +165,9 @@
<string name="auth_wrong_connection_title">Couldn\'t establish connection</string> <string name="auth_wrong_connection_title">Couldn\'t establish connection</string>
<string name="auth_secure_connection">Secure connection established</string> <string name="auth_secure_connection">Secure connection established</string>
<string name="auth_login_details">Login details</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_message">Application terminated unexpectedly. Would you like to submit crash report?</string>
<string name="crashlog_send_report">Send report</string> <string name="crashlog_send_report">Send report</string>

View file

@ -22,6 +22,7 @@ import java.net.URL;
import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.HttpStatus;
import com.owncloud.android.R;
import com.owncloud.android.network.OwnCloudClientUtils; import com.owncloud.android.network.OwnCloudClientUtils;
import eu.alefzero.webdav.WebdavClient; import eu.alefzero.webdav.WebdavClient;
@ -64,13 +65,13 @@ public class AuthenticationRunnable implements Runnable {
postResult(true, uri.toString()); postResult(true, uri.toString());
break; break;
case HttpStatus.SC_UNAUTHORIZED: case HttpStatus.SC_UNAUTHORIZED:
postResult(false, "Invalid login or/and password"); postResult(false, mContext.getString(R.string.auth_unauthorized));
break; break;
case HttpStatus.SC_NOT_FOUND: case HttpStatus.SC_NOT_FOUND:
postResult(false, "Wrong path given"); postResult(false, mContext.getString(R.string.auth_not_found));
break; break;
default: default:
postResult(false, "Internal server error, code: " + login_result); postResult(false, String.format(mContext.getString(R.string.auth_internal), login_result));
} }
} }

View 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 // 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); 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) { public void onCancelClick(View view) {