# HG changeset patch # User Vincent Veronis # Date 1254410601 -7200 # Node ID 2e33fad3ec9853448ce1d42f70f11846ba776507 # Parent 489d3728f7b7ea6274bb570271f34fec197048b3 User info delete user. User info resend subscription. diff -r 489d3728f7b7 -r 2e33fad3ec98 res/values-en/strings.xml --- a/res/values-en/strings.xml Thu Oct 01 16:57:07 2009 +0200 +++ b/res/values-en/strings.xml Thu Oct 01 17:23:21 2009 +0200 @@ -225,5 +225,6 @@ Block Delete User informations + Suscription resend diff -r 489d3728f7b7 -r 2e33fad3ec98 res/values-fr/strings.xml --- a/res/values-fr/strings.xml Thu Oct 01 16:57:07 2009 +0200 +++ b/res/values-fr/strings.xml Thu Oct 01 17:23:21 2009 +0200 @@ -217,4 +217,5 @@ Bloquer Supprimer Informations utilisateur + Souscription réenvoyée diff -r 489d3728f7b7 -r 2e33fad3ec98 src/com/beem/project/beem/service/RosterAdapter.java --- a/src/com/beem/project/beem/service/RosterAdapter.java Thu Oct 01 16:57:07 2009 +0200 +++ b/src/com/beem/project/beem/service/RosterAdapter.java Thu Oct 01 17:23:21 2009 +0200 @@ -3,7 +3,6 @@ */ package com.beem.project.beem.service; - import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -85,15 +84,10 @@ * {@inheritDoc} */ @Override - public void deleteContact(Contact contact, String group) throws RemoteException { + public void deleteContact(Contact contact) throws RemoteException { try { RosterEntry entry = mAdaptee.getEntry(contact.getJID()); - if (entry.getGroups().size() == 0) { - mAdaptee.removeEntry(entry); - } else { - mAdaptee.getGroup(group).removeEntry(entry); - mRosterListener.onEntryDeleteFromGroup(group, contact.getJID()); - } + mAdaptee.removeEntry(entry); } catch (XMPPException e) { e.printStackTrace(); } @@ -107,7 +101,7 @@ try { mAdaptee.createGroup(groupname); } catch (IllegalArgumentException e) { - //pas grave, plus simple a gerer comme ca. + // pas grave, plus simple a gerer comme ca. Log.e(TAG, "Error while creating group", e); } } @@ -201,7 +195,7 @@ * @param jid the jid of the entry which is deleted. */ public void onEntryDeleteFromGroup(String group, String jid) { - //Log.i(TAG, "entry delete listener"); + // Log.i(TAG, "entry delete listener"); final int n = mRemoteRosListeners.beginBroadcast(); for (int i = 0; i < n; i++) { IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i); @@ -220,7 +214,7 @@ */ @Override public void entriesAdded(Collection addresses) { - //Log.i(TAG, "Ajout de l'entry " + addresses.size() + " " + addresses.toArray()[0]); + // Log.i(TAG, "Ajout de l'entry " + addresses.size() + " " + addresses.toArray()[0]); final int n = mRemoteRosListeners.beginBroadcast(); List tab = new ArrayList(); @@ -241,7 +235,7 @@ */ @Override public void entriesDeleted(Collection addresses) { - //Log.i(TAG, "Suppression de l'entry"); + // Log.i(TAG, "Suppression de l'entry"); final int n = mRemoteRosListeners.beginBroadcast(); List tab = new ArrayList(); @@ -262,7 +256,7 @@ */ @Override public void entriesUpdated(Collection addresses) { - //Log.i(TAG, "Update de l'entry " + addresses.size() + " " + addresses.toArray()[0]); + // Log.i(TAG, "Update de l'entry " + addresses.size() + " " + addresses.toArray()[0]); final int n = mRemoteRosListeners.beginBroadcast(); List tab = new ArrayList(); @@ -283,7 +277,7 @@ */ @Override public void presenceChanged(Presence presence) { - //Log.i(TAG, "presence Changed"); + // Log.i(TAG, "presence Changed"); /* redispatch vers les IBeemRosterListener */ final int n = mRemoteRosListeners.beginBroadcast(); diff -r 489d3728f7b7 -r 2e33fad3ec98 src/com/beem/project/beem/service/aidl/IRoster.aidl --- a/src/com/beem/project/beem/service/aidl/IRoster.aidl Thu Oct 01 16:57:07 2009 +0200 +++ b/src/com/beem/project/beem/service/aidl/IRoster.aidl Thu Oct 01 17:23:21 2009 +0200 @@ -8,7 +8,7 @@ Contact addContact(in String user, in String name, in String[] groups); - void deleteContact(in Contact contact, in String group); + void deleteContact(in Contact contact); Contact getContact(in String jid); void setContactName(in String jid, in String name); diff -r 489d3728f7b7 -r 2e33fad3ec98 src/com/beem/project/beem/ui/ContactDialog.java --- a/src/com/beem/project/beem/ui/ContactDialog.java Thu Oct 01 16:57:07 2009 +0200 +++ b/src/com/beem/project/beem/ui/ContactDialog.java Thu Oct 01 17:23:21 2009 +0200 @@ -113,32 +113,6 @@ } - class deleteListener implements View.OnClickListener { - - @Override - public void onClick(View v) { - final Activity a = ContactDialog.this.getOwnerActivity(); - AlertDialog.Builder builder = new AlertDialog.Builder(a); - builder.setMessage(a.getString(R.string.CDDelete)).setCancelable(false).setPositiveButton( - a.getString(R.string.CDSure2DeleteYes), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - try { - mXmppFacade.getRoster().deleteContact(mContact, mGroup); - } catch (RemoteException e) { - e.printStackTrace(); - } - dismiss(); - } - }).setNegativeButton(a.getString(R.string.CDSure2DeleteNo), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - } - }); - AlertDialog alert = builder.create(); - alert.show(); - } - } - class infosListener implements View.OnClickListener { @Override @@ -152,22 +126,6 @@ } - class resendListener implements View.OnClickListener { - - @Override - public void onClick(View v) { - Presence presencePacket = new Presence(Presence.Type.subscribe); - presencePacket.setTo(mContact.getJID()); - try { - mXmppFacade.sendPresencePacket(new PresenceAdapter(presencePacket)); - } catch (RemoteException e) { - Log.e(TAG, "resend subscription error", e); - } - dismiss(); - } - - } - private class BeemServiceConnection implements ServiceConnection { @Override diff -r 489d3728f7b7 -r 2e33fad3ec98 src/com/beem/project/beem/ui/UserInfo.java --- a/src/com/beem/project/beem/ui/UserInfo.java Thu Oct 01 16:57:07 2009 +0200 +++ b/src/com/beem/project/beem/ui/UserInfo.java Thu Oct 01 17:23:21 2009 +0200 @@ -2,16 +2,21 @@ 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.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; @@ -19,10 +24,12 @@ 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; @@ -60,6 +67,10 @@ 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_re_suscription); + v.setOnClickListener(new ResendListener()); mTextAlias = (TextView) findViewById(R.id.userinfo_alias); mGalleryGroups = (Gallery) findViewById(R.id.userinfo_groups); mReceiver = new BeemBroadcastReceiver(mServConn); @@ -99,18 +110,18 @@ @Override public void onClick(View v) { - Dialog d = new ContactDialogAliasDialog(); + Dialog d = new DialogAlias(); d.show(); } } - public class ContactDialogAliasDialog extends Dialog { + public class DialogAlias extends Dialog { /** * Constructor. */ - public ContactDialogAliasDialog() { + public DialogAlias() { super(UserInfo.this); setContentView(R.layout.contactdialogaliasdialog); setTitle(mContact.getJID()); @@ -202,6 +213,65 @@ } /** + * Event simple click on layout resend suscription. + */ + class ResendListener implements View.OnClickListener { + + /** + * Constructor. + */ + public ResendListener() { + } + + @Override + public void onClick(View v) { + 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_LONG).show(); + } + + } + + /** + * Event simple click on layout delete + */ + 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.CDSure2Delete)).setCancelable(false).setPositiveButton( + UserInfo.this.getString(R.string.CDSure2DeleteYes), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + try { + mXmppFacade.getRoster().deleteContact(mContact); + } catch (RemoteException e) { + e.printStackTrace(); + } + } + }).setNegativeButton(UserInfo.this.getString(R.string.CDSure2DeleteNo), + 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 {