# HG changeset patch # User Vincent Veronis # Date 1254408612 -7200 # Node ID 32d2c5840a8cfce1a26b141597277f709017612b # Parent 1385ea6318524f60d9b6c7750704a627b4eee8df Ajout de la layout vcard Ajout de la layout manage group avec une banner defilante qui affiche tous les groups d'un user. diff -r 1385ea631852 -r 32d2c5840a8c res/layout/contactlist.xml --- a/res/layout/contactlist.xml Thu Oct 01 15:48:06 2009 +0200 +++ b/res/layout/contactlist.xml Thu Oct 01 16:50:12 2009 +0200 @@ -4,7 +4,7 @@ android:orientation="vertical"> - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 1385ea631852 -r 32d2c5840a8c res/values-en/strings.xml --- a/res/values-en/strings.xml Thu Oct 01 15:48:06 2009 +0200 +++ b/res/values-en/strings.xml Thu Oct 01 16:50:12 2009 +0200 @@ -38,7 +38,7 @@ Call Alias Resend suscription - User infos + Manage User Block user Delete user Are you sure you want to delete this contact? @@ -220,9 +220,10 @@ --> Alias VCard - Modifier groupe - Renvoyer souscription - Bloquer - Supprimer + Manage groups + Resend suscription + Block + Delete + User informations diff -r 1385ea631852 -r 32d2c5840a8c res/values-fr/strings.xml --- a/res/values-fr/strings.xml Thu Oct 01 15:48:06 2009 +0200 +++ b/res/values-fr/strings.xml Thu Oct 01 16:50:12 2009 +0200 @@ -35,7 +35,7 @@ Chat Appeller - Informations utilisateur + Gestion utilisateur Êtes-vous sûr de vouloir supprimer ce contact ? Oui Non @@ -216,4 +216,5 @@ Renvoyer souscription Bloquer Supprimer + Informations utilisateur diff -r 1385ea631852 -r 32d2c5840a8c src/com/beem/project/beem/ui/ContactList.java --- a/src/com/beem/project/beem/ui/ContactList.java Thu Oct 01 15:48:06 2009 +0200 +++ b/src/com/beem/project/beem/ui/ContactList.java Thu Oct 01 16:50:12 2009 +0200 @@ -235,7 +235,7 @@ * buildBanner. */ private void buildBanner() { - Gallery g = (Gallery) findViewById(R.id.gallery); + Gallery g = (Gallery) findViewById(R.id.contactlist_banner); g.setOnItemClickListener(new OnItemClickGroupName()); g.setAdapter(mAdapterBanner); } @@ -288,7 +288,7 @@ } /** - * Event on middle groupe name. + * Event simple click on middle groupe name. */ private class OnItemClickGroupName implements OnItemClickListener { diff -r 1385ea631852 -r 32d2c5840a8c src/com/beem/project/beem/ui/UserInfo.java --- a/src/com/beem/project/beem/ui/UserInfo.java Thu Oct 01 15:48:06 2009 +0200 +++ b/src/com/beem/project/beem/ui/UserInfo.java Thu Oct 01 16:50:12 2009 +0200 @@ -1,18 +1,23 @@ package com.beem.project.beem.ui; +import java.util.List; + import android.app.Activity; import android.app.Dialog; import android.content.ComponentName; +import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; -import android.net.Uri; 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 com.beem.project.beem.BeemService; @@ -30,7 +35,8 @@ private static final Intent SERVICE_INTENT = new Intent(); private final ServiceConnection mServConn = new BeemServiceConnection(); - private String mJID; + private TextView mTextAlias; + private Gallery mGalleryGroups; private Contact mContact; private IXmppFacade mXmppFacade; private BeemBroadcastReceiver mReceiver; @@ -54,7 +60,8 @@ setContentView(R.layout.userinfo); View v = (View) findViewById(R.id.userinfo_layout_alias); v.setOnClickListener(new AliasListener()); - + mTextAlias = (TextView) findViewById(R.id.userinfo_alias); + mGalleryGroups = (Gallery) findViewById(R.id.userinfo_groups); mReceiver = new BeemBroadcastReceiver(mServConn); } @@ -80,11 +87,18 @@ unbindService(mServConn); } - class AliasListener implements View.OnClickListener { + /** + * Event simple click on layout alias. + */ + private class AliasListener implements View.OnClickListener { + /** + * Constructor. + */ + public AliasListener() { + } @Override public void onClick(View v) { - Dialog d = new ContactDialogAliasDialog(); d.show(); } @@ -93,6 +107,9 @@ public class ContactDialogAliasDialog extends Dialog { + /** + * Constructor. + */ public ContactDialogAliasDialog() { super(UserInfo.this); setContentView(R.layout.contactdialogaliasdialog); @@ -102,31 +119,84 @@ nameText.setText(mContact.getJID()); else nameText.setText(mContact.getName()); + Button ok = (Button) findViewById(R.id.CDAliasDialogOk); + ok.setOnClickListener(new ContactDialogAliasDialogOK()); + } - Button ok = (Button) findViewById(R.id.CDAliasDialogOk); - ok.setOnClickListener(new View.OnClickListener() { + private class ContactDialogAliasDialogOK implements View.OnClickListener { + + @Override + public void onClick(View v) { + IRoster r; + try { + r = mXmppFacade.getRoster(); + if (r != null) { + EditText nameText = (EditText) findViewById(R.id.CDAliasDialogName); + String name = nameText.getText().toString(); + if (name.length() == 0) + name = mContact.getJID(); + r.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 mListGroup; - @Override - public void onClick(View v) { - IRoster r; - try { - r = mXmppFacade.getRoster(); - if (r != null) { - EditText nameText = (EditText) findViewById(R.id.CDAliasDialogName); - String name = nameText.getText().toString(); - if (name.length() == 0) - name = mContact.getJID(); - r.setContactName(mContact.getJID(), name); - mContact.setName(name); + /** + * Constructor. + * @param c context activity. + */ + public BeemGroups(final Context c, List listGroup) { + mContext = c; + if (listGroup.size() == 0) + listGroup.add("No Group"); + mListGroup = listGroup; + } + + /** + * {@inheritDoc} + */ + @Override + public int getCount() { + return mListGroup.size(); + } - } - } catch (RemoteException e) { - e.printStackTrace(); - } - dismiss(); - } + /** + * {@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; } } @@ -142,6 +212,9 @@ public BeemServiceConnection() { } + /** + * {@inheritDoc} + */ @Override public void onServiceConnected(ComponentName name, IBinder service) { mXmppFacade = IXmppFacade.Stub.asInterface(service); @@ -149,14 +222,19 @@ IRoster r = mXmppFacade.getRoster(); if (r != null) { String jidByUri = getIntent().getData().getEncodedSchemeSpecificPart(); + setTitle(jidByUri); mContact = r.getContact(jidByUri); - setTitle(mContact.getJID()); + mTextAlias.setText(mContact.getName()); + mGalleryGroups.setAdapter(new BeemGroups(UserInfo.this, mContact.getGroups())); } } catch (RemoteException e) { e.printStackTrace(); } } + /** + * {@inheritDoc} + */ @Override public void onServiceDisconnected(ComponentName name) { mXmppFacade = null;