diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2014-03-14 22:40:56 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2014-03-14 22:40:56 +0100 |
commit | b1a3d09ca6a4be59b57e2f7b1cdc8a245d60a858 (patch) | |
tree | ca6d7f5eafd7bbe3deff4e9ad7a1f4a9a0a77bf3 /src/eu/siacs/conversations/ui | |
parent | 4e4a767743a62d1f88814e5cf024bf983772df2c (diff) |
use conference subject to identiy room
Diffstat (limited to 'src/eu/siacs/conversations/ui')
4 files changed, 24 insertions, 8 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index 1577fdc53..ad643c315 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -12,11 +12,13 @@ import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.utils.UIHelper; import android.os.Bundle; +import android.preference.PreferenceManager; import android.app.AlertDialog; import android.app.FragmentTransaction; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.SharedPreferences; import android.graphics.Color; import android.graphics.Typeface; import android.support.v4.widget.SlidingPaneLayout; @@ -53,6 +55,7 @@ public class ConversationActivity extends XmppActivity { private ListView listView; private boolean paneShouldBeOpen = true; + private boolean useSubject = true; private ArrayAdapter<Conversation> listAdapter; private OnConversationListChangedListener onConvChanged = new OnConversationListChangedListener() { @@ -163,7 +166,7 @@ public class ConversationActivity extends XmppActivity { view.setBackgroundColor(Color.TRANSPARENT); } TextView convName = (TextView) view.findViewById(R.id.conversation_name); - convName.setText(conv.getName()); + convName.setText(conv.getName(useSubject)); TextView convLastMsg = (TextView) view.findViewById(R.id.conversation_lastmsg); convLastMsg.setText(conv.getLatestMessage().getBody()); @@ -179,7 +182,7 @@ public class ConversationActivity extends XmppActivity { .setText(UIHelper.readableTimeDifference(conv.getLatestMessage().getTimeSent())); ImageView imageView = (ImageView) view.findViewById(R.id.conversation_image); - imageView.setImageBitmap(UIHelper.getContactPicture(conv.getContact(), conv.getName(),200, activity.getApplicationContext())); + imageView.setImageBitmap(UIHelper.getContactPicture(conv.getContact(), conv.getName(useSubject),200, activity.getApplicationContext())); return view; } @@ -221,7 +224,7 @@ public class ConversationActivity extends XmppActivity { paneShouldBeOpen = false; if (conversationList.size() > 0) { getActionBar().setDisplayHomeAsUpEnabled(true); - getActionBar().setTitle(getSelectedConversation().getName()); + getActionBar().setTitle(getSelectedConversation().getName(useSubject)); invalidateOptionsMenu(); if (!getSelectedConversation().isRead()) { getSelectedConversation().markRead(); @@ -399,6 +402,8 @@ public class ConversationActivity extends XmppActivity { public void onStart() { super.onStart(); this.registerListener(); + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); + this.useSubject = preferences.getBoolean("use_subject_in_muc", true); if (conversationList.size()>=1) { onConvChanged.onConversationListChanged(); } diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index 71d4100f0..d8ead9a62 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -62,6 +62,8 @@ public class ConversationFragment extends Fragment { private String pastedText = null; protected Bitmap selfBitmap; + + private boolean useSubject = true; private IntentSender askForPassphraseIntent = null; @@ -214,7 +216,7 @@ public class ConversationFragment extends Fragment { if (item.getConversation().getMode() == Conversation.MODE_SINGLE) { viewHolder.imageView.setImageBitmap(mBitmapCache - .get(item.getConversation().getName(), item + .get(item.getConversation().getName(useSubject), item .getConversation().getContact(), getActivity() .getApplicationContext())); @@ -250,7 +252,7 @@ public class ConversationFragment extends Fragment { .getApplicationContext())); } else { viewHolder.imageView.setImageBitmap(mBitmapCache - .get(item.getConversation().getName(), + .get(item.getConversation().getName(useSubject), null, getActivity() .getApplicationContext())); } @@ -330,7 +332,7 @@ public class ConversationFragment extends Fragment { if (!activity.shouldPaneBeOpen()) { activity.getSlidingPaneLayout().closePane(); activity.getActionBar().setDisplayHomeAsUpEnabled(true); - activity.getActionBar().setTitle(conversation.getName()); + activity.getActionBar().setTitle(conversation.getName(useSubject)); activity.invalidateOptionsMenu(); } diff --git a/src/eu/siacs/conversations/ui/MucDetailsActivity.java b/src/eu/siacs/conversations/ui/MucDetailsActivity.java index 478397e7a..390978950 100644 --- a/src/eu/siacs/conversations/ui/MucDetailsActivity.java +++ b/src/eu/siacs/conversations/ui/MucDetailsActivity.java @@ -9,7 +9,9 @@ import eu.siacs.conversations.entities.MucOptions; import eu.siacs.conversations.entities.MucOptions.User; import eu.siacs.conversations.utils.UIHelper; import android.content.Context; +import android.content.SharedPreferences; import android.os.Bundle; +import android.preference.PreferenceManager; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; @@ -99,6 +101,8 @@ public class MucDetailsActivity extends XmppActivity { @Override void onBackendConnected() { + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); + boolean useSubject = preferences.getBoolean("use_subject_in_muc", true); if (uuid != null) { for (Conversation mConv : xmppConnectionService.getConversations()) { if (mConv.getUuid().equals(uuid)) { @@ -106,7 +110,7 @@ public class MucDetailsActivity extends XmppActivity { } } if (this.conversation != null) { - setTitle(conversation.getName()); + setTitle(conversation.getName(useSubject)); mFullJid.setText(conversation.getContactJid().split("/")[0]); mYourNick.setText(conversation.getMucOptions().getNick()); mRoleAffiliaton = (TextView) findViewById(R.id.muc_role); diff --git a/src/eu/siacs/conversations/ui/ShareWithActivity.java b/src/eu/siacs/conversations/ui/ShareWithActivity.java index 81616212a..51bad721d 100644 --- a/src/eu/siacs/conversations/ui/ShareWithActivity.java +++ b/src/eu/siacs/conversations/ui/ShareWithActivity.java @@ -13,8 +13,10 @@ import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.utils.UIHelper; import android.content.Intent; +import android.content.SharedPreferences; import android.graphics.Bitmap; import android.os.Bundle; +import android.preference.PreferenceManager; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; @@ -66,6 +68,9 @@ public class ShareWithActivity extends XmppActivity { @Override void onBackendConnected() { + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); + boolean useSubject = preferences.getBoolean("use_subject_in_muc", true); + Set<String> displayedContacts = new HashSet<String>(); conversations.removeAllViews(); List<Conversation> convList = xmppConnectionService.getConversations(); @@ -76,7 +81,7 @@ public class ShareWithActivity extends XmppActivity { } }); for(final Conversation conversation : convList) { - View view = createContactView(conversation.getName(), conversation.getLatestMessage().getBody().trim(), UIHelper.getContactPicture(conversation.getContact(),conversation.getName(), 90,this.getApplicationContext())); + View view = createContactView(conversation.getName(useSubject), conversation.getLatestMessage().getBody().trim(), UIHelper.getContactPicture(conversation.getContact(),conversation.getName(useSubject), 90,this.getApplicationContext())); view.setOnClickListener(new OnClickListener() { @Override |