update action bar with conversations updates as well
This commit is contained in:
parent
97344c079a
commit
81a1a48b8d
|
@ -22,21 +22,7 @@ public class PresenceParser extends AbstractParser implements
|
|||
|
||||
public void parseConferencePresence(PresencePacket packet, Account account) {
|
||||
PgpEngine mPgpEngine = mXmppConnectionService.getPgpEngine();
|
||||
if (packet.hasChild("x", "http://jabber.org/protocol/muc#user")) {
|
||||
final Conversation muc = packet.getFrom() == null ? null : mXmppConnectionService.find(
|
||||
account,
|
||||
packet.getFrom().toBareJid());
|
||||
if (muc != null) {
|
||||
boolean before = muc.getMucOptions().online();
|
||||
muc.getMucOptions().processPacket(packet, mPgpEngine);
|
||||
if (before != muc.getMucOptions().online()) {
|
||||
mXmppConnectionService.updateConversationUi();
|
||||
}
|
||||
mXmppConnectionService.getAvatarService().clear(muc);
|
||||
}
|
||||
} else if (packet.hasChild("x", "http://jabber.org/protocol/muc")) {
|
||||
final Conversation conversation = mXmppConnectionService.find(account,
|
||||
packet.getFrom().toBareJid());
|
||||
final Conversation conversation = packet.getFrom() == null ? null : mXmppConnectionService.find(account, packet.getFrom().toBareJid());
|
||||
if (conversation != null) {
|
||||
final MucOptions mucOptions = conversation.getMucOptions();
|
||||
boolean before = mucOptions.online();
|
||||
|
@ -48,7 +34,6 @@ public class PresenceParser extends AbstractParser implements
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void parseContactPresence(PresencePacket packet, Account account) {
|
||||
PresenceGenerator mPresenceGenerator = mXmppConnectionService
|
||||
|
|
|
@ -181,7 +181,6 @@ public class ConversationActivity extends XmppActivity implements
|
|||
hideConversationsOverview();
|
||||
}
|
||||
});
|
||||
//registerForContextMenu(listView);
|
||||
mContentView = findViewById(R.id.content_view_spl);
|
||||
if (mContentView == null) {
|
||||
mContentView = findViewById(R.id.content_view_ll);
|
||||
|
@ -196,12 +195,7 @@ public class ConversationActivity extends XmppActivity implements
|
|||
|
||||
@Override
|
||||
public void onPanelOpened(View arg0) {
|
||||
ActionBar ab = getActionBar();
|
||||
if (ab != null) {
|
||||
ab.setDisplayHomeAsUpEnabled(false);
|
||||
ab.setHomeButtonEnabled(false);
|
||||
ab.setTitle(R.string.app_name);
|
||||
}
|
||||
updateActionBarTitle();
|
||||
invalidateOptionsMenu();
|
||||
hideKeyboard();
|
||||
if (xmppConnectionServiceBound) {
|
||||
|
@ -237,20 +231,32 @@ public class ConversationActivity extends XmppActivity implements
|
|||
});
|
||||
}
|
||||
|
||||
public void openConversation() {
|
||||
private void updateActionBarTitle() {
|
||||
updateActionBarTitle(isConversationsOverviewHideable() && !isConversationsOverviewVisable());
|
||||
}
|
||||
|
||||
private void updateActionBarTitle(boolean titleShouldBeName) {
|
||||
ActionBar ab = getActionBar();
|
||||
if (ab != null) {
|
||||
if (titleShouldBeName) {
|
||||
ab.setDisplayHomeAsUpEnabled(true);
|
||||
ab.setHomeButtonEnabled(true);
|
||||
if (getSelectedConversation().getMode() == Conversation.MODE_SINGLE
|
||||
|| ConversationActivity.this
|
||||
.useSubjectToIdentifyConference()) {
|
||||
if (getSelectedConversation().getMode() == Conversation.MODE_SINGLE || useSubjectToIdentifyConference()) {
|
||||
ab.setTitle(getSelectedConversation().getName());
|
||||
} else {
|
||||
ab.setTitle(getSelectedConversation().getContactJid().toBareJid().toString());
|
||||
}
|
||||
} else {
|
||||
ab.setDisplayHomeAsUpEnabled(false);
|
||||
ab.setHomeButtonEnabled(false);
|
||||
ab.setTitle(R.string.app_name);
|
||||
}
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
private void openConversation() {
|
||||
this.updateActionBarTitle();
|
||||
this.invalidateOptionsMenu();
|
||||
if (xmppConnectionServiceBound) {
|
||||
xmppConnectionService.getNotificationService().setOpenConversation(getSelectedConversation());
|
||||
if (!getSelectedConversation().isRead()) {
|
||||
|
@ -739,8 +745,9 @@ public class ConversationActivity extends XmppActivity implements
|
|||
this.mConversationFragment.appendText(text);
|
||||
}
|
||||
hideConversationsOverview();
|
||||
if (mContentView instanceof SlidingPaneLayout) {
|
||||
openConversation();
|
||||
if (mContentView instanceof SlidingPaneLayout) {
|
||||
updateActionBarTitle(true); //fixes bug where slp isn't properly closed yet
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -928,18 +935,16 @@ public class ConversationActivity extends XmppActivity implements
|
|||
|
||||
@Override
|
||||
public void onAccountUpdate() {
|
||||
final ConversationFragment fragment = (ConversationFragment) getFragmentManager()
|
||||
.findFragmentByTag("conversation");
|
||||
if (fragment != null) {
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
fragment.updateMessages();
|
||||
updateConversationList();
|
||||
ConversationActivity.this.mConversationFragment.updateMessages();
|
||||
updateActionBarTitle();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConversationUpdate() {
|
||||
|
@ -954,6 +959,7 @@ public class ConversationActivity extends XmppActivity implements
|
|||
finish();
|
||||
}
|
||||
ConversationActivity.this.mConversationFragment.updateMessages();
|
||||
updateActionBarTitle();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -964,7 +970,9 @@ public class ConversationActivity extends XmppActivity implements
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
updateConversationList();
|
||||
ConversationActivity.this.mConversationFragment.updateMessages();
|
||||
updateActionBarTitle();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue