mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Fix for #142
Workaround for multiline mode with enter to send ( http://stackoverflow.com/a/6772713/4026792 )
This commit is contained in:
@@ -2,7 +2,6 @@ package com.moez.QKSMS.ui.conversationlist;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
|
||||
@@ -33,7 +33,6 @@ import com.moez.QKSMS.transaction.SmsHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.google.android.mms.pdu_alt.NotificationInd;
|
||||
import com.google.android.mms.pdu_alt.PduHeaders;
|
||||
import com.google.android.mms.pdu_alt.PduPersister;
|
||||
import com.google.android.mms.pdu_alt.RetrieveConf;
|
||||
import com.google.android.mms.pdu_alt.SendReq;
|
||||
import com.moez.QKSMS.QKSMSApp;
|
||||
import com.moez.QKSMS.R;
|
||||
import com.moez.QKSMS.data.Contact;
|
||||
|
||||
@@ -194,18 +194,23 @@ public class ComposeView extends LinearLayout implements View.OnClickListener, L
|
||||
switch (Integer.parseInt(mPrefs.getString(SettingsFragment.ENTER_BUTTON, "0"))) {
|
||||
case 0: // emoji
|
||||
break;
|
||||
case 1: // return
|
||||
case 1: // new line
|
||||
mReplyText.setInputType(InputType.TYPE_CLASS_TEXT |
|
||||
InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE |
|
||||
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
|
||||
InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE);
|
||||
mReplyText.setSingleLine(false);
|
||||
break;
|
||||
case 2: // send
|
||||
mReplyText.setInputType(
|
||||
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
|
||||
mReplyText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI |
|
||||
EditorInfo.IME_ACTION_SEND);
|
||||
mReplyText.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
mReplyText.setSingleLine(false);
|
||||
mReplyText.setOnKeyListener(new OnKeyListener() { //Workaround because ACTION_SEND does not support multiline mode
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (keyCode == 66) {
|
||||
sendSms();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}});
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -228,18 +233,6 @@ public class ComposeView extends LinearLayout implements View.OnClickListener, L
|
||||
}
|
||||
});
|
||||
|
||||
mReplyText.setOnEditorActionListener(new android.widget.TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(android.widget.TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_SEND) {
|
||||
sendSms();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mProgressAnimator = new ValueAnimator();
|
||||
mProgressAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
mProgressAnimator.setDuration(mDelayDuration);
|
||||
@@ -460,7 +453,9 @@ public class ComposeView extends LinearLayout implements View.OnClickListener, L
|
||||
}
|
||||
|
||||
long threadId = mConversation != null ? mConversation.getThreadId() : 0;
|
||||
sendTransaction.sendNewMessage(message, threadId);
|
||||
if (!message.toString().equals("")) {
|
||||
sendTransaction.sendNewMessage(message, threadId);
|
||||
}
|
||||
NotificationManager.update(mContext);
|
||||
|
||||
if (mConversationLegacy != null) {
|
||||
|
||||
Reference in New Issue
Block a user