From 63dfbc0034b551bf1836930c06035fe5e0f84fd6 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Mon, 8 Mar 2010 21:44:42 +0100 Subject: [PATCH] Push channel events to switched view if needed --- src/org/yaaic/adapter/DeckAdapter.java | 6 +++--- src/org/yaaic/view/ServerActivity.java | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/org/yaaic/adapter/DeckAdapter.java b/src/org/yaaic/adapter/DeckAdapter.java index 1da3577..204a857 100644 --- a/src/org/yaaic/adapter/DeckAdapter.java +++ b/src/org/yaaic/adapter/DeckAdapter.java @@ -41,7 +41,7 @@ public class DeckAdapter extends BaseAdapter { private HashMap map = new HashMap(); private LinkedList channels = new LinkedList(); - private View currentView; + private MessageListView currentView; private String currentChannel; private int width; @@ -128,7 +128,7 @@ public class DeckAdapter extends BaseAdapter * * @param switched */ - public void setSwitched(String channel, View current) + public void setSwitched(String channel, MessageListView current) { currentChannel = channel; currentView = current; @@ -139,7 +139,7 @@ public class DeckAdapter extends BaseAdapter * * @return */ - public View getSwitchedView() + public MessageListView getSwitchedView() { return currentView; } diff --git a/src/org/yaaic/view/ServerActivity.java b/src/org/yaaic/view/ServerActivity.java index e239477..9e1fffa 100644 --- a/src/org/yaaic/view/ServerActivity.java +++ b/src/org/yaaic/view/ServerActivity.java @@ -226,6 +226,11 @@ public class ServerActivity extends Activity implements ServiceConnection, Chann MessageListAdapter adapter = view.getAdapter(); adapter.addMessage(message); } + + if (deckAdapter.isSwitched()) { + MessageListView switchedView = deckAdapter.getSwitchedView(); + switchedView.getAdapter().addMessage(message); + } } /**