So, I may be able to trick the SMS app from sending the message when
the enter key is pressed by temporarily setting the shift state of the
key event to pressed, before its delivered to the EditText view via the
InputConnection.
In that case it should add a newline instead of sending the message.
I'm not sure this is actually a good idea, however my users are asking
and its fun to poke around :)
in case anyone is interested, this is the code from the SMS app that
causes the enter key to send the SMS message:
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} p.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #528f73}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height:
15.0px} span.s1 {color: #911d67} span.s2 {color: #000000}
public boolean onEditorAction(TextView v, int actionId, KeyEvent event)
{
if (event != null) {
// if shift key is down, then we want to insert the '\n' char in the
TextView;
// otherwise, the default action is to send the message.
if (!event.isShiftPressed()) {
if (isPreparedForSending()) {
confirmSendMessageIfNeeded();
}
return true;
}
return false;
}
if (isPreparedForSending()) {
confirmSendMessageIfNeeded();
}
return true;
}
Thats actually and event listener on the EditText view where
EditText.setOnEditorActionListener has been set.
- Brill Pappin
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en