Option to list full JID in roster
authorVincent V. <marseille@beem-project.com>
Thu, 10 May 2012 16:11:18 +0200
changeset 980 1e9c4a0a9acf
parent 979 847e7f7d88c1
child 981 e1b1c8ad710a
Option to list full JID in roster Feature #322
res/values-fr/strings.xml
res/values/strings.xml
res/xml/preferences.xml
src/com/beem/project/beem/BeemApplication.java
src/com/beem/project/beem/ui/ContactListAdapter.java
--- a/res/values-fr/strings.xml	Thu May 10 14:03:11 2012 +0200
+++ b/res/values-fr/strings.xml	Thu May 10 16:11:18 2012 +0200
@@ -90,6 +90,8 @@
 		d\'ami(e)s</string>
 	<string name="CLP_hide_groups">Cachez les groupes</string>	
 	<string name="CLP_hide_groups_sum">Cochez cette option pour cacher les groupes</string>
+	<string name="CLP_show_jid">Affichez les JID</string>
+	<string name="CLP_show_jid_sum">Cochez cette option pour afficher les JIDs des contacts</string>
 	<string name="CLP_hidden_contact">Cachez les contacts déconnectés</string>
 	<string name="CLP_hidden_contact_sum">Cochez cette option pour cacher les contacts déconnectés</string>
 	<string name="settings_account_username">Nom d\'utilisateur (JID)</string>
--- a/res/values/strings.xml	Thu May 10 14:03:11 2012 +0200
+++ b/res/values/strings.xml	Thu May 10 16:11:18 2012 +0200
@@ -90,6 +90,8 @@
 	</string>
 	<string name="CLP_hide_groups">Hide groups</string>	
 	<string name="CLP_hide_groups_sum">Check this option to hide groups</string>
+	<string name="CLP_show_jid">Show JID</string>
+	<string name="CLP_show_jid_sum">Check this option to always show Contact\'s JID</string>
 	<string name="CLP_hidden_contact">Hide buddies</string>
 	<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
 	</string>
--- a/res/xml/preferences.xml	Thu May 10 14:03:11 2012 +0200
+++ b/res/xml/preferences.xml	Thu May 10 16:11:18 2012 +0200
@@ -42,6 +42,9 @@
 			<CheckBoxPreference android:title="@string/CLP_hide_groups"
 				android:defaultValue="false" android:summary="@string/CLP_hide_groups_sum"
 				android:key="hide_groups" />
+			<CheckBoxPreference android:title="@string/CLP_show_jid"
+				android:defaultValue="false" android:key="show_jid" 
+				android:summary="@string/CLP_show_jid_sum"/>
 			<CheckBoxPreference android:title="@string/away_chk_title"
 				android:defaultValue="true" android:summary="@string/away_chk_sum"
 				android:key="use_auto_away" />
--- a/src/com/beem/project/beem/BeemApplication.java	Thu May 10 14:03:11 2012 +0200
+++ b/src/com/beem/project/beem/BeemApplication.java	Thu May 10 16:11:18 2012 +0200
@@ -103,6 +103,8 @@
     public static final String USE_COMPACT_CHAT_UI_KEY = "use_compact_chat_ui";
     /** Preference key for history path on the SDCard. */
     public static final String CHAT_HISTORY_KEY = "settings_chat_history_path";
+    /** Preference key to show the jid in the contact list. */
+    public static final String SHOW_JID = "show_jid";
 
     //TODO add the other one
 
--- a/src/com/beem/project/beem/ui/ContactListAdapter.java	Thu May 10 14:03:11 2012 +0200
+++ b/src/com/beem/project/beem/ui/ContactListAdapter.java	Thu May 10 16:11:18 2012 +0200
@@ -33,9 +33,11 @@
 import java.util.List;
 
 import android.content.Context;
+import android.content.SharedPreferences;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.LayerDrawable;
 import android.net.Uri;
+import android.preference.PreferenceManager;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -46,6 +48,7 @@
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import com.beem.project.beem.BeemApplication;
 import com.beem.project.beem.R;
 import com.beem.project.beem.providers.AvatarProvider;
 import com.beem.project.beem.service.Contact;
@@ -150,7 +153,11 @@
     private void bindView(View view, Contact curContact) {
 	if (curContact != null) {
 	    TextView v = (TextView) view.findViewById(R.id.contactlistpseudo);
-	    v.setText(curContact.getName());
+	    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
+	    if (settings.getBoolean(BeemApplication.SHOW_JID, false))
+	    	v.setText(curContact.getJID());
+	    else
+		v.setText(curContact.getName());
 	    v = (TextView) view.findViewById(R.id.contactlistmsgperso);
 	    v.setText(curContact.getMsgState());
 	    ImageView img = (ImageView) view.findViewById(R.id.avatar);