From 45aede14bd7d384e8adbcd6697ba39b1dcbf77b4 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Mon, 22 Sep 2014 13:23:35 +0200 Subject: fixed #452 --- src/eu/siacs/conversations/ui/ConversationActivity.java | 6 +++++- src/eu/siacs/conversations/ui/ConversationFragment.java | 6 +++++- src/eu/siacs/conversations/ui/XmppActivity.java | 7 +++++++ src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java | 6 +++++- 4 files changed, 22 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index 03d034d9..07c26259 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -154,7 +154,11 @@ public class ConversationActivity extends XmppActivity implements if (ab != null) { ab.setDisplayHomeAsUpEnabled(true); ab.setHomeButtonEnabled(true); - ab.setTitle(getSelectedConversation().getName()); + if (getSelectedConversation().getMode() == Conversation.MODE_SINGLE || activity.useSubjectToIdentifyConference()) { + ab.setTitle(getSelectedConversation().getName()); + } else { + ab.setTitle(getSelectedConversation().getContactJid().split("/")[0]); + } } invalidateOptionsMenu(); if (!getSelectedConversation().isRead()) { diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index 299bf281..feed9df5 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -380,7 +380,11 @@ public class ConversationFragment extends Fragment { activity.getSlidingPaneLayout().closePane(); activity.getActionBar().setDisplayHomeAsUpEnabled(true); activity.getActionBar().setHomeButtonEnabled(true); - activity.getActionBar().setTitle(conversation.getName()); + if (conversation.getMode() == Conversation.MODE_SINGLE || activity.useSubjectToIdentifyConference()) { + activity.getActionBar().setTitle(conversation.getName()); + } else { + activity.getActionBar().setTitle(conversation.getContactJid().split("/")[0]); + } activity.invalidateOptionsMenu(); } } diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java index 351462ae..26a33d1a 100644 --- a/src/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/eu/siacs/conversations/ui/XmppActivity.java @@ -62,6 +62,8 @@ public abstract class XmppActivity extends Activity { protected int mColorOrange; protected int mColorGreen; protected int mPrimaryColor; + + protected boolean mUseSubject = true; private DisplayMetrics metrics; @@ -207,12 +209,17 @@ public abstract class XmppActivity extends Activity { if (getPreferences().getBoolean("use_larger_font", false)) { setTheme(R.style.ConversationsTheme_LargerText); } + mUseSubject = getPreferences().getBoolean("use_subject", true); } protected SharedPreferences getPreferences() { return PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); } + + public boolean useSubjectToIdentifyConference() { + return mUseSubject; + } public void switchToConversation(Conversation conversation) { switchToConversation(conversation, null, false); diff --git a/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index bfcba135..e40723f4 100644 --- a/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -52,7 +52,11 @@ public class ConversationAdapter extends ArrayAdapter { } TextView convName = (TextView) view .findViewById(R.id.conversation_name); - convName.setText(conv.getName()); + if (conv.getMode() == Conversation.MODE_SINGLE || activity.useSubjectToIdentifyConference()) { + convName.setText(conv.getName()); + } else { + convName.setText(conv.getContactJid().split("/")[0]); + } TextView convLastMsg = (TextView) view .findViewById(R.id.conversation_lastmsg); ImageView imagePreview = (ImageView) view -- cgit v1.2.3