1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-28 04:02:19 -05:00

Issue 708

Basically, patch submitted by themaninthesuitcase in Issue 708, but
consolidated into a single method.
This commit is contained in:
Daniel Applebaum 2009-10-23 01:03:51 +00:00
parent 6815f85684
commit e315ee9156

View File

@ -120,9 +120,11 @@ public class AccountSetupBasics extends K9Activity
} }
private void validateFields() { private void validateFields() {
String email = mEmailView.getText().toString();
boolean valid = Utility.requiredFieldValid(mEmailView) boolean valid = Utility.requiredFieldValid(mEmailView)
&& Utility.requiredFieldValid(mPasswordView) && Utility.requiredFieldValid(mPasswordView)
&& mEmailValidator.isValid(mEmailView.getText().toString()); && mEmailValidator.isValid(email);
/*&& email.contains("@"); */ // Not sure if this is a good idea or not
mNextButton.setEnabled(valid); mNextButton.setEnabled(valid);
mManualSetupButton.setEnabled(valid); mManualSetupButton.setEnabled(valid);
/* /*
@ -181,7 +183,7 @@ public class AccountSetupBasics extends K9Activity
private void finishAutoSetup() { private void finishAutoSetup() {
String email = mEmailView.getText().toString(); String email = mEmailView.getText().toString();
String password = mPasswordView.getText().toString(); String password = mPasswordView.getText().toString();
String[] emailParts = email.split("@"); String[] emailParts = splitEmail(email);
String user = emailParts[0]; String user = emailParts[0];
String domain = emailParts[1]; String domain = emailParts[1];
URI incomingUri = null; URI incomingUri = null;
@ -233,7 +235,7 @@ public class AccountSetupBasics extends K9Activity
private void onNext() { private void onNext() {
String email = mEmailView.getText().toString(); String email = mEmailView.getText().toString();
String password = mPasswordView.getText().toString(); String password = mPasswordView.getText().toString();
String[] emailParts = email.split("@"); String[] emailParts = splitEmail(email);
String user = emailParts[0]; String user = emailParts[0];
String domain = emailParts[1]; String domain = emailParts[1];
mProvider = findProviderForDomain(domain); mProvider = findProviderForDomain(domain);
@ -271,7 +273,7 @@ public class AccountSetupBasics extends K9Activity
private void onManualSetup() { private void onManualSetup() {
String email = mEmailView.getText().toString(); String email = mEmailView.getText().toString();
String password = mPasswordView.getText().toString(); String password = mPasswordView.getText().toString();
String[] emailParts = email.split("@"); String[] emailParts = splitEmail(email);
String user = emailParts[0]; String user = emailParts[0];
String domain = emailParts[1]; String domain = emailParts[1];
@ -366,6 +368,15 @@ public class AccountSetupBasics extends K9Activity
return null; return null;
} }
private String[] splitEmail(String email)
{
String[] retParts = new String[2];
String[] emailParts = email.split("@");
retParts[0] = (emailParts.length > 0 ) ? emailParts[0] : "";
retParts[1] = (emailParts.length > 1 ) ? emailParts[1] : "";
return retParts;
}
static class Provider implements Serializable { static class Provider implements Serializable {
private static final long serialVersionUID = 8511656164616538989L; private static final long serialVersionUID = 8511656164616538989L;