mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-27 07:49:28 +00:00
Pressing return key when typing a message in the conversation system request the message to be sent.
This commit is contained in:
parent
d68755f4fe
commit
fcf25c8da5
@ -13,9 +13,11 @@ import android.support.annotation.NonNull;
|
|||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.KeyEvent;
|
||||||
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.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
@ -246,6 +248,35 @@ public class ConversationFragment extends Fragment
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Make message input act like send button on enter key press
|
||||||
|
new_message_content.setOnKeyListener(new View.OnKeyListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||||
|
|
||||||
|
if(event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||||
|
send_message();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/*setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||||
|
|
||||||
|
if(event != null){
|
||||||
|
if(event.getKeyCode() == KeyEvent.KEYCODE_ENTER &&
|
||||||
|
//actionId == EditorInfo.IME_NULL &&
|
||||||
|
event.getAction() == KeyEvent.ACTION_DOWN)
|
||||||
|
send_message();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
|
||||||
//Make pick image button lives
|
//Make pick image button lives
|
||||||
pick_image_button.setOnClickListener(new View.OnClickListener() {
|
pick_image_button.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="text"
|
||||||
android:hint="@string/fragment_conversation_new_message_placeholder"/>
|
android:hint="@string/fragment_conversation_new_message_placeholder"/>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
|
Loading…
Reference in New Issue
Block a user