fixed enter is send option

This commit is contained in:
iNPUTmice 2015-03-06 22:22:50 +01:00
parent 44028a547f
commit cbca92d209
2 changed files with 10 additions and 6 deletions

View File

@ -1012,8 +1012,13 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
} }
@Override @Override
public void onEnterPressed() { public boolean onEnterPressed() {
if (activity.enterIsSend()) {
sendMessage(); sendMessage();
return true;
} else {
return false;
}
} }
@Override @Override

View File

@ -37,11 +37,10 @@ public class EditMessage extends EditText {
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_ENTER) { if (keyCode == KeyEvent.KEYCODE_ENTER) {
if (keyboardListener != null) { if (keyboardListener != null && keyboardListener.onEnterPressed()) {
keyboardListener.onEnterPressed();
}
return true; return true;
} }
}
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
} }
@ -70,7 +69,7 @@ public class EditMessage extends EditText {
} }
public interface KeyboardListener { public interface KeyboardListener {
public void onEnterPressed(); public boolean onEnterPressed();
public void onTypingStarted(); public void onTypingStarted();
public void onTypingStopped(); public void onTypingStopped();
public void onTextDeleted(); public void onTextDeleted();