Fix more IME actions
b/13544189 Change-Id: I5dbbf45a1b68cac2d63ba41c70daff9d33cbb492
This commit is contained in:
parent
d1a48cb5f4
commit
6cbdd5bba0
|
@ -35,8 +35,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/account_setup_incoming_username_label"
|
||||
android:inputType="textEmailAddress"
|
||||
android:imeOptions="actionDone" />
|
||||
android:inputType="textEmailAddress" />
|
||||
</TableRow>
|
||||
<TableRow
|
||||
android:paddingTop="16dip" >
|
||||
|
@ -95,8 +94,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/account_setup_incoming_server_label"
|
||||
android:inputType="textUri"
|
||||
android:imeOptions="actionDone" />
|
||||
android:inputType="textUri" />
|
||||
</TableRow>
|
||||
<TableRow
|
||||
android:paddingTop="16dip" >
|
||||
|
@ -125,8 +123,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/account_setup_incoming_port_label"
|
||||
android:inputType="number"
|
||||
android:imeOptions="actionDone" />
|
||||
android:inputType="number" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
|
@ -159,8 +156,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/account_setup_incoming_imap_path_prefix_label"
|
||||
android:hint="@string/account_setup_incoming_imap_path_prefix_hint"
|
||||
android:inputType="text"
|
||||
android:imeOptions="actionDone" />
|
||||
android:inputType="text" />
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@
|
|||
android:id="@+id/account_server"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textUri"
|
||||
android:imeOptions="actionDone" />
|
||||
android:inputType="textUri" />
|
||||
</TableRow>
|
||||
<TableRow
|
||||
android:paddingTop="16dip" >
|
||||
|
@ -63,8 +62,7 @@
|
|||
android:id="@+id/account_port"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:imeOptions="actionDone" />
|
||||
android:inputType="number" />
|
||||
</TableRow>
|
||||
<!-- Note, this row is not a TableRow, and it will span the entire table - no columns -->
|
||||
<LinearLayout
|
||||
|
@ -103,8 +101,7 @@
|
|||
android:id="@+id/account_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textEmailAddress"
|
||||
android:imeOptions="actionDone" />
|
||||
android:inputType="textEmailAddress" />
|
||||
</TableRow>
|
||||
<TableRow
|
||||
android:id="@+id/account_require_login_settings_2"
|
||||
|
|
|
@ -31,8 +31,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:hint="@string/account_setup_incoming_username_label"
|
||||
android:inputType="textEmailAddress"
|
||||
android:imeOptions="actionNext" />
|
||||
android:inputType="textEmailAddress" />
|
||||
|
||||
<com.android.email.activity.setup.AuthenticationView
|
||||
android:id="@+id/authentication_view"
|
||||
|
@ -80,8 +79,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:hint="@string/account_setup_incoming_server_label"
|
||||
android:inputType="textUri"
|
||||
android:imeOptions="actionNext" />
|
||||
android:inputType="textUri" />
|
||||
<TextView
|
||||
android:text="@string/account_setup_incoming_port_label"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -92,8 +90,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:hint="@string/account_setup_incoming_port_label"
|
||||
android:inputType="number"
|
||||
android:imeOptions="actionDone" />
|
||||
android:inputType="number" />
|
||||
<TextView
|
||||
android:text="@string/account_setup_incoming_security_label"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -131,7 +128,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:hint="@string/account_setup_incoming_imap_path_prefix_hint"
|
||||
android:inputType="text"
|
||||
android:imeOptions="actionDone" />
|
||||
android:inputType="text" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
<EditText
|
||||
android:id="@+id/account_server"
|
||||
android:inputType="textUri"
|
||||
android:imeOptions="actionDone"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
<TextView
|
||||
|
@ -40,7 +39,6 @@
|
|||
<EditText
|
||||
android:id="@+id/account_port"
|
||||
android:inputType="number"
|
||||
android:imeOptions="actionDone"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
<TextView
|
||||
|
@ -71,7 +69,6 @@
|
|||
<EditText
|
||||
android:id="@+id/account_username"
|
||||
android:inputType="textEmailAddress"
|
||||
android:imeOptions="actionDone"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
<com.android.email.activity.setup.AuthenticationView
|
||||
|
|
|
@ -22,14 +22,11 @@ import android.content.Context;
|
|||
import android.content.Loader;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnFocusChangeListener;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TextView.OnEditorActionListener;
|
||||
|
||||
import com.android.email.R;
|
||||
import com.android.email.activity.UiUtilities;
|
||||
|
@ -238,32 +235,6 @@ public abstract class AccountServerBaseFragment extends AccountSetupFragment
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A keyboard listener which dismisses the keyboard when "DONE" is pressed, but doesn't muck
|
||||
* around with focus. This is useful in settings screens, as we don't want focus to change
|
||||
* since some fields throw up errors when they're focused to give the user more info.
|
||||
*/
|
||||
protected final OnEditorActionListener mDismissImeOnDoneListener =
|
||||
new OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
// Dismiss soft keyboard but don't modify focus.
|
||||
final Context context = getActivity();
|
||||
if (context == null) {
|
||||
return false;
|
||||
}
|
||||
final InputMethodManager imm = (InputMethodManager) context.getSystemService(
|
||||
Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null && imm.isActive()) {
|
||||
imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns whether or not any settings have changed.
|
||||
*/
|
||||
|
|
|
@ -24,12 +24,10 @@ import android.text.Editable;
|
|||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.format.DateUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -50,7 +48,7 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
|
||||
public class AccountSetupCredentialsFragment extends AccountSetupFragment
|
||||
implements OnClickListener, HostCallback, TextView.OnEditorActionListener {
|
||||
implements OnClickListener, HostCallback {
|
||||
|
||||
private static final int CERTIFICATE_REQUEST = 1000;
|
||||
|
||||
|
@ -146,9 +144,6 @@ public class AccountSetupCredentialsFragment extends AccountSetupFragment
|
|||
mClientCertificateSelector.setHostCallback(this);
|
||||
mClientCertificateSelector.setCertificate(getArguments().getString(EXTRA_CLIENT_CERT));
|
||||
|
||||
mImapPasswordText.setOnEditorActionListener(this);
|
||||
mRegularPasswordText.setOnEditorActionListener(this);
|
||||
|
||||
// After any text edits, call validateFields() which enables or disables the Next button
|
||||
mValidationTextWatcher = new TextWatcher() {
|
||||
@Override
|
||||
|
@ -213,12 +208,10 @@ public class AccountSetupCredentialsFragment extends AccountSetupFragment
|
|||
super.onDestroy();
|
||||
if (mImapPasswordText != null) {
|
||||
mImapPasswordText.removeTextChangedListener(mValidationTextWatcher);
|
||||
mImapPasswordText.setOnEditorActionListener(null);
|
||||
mImapPasswordText = null;
|
||||
}
|
||||
if (mRegularPasswordText != null) {
|
||||
mRegularPasswordText.removeTextChangedListener(mValidationTextWatcher);
|
||||
mRegularPasswordText.setOnEditorActionListener(null);
|
||||
mRegularPasswordText = null;
|
||||
}
|
||||
}
|
||||
|
@ -310,22 +303,6 @@ public class AccountSetupCredentialsFragment extends AccountSetupFragment
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
if (isNextButtonEnabled()) {
|
||||
final Callback callback = (Callback) getActivity();
|
||||
if (callback != null) {
|
||||
final Bundle results = getCredentialResults();
|
||||
callback.onCredentialsComplete(results);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
if (mOfferOAuth) {
|
||||
return mImapPasswordText.getText().toString();
|
||||
|
|
|
@ -318,21 +318,18 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
|
|||
account == null, account == null || account.mHostAuthRecv == null);
|
||||
return;
|
||||
}
|
||||
TextView lastView = mImapPathPrefixView;
|
||||
mBaseScheme = account.mHostAuthRecv.mProtocol;
|
||||
mServerLabelView.setText(R.string.account_setup_incoming_server_label);
|
||||
mServerView.setContentDescription(getResources().getText(
|
||||
R.string.account_setup_incoming_server_label));
|
||||
if (!mServiceInfo.offerPrefix) {
|
||||
mImapPathPrefixSectionView.setVisibility(View.GONE);
|
||||
lastView = mPortView;
|
||||
}
|
||||
if (!mServiceInfo.offerLocalDeletes) {
|
||||
mDeletePolicyLabelView.setVisibility(View.GONE);
|
||||
mDeletePolicyView.setVisibility(View.GONE);
|
||||
mPortView.setImeOptions(EditorInfo.IME_ACTION_NEXT);
|
||||
}
|
||||
lastView.setOnEditorActionListener(mDismissImeOnDoneListener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue