From 231f82a8cd409077419d601538eb26f0f9dfd283 Mon Sep 17 00:00:00 2001 From: Thodoris1999 Date: Thu, 13 Sep 2018 15:46:44 +0300 Subject: [PATCH] do not allow line break character on subject edittexts --- .../activities/create_content/CreateContentActivity.java | 4 ++++ .../java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/create_content/CreateContentActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/create_content/CreateContentActivity.java index 781bb9f3..b0b6a11b 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/create_content/CreateContentActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/create_content/CreateContentActivity.java @@ -5,7 +5,9 @@ import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.design.widget.TextInputLayout; +import android.text.InputType; import android.view.View; +import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.widget.Toast; @@ -50,6 +52,8 @@ public class CreateContentActivity extends BaseActivity implements EmojiKeyboard emojiKeyboard = findViewById(R.id.emoji_keyboard); subjectInput = findViewById(R.id.subject_input); + subjectInput.getEditText().setRawInputType(InputType.TYPE_CLASS_TEXT); + subjectInput.getEditText().setImeOptions(EditorInfo.IME_ACTION_DONE); contentEditor = findViewById(R.id.main_content_editorview); setEmojiKeyboardInputConnection(contentEditor.getInputConnection()); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java index 4c853526..bf9f3b52 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java @@ -16,10 +16,12 @@ import android.support.v4.content.res.ResourcesCompat; import android.support.v7.app.AlertDialog; import android.support.v7.content.res.AppCompatResources; import android.support.v7.widget.RecyclerView; +import android.text.InputType; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; import android.webkit.WebResourceRequest; @@ -456,6 +458,8 @@ class TopicAdapter extends RecyclerView.Adapter { .into(holder.thumbnail); holder.username.setText(getSessionManager().getUsername()); holder.quickReplySubject.setText("Re: " + viewModel.getTopicTitle().getValue()); + holder.quickReplySubject.setRawInputType(InputType.TYPE_CLASS_TEXT); + holder.quickReplySubject.setImeOptions(EditorInfo.IME_ACTION_DONE); holder.replyEditor.setEmojiKeyboardOwner(emojiKeyboardOwner); InputConnection ic = holder.replyEditor.getInputConnection(); @@ -505,6 +509,8 @@ class TopicAdapter extends RecyclerView.Adapter { .into(holder.thumbnail); holder.username.setText(getSessionManager().getUsername()); holder.editSubject.setText(postsList.get(position).getSubject()); + holder.editSubject.setRawInputType(InputType.TYPE_CLASS_TEXT); + holder.editSubject.setImeOptions(EditorInfo.IME_ACTION_DONE); holder.editEditor.setEmojiKeyboardOwner(emojiKeyboardOwner); InputConnection ic = holder.editEditor.getInputConnection();