1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-25 18:32:15 -05:00

Show error if user is not connected but sends a message

This commit is contained in:
Sebastian Kaspari 2010-03-10 23:53:39 +01:00
parent 0570e3d638
commit 031c042d50
2 changed files with 8 additions and 0 deletions

BIN
res/drawable/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

View File

@ -343,6 +343,14 @@ public class ConversationActivity extends Activity implements ServiceConnection,
public boolean onKey(View view, int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) {
if (!server.isConnected()) {
Message message = new Message("Not connected");
message.setColor(Message.COLOR_RED);
message.setIcon(R.drawable.error);
server.getConversation(server.getSelectedConversation()).addMessage(message);
onConversationMessage(server.getSelectedConversation());
}
EditText input = (EditText) view;
String text = input.getText().toString();
input.setText("");