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