diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/PostsAdapter.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/PostsAdapter.java index c22edcf..8500a8a 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/PostsAdapter.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/PostsAdapter.java @@ -4,6 +4,7 @@ import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.ArrayMap; +import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -243,6 +244,21 @@ public class PostsAdapter extends ArrayAdapter{ } }); + //Make the comment input behaves like the send button when the user hit the + //enter key + input_comment.setOnKeyListener(new View.OnKeyListener() { + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + + if(event.getAction() == KeyEvent.ACTION_DOWN + && keyCode == KeyEvent.KEYCODE_ENTER){ + sendComment(position, finalConvertView); + } + + return false; + } + }); + } } diff --git a/app/src/main/res/layout/post_item.xml b/app/src/main/res/layout/post_item.xml index 20920cb..c09d95a 100644 --- a/app/src/main/res/layout/post_item.xml +++ b/app/src/main/res/layout/post_item.xml @@ -115,7 +115,7 @@ android:layout_weight="1" style="@style/TextAppearance.AppCompat" android:hint="@string/new_comment_hint" - android:inputType="textMultiLine" /> + android:inputType="text" />