mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-12-26 13:38:59 +00:00
User can hit enter to send a comment
This commit is contained in:
parent
120872a131
commit
a7e812b8e5
@ -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<Post>{
|
||||
}
|
||||
});
|
||||
|
||||
//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;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@
|
||||
android:layout_weight="1"
|
||||
style="@style/TextAppearance.AppCompat"
|
||||
android:hint="@string/new_comment_hint"
|
||||
android:inputType="textMultiLine" />
|
||||
android:inputType="text" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/comment_send_button"
|
||||
|
Loading…
Reference in New Issue
Block a user