Fix issues with clicks

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-01-25 16:02:52 +01:00
parent f08b8e63bb
commit 955de43b45
4 changed files with 26 additions and 14 deletions

View file

@ -30,6 +30,7 @@ import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.Button; import android.widget.Button;
import com.bluelinelabs.conductor.RouterTransaction; import com.bluelinelabs.conductor.RouterTransaction;
@ -128,6 +129,14 @@ public class EntryMenuController extends BaseController {
super.onViewBound(view); super.onViewBound(view);
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this); 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() { editText.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { 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 (!TextUtils.isEmpty(s)) {
if (operationCode == 2) { if (operationCode == 2) {
if (room.getName() == null || !room.getName().equals(s.toString())) { if (room.getName() == null || !room.getName().equals(s.toString())) {
if (proceedButton.isEnabled()) { if (!proceedButton.isEnabled()) {
proceedButton.setEnabled(true); proceedButton.setEnabled(true);
proceedButton.setAlpha(1.0f); proceedButton.setAlpha(1.0f);
} }
} else { } else {
if (!proceedButton.isEnabled()) { if (proceedButton.isEnabled()) {
proceedButton.setEnabled(false); proceedButton.setEnabled(false);
proceedButton.setAlpha(0.7f); proceedButton.setAlpha(0.7f);
} }

View file

@ -28,7 +28,7 @@
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes <studio.carbonylgroup.textfieldboxes.TextFieldBoxes
android:id="@+id/text_field_boxes" android:id="@+id/text_field_boxes"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="96dp" android:layout_height="104dp"
android:layout_marginEnd="@dimen/activity_horizontal_margin" android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin" android:layout_marginStart="@dimen/activity_horizontal_margin"
app:errorColor="@color/nc_darkRed" app:errorColor="@color/nc_darkRed"

View file

@ -25,24 +25,27 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:background="@color/nc_white_color" android:background="@color/nc_white_color">
android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/icon_image_view" android:id="@+id/icon_image_view"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginStart="16dp"/> android:layout_marginStart="16dp"
android:focusable="false"
android:focusableInTouchMode="false"/>
<TextView <TextView
android:id="@+id/app_title_text_view" android:id="@+id/app_title_text_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_toEndOf="@id/icon_image_view" android:layout_toEndOf="@id/icon_image_view"
android:focusable="false"
android:focusableInTouchMode="false"
android:textAlignment="center" android:textAlignment="center"
android:textSize="12sp" android:textSize="12sp"
tools:text="App title"/> tools:text="App title"/>

View file

@ -22,16 +22,16 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:orientation="vertical"> android:layout_marginTop="16dp">
<TextView <TextView
android:id="@+id/menu_text" android:id="@+id/menu_text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:textSize="12sp"/> android:textSize="12sp"/>
</RelativeLayout> </RelativeLayout>