diff --git a/k9mail/src/main/java/com/fsck/k9/view/RecipientSelectView.java b/k9mail/src/main/java/com/fsck/k9/view/RecipientSelectView.java index 9a96a4992f6..f7cfbd651fc 100644 --- a/k9mail/src/main/java/com/fsck/k9/view/RecipientSelectView.java +++ b/k9mail/src/main/java/com/fsck/k9/view/RecipientSelectView.java @@ -13,6 +13,7 @@ import android.app.LoaderManager.LoaderCallbacks; import android.content.Context; import android.content.Loader; +import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -195,6 +196,22 @@ protected void onDetachedFromWindow() { attachedToWindow = false; } + @Override + public void onFocusChanged(boolean hasFocus, int direction, Rect previous) { + super.onFocusChanged(hasFocus, direction, previous); + if (hasFocus) { + displayKeyboard(); + } + } + + private void displayKeyboard() { + InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + if (imm == null) { + return; + } + imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT); + } + @Override public void showDropDown() { boolean cursorIsValid = adapter != null; @@ -343,7 +360,13 @@ public void onLoaderReset(Loader> loader) { } public boolean hasUncompletedText() { - return !TextUtils.isEmpty(currentCompletionText()); + String currentCompletionText = currentCompletionText(); + return !TextUtils.isEmpty(currentCompletionText) && !isPlaceholderText(currentCompletionText); + } + + static private boolean isPlaceholderText(String currentCompletionText) { + // TODO string matching here is sort of a hack, but it's somewhat reliable and the info isn't easily available + return currentCompletionText.startsWith("+") && currentCompletionText.substring(1).matches("[0-9]+"); } @Override