jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/333920 )
Change subject: Fix: wrap long description inputs across multiple lines ...................................................................... Fix: wrap long description inputs across multiple lines Setting the IME options to "actionDone" unexpectedly disables the multiline wrap behavior of the EditText. Add a workaround to PlainPasteEditText after the input connection is made Change-Id: Iea367c06f238c4bf62d01feea631f13bba6d0c15 --- M app/src/main/java/org/wikipedia/views/PlainPasteEditText.java M app/src/main/res/layout/view_description_edit.xml 2 files changed, 19 insertions(+), 1 deletion(-) Approvals: jenkins-bot: Verified Mholloway: Looks good to me, approved diff --git a/app/src/main/java/org/wikipedia/views/PlainPasteEditText.java b/app/src/main/java/org/wikipedia/views/PlainPasteEditText.java index 4dbf47f..227c53e 100644 --- a/app/src/main/java/org/wikipedia/views/PlainPasteEditText.java +++ b/app/src/main/java/org/wikipedia/views/PlainPasteEditText.java @@ -5,8 +5,12 @@ import android.content.Context; import android.support.design.widget.TextInputEditText; import android.util.AttributeSet; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputConnection; import org.wikipedia.util.ClipboardUtil; + +import static android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE; public class PlainPasteEditText extends TextInputEditText { public PlainPasteEditText(Context context) { @@ -29,6 +33,20 @@ return super.onTextContextMenuItem(id); } + @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { + InputConnection connection = super.onCreateInputConnection(outAttrs); + + // For multiline EditTexts that specify a done keyboard action, unset the no carriage return + // flag which otherwise limits the EditText to a single line + boolean multilineInput = (getInputType() & TYPE_TEXT_FLAG_MULTI_LINE) == TYPE_TEXT_FLAG_MULTI_LINE; + boolean actionDone = (outAttrs.imeOptions & EditorInfo.IME_ACTION_DONE) == EditorInfo.IME_ACTION_DONE; + if (actionDone && multilineInput) { + outAttrs.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION; + } + + return connection; + } + private boolean onTextContextMenuPaste() { // Do not allow pasting of formatted text! // We do this by intercepting the clipboard and temporarily replacing its diff --git a/app/src/main/res/layout/view_description_edit.xml b/app/src/main/res/layout/view_description_edit.xml index dd6e630..7ec2a27 100644 --- a/app/src/main/res/layout/view_description_edit.xml +++ b/app/src/main/res/layout/view_description_edit.xml @@ -120,7 +120,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:imeOptions="actionDone" - android:inputType="text" + android:inputType="textMultiLine" android:hint="@string/description_edit_text_hint"/> </android.support.design.widget.TextInputLayout> -- To view, visit https://gerrit.wikimedia.org/r/333920 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iea367c06f238c4bf62d01feea631f13bba6d0c15 Gerrit-PatchSet: 2 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org> Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org> Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org> Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org> Gerrit-Reviewer: Niedzielski <sniedziel...@wikimedia.org> Gerrit-Reviewer: Sniedzielski <sniedziel...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits