don't crash when selecting a conversation by uuid did not work

This commit is contained in:
Daniel Gultsch 2015-01-10 19:43:23 +01:00
parent c89fdec0b1
commit 158f5dd17c
1 changed files with 20 additions and 16 deletions

View File

@ -784,11 +784,9 @@ public class ConversationActivity extends XmppActivity
} else if (conversationList.size() <= 0) { } else if (conversationList.size() <= 0) {
startActivity(new Intent(this, StartConversationActivity.class)); startActivity(new Intent(this, StartConversationActivity.class));
finish(); finish();
} else if (getIntent() != null } else if (getIntent() != null && VIEW_CONVERSATION.equals(getIntent().getType())) {
&& VIEW_CONVERSATION.equals(getIntent().getType())) {
handleViewConversationIntent(getIntent()); handleViewConversationIntent(getIntent());
} else if (mOpenConverstaion != null) { } else if (selectConversationByUuid(mOpenConverstaion)) {
selectConversationByUuid(mOpenConverstaion);
if (mPanelOpen) { if (mPanelOpen) {
showConversationsOverview(); showConversationsOverview();
} else { } else {
@ -823,26 +821,32 @@ public class ConversationActivity extends XmppActivity
String uuid = (String) intent.getExtras().get(CONVERSATION); String uuid = (String) intent.getExtras().get(CONVERSATION);
String text = intent.getExtras().getString(TEXT, ""); String text = intent.getExtras().getString(TEXT, "");
String nick = intent.getExtras().getString(NICK,null); String nick = intent.getExtras().getString(NICK,null);
selectConversationByUuid(uuid); if (selectConversationByUuid(uuid)) {
this.mConversationFragment.reInit(getSelectedConversation()); this.mConversationFragment.reInit(getSelectedConversation());
if (nick!=null) { if (nick != null) {
this.mConversationFragment.highlightInConference(nick); this.mConversationFragment.highlightInConference(nick);
} else { } else {
this.mConversationFragment.appendText(text); this.mConversationFragment.appendText(text);
} }
hideConversationsOverview(); hideConversationsOverview();
openConversation(); openConversation();
if (mContentView instanceof SlidingPaneLayout) { if (mContentView instanceof SlidingPaneLayout) {
updateActionBarTitle(true); //fixes bug where slp isn't properly closed yet updateActionBarTitle(true); //fixes bug where slp isn't properly closed yet
}
} }
} }
private void selectConversationByUuid(String uuid) { private boolean selectConversationByUuid(String uuid) {
if (uuid == null) {
return false;
}
for (Conversation aConversationList : conversationList) { for (Conversation aConversationList : conversationList) {
if (aConversationList.getUuid().equals(uuid)) { if (aConversationList.getUuid().equals(uuid)) {
setSelectedConversation(aConversationList); setSelectedConversation(aConversationList);
return true;
} }
} }
return false;
} }
@Override @Override