Création d'un package pour les builders de Box.
--- a/src/com/beem/project/beem/ui/ContactList.java Tue Dec 08 22:10:01 2009 +0100
+++ b/src/com/beem/project/beem/ui/ContactList.java Thu Dec 10 04:14:24 2009 +0100
@@ -1,46 +1,17 @@
/**
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Véronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program “Beem”
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
+ * BEEM is a videoconference application on the Android Platform. Copyright (C) 2009 by Frederic-Charles Barthelery,
+ * Jean-Manuel Da Silva, Nikita Kozlov, Philippe Lago, Jean Baptiste Vergely, Vincent Véronis. This file is part of
+ * BEEM. BEEM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
+ * version. BEEM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with BEEM. If not, see
+ * <http://www.gnu.org/licenses/>. Please send bug reports with examples or suggestions to contact@beem-project.com or
+ * http://dev.beem-project.com/ Epitech, hereby disclaims all copyright interest in the program “Beem” written by
+ * Frederic-Charles Barthelery, Jean-Manuel Da Silva, Nikita Kozlov, Philippe Lago, Jean Baptiste Vergely, Vincent
+ * Veronis. Nicolas Sadirac, November 26, 2009 President of Epitech. Flavien Astraud, November 26, 2009 Head of the EIP
+ * Laboratory.
+ */
package com.beem.project.beem.ui;
import java.util.ArrayList;
@@ -50,15 +21,12 @@
import java.util.List;
import java.util.Map;
-import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.util.StringUtils;
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;
@@ -79,12 +47,10 @@
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
-import android.widget.EditText;
import android.widget.Gallery;
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;
@@ -94,12 +60,15 @@
import com.beem.project.beem.service.aidl.IBeemRosterListener;
import com.beem.project.beem.service.aidl.IRoster;
import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.ui.dialogs.builders.Alias;
+import com.beem.project.beem.ui.dialogs.builders.DeleteContact;
+import com.beem.project.beem.ui.dialogs.builders.ResendSubscription;
import com.beem.project.beem.utils.BeemBroadcastReceiver;
import com.beem.project.beem.utils.Status;
-// TODO: Auto-generated Javadoc
/**
* The contact list activity displays the roster of the user.
+ * TODO: Dismiss dialogs on destroy to avoid window leak
*/
public class ContactList extends Activity {
@@ -225,7 +194,7 @@
item.getSubMenu().setHeaderTitle(mContact.getJID());
return true;
case R.id.contact_list_context_menu_userinfo_alias:
- Dialog alias = new DialogAlias(ContactList.this).create();
+ Dialog alias = new Alias(ContactList.this, mRoster, mContact).create();
alias.show();
return true;
case R.id.contact_list_context_menu_userinfo_group:
@@ -234,13 +203,13 @@
startActivity(in);
return true;
case R.id.contact_list_context_menu_userinfo_subscription:
- Dialog subscription = new DialogResendSubscription(ContactList.this).create();
+ Dialog subscription = new ResendSubscription(ContactList.this, mXmppFacade, mContact).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();
+ Dialog delete = new DeleteContact(ContactList.this, mRoster, mContact).create();
delete.show();
return true;
default:
@@ -250,7 +219,8 @@
return super.onContextItemSelected(item);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onActivityResult(int, int, android.content.Intent)
*/
@Override
@@ -286,7 +256,8 @@
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onDestroy()
*/
@Override
@@ -742,147 +713,8 @@
}
/**
- * Create dialog alias.
- */
- public class DialogAlias extends AlertDialog.Builder {
- private EditText mEditTextAlias;
-
- /**
- * Constructor.
- * @param context context activity.
- */
- public DialogAlias(final Context context) {
- super(context);
- LayoutInflater factory = LayoutInflater.from(context);
- final View textEntryView = factory.inflate(R.layout.contactdialogaliasdialog, null);
- setTitle(mContact.getJID());
- setView(textEntryView);
- mEditTextAlias = (EditText) textEntryView.findViewById(R.id.CDAliasDialogName);
- mEditTextAlias.setText(mContact.getName());
- setPositiveButton(R.string.OkButton, new ContactDialogAliasDialog());
- setNegativeButton(R.string.CancelButton, new ContactDialogAliasDialog());
- }
-
- /**
- * Event click listener.
- */
- class ContactDialogAliasDialog implements DialogInterface.OnClickListener {
-
- /**
- * Constructor.
- */
- public ContactDialogAliasDialog() {
- }
-
- /* (non-Javadoc)
- * @see android.content.DialogInterface.OnClickListener#onClick(android.content.DialogInterface, int)
- */
- @Override
- public void onClick(DialogInterface dialog, int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- String name = mEditTextAlias.getText().toString();
- if (name.length() == 0)
- name = mContact.getJID();
- try {
- mRoster.setContactName(mContact.getJID(), name);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
-
- /**
* Create dialog resend subscription.
*/
- public class DialogResendSubscription extends AlertDialog.Builder {
-
- /**
- * Constructor.
- * @param context context activity
- */
- public DialogResendSubscription(final Context context) {
- super(context);
- setMessage(R.string.userinfo_sureresend);
- DialogClickListener dl = new DialogClickListener();
- setPositiveButton(R.string.userinfo_yes, dl);
- setNegativeButton(R.string.userinfo_no, dl);
- }
-
- /**
- * Event click listener.
- */
- class DialogClickListener implements DialogInterface.OnClickListener {
-
- /**
- * Constructor.
- */
- DialogClickListener() {
- }
-
- /* (non-Javadoc)
- * @see android.content.DialogInterface.OnClickListener#onClick(android.content.DialogInterface, int)
- */
- @Override
- public void onClick(DialogInterface dialog, int which) {
- if (which == DialogInterface.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();
- }
- }
- }
-
- }
-
- }
-
- /**
- * Create dialog delete.
- */
- public class DialogDelete extends AlertDialog.Builder {
-
- /**
- * Constructor.
- * @param context context activity.
- */
- public DialogDelete(final 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);
- }
-
- /**
- * Event click listener.
- */
- private class DialogClickListener implements DialogInterface.OnClickListener {
- /**
- * Constructor.
- */
- public DialogClickListener() {
- }
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- try {
- mRoster.deleteContact(mContact);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- }
/**
* The service connection used to connect to the Beem service.
@@ -937,7 +769,6 @@
} catch (RemoteException e) {
e.printStackTrace();
}
-
}
@Override
--- a/src/com/beem/project/beem/ui/Login.java Tue Dec 08 22:10:01 2009 +0100
+++ b/src/com/beem/project/beem/ui/Login.java Thu Dec 10 04:14:24 2009 +0100
@@ -59,7 +59,6 @@
import com.beem.project.beem.R;
import com.beem.project.beem.utils.BeemConnectivity;
-// TODO: Auto-generated Javadoc
/**
* This class is the main Activity for the Beem project.
* @author Da Risk <darisk972@gmai.com>
--- a/src/com/beem/project/beem/ui/PrivacyList.java Tue Dec 08 22:10:01 2009 +0100
+++ b/src/com/beem/project/beem/ui/PrivacyList.java Thu Dec 10 04:14:24 2009 +0100
@@ -76,7 +76,6 @@
import com.beem.project.beem.service.aidl.IXmppFacade;
import com.beem.project.beem.utils.BeemBroadcastReceiver;
-// TODO: Auto-generated Javadoc
/**
* This class represents an activity which allows the user to manage his privacy lists.
* @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/dialogs/builders/Alias.java Thu Dec 10 04:14:24 2009 +0100
@@ -0,0 +1,73 @@
+package com.beem.project.beem.ui.dialogs.builders;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.RemoteException;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.EditText;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.aidl.IRoster;
+
+/**
+ * Create dialog alias.
+ */
+public class Alias extends AlertDialog.Builder {
+
+ private IRoster mRoster;
+ private Contact mContact;
+ private EditText mEditTextAlias;
+
+ /**
+ * Constructor.
+ * @param context context activity.
+ */
+ public Alias(final Context context, IRoster roster, Contact contact) {
+ super(context);
+
+ mRoster = roster;
+ mContact = contact;
+
+ LayoutInflater factory = LayoutInflater.from(context);
+ final View textEntryView = factory.inflate(R.layout.contactdialogaliasdialog, null);
+ setTitle(mContact.getJID());
+ setView(textEntryView);
+ mEditTextAlias = (EditText) textEntryView.findViewById(R.id.CDAliasDialogName);
+ mEditTextAlias.setText(mContact.getName());
+ setPositiveButton(R.string.OkButton, new DialogClickListener());
+ setNegativeButton(R.string.CancelButton, new DialogClickListener());
+ }
+
+ /**
+ * Event click listener.
+ */
+ class DialogClickListener implements DialogInterface.OnClickListener {
+
+ /**
+ * Constructor.
+ */
+ public DialogClickListener() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see android.content.DialogInterface.OnClickListener#onClick(android.content.DialogInterface, int)
+ */
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ String name = mEditTextAlias.getText().toString();
+ if (name.length() == 0)
+ name = mContact.getJID();
+ try {
+ mRoster.setContactName(mContact.getJID(), name);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/dialogs/builders/DeleteContact.java Thu Dec 10 04:14:24 2009 +0100
@@ -0,0 +1,56 @@
+package com.beem.project.beem.ui.dialogs.builders;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.RemoteException;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.aidl.IRoster;
+
+public class DeleteContact extends AlertDialog.Builder {
+
+ private IRoster mRoster;
+ private Contact mContact;
+
+ /**
+ * Constructor.
+ * @param context context activity.
+ */
+ public DeleteContact(final Context context, IRoster roster, Contact contact) {
+ super(context);
+
+ mContact = contact;
+ mRoster = roster;
+
+ setMessage(R.string.userinfo_sure2delete);
+ DialogClickListener dl = new DialogClickListener();
+ setPositiveButton(R.string.userinfo_yes, dl);
+ setNegativeButton(R.string.userinfo_no, dl);
+ }
+
+ /**
+ * Event click listener.
+ */
+ private class DialogClickListener implements DialogInterface.OnClickListener {
+
+
+ /**
+ * Constructor.
+ */
+ public DialogClickListener() {
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ try {
+ mRoster.deleteContact(mContact);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/dialogs/builders/ResendSubscription.java Thu Dec 10 04:14:24 2009 +0100
@@ -0,0 +1,71 @@
+package com.beem.project.beem.ui.dialogs.builders;
+
+import org.jivesoftware.smack.packet.Presence;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.RemoteException;
+import android.widget.Toast;
+
+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.IXmppFacade;
+
+public class ResendSubscription extends AlertDialog.Builder {
+
+ private Context mContext;
+ private IXmppFacade mXmppFacade;
+ private Contact mContact;
+
+ /**
+ * Constructor.
+ * @param context context activity
+ */
+ public ResendSubscription(final Context context, IXmppFacade xmppFacade, Contact contact) {
+ super(context);
+
+ mContext = context;
+ mXmppFacade = xmppFacade;
+ mContact = contact;
+
+ setMessage(R.string.userinfo_sureresend);
+ DialogClickListener dl = new DialogClickListener();
+ setPositiveButton(R.string.userinfo_yes, dl);
+ setNegativeButton(R.string.userinfo_no, dl);
+ }
+
+ /**
+ * Event click listener.
+ */
+ class DialogClickListener implements DialogInterface.OnClickListener {
+
+
+
+ /**
+ * Constructor.
+ */
+ DialogClickListener() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see android.content.DialogInterface.OnClickListener#onClick(android.content.DialogInterface, int)
+ */
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ Presence presencePacket = new Presence(Presence.Type.subscribe);
+ presencePacket.setTo(mContact.getJID());
+ try {
+ mXmppFacade.sendPresencePacket(new PresenceAdapter(presencePacket));
+ Toast.makeText(mContext, mContext.getString(R.string.userinfo_resend), Toast.LENGTH_SHORT).show();
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ }
+}