Merge
authorDa Risk <darisk972@gmail.com>
Sat, 13 Feb 2010 23:37:39 +0100
changeset 669 c3946d9276ea
parent 668 f6c0888906e1 (current diff)
parent 667 d54deda513ff (diff)
child 670 9fb797159236
Merge
res/layout/preferences.xml
src/com/beem/project/beem/BeemService.java
src/com/beem/project/beem/ui/ContactList.java
--- a/res/layout/contactlist.xml	Sat Feb 13 23:26:09 2010 +0100
+++ b/res/layout/contactlist.xml	Sat Feb 13 23:37:39 2010 +0100
@@ -2,19 +2,12 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 	android:layout_width="fill_parent" android:layout_height="fill_parent"
 	android:orientation="vertical">
-	<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
-		android:id="@+id/contactlist_banner" android:layout_width="fill_parent"
-		android:layout_height="42px" android:spacing="42px"
-		android:unselectedAlpha="0.4" android:background="#222222" />
-	<View android:layout_width="fill_parent" android:layout_height="2dp"
-		android:fadingEdge="horizontal" android:background="#555555" />
+	<ViewStub android:id="@+id/contactlist_stub" android:inflatedId="@+id/contactlist_groupstub" android:layout_width="fill_parent"
+		android:layout_height="wrap_content" android:layout="@layout/contactlist_groupstub"/>
 	<LinearLayout android:layout_width="fill_parent"
 		android:layout_height="fill_parent" android:orientation="horizontal"
 		android:padding="2px">
-		<ListView android:id="@+id/contactlist"
-		    android:layout_width="fill_parent" android:layout_height="fill_parent"
-		    android:transcriptMode="disabled" />
-		<!-- normal should be better -->
+		<ListView android:id="@+id/contactlist" android:layout_width="fill_parent"
+			android:layout_height="fill_parent" android:transcriptMode="disabled" />
 	</LinearLayout>
-
 </LinearLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/contactlist_groupstub.xml	Sat Feb 13 23:37:39 2010 +0100
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:id="@+id/contactlist_groupstub" android:layout_width="wrap_content"
+	android:layout_height="wrap_content">
+	<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
+		android:id="@+id/contactlist_banner" android:layout_width="fill_parent"
+		android:layout_height="42px" android:spacing="42px"
+		android:unselectedAlpha="0.4" android:background="#222222" />
+	<View android:layout_width="fill_parent" android:layout_height="2dp"
+		android:fadingEdge="horizontal" android:background="#555555" />
+</LinearLayout>
--- a/res/layout/preferences.xml	Sat Feb 13 23:26:09 2010 +0100
+++ b/res/layout/preferences.xml	Sat Feb 13 23:37:39 2010 +0100
@@ -7,6 +7,9 @@
 			<CheckBoxPreference android:title="@string/CLP_hidden_contact"
 				android:defaultValue="false" android:summary="@string/CLP_hidden_contact_sum"
 				android:key="settings_key_hidden_contact" />
+			<CheckBoxPreference android:title="@string/CLP_hide_groups"
+				android:defaultValue="false" android:summary="@string/CLP_hide_groups_sum"
+				android:key="settings_key_hide_groups" />
 		</PreferenceScreen>
 	</PreferenceCategory>
 	<PreferenceCategory android:title="@string/user_preferences">
--- a/res/values-fr/strings.xml	Sat Feb 13 23:26:09 2010 +0100
+++ b/res/values-fr/strings.xml	Sat Feb 13 23:37:39 2010 +0100
@@ -203,8 +203,11 @@
 	<string name="contact_list_preferences">Liste d\'ami(e)s</string>
 	<string name="contact_list_preferences_sum">Une série d\'options d\'affichage de votre liste
 		d\'ami(e)s</string>
-	<string name="CLP_hidden_contact">Caché(e)s</string>
-	<string name="CLP_hidden_contact_sum">Cochez cette option pour cacher les ami(e)s déconnecté(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_hidden_contact">Cachez les contacts</string>
+	<string name="CLP_hidden_contact_sum">Cochez cette option pour cacher les contacts déconnectés</string>
 	
 	<!-- EditSettings Activity Account tab -->
 	<string name="settings_account_username">Nom d\'utilisateur</string>
--- a/res/values/strings.xml	Sat Feb 13 23:26:09 2010 +0100
+++ b/res/values/strings.xml	Sat Feb 13 23:37:39 2010 +0100
@@ -193,7 +193,10 @@
 	<string name="contact_list_preferences">Buddy list</string>
 	<string name="contact_list_preferences_sum">A set of display options for your buddy list
 	</string>
-	<string name="CLP_hidden_contact">Hidden</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_hidden_contact">Hide buddies</string>
 	<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
 	</string>
 
--- a/src/com/beem/project/beem/BeemService.java	Sat Feb 13 23:26:09 2010 +0100
+++ b/src/com/beem/project/beem/BeemService.java	Sat Feb 13 23:37:39 2010 +0100
@@ -40,7 +40,7 @@
     Flavien Astraud, November 26, 2009
     Head of the EIP Laboratory.
 
- */
+*/
 package com.beem.project.beem;
 
 import org.jivesoftware.smack.ConnectionConfiguration;
@@ -53,30 +53,6 @@
 import org.jivesoftware.smack.proxy.ProxyInfo;
 import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType;
 import org.jivesoftware.smack.util.StringUtils;
-import org.jivesoftware.smackx.GroupChatInvitation;
-import org.jivesoftware.smackx.PrivateDataManager;
-import org.jivesoftware.smackx.packet.ChatStateExtension;
-import org.jivesoftware.smackx.packet.LastActivity;
-import org.jivesoftware.smackx.packet.OfflineMessageInfo;
-import org.jivesoftware.smackx.packet.OfflineMessageRequest;
-import org.jivesoftware.smackx.packet.SharedGroupsInfo;
-import org.jivesoftware.smackx.provider.AdHocCommandDataProvider;
-import org.jivesoftware.smackx.provider.BytestreamsProvider;
-import org.jivesoftware.smackx.provider.DataFormProvider;
-import org.jivesoftware.smackx.provider.DelayInformationProvider;
-import org.jivesoftware.smackx.provider.DiscoverInfoProvider;
-import org.jivesoftware.smackx.provider.DiscoverItemsProvider;
-import org.jivesoftware.smackx.provider.IBBProviders;
-import org.jivesoftware.smackx.provider.MUCAdminProvider;
-import org.jivesoftware.smackx.provider.MUCOwnerProvider;
-import org.jivesoftware.smackx.provider.MUCUserProvider;
-import org.jivesoftware.smackx.provider.MessageEventProvider;
-import org.jivesoftware.smackx.provider.MultipleAddressesProvider;
-import org.jivesoftware.smackx.provider.RosterExchangeProvider;
-import org.jivesoftware.smackx.provider.StreamInitiationProvider;
-import org.jivesoftware.smackx.provider.VCardProvider;
-import org.jivesoftware.smackx.provider.XHTMLExtensionProvider;
-import org.jivesoftware.smackx.search.UserSearch;
 
 import android.app.Notification;
 import android.app.NotificationManager;
@@ -310,7 +286,7 @@
     private void configure(ProviderManager pm) {
 	// Privacy
 	pm.addIQProvider("query", "jabber:iq:privacy", new PrivacyProvider());
-	
+
 	/*
 	// Private Data Storage
 	pm.addIQProvider("query", "jabber:iq:private", new PrivateDataManager.PrivateDataIQProvider());
@@ -390,7 +366,7 @@
 	    new AdHocCommandDataProvider.BadSessionIDError());
 	pm.addExtensionProvider("session-expired", COMMAND_NAMESPACE,
 	    new AdHocCommandDataProvider.SessionExpiredError());
-	    */
+	 */
     }
 }
 
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Sat Feb 13 23:26:09 2010 +0100
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Sat Feb 13 23:37:39 2010 +0100
@@ -40,7 +40,7 @@
     Flavien Astraud, November 26, 2009
     Head of the EIP Laboratory.
 
- */
+*/
 package com.beem.project.beem.service;
 
 import org.jivesoftware.smack.ConnectionConfiguration;
--- a/src/com/beem/project/beem/ui/ContactList.java	Sat Feb 13 23:26:09 2010 +0100
+++ b/src/com/beem/project/beem/ui/ContactList.java	Sat Feb 13 23:37:39 2010 +0100
@@ -59,6 +59,7 @@
 import android.content.ServiceConnection;
 import android.content.SharedPreferences;
 import android.graphics.BitmapFactory;
+import android.graphics.drawable.BitmapDrawable;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
@@ -72,14 +73,15 @@
 import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.ViewStub;
 import android.widget.AdapterView;
 import android.widget.BaseAdapter;
 import android.widget.Gallery;
+import android.widget.LinearLayout;
+import android.widget.ListView;
 import android.widget.TextView;
-import android.widget.ListView;
 import android.widget.AdapterView.AdapterContextMenuInfo;
 import android.widget.AdapterView.OnItemClickListener;
-import android.graphics.drawable.BitmapDrawable;
 
 import com.beem.project.beem.R;
 import com.beem.project.beem.service.Contact;
@@ -237,7 +239,7 @@
 		    break;
 		default:
 		    result = super.onContextItemSelected(item);
-		    break;
+		break;
 	    }
 	    return result;
 	}
@@ -284,8 +286,11 @@
 	if (mXmppFacade == null)
 	    bindService(SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
 	else {
+	    if (!mSettings.getBoolean("settings_key_hide_groups", false))
+		buildBanner();
+	    else
+		hideGroups();
 	    buildContactList();
-	    buildBanner();
 	}
     }
 
@@ -380,6 +385,10 @@
      * buildBanner.
      */
     private void buildBanner() {
+
+	ViewStub stub = (ViewStub) findViewById(R.id.contactlist_stub);
+	if (stub != null)
+	    stub.inflate();
 	Gallery g = (Gallery) findViewById(R.id.contactlist_banner);
 	g.setOnItemClickListener(new OnItemClickGroupName());
 	g.setAdapter(mAdapterBanner);
@@ -432,11 +441,11 @@
 	mIconsMap.put(Status.CONTACT_STATUS_AVAILABLE, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
 	    android.R.drawable.presence_online)));
 	mIconsMap.put(Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT,
-		new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_online)));
+	    new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_online)));
 	mIconsMap.put(Status.CONTACT_STATUS_AWAY,
-		new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_away)));
+	    new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_away)));
 	mIconsMap.put(Status.CONTACT_STATUS_BUSY,
-		new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_busy)));
+	    new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_busy)));
 	mIconsMap.put(Status.CONTACT_STATUS_DISCONNECT, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
 	    android.R.drawable.presence_offline)));
 	mIconsMap.put(Status.CONTACT_STATUS_UNAVAILABLE, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
@@ -786,7 +795,10 @@
 		    }
 		    mContactOnGroup.put(getString(R.string.contact_list_all_contact), tmpContactList);
 		    mCurGroup = getString(R.string.contact_list_all_contact);
-		    buildBanner();
+		    if (!mSettings.getBoolean("settings_key_hide_groups", false))
+			buildBanner();
+		    else
+			hideGroups();
 		    buildContactList();
 		}
 	    } catch (RemoteException e) {
@@ -813,4 +825,10 @@
     protected void finalize() {
 	Log.e(TAG, "FINALIZE");
     }
+
+    private void hideGroups() {
+	ViewStub stub = (ViewStub) findViewById(R.id.contactlist_stub);
+	if (stub == null)
+	    ((LinearLayout) findViewById(R.id.contactlist_groupstub)).setVisibility(View.GONE);	
+    }
 }