am 1be8b05b
: The error message "This field can\'t be blank" can be ignored
* commit '1be8b05bb59c3e87fef0f4c474a24f678367b495': The error message "This field can't be blank" can be ignored
This commit is contained in:
commit
04c771810a
@ -264,8 +264,6 @@
|
|||||||
<!-- On "Set up email" screen, label of text field -->
|
<!-- On "Set up email" screen, label of text field -->
|
||||||
<string name="account_setup_names_user_name_label">
|
<string name="account_setup_names_user_name_label">
|
||||||
Your name (displayed on outgoing messages)</string>
|
Your name (displayed on outgoing messages)</string>
|
||||||
<!-- On "Set up email" screen, error pop-up when user_name field is empty [CHAR LIMIT=none] -->
|
|
||||||
<string name="account_setup_names_user_name_empty_error">This field can\'t be blank.</string>
|
|
||||||
|
|
||||||
<!-- Activity Title for the account type selector (IMAP or POP3 or EAS) [CHAR LIMIT=45] -->
|
<!-- Activity Title for the account type selector (IMAP or POP3 or EAS) [CHAR LIMIT=45] -->
|
||||||
<string name="account_setup_account_type_title">Account setup</string>
|
<string name="account_setup_account_type_title">Account setup</string>
|
||||||
|
@ -23,9 +23,7 @@ import android.content.Loader;
|
|||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
import android.text.Editable;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.text.method.TextKeyListener;
|
import android.text.method.TextKeyListener;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -41,7 +39,6 @@ public class AccountSetupNamesFragment extends AccountSetupFragment {
|
|||||||
private EditText mDescription;
|
private EditText mDescription;
|
||||||
private EditText mName;
|
private EditText mName;
|
||||||
private View mAccountNameLabel;
|
private View mAccountNameLabel;
|
||||||
private boolean mRequiresName = true;
|
|
||||||
|
|
||||||
public interface Callback extends AccountSetupFragment.Callback {
|
public interface Callback extends AccountSetupFragment.Callback {
|
||||||
|
|
||||||
@ -64,22 +61,6 @@ public class AccountSetupNamesFragment extends AccountSetupFragment {
|
|||||||
mDescription = UiUtilities.getView(view, R.id.account_description);
|
mDescription = UiUtilities.getView(view, R.id.account_description);
|
||||||
mName = UiUtilities.getView(view, R.id.account_name);
|
mName = UiUtilities.getView(view, R.id.account_name);
|
||||||
mAccountNameLabel = UiUtilities.getView(view, R.id.account_name_label);
|
mAccountNameLabel = UiUtilities.getView(view, R.id.account_name_label);
|
||||||
|
|
||||||
final TextWatcher validationTextWatcher = new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
validateFields();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
mName.addTextChangedListener(validationTextWatcher);
|
|
||||||
mName.setKeyListener(TextKeyListener.getInstance(false, TextKeyListener.Capitalize.WORDS));
|
mName.setKeyListener(TextKeyListener.getInstance(false, TextKeyListener.Capitalize.WORDS));
|
||||||
|
|
||||||
setPreviousButtonVisibility(View.INVISIBLE);
|
setPreviousButtonVisibility(View.INVISIBLE);
|
||||||
@ -113,7 +94,6 @@ public class AccountSetupNamesFragment extends AccountSetupFragment {
|
|||||||
final EmailServiceUtils.EmailServiceInfo info =
|
final EmailServiceUtils.EmailServiceInfo info =
|
||||||
setupData.getIncomingServiceInfo(getActivity());
|
setupData.getIncomingServiceInfo(getActivity());
|
||||||
if (!info.usesSmtp) {
|
if (!info.usesSmtp) {
|
||||||
mRequiresName = false;
|
|
||||||
mName.setVisibility(View.GONE);
|
mName.setVisibility(View.GONE);
|
||||||
mAccountNameLabel.setVisibility(View.GONE);
|
mAccountNameLabel.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
@ -151,27 +131,6 @@ public class AccountSetupNamesFragment extends AccountSetupFragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the "done" button is in the proper state
|
|
||||||
validateFields();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check input fields for legal values and enable/disable next button
|
|
||||||
*/
|
|
||||||
private void validateFields() {
|
|
||||||
boolean enableNextButton = true;
|
|
||||||
// Validation is based only on the "user name" field, not shown for EAS accounts
|
|
||||||
if (mRequiresName) {
|
|
||||||
final String userName = mName.getText().toString().trim();
|
|
||||||
if (TextUtils.isEmpty(userName)) {
|
|
||||||
enableNextButton = false;
|
|
||||||
mName.setError(getString(R.string.account_setup_names_user_name_empty_error));
|
|
||||||
} else {
|
|
||||||
mName.setError(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setNextButtonEnabled(enableNextButton);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
|
Loading…
Reference in New Issue
Block a user