Submenu finish.
authorVincent Veronis <veroni_v@epitech.net>
Fri, 04 Dec 2009 13:12:00 +0100
changeset 556 9d3c83e70ed2
parent 555 5262009d9a24
child 557 9a7d86bc5d45
Submenu finish. Delete older submenu (Userinfo activity and dialog)
AndroidManifest.xml
res/layout/contactdialog.xml
res/layout/userinfo.xml
res/menu/contactlist_context.xml
res/values-fr/strings.xml
res/values/strings.xml
src/com/beem/project/beem/ui/ContactDialog.java
src/com/beem/project/beem/ui/ContactList.java
src/com/beem/project/beem/ui/UserInfo.java
--- a/AndroidManifest.xml	Fri Dec 04 11:31:17 2009 +0100
+++ b/AndroidManifest.xml	Fri Dec 04 13:12:00 2009 +0100
@@ -53,12 +53,6 @@
 					android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
 			</intent-filter>
 		</activity>
-		<activity android:name=".ui.UserInfo" android:label="@string/user_info_name">
-			<intent-filter android:label="Beem Connection">
-				<action
-					android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
-			</intent-filter>
-		</activity>
 		<activity android:name=".jingle.demo.JingleCallActivity"
 			android:label="JingleDemoCall">
 			<intent-filter>
--- a/res/layout/contactdialog.xml	Fri Dec 04 11:31:17 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-	android:orientation="vertical" android:layout_width="fill_parent"
-	android:layout_height="fill_parent">
-
-	<Button android:id="@+id/CDChat" android:layout_width="fill_parent"
-		android:layout_height="wrap_content" android:text="@string/CDChat" />
-		
-	<Button android:id="@+id/CDCall" android:layout_width="fill_parent"
-		android:layout_height="wrap_content" android:text="@string/CDCall" />
-
-	<Button android:id="@+id/CDInfos" android:layout_width="fill_parent"
-		android:layout_height="wrap_content" android:text="@string/CDInfos" />
-
-</LinearLayout>
\ No newline at end of file
--- a/res/layout/userinfo.xml	Fri Dec 04 11:31:17 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-	android:orientation="vertical" android:layout_width="fill_parent"
-	android:layout_height="fill_parent">
-	<LinearLayout android:orientation="vertical"
-		android:layout_width="fill_parent" android:layout_height="wrap_content">
-		<LinearLayout android:id="@+id/userinfo_layout_alias"
-			android:orientation="vertical" android:layout_width="fill_parent"
-			android:layout_height="70px">
-			<TextView android:layout_width="fill_parent"
-				android:layout_height="wrap_content" android:paddingLeft="20sp"
-				android:singleLine="true" android:maxLines="1" android:textSize="30px"
-				android:text="@string/userinfo_label_alias" />
-			<TextView android:id="@+id/userinfo_alias"
-				android:layout_width="fill_parent" android:layout_height="wrap_content"
-				android:paddingLeft="20sp" android:singleLine="true" />
-		</LinearLayout>
-		<View android:layout_height="1px" android:layout_width="fill_parent"
-			android:background="#FFFFFF" />
-		<LinearLayout android:id="@+id/userinfo_layout_chg_group"
-			android:orientation="vertical" android:layout_width="fill_parent"
-			android:layout_height="70px">
-			<TextView android:layout_width="fill_parent"
-				android:layout_height="wrap_content" android:paddingLeft="20sp"
-				android:singleLine="true" android:maxLines="1" android:textSize="30px"
-				android:text="@string/userinfo_label_chg_group" />
-			<Gallery android:id="@+id/userinfo_groups"
-				android:layout_width="fill_parent" android:layout_height="wrap_content"
-				android:spacing="10px" />
-		</LinearLayout>
-		<View android:layout_height="1px" android:layout_width="fill_parent"
-			android:background="#FFFFFF" />
-		<LinearLayout android:id="@+id/userinfo_layout_re_suscription"
-			android:orientation="vertical" android:layout_width="fill_parent"
-			android:layout_height="70px">
-			<TextView android:layout_width="fill_parent"
-				android:layout_height="wrap_content" android:paddingLeft="20sp"
-				android:singleLine="true" android:maxLines="1" android:textSize="30px"
-				android:text="@string/userinfo_label_re_suscription" />
-		</LinearLayout>
-		<View android:layout_height="1px" android:layout_width="fill_parent"
-			android:background="#FFFFFF" />
-		<LinearLayout android:id="@+id/userinfo_layout_block"
-			android:orientation="vertical" android:layout_width="fill_parent"
-			android:layout_height="70px">
-			<TextView android:layout_width="fill_parent"
-				android:layout_height="wrap_content" android:paddingLeft="20sp"
-				android:singleLine="true" android:maxLines="1" android:textSize="30px"
-				android:text="@string/userinfo_label_block" />
-		</LinearLayout>
-		<View android:layout_height="1px" android:layout_width="fill_parent"
-			android:background="#FFFFFF" />
-		<LinearLayout android:id="@+id/userinfo_layout_delete"
-			android:orientation="vertical" android:layout_width="fill_parent"
-			android:layout_height="70px">
-			<TextView android:layout_width="fill_parent"
-				android:layout_height="wrap_content" android:paddingLeft="20sp"
-				android:singleLine="true" android:maxLines="1" android:textSize="30px"
-				android:text="@string/userinfo_label_delete" />
-		</LinearLayout>
-	</LinearLayout>
-</ScrollView>
\ No newline at end of file
--- a/res/menu/contactlist_context.xml	Fri Dec 04 11:31:17 2009 +0100
+++ b/res/menu/contactlist_context.xml	Fri Dec 04 13:12:00 2009 +0100
@@ -6,12 +6,12 @@
 	<item android:id="@+id/contact_list_context_menu_user_info"
 		android:title="@string/CDInfos">
 		<menu>
-			<item android:id="@+id/menu_userinfo_alias" android:title="@string/userinfo_label_alias" />
-			<item android:id="@+id/userinfo_layout_chg_group" android:title="@string/userinfo_label_chg_group" />
-			<item android:id="@+id/userinfo_layout_re_suscription"
-				android:title="@string/userinfo_label_re_suscription" />
-			<item android:id="@+id/userinfo_layout_block" android:title="@string/userinfo_label_block" />
-			<item android:id="@+id/userinfo_layout_delete" android:title="@string/userinfo_label_delete" />
+			<item android:id="@+id/contact_list_context_menu_userinfo_alias" android:title="@string/userinfo_label_alias" />
+			<item android:id="@+id/contact_list_context_menu_userinfo_group" android:title="@string/userinfo_label_chg_group" />
+			<item android:id="@+id/contact_list_context_menu_userinfo_subscription"
+				android:title="@string/userinfo_label_re_subscription" />
+			<item android:id="@+id/contact_list_context_menu_userinfo_block" android:title="@string/userinfo_label_block" />
+			<item android:id="@+id/contact_list_context_menu_userinfo_delete" android:title="@string/userinfo_label_delete" />
 		</menu>
 	</item>
 </menu>
--- a/res/values-fr/strings.xml	Fri Dec 04 11:31:17 2009 +0100
+++ b/res/values-fr/strings.xml	Fri Dec 04 13:12:00 2009 +0100
@@ -253,7 +253,7 @@
 	-->
 	<string name="userinfo_label_alias">Alias</string>
 	<string name="userinfo_label_chg_group">Modifier groupe</string>
-	<string name="userinfo_label_re_suscription">Renvoyer l\'invitation</string>
+	<string name="userinfo_label_re_subscription">Renvoyer l\'invitation</string>
 	<string name="userinfo_label_block">Bloquer</string>
 	<string name="userinfo_label_delete">Supprimer</string>
 	<string name="userinfo_resend">Souscription réenvoyée</string>
--- a/res/values/strings.xml	Fri Dec 04 11:31:17 2009 +0100
+++ b/res/values/strings.xml	Fri Dec 04 13:12:00 2009 +0100
@@ -236,7 +236,7 @@
 	<!-- UserInfo dialog -->
 	<string name="userinfo_label_alias">Alias</string>
 	<string name="userinfo_label_chg_group">Manage groups</string>
-	<string name="userinfo_label_re_suscription">Resend invit</string>
+	<string name="userinfo_label_re_subscription">Resend invit</string>
 	<string name="userinfo_label_block">Block</string>
 	<string name="userinfo_label_delete">Delete</string>
 	<string name="userinfo_resend">Suscription resend</string>
