mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-26 10:52:16 -05:00
Do more work on threads
This commit is contained in:
parent
6da41e633a
commit
2a679baf6e
@ -138,6 +138,8 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fill view with messages that have been buffered while paused
|
// Fill view with messages that have been buffered while paused
|
||||||
|
new Thread() {
|
||||||
|
public void run() {
|
||||||
for (Conversation conversation : server.getConversations()) {
|
for (Conversation conversation : server.getConversations()) {
|
||||||
while (conversation.hasBufferedMessages()) {
|
while (conversation.hasBufferedMessages()) {
|
||||||
if (conversation.getMessageListAdapter() != null) {
|
if (conversation.getMessageListAdapter() != null) {
|
||||||
@ -146,6 +148,8 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On Pause
|
* On Pause
|
||||||
@ -361,9 +365,9 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
|||||||
if (conversation != null) {
|
if (conversation != null) {
|
||||||
if (!text.trim().startsWith("/")) {
|
if (!text.trim().startsWith("/")) {
|
||||||
if (conversation.getType() != Conversation.TYPE_SERVER) {
|
if (conversation.getType() != Conversation.TYPE_SERVER) {
|
||||||
String nickname = this.binder.getService().getConnection(serverId).getNick();
|
String nickname = binder.getService().getConnection(serverId).getNick();
|
||||||
conversation.addMessage(new Message("<" + nickname + "> " + text));
|
conversation.addMessage(new Message("<" + nickname + "> " + text));
|
||||||
this.binder.getService().getConnection(serverId).sendMessage(conversation.getName(), text);
|
binder.getService().getConnection(serverId).sendMessage(conversation.getName(), text);
|
||||||
} else {
|
} else {
|
||||||
Message message = new Message("You can only chat from within a channel or a query");
|
Message message = new Message("You can only chat from within a channel or a query");
|
||||||
message.setColor(Message.COLOR_YELLOW);
|
message.setColor(Message.COLOR_YELLOW);
|
||||||
@ -387,11 +391,16 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
|||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
||||||
{
|
{
|
||||||
if (resultCode == RESULT_OK) {
|
|
||||||
// currently there's only the "join channel" activity
|
// currently there's only the "join channel" activity
|
||||||
binder.getService().getConnection(serverId).joinChannel(
|
if (resultCode == RESULT_OK) {
|
||||||
data.getExtras().getString("channel")
|
final String channel = data.getExtras().getString("channel");
|
||||||
);
|
|
||||||
|
// run on own thread
|
||||||
|
new Thread() {
|
||||||
|
public void run() {
|
||||||
|
binder.getService().getConnection(serverId).joinChannel(channel);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user