From abaabae853f67b4048b194131bd7b72114e86ba1 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 18 Feb 2017 18:08:37 +0100 Subject: [PATCH] only change actionbar display options when changed --- .../conversations/ui/ConversationActivity.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index ce8867e80..21c2dc783 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -203,9 +203,9 @@ public class ConversationActivity extends XmppActivity this.listAdapter = new ConversationAdapter(this, conversationList); listView.setAdapter(this.listAdapter); - if (getActionBar() != null) { - getActionBar().setDisplayHomeAsUpEnabled(false); - getActionBar().setHomeButtonEnabled(false); + final ActionBar actionBar = getActionBar(); + if (actionBar != null) { + actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE); } listView.setOnItemClickListener(new OnItemClickListener() { @@ -351,16 +351,18 @@ public class ConversationActivity extends XmppActivity final Conversation conversation = getSelectedConversation(); if (ab != null) { if (titleShouldBeName && conversation != null) { - ab.setDisplayHomeAsUpEnabled(true); - ab.setHomeButtonEnabled(true); + if ((ab.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != ActionBar.DISPLAY_HOME_AS_UP) { + ab.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE); + } if (conversation.getMode() == Conversation.MODE_SINGLE || useSubjectToIdentifyConference()) { ab.setTitle(conversation.getName()); } else { ab.setTitle(conversation.getJid().toBareJid().toString()); } } else { - ab.setDisplayHomeAsUpEnabled(false); - ab.setHomeButtonEnabled(false); + if ((ab.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) == ActionBar.DISPLAY_HOME_AS_UP) { + ab.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE); + } ab.setTitle(R.string.app_name); } }