--- a/src/com/beem/project/beem/ui/ContactDialog.java	Fri Dec 04 11:31:17 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-package com.beem.project.beem.ui;
-
-import android.app.Activity;
-import android.app.Dialog;
-import android.app.Service;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.View;
-import android.widget.Button;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-
-/**
- * This activity class provides the view to show dialog when long click on contact list.
- * @author marseille
- */
-public class ContactDialog extends Dialog {
-
-    private static final Intent SERVICE_INTENT = new Intent();
-    private final Contact mContact;
-    private final Context mContext;
-    private IXmppFacade mXmppFacade;
-    private final ServiceConnection mServConn = new BeemServiceConnection();
-
-    static {
-	SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
-    }
-
-    /**
-     * Constructor.
-     * @param context context where is call the dialog.
-     * @param curContact current contact.
-     */
-    public ContactDialog(final Context context, final Contact curContact) {
-	super(context);
-	mContext = context;
-
-	setContentView(R.layout.contactdialog);
-	mContact = curContact;
-	setTitle(curContact.getJID());
-
-	Button button = (Button) findViewById(R.id.CDChat);
-	button.setOnClickListener(new ChatListener());
-	button = (Button) findViewById(R.id.CDInfos);
-	button.setOnClickListener(new InfosListener());
-	button = (Button) findViewById(R.id.CDCall);
-	button.setOnClickListener(new CallListener());
-	mContext.bindService(SERVICE_INTENT, mServConn, Service.BIND_AUTO_CREATE);
-    }
-
-    @Override
-    protected void onStop() {
-        // TODO Auto-generated method stub
-        super.onStop();
-	mContext.unbindService(mServConn);
-    }
-    
-    @Override
-    public void dismiss() {
-	super.dismiss();
-
-    }
-
-    /**
-     * Event simple click on call button.
-     */
-    class CallListener implements View.OnClickListener {
-
-	/**
-	 * Constructor.
-	 */
-	public CallListener() {
-	}
-
-	@Override
-	public void onClick(View v) {
-	    try {
-		// TODO permettre a l'user de choisir a quel ressource il veut
-		// faire le call.
-		mXmppFacade.call(mContact.getJID() + "/psi");
-	    } catch (RemoteException e) {
-		e.printStackTrace();
-	    }
-	}
-    }
-
-    /**
-     * Event simple click on chat button.
-     */
-    class ChatListener implements View.OnClickListener {
-
-	/**
-	 * Constructor.
-	 */
-	public ChatListener() {
-	}
-
-	@Override
-	public void onClick(View v) {
-	    Activity a = ContactDialog.this.getOwnerActivity();
-	    Intent i = new Intent(mContext, Chat.class);
-	    i.setData(mContact.toUri());
-	    a.startActivity(i);
-	    dismiss();
-	}
-
-    }
-
-    /**
-     * Event simple click on info button.
-     */
-    class InfosListener implements View.OnClickListener {
-
-	/**
-	 * Constructor.
-	 */
-	public InfosListener() {
-	}
-
-	@Override
-	public void onClick(View v) {
-	    Activity a = ContactDialog.this.getOwnerActivity();
-	    Intent i = new Intent(mContext, UserInfo.class);
-	    Log.i("OOO", mContact.getJID());
-	    i.putExtra("contact_contactdialog", mContact.getJID());
-	    a.startActivity(i);
-	    dismiss();
-	}
-
-    }
-
-    /**
-     * The service connection used to connect to the Beem service.
-     */
-    private class BeemServiceConnection implements ServiceConnection {
-
-	/**
-	 * Constructor.
-	 */
-	public BeemServiceConnection() {
-	}
-
-	@Override
-	public void onServiceConnected(ComponentName name, IBinder service) {
-	    mXmppFacade = IXmppFacade.Stub.asInterface(service);
-	}
-
-	@Override
-	public void onServiceDisconnected(ComponentName name) {
-	    mXmppFacade = null;
-	}
-    }
-
-}
--- a/src/com/beem/project/beem/ui/ContactList.java	Fri Dec 04 11:31:17 2009 +0100
+++ b/src/com/beem/project/beem/ui/ContactList.java	Fri Dec 04 13:12:00 2009 +0100
@@ -7,6 +7,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.jivesoftware.smack.packet.Presence;
 import org.jivesoftware.smack.util.StringUtils;
 
 import android.app.Activity;
@@ -26,7 +27,6 @@
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.preference.PreferenceManager;
-import android.util.Log;
 import android.view.ContextMenu;
 import android.view.LayoutInflater;
 import android.view.Menu;
@@ -41,6 +41,7 @@
 import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.TextView;
+import android.widget.Toast;
 import android.widget.AdapterView.AdapterContextMenuInfo;
 import android.widget.AdapterView.OnItemClickListener;
 
@@ -61,7 +62,6 @@
     // private static final String TAG = "CONTACTLIST_ACT";
     private static final Intent SERVICE_INTENT = new Intent();
     private static final int REQUEST_CODE = 1;
-    private static final int DIALOG_ALIAS = 11;
     private BeemContactList mAdapterContactList;
     private BeemBanner mAdapterBanner;
     private IRoster mRoster;
@@ -77,7 +77,6 @@
     private BeemBroadcastReceiver mReceiver;
     private final Map<Integer, Bitmap> mIconsMap = new HashMap<Integer, Bitmap>();
     private LayoutInflater mInflater;
-    private ContactDialog mContactDialog;
 
     static {
 	SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
@@ -145,7 +144,6 @@
     @Override
     public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
 	super.onCreateContextMenu(menu, v, menuInfo);
-	// TODO gere les info du context menu pour afficher que pour le bon long click
 	MenuInflater inflater = getMenuInflater();
 	inflater.inflate(R.menu.contactlist_context, menu);
 	AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
@@ -153,11 +151,9 @@
 	try {
 	    mContact = mRoster.getContact(c.getJID());
 	} catch (RemoteException e) {
-	    // TODO Auto-generated catch block
 	    e.printStackTrace();
 	}
 	menu.setHeaderTitle(mContact.getJID());
-	Log.e("OO", mContact.getName());
     }
 
     /**
@@ -182,11 +178,26 @@
 		    }
 		    return true;
 		case R.id.contact_list_context_menu_user_info:
-		    item.getSubMenu().setHeaderTitle(mContact.getName());
+		    item.getSubMenu().setHeaderTitle(mContact.getJID());
+		    return true;
+		case R.id.contact_list_context_menu_userinfo_alias:
+		    Dialog alias = new DialogAlias(ContactList.this).create();
+		    alias.show();
 		    return true;
-		case R.id.menu_userinfo_alias:
-		    Dialog alias = new DialogAlias(ContactList.this, mContact).create();
-		    alias.show();
+		case R.id.contact_list_context_menu_userinfo_group:
+		    in = new Intent(this, GroupList.class);
+		    in.putExtra("contact", mContact);
+		    startActivity(in);
+		    return true;
+		case R.id.contact_list_context_menu_userinfo_subscription:
+		    Dialog subscription = new DialogResendSubscription(ContactList.this).create();
+		    subscription.show();
+		    return true;
+		case R.id.contact_list_context_menu_userinfo_block:
+		    return true;
+		case R.id.contact_list_context_menu_userinfo_delete:
+		    Dialog delete = new DialogDelete(ContactList.this).create();
+		    delete.show();
 		    return true;
 		default:
 		    return super.onContextItemSelected(item);
@@ -222,8 +233,6 @@
     @Override
     protected void onStop() {
 	super.onStop();
-	if (mContactDialog != null)
-	    mContactDialog.dismiss();
 	if (mReceiver.isBinded()) {
 	    unbindService(mServConn);
 	    mReceiver.setBinded(false);
@@ -687,19 +696,17 @@
      */
     public class DialogAlias extends AlertDialog.Builder {
 	EditText editTextAlias;
-	Contact contact;
 
-	protected DialogAlias(Context context, Contact c) {
+	public DialogAlias(Context context) {
 	    super(context);
 	    LayoutInflater factory = LayoutInflater.from(context);
 	    final View textEntryView = factory.inflate(R.layout.contactdialogaliasdialog, null);
-	    setTitle(c.getName());
+	    setTitle(mContact.getJID());
 	    setView(textEntryView);
 	    editTextAlias = (EditText) textEntryView.findViewById(R.id.CDAliasDialogName);
 	    editTextAlias.setText(mContact.getName());
 	    setPositiveButton("OK", new ContactDialogAliasDialog());
 	    setNegativeButton("Cancel", new ContactDialogAliasDialog());
-	    contact = c;
 	}
 
 	/**
@@ -715,19 +722,88 @@
 
 	    @Override
 	    public void onClick(DialogInterface dialog, int which) {
-		Log.i("OOO", "OO " + which);
-		String name = editTextAlias.getText().toString();
-		if (name.length() == 0)
-		    name = mContact.getJID();
-		try {
-		    mRoster.setContactName(mContact.getJID(), name);
-		} catch (RemoteException e) {
-		    e.printStackTrace();
+		if (which == Dialog.BUTTON_POSITIVE) {
+		    String name = editTextAlias.getText().toString();
+		    if (name.length() == 0)
+			name = mContact.getJID();
+		    try {
+			mRoster.setContactName(mContact.getJID(), name);
+		    } catch (RemoteException e) {
+			e.printStackTrace();
+		    }
 		}
 	    }
 	}
     }
 
+    public class DialogResendSubscription extends AlertDialog.Builder {
+
+	public DialogResendSubscription(Context arg0) {
+	    super(arg0);
+	    setMessage(R.string.userinfo_sureresend);
+	    DialogClickListener dl = new DialogClickListener();
+	    setPositiveButton(R.string.userinfo_yes, dl);
+	    setNegativeButton(R.string.userinfo_no, dl);
+	}
+
+	class DialogClickListener implements DialogInterface.OnClickListener {
+
+	    /**
+	     * Constructor.
+	     */
+	    DialogClickListener() {
+	    }
+
+	    @Override
+	    public void onClick(DialogInterface dialog, int which) {
+		if (which == Dialog.BUTTON_POSITIVE) {
+		    Presence presencePacket = new Presence(Presence.Type.subscribe);
+		    presencePacket.setTo(mContact.getJID());
+		    try {
+			mXmppFacade.sendPresencePacket(new PresenceAdapter(presencePacket));
+			Toast.makeText(ContactList.this, getString(R.string.userinfo_resend), Toast.LENGTH_SHORT)
+			    .show();
+		    } catch (RemoteException e) {
+			e.printStackTrace();
+		    }
+		}
+	    }
+
+	}
+
+    }
+
+    public class DialogDelete extends AlertDialog.Builder {
+
+	public DialogDelete(Context context) {
+	    super(context);
+	    setMessage(R.string.userinfo_sure2delete);
+	    DialogClickListener dl = new DialogClickListener();
+	    setPositiveButton(R.string.userinfo_yes, dl);
+	    setNegativeButton(R.string.userinfo_no, dl);
+	}
+
+	private class DialogClickListener implements DialogInterface.OnClickListener {
+	    /**
+	     * Constructor.
+	     */
+	    public DialogClickListener() {
+	    }
+
+	    @Override
+	    public void onClick(DialogInterface dialog, int which) {
+		if (which == Dialog.BUTTON_POSITIVE) {
+		    try {
+			mRoster.deleteContact(mContact);
+		    } catch (RemoteException e) {
+			e.printStackTrace();
+		    }
+		}
+	    }
+	}
+
+    }
+
     /**
      * The service connection used to connect to the Beem service.
      */
--- a/src/com/beem/project/beem/ui/UserInfo.java	Fri Dec 04 11:31:17 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,371 +0,0 @@
-package com.beem.project.beem.ui;
-
-import java.util.List;
-
-import org.jivesoftware.smack.packet.Presence;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.Gallery;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.beem.project.beem.BeemService;
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.service.PresenceAdapter;
-import com.beem.project.beem.service.aidl.IRoster;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-import com.beem.project.beem.utils.BeemBroadcastReceiver;
-
-/**
- * This activity class provides the view for user infos after long click on a correspondant.
- * @author marseille
- */
-public class UserInfo extends Activity {
-
-    private static final Intent SERVICE_INTENT = new Intent();
-    private final ServiceConnection mServConn = new BeemServiceConnection();
-    private TextView mTextAlias;
-    private Gallery mGalleryGroups;
-    private Contact mContact;
-    private IXmppFacade mXmppFacade;
-    private BeemBroadcastReceiver mReceiver;
-    private String mJID;
-    private IRoster mRoster;
-
-    static {
-	SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
-    }
-
-    /**
-     * Constructor.
-     */
-    public UserInfo() {
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-	super.onCreate(savedInstanceState);
-	setContentView(R.layout.userinfo);
-	View v = (View) findViewById(R.id.userinfo_layout_alias);
-	v.setOnClickListener(new AliasListener());
-	v = findViewById(R.id.userinfo_layout_delete);
-	v.setOnClickListener(new DeleteListener());
-	v = findViewById(R.id.userinfo_layout_chg_group);
-	v.setOnClickListener(new GroupListener());
-	v = findViewById(R.id.userinfo_layout_re_suscription);
-	v.setOnClickListener(new ResendListener());
-	mTextAlias = (TextView) findViewById(R.id.userinfo_alias);
-	mGalleryGroups = (Gallery) findViewById(R.id.userinfo_groups);
-	mReceiver = new BeemBroadcastReceiver(mServConn);
-	this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void onResume() {
-	super.onResume();
-	bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void onPause() {
-	super.onPause();
-	if (mReceiver.isBinded()) {
-	    unbindService(mServConn);
-	    mReceiver.setBinded(false);
-	}
-    }
-
-    @Override
-    protected void onDestroy() {
-	super.onDestroy();
-	this.unregisterReceiver(mReceiver);
-    }
-
-    /**
-     * Event simple click on layout alias.
-     */
-    private class AliasListener implements View.OnClickListener {
-	/**
-	 * Constructor.
-	 */
-	public AliasListener() {
-	}
-
-	@Override
-	public void onClick(View v) {
-	    Dialog d = new DialogAlias();
-	    d.show();
-	}
-    }
-
-    /**
-     * Event simple click on layout group.
-     */
-    private class GroupListener implements View.OnClickListener {
-	/**
-	 * Constructor.
-	 */
-	public GroupListener() {
-	}
-
-	@Override
-	public void onClick(View v) {
-	    Intent i = new Intent(UserInfo.this, GroupList.class);
-	    i.putExtra("contact", mContact);
-	    startActivity(i);
-	}
-
-    }
-
-    /**
-     * Create dialog alias.
-     */
-    public class DialogAlias extends Dialog {
-
-	/**
-	 * Constructor.
-	 */
-	public DialogAlias() {
-	    super(UserInfo.this);
-	    setContentView(R.layout.contactdialogaliasdialog);
-	    setTitle(mContact.getJID());
-	    EditText nameText = (EditText) findViewById(R.id.CDAliasDialogName);
-	    if (mContact.getName().length() == 0)
-		nameText.setText(mContact.getJID());
-	    else
-		nameText.setText(mContact.getName());
-	    //Button ok = (Button) findViewById(R.id.CDAliasDialogOk);
-	    //ok.setOnClickListener(new ContactDialogAliasDialogOK());
-	}
-
-	/**
-	 * Event click on the button OK.
-	 */
-	public class ContactDialogAliasDialogOK implements View.OnClickListener {
-
-	    /**
-	     * Constructor.
-	     */
-	    public ContactDialogAliasDialogOK() {
-	    }
-
-	    @Override
-	    public void onClick(View v) {
-		try {
-		    EditText nameText = (EditText) findViewById(R.id.CDAliasDialogName);
-		    String name = nameText.getText().toString();
-		    if (name.length() == 0)
-			name = mContact.getJID();
-		    mRoster.setContactName(mContact.getJID(), name);
-		    mContact.setName(name);
-		    mTextAlias.setText(name);
-
-		} catch (RemoteException e) {
-		    e.printStackTrace();
-		}
-		dismiss();
-	    }
-	}
-    }
-
-    /**
-     * Adapter group horizontal list.
-     */
-    public class BeemGroups extends BaseAdapter {
-	private Context mContext;
-	private List<String> mListGroup;
-
-	/**
-	 * Constructor.
-	 * @param c context activity.
-	 * @param listGroup the user group list.
-	 */
-	public BeemGroups(final Context c, final List<String> listGroup) {
-	    mContext = c;
-	    if (listGroup.size() == 0)
-		listGroup.add(getString(R.string.contact_list_no_group));
-	    mListGroup = listGroup;
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public int getCount() {
-	    return mListGroup.size();
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public Object getItem(int position) {
-	    return position;
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public long getItemId(int position) {
-	    return position;
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public View getView(int position, View convertView, ViewGroup parent) {
-	    TextView textView = new TextView(mContext);
-	    textView.setText(mListGroup.get(position));
-	    return textView;
-	}
-
-    }
-
-    /**
-     * Event simple click on layout resend suscription.
-     */
-    private class ResendListener implements View.OnClickListener {
-
-	/**
-	 * Constructor.
-	 */
-	public ResendListener() {
-	}
-
-	@Override
-	public void onClick(View v) {
-
-	    AlertDialog.Builder builder = new AlertDialog.Builder(UserInfo.this);
-	    builder.setMessage(UserInfo.this.getString(R.string.userinfo_sureresend)).setCancelable(false)
-		.setPositiveButton(UserInfo.this.getString(R.string.userinfo_yes),
-		    new DialogInterface.OnClickListener() {
-			public void onClick(DialogInterface dialog, int id) {
-			    Presence presencePacket = new Presence(Presence.Type.subscribe);
-			    presencePacket.setTo(mContact.getJID());
-			    try {
-				mXmppFacade.sendPresencePacket(new PresenceAdapter(presencePacket));
-			    } catch (RemoteException e) {
-				e.printStackTrace();
-			    }
-			    Toast.makeText(UserInfo.this, getString(R.string.userinfo_resend), Toast.LENGTH_SHORT)
-				.show();
-			}
-		    }).setNegativeButton(UserInfo.this.getString(R.string.userinfo_no),
-		    new DialogInterface.OnClickListener() {
-			public void onClick(DialogInterface dialog, int id) {
-			    dialog.cancel();
-			}
-		    });
-	    AlertDialog alert = builder.create();
-	    alert.show();
-	}
-
-    }
-
-    /**
-     * Event simple click on layout delete.
-     */
-    private class DeleteListener implements View.OnClickListener {
-
-	/**
-	 * Constructor.
-	 */
-	public DeleteListener() {
-	    
-	}
-
-	@Override
-	public void onClick(View v) {
-	    AlertDialog.Builder builder = new AlertDialog.Builder(UserInfo.this);
-	    builder.setMessage(UserInfo.this.getString(R.string.userinfo_sure2delete)).setCancelable(false)
-		.setPositiveButton(UserInfo.this.getString(R.string.userinfo_yes),
-		    new DialogInterface.OnClickListener() {
-			public void onClick(DialogInterface dialog, int id) {
-			    try {
-				mRoster.deleteContact(mContact);
-			    } catch (RemoteException e) {
-				e.printStackTrace();
-			    }
-			    finish();
-			}
-		    }).setNegativeButton(UserInfo.this.getString(R.string.userinfo_no),
-		    new DialogInterface.OnClickListener() {
-			public void onClick(DialogInterface dialog, int id) {
-			    dialog.cancel();
-			}
-		    });
-	    AlertDialog alert = builder.create();
-	    alert.show();
-	}
-    }
-
-    /**
-     * The ServiceConnection used to connect to the Beem service.
-     */
-    private class BeemServiceConnection implements ServiceConnection {
-
-	/**
-	 * Constructor.
-	 */
-	public BeemServiceConnection() {
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public void onServiceConnected(ComponentName name, IBinder service) {
-	    mXmppFacade = IXmppFacade.Stub.asInterface(service);
-	    mReceiver.setBinded(true);
-	    try {
-		mRoster = mXmppFacade.getRoster();
-		mJID = getIntent().getStringExtra("contact_contactdialog");
-		mContact = mRoster.getContact(mJID);
-		if (mContact.getName() != null)
-		    mTextAlias.setText(mContact.getName());
-		else
-		    mTextAlias.setText(mContact.getJID());
-		mGalleryGroups.setAdapter(new BeemGroups(UserInfo.this, mContact.getGroups()));
-		setTitle(mJID);
-	    } catch (RemoteException e) {
-		e.printStackTrace();
-	    }
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public void onServiceDisconnected(ComponentName name) {
-	    mXmppFacade = null;
-	}
-    }
-}