diff --git a/res/values/strings.xml b/res/values/strings.xml
index 225ff401e9..6257fb2493 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -186,6 +186,35 @@
exchanges\' setting disabled.
+
+ Connect With TextSecure
+ Select Your Country
+ You must specify your
+ country code
+
+ You must specify your
+ phone number
+
+ Invalid number
+ The number you
+ specified (%s) is invalid.
+
+ Unsupported
+ Sorry,
+ this device is not supported for data messaging. Devices running versions of Android older
+ than 4.0 must have a registered Google Account. Devices running Android 4.0 or newer do not
+ require a Google Account, but must have the Play Store app installed.
+
+
+ We will now verify that the following number is associated with this device:
+
+ %s
+
+ Is this number correct, or would you like to edit it before continuing?
+
+ Continue
+ Edit
+
Possible Problems
diff --git a/src/org/thoughtcrime/securesms/RegistrationActivity.java b/src/org/thoughtcrime/securesms/RegistrationActivity.java
index da22ef45c4..e928da7a01 100644
--- a/src/org/thoughtcrime/securesms/RegistrationActivity.java
+++ b/src/org/thoughtcrime/securesms/RegistrationActivity.java
@@ -28,25 +28,21 @@ import org.thoughtcrime.securesms.util.PhoneNumberFormatter;
import org.thoughtcrime.securesms.util.Util;
/**
- * The create account activity. Kicks off an account creation event, then waits
- * the server to respond with a challenge via SMS, receives the challenge, and
- * verifies it with the server.
+ * The register account activity. Begins the account registration process.
*
* @author Moxie Marlinspike
*
*/
-
public class RegistrationActivity extends SherlockActivity {
private static final int PICK_COUNTRY = 1;
- private AsYouTypeFormatter countryFormatter;
+ private AsYouTypeFormatter countryFormatter;
private ArrayAdapter countrySpinnerAdapter;
- private Spinner countrySpinner;
- private TextView countryCode;
+ private Spinner countrySpinner;
+ private TextView countryCode;
private TextView number;
- private Button createButton;
-
+ private Button createButton;
@Override
public void onCreate(Bundle icicle) {
@@ -54,7 +50,7 @@ public class RegistrationActivity extends SherlockActivity {
setContentView(R.layout.registration_activity);
ActionBar actionBar = this.getSupportActionBar();
- actionBar.setTitle("Connect With TextSecure");
+ actionBar.setTitle(getString(R.string.RegistrationActivity_connect_with_textsecure));
initializeResources();
initializeNumber();
@@ -77,7 +73,7 @@ public class RegistrationActivity extends SherlockActivity {
this.countrySpinnerAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item);
this.countrySpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
- setCountryDisplay("Select Your Country");
+ setCountryDisplay(getString(R.string.RegistrationActivity_select_your_country));
this.countrySpinner.setAdapter(this.countrySpinnerAdapter);
this.countrySpinner.setOnTouchListener(new View.OnTouchListener() {
@@ -99,7 +95,7 @@ public class RegistrationActivity extends SherlockActivity {
private void initializeNumber() {
String localNumber = ((TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE))
- .getLine1Number();
+ .getLine1Number();
if (!Util.isEmpty(localNumber) && !localNumber.startsWith("+")) {
if (localNumber.length() == 10) localNumber = "+1" + localNumber;
@@ -130,11 +126,8 @@ public class RegistrationActivity extends SherlockActivity {
PhoneNumberUtil util = PhoneNumberUtil.getInstance();
String regionCode = util.getRegionCodeForCountryCode(countryCode);
- if (regionCode == null) {
- this.countryFormatter = null;
- } else {
- this.countryFormatter = util.getAsYouTypeFormatter(regionCode);
- }
+ if (regionCode == null) this.countryFormatter = null;
+ else this.countryFormatter = util.getAsYouTypeFormatter(regionCode);
}
private String getConfiguredE164Number() {
@@ -148,13 +141,15 @@ public class RegistrationActivity extends SherlockActivity {
final RegistrationActivity self = RegistrationActivity.this;
if (Util.isEmpty(countryCode.getText())) {
- Toast.makeText(self, "You must specify your country code",
+ Toast.makeText(self,
+ getString(R.string.RegistrationActivity_you_must_specify_your_country_code),
Toast.LENGTH_LONG).show();
return;
}
if (Util.isEmpty(number.getText())) {
- Toast.makeText(self, "You must specify your phone number",
+ Toast.makeText(self,
+ getString(R.string.RegistrationActivity_you_must_specify_your_phone_number),
Toast.LENGTH_LONG).show();
return;
}
@@ -163,22 +158,24 @@ public class RegistrationActivity extends SherlockActivity {
if (!PhoneNumberFormatter.isValidNumber(e164number)) {
Util.showAlertDialog(self,
- "Invalid number",
- String.format("The number you specified (%s) is invalid.", e164number));
+ getString(R.string.RegistrationActivity_invalid_number),
+ String.format(getString(R.string.RegistrationActivity_the_number_you_specified_s_is_invalid),
+ e164number));
return;
}
try {
GCMRegistrar.checkDevice(self);
} catch (UnsupportedOperationException uoe) {
- Util.showAlertDialog(self, "Unsupported", "Sorry, this device is not supported for data messaging. Devices running versions of Android older than 4.0 must have a registered Google Account. Devices running Android 4.0 or newer do not require a Google Account, but must have the Play Store app installed.");
+ Util.showAlertDialog(self, getString(R.string.RegistrationActivity_unsupported),
+ getString(R.string.RegistrationActivity_sorry_this_device_is_not_supported_for_data_messaging));
return;
}
AlertDialog.Builder dialog = new AlertDialog.Builder(self);
- dialog.setMessage(String.format("We will now verify that the following number is associated with this device:\n\n%s\n\nIs this number correct, or would you like to edit it before continuing?",
+ dialog.setMessage(String.format(getString(R.string.RegistrationActivity_we_will_now_verify_that_the_following_number_is_associated_with_your_device_s),
PhoneNumberFormatter.getInternationalFormatFromE164(e164number)));
- dialog.setPositiveButton("Continue",
+ dialog.setPositiveButton(getString(R.string.RegistrationActivity_continue),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
@@ -188,7 +185,7 @@ public class RegistrationActivity extends SherlockActivity {
finish();
}
});
- dialog.setNegativeButton("Edit", null);
+ dialog.setNegativeButton(getString(R.string.RegistrationActivity_edit), null);
dialog.show();
}
}
@@ -197,13 +194,14 @@ public class RegistrationActivity extends SherlockActivity {
@Override
public void afterTextChanged(Editable s) {
if (Util.isEmpty(s)) {
- setCountryDisplay("Select your country");
+ setCountryDisplay(getString(R.string.RegistrationActivity_select_your_country));
countryFormatter = null;
return;
}
int countryCode = Integer.parseInt(s.toString());
String regionCode = PhoneNumberUtil.getInstance().getRegionCodeForCountryCode(countryCode);
+
setCountryFormatter(countryCode);
setCountryDisplay(PhoneNumberFormatter.getRegionDisplayName(regionCode));