mirror of
https://github.com/moparisthebest/Yaaic
synced 2025-01-09 12:48:00 -05:00
Update conversation switcher on conversation selection
This commit is contained in:
parent
e0ae24eac8
commit
1fc7cc4b73
@ -119,9 +119,12 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
||||
|
||||
switcher = (ViewSwitcher) findViewById(R.id.switcher);
|
||||
|
||||
dots = (ConversationSwitcher) findViewById(R.id.dots);
|
||||
dots.setServer(server);
|
||||
|
||||
deckAdapter = new DeckAdapter();
|
||||
deck = (Gallery) findViewById(R.id.deck);
|
||||
deck.setOnItemSelectedListener(new ConversationSelectedListener(server, (TextView) findViewById(R.id.title)));
|
||||
deck.setOnItemSelectedListener(new ConversationSelectedListener(server, (TextView) findViewById(R.id.title), dots));
|
||||
deck.setAdapter(deckAdapter);
|
||||
deck.setOnItemClickListener(new ConversationClickListener(deckAdapter, switcher));
|
||||
deck.setBackgroundDrawable(new NonScalingBackgroundDrawable(this, deck, R.drawable.background));
|
||||
@ -172,9 +175,6 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
||||
} else {
|
||||
((EditText) findViewById(R.id.input)).setEnabled(true);
|
||||
}
|
||||
|
||||
dots = (ConversationSwitcher) findViewById(R.id.dots);
|
||||
dots.setServer(server);
|
||||
|
||||
// Optimization - cache field lookup
|
||||
Collection<Conversation> mConversations = server.getConversations();
|
||||
@ -344,6 +344,7 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
||||
MessageListAdapter adapter = conversation.getMessageListAdapter();
|
||||
|
||||
conversation.setStatus(Conversation.STATUS_MESSAGE);
|
||||
|
||||
if (dots != null) {
|
||||
dots.invalidate();
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import android.widget.AdapterView.OnItemSelectedListener;
|
||||
|
||||
import org.yaaic.model.Conversation;
|
||||
import org.yaaic.model.Server;
|
||||
import org.yaaic.view.ConversationSwitcher;
|
||||
|
||||
/**
|
||||
* Listener for conversation selections
|
||||
@ -37,6 +38,7 @@ public class ConversationSelectedListener implements OnItemSelectedListener
|
||||
{
|
||||
private Server server;
|
||||
private TextView titleView;
|
||||
private ConversationSwitcher switcher;
|
||||
|
||||
/**
|
||||
* Create a new ConversationSelectedListener
|
||||
@ -44,10 +46,11 @@ public class ConversationSelectedListener implements OnItemSelectedListener
|
||||
* @param server
|
||||
* @param titleView
|
||||
*/
|
||||
public ConversationSelectedListener(Server server, TextView titleView)
|
||||
public ConversationSelectedListener(Server server, TextView titleView, ConversationSwitcher switcher)
|
||||
{
|
||||
this.server = server;
|
||||
this.titleView = titleView;
|
||||
this.switcher = switcher;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,6 +77,8 @@ public class ConversationSelectedListener implements OnItemSelectedListener
|
||||
conversation.setStatus(Conversation.STATUS_SELECTED);
|
||||
server.setSelectedConversation(conversation.getName());
|
||||
}
|
||||
|
||||
switcher.invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user