diff options
Diffstat (limited to '')
-rw-r--r-- | res/values/strings.xml | 4 | ||||
-rw-r--r-- | res/xml/preferences.xml | 5 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationActivity.java | 6 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationFragment.java | 6 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/XmppActivity.java | 7 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java | 6 |
6 files changed, 30 insertions, 4 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index be76c140..8d976dce 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -259,5 +259,7 @@ <string name="pref_use_indicate_received_summary">Received masseges will be marked with a green tick. Be aware that this might no work in every case.</string> <string name="pref_use_send_button_to_indicate_status_summary">Colorize send button to indicate contact status</string> <string name="pref_expert_options_other">Other</string> + <string name="pref_conference_name">Conference name</string> + <string name="pref_conference_name_summary">Use room’s subject instead of JID to identify conferences</string> -</resources> +</resources>
\ No newline at end of file diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 3dab0959..024335f1 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -64,6 +64,11 @@ </PreferenceCategory> <PreferenceCategory android:title="@string/pref_ui_options" > <CheckBoxPreference + android:defaultValue="true" + android:key="use_subject" + android:summary="@string/pref_conference_name_summary" + android:title="@string/pref_conference_name" /> + <CheckBoxPreference android:defaultValue="false" android:key="use_larger_font" android:summary="@string/pref_use_larger_font_summary" 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<Conversation> { } 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 |