diff options
Diffstat (limited to 'src/main/java/de')
3 files changed, 25 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index faa8bdc37..c3fdfefa2 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -104,7 +104,15 @@ public class ConversationActivity extends XmppActivity implements OnConversation invalidateActionBarTitle(); Intent intent = pendingViewIntent.pop(); if (intent != null) { - processViewIntent(intent); + if (processViewIntent(intent)) { + return; + } + } + if (binding.secondaryFragment != null && ConversationFragment.getConversation(this) == null) { + Conversation conversation = ConversationsOverviewFragment.getSuggestion(this); + if (conversation != null) { + openConversation(conversation, null); + } } } @@ -122,14 +130,15 @@ public class ConversationActivity extends XmppActivity implements OnConversation } } - private void processViewIntent(Intent intent) { + private boolean processViewIntent(Intent intent) { String uuid = intent.getStringExtra(EXTRA_CONVERSATION); Conversation conversation = uuid != null ? xmppConnectionService.findConversationByUuid(uuid) : null; if (conversation == null) { Log.d(Config.LOGTAG, "unable to view conversation with uuid:" + uuid); - return; + return false; } openConversation(conversation, intent.getExtras()); + return true; } @Override diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsMainActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsMainActivity.java deleted file mode 100644 index e69de29bb..000000000 --- a/src/main/java/de/pixart/messenger/ui/ConversationsMainActivity.java +++ /dev/null diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java index ecfbaf595..173d09cc7 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java @@ -30,6 +30,7 @@ package de.pixart.messenger.ui; import android.app.Activity; +import android.app.Fragment; import android.databinding.DataBindingUtil; import android.os.Bundle; import android.util.Log; @@ -114,4 +115,16 @@ public class ConversationsOverviewFragment extends XmppFragment { this.activity.xmppConnectionService.populateWithOrderedConversations(this.conversations); this.conversationsAdapter.notifyDataSetChanged(); } + + public static Conversation getSuggestion(Activity activity) { + Fragment fragment = activity.getFragmentManager().findFragmentById(R.id.main_fragment); + if (fragment != null && fragment instanceof ConversationsOverviewFragment) { + List<Conversation> conversations = ((ConversationsOverviewFragment) fragment).conversations; + if (conversations.size() > 0) { + return conversations.get(0); + } + } + return null; + + } }
\ No newline at end of file |