From 955de43b45ebd2ac40067ddbad501f07c06f6fc6 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Thu, 25 Jan 2018 16:02:52 +0100 Subject: [PATCH] Fix issues with clicks Signed-off-by: Mario Danic --- .../bottomsheet/EntryMenuController.java | 13 +++++++++++-- app/src/main/res/layout/controller_entry_menu.xml | 2 +- app/src/main/res/layout/rv_item_app.xml | 15 +++++++++------ app/src/main/res/layout/rv_item_menu.xml | 10 +++++----- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.java b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.java index c5cf8f1cb..f6646ab9d 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.java @@ -30,6 +30,7 @@ import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.EditorInfo; import android.widget.Button; import com.bluelinelabs.conductor.RouterTransaction; @@ -128,6 +129,14 @@ public class EntryMenuController extends BaseController { super.onViewBound(view); NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this); + editText.setOnEditorActionListener((v, actionId, event) -> { + if (actionId == EditorInfo.IME_ACTION_DONE && proceedButton.isEnabled()) { + proceedButton.callOnClick(); + return true; + } + return false; + }); + editText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -144,12 +153,12 @@ public class EntryMenuController extends BaseController { if (!TextUtils.isEmpty(s)) { if (operationCode == 2) { if (room.getName() == null || !room.getName().equals(s.toString())) { - if (proceedButton.isEnabled()) { + if (!proceedButton.isEnabled()) { proceedButton.setEnabled(true); proceedButton.setAlpha(1.0f); } } else { - if (!proceedButton.isEnabled()) { + if (proceedButton.isEnabled()) { proceedButton.setEnabled(false); proceedButton.setAlpha(0.7f); } diff --git a/app/src/main/res/layout/controller_entry_menu.xml b/app/src/main/res/layout/controller_entry_menu.xml index ff85b58ec..6eee8210c 100644 --- a/app/src/main/res/layout/controller_entry_menu.xml +++ b/app/src/main/res/layout/controller_entry_menu.xml @@ -28,7 +28,7 @@ + android:background="@color/nc_white_color"> + android:layout_marginStart="16dp" + android:focusable="false" + android:focusableInTouchMode="false"/> - \ No newline at end of file + diff --git a/app/src/main/res/layout/rv_item_menu.xml b/app/src/main/res/layout/rv_item_menu.xml index 228b2ac34..6b294bcdf 100644 --- a/app/src/main/res/layout/rv_item_menu.xml +++ b/app/src/main/res/layout/rv_item_menu.xml @@ -22,16 +22,16 @@ + android:layout_marginTop="16dp"> - - \ No newline at end of file +