aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values-de/strings.xml4
-rw-r--r--res/values/strings.xml4
-rw-r--r--src/eu/siacs/conversations/ui/EditAccount.java33
3 files changed, 21 insertions, 20 deletions
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index 88376842..292a81e8 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -164,5 +164,9 @@
<string name="mgmt_account_disable">Vorübergehend abschalten</string>
<string name="mgmt_account_enable">Anschalten</string>
<string name="attach_record_voice">Sprache aufzeichnen</string>
+ <string name="account_settings">Kontoeinstellungen</string>
+ <string name="save">Speichern</string>
+ <string name="passwords_do_not_match">Passwörter stimmen nicht überein</string>
+ <string name="invalid_jid">Ungültige Jabber ID</string>
</resources> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9841aa60..2b5c25f2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -164,5 +164,9 @@
<string name="mgmt_account_disable">Temporarily disable</string>
<string name="mgmt_account_enable">Enable</string>
<string name="attach_record_voice">Record voice</string>
+ <string name="account_settings">Account Settings</string>
+ <string name="save">Save</string>
+ <string name="passwords_do_not_match">Passwords do not match</string>
+ <string name="invalid_jid">This is not a valid Jabber ID</string>
</resources> \ No newline at end of file
diff --git a/src/eu/siacs/conversations/ui/EditAccount.java b/src/eu/siacs/conversations/ui/EditAccount.java
index 8b1c0fa6..47930747 100644
--- a/src/eu/siacs/conversations/ui/EditAccount.java
+++ b/src/eu/siacs/conversations/ui/EditAccount.java
@@ -51,27 +51,19 @@ public class EditAccount extends DialogFragment {
final CheckBox registerAccount = (CheckBox) view
.findViewById(R.id.edit_account_register_new);
- final String okButtonDesc;
-
if (account != null) {
jidText.setText(account.getJid());
password.setText(account.getPassword());
- Log.d("xmppService","mein debugger. account != null");
if (account.isOptionSet(Account.OPTION_REGISTER)) {
registerAccount.setChecked(true);
- builder.setTitle(getString(R.string.register_account));
- okButtonDesc = "Register";
passwordConfirm.setVisibility(View.VISIBLE);
passwordConfirm.setText(account.getPassword());
} else {
registerAccount.setVisibility(View.GONE);
- builder.setTitle("Edit account");
- okButtonDesc = "Edit";
}
- } else {
- builder.setTitle("Add account");
- okButtonDesc = "Add";
}
+ builder.setTitle(R.string.account_settings);
+
registerAccount
.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@@ -79,26 +71,19 @@ public class EditAccount extends DialogFragment {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
- AlertDialog d = (AlertDialog) getDialog();
- Button positiveButton = (Button) d
- .getButton(Dialog.BUTTON_POSITIVE);
if (isChecked) {
- d.setTitle(getString(R.string.register_account));
- positiveButton.setText("Register");
passwordConfirm.setVisibility(View.VISIBLE);
confirmPwDesc.setVisibility(View.VISIBLE);
} else {
- d.setTitle("Add account");
passwordConfirm.setVisibility(View.GONE);
- positiveButton.setText("Add");
confirmPwDesc.setVisibility(View.GONE);
}
}
});
builder.setView(view);
- builder.setNeutralButton("Cancel", null);
- builder.setPositiveButton(okButtonDesc, null);
+ builder.setNeutralButton(R.string.cancel, null);
+ builder.setPositiveButton(R.string.save, null);
return builder.create();
}
@@ -114,7 +99,9 @@ public class EditAccount extends DialogFragment {
String jid = jidEdit.getText().toString();
EditText passwordEdit = (EditText) d
.findViewById(R.id.account_password);
+ EditText passwordConfirmEdit = (EditText) d.findViewById(R.id.account_password_confirm2);
String password = passwordEdit.getText().toString();
+ String passwordConfirm = passwordConfirmEdit.getText().toString();
CheckBox register = (CheckBox) d.findViewById(R.id.edit_account_register_new);
String username;
String server;
@@ -123,9 +110,15 @@ public class EditAccount extends DialogFragment {
username = parts[0];
server = parts[1];
} else {
- jidEdit.setError("Invalid Jabber ID");
+ jidEdit.setError(getString(R.string.invalid_jid));
return;
}
+ if (register.isChecked()) {
+ if (!passwordConfirm.equals(password)) {
+ passwordConfirmEdit.setError(getString(R.string.passwords_do_not_match));
+ return;
+ }
+ }
if (account != null) {
account.setPassword(password);
account.setUsername(username);