Gestion du changement de group.
--- a/checkstyle.xml Wed Sep 16 22:45:41 2009 +0200
+++ b/checkstyle.xml Thu Sep 17 16:33:18 2009 +0200
@@ -1,264 +1,264 @@
-<?xml version="1.0"?>
-<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<!--
-
- Checkstyle configuration that checks the sun coding conventions from:
-
- - the Java Language Specification at
- http://java.sun.com/docs/books/jls/second_edition/html/index.html
-
- - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
-
- - the Javadoc guidelines at
- http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
-
- - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
-
- - some best practices
-
- Checkstyle is very configurable. Be sure to read the documentation at
- http://checkstyle.sf.net (or in your downloaded distribution).
-
- Most Checks are configurable, be sure to consult the documentation.
-
- To completely disable a check, just comment it out or delete it from the file.
-
- Finally, it is worth reading the documentation.
-
--->
-
-<module name="Checker">
- <!--
- If you set the basedir property below, then all reported file
- names will be relative to the specified directory. See
- http://checkstyle.sourceforge.net/5.x/config.html#Checker
--->
- <property name="basedir" value="/home/beem/"/>
-
- <property name="severity" value="warning"/>
-
- <!-- Checks that a package-info.java file exists for each package. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
- <module name="JavadocPackage">
- <property name="allowLegacy" value="true"/>
- </module>
-
- <!-- Checks whether files end with a new line. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
- <module name="NewlineAtEndOfFile"/>
-
- <!-- Checks that property files contain the same keys. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
- <module name="Translation"/>
-
- <!-- Checks for Size Violations. -->
- <!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="FileLength"/>
-
- <!-- Checks for whitespace -->
- <!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <!-- we want tab
- <module name="FileTabCharacter"/>
- -->
-
- <!-- Miscellaneous other checks. -->
- <!-- See http://checkstyle.sf.net/config_misc.html -->
- <module name="RegexpSingleline">
- <property name="format" value="\s+$"/>
- <property name="minimum" value="0"/>
- <property name="maximum" value="0"/>
- <property name="message" value="Line has trailing spaces."/>
- </module>
-
-
- <module name="TreeWalker">
-
- <!-- Checks for Javadoc comments. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html -->
- <module name="JavadocMethod">
- <property name="allowUndeclaredRTE" value="true"/>
- </module>
- <module name="JavadocType"/>
- <module name="JavadocVariable">
- <property name="scope" value="package" />
- </module>
- <module name="JavadocStyle">
- <property name="checkEmptyJavadoc" value="true"/>
- </module>
-
-
- <!-- Checks for Naming Conventions. -->
- <!-- See http://checkstyle.sf.net/config_naming.html -->
- <module name="ConstantName"/>
- <module name="LocalFinalVariableName"/>
- <module name="LocalVariableName"/>
- <module name="MemberName">
- <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
- <property name="severity" value="error"/>
- </module>
- <module name="MethodName"/>
- <module name="PackageName"/>
- <module name="ParameterName"/>
- <module name="StaticVariableName"/>
- <module name="TypeName"/>
-
-
- <!-- Checks for Headers -->
- <!-- See http://checkstyle.sf.net/config_header.html -->
- <!-- <module name="Header"> -->
- <!-- The follow property value demonstrates the ability -->
- <!-- to have access to ANT properties. In this case it uses -->
- <!-- the ${basedir} property to allow Checkstyle to be run -->
- <!-- from any directory within a project. See property -->
- <!-- expansion, -->
- <!-- http://checkstyle.sf.net/config.html#properties -->
- <!-- <property -->
- <!-- name="headerFile" -->
- <!-- value="${basedir}/java.header"/> -->
- <!-- </module> -->
-
- <!-- Following interprets the header file as regular expressions. -->
- <!-- <module name="RegexpHeader"/> -->
-
-
- <!-- Checks for imports -->
- <!-- See http://checkstyle.sf.net/config_import.html -->
- <module name="AvoidStarImport"/>
- <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
- <module name="RedundantImport"/>
- <module name="UnusedImports"/>
- <module name="AvoidStaticImport">
- <property name="excludes" value="*"/>
- </module>
-
-
- <!-- Checks for Size Violations. -->
- <!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="LineLength">
- <property name="max" value="120" />
- </module>
- <module name="MethodLength"/>
- <module name="ParameterNumber"/>
- <module name="AnonInnerLength">
- <property name="max" value="60" />
- </module>
-
-
- <!-- Checks for whitespace -->
- <!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <module name="EmptyForIteratorPad"/>
- <module name="GenericWhitespace"/>
- <module name="MethodParamPad"/>
- <module name="NoWhitespaceAfter"/>
- <module name="NoWhitespaceBefore"/>
- <module name="OperatorWrap"/>
- <module name="ParenPad"/>
- <module name="TypecastParenPad"/>
- <!-- We want mixed tabulation
- <module name="TabCharacter"/>
- -->
- <module name="WhitespaceAfter"/>
- <module name="WhitespaceAround"/>
-
-
- <!-- Modifier Checks -->
- <!-- See http://checkstyle.sf.net/config_modifiers.html -->
- <module name="ModifierOrder"/>
- <module name="RedundantModifier"/>
-
-
- <!-- Checks for blocks. You know, those {}'s -->
- <!-- See http://checkstyle.sf.net/config_blocks.html -->
- <module name="AvoidNestedBlocks"/>
- <module name="EmptyBlock"/>
- <module name="LeftCurly"/>
- <!--
- <module name="NeedBraces"/>
- -->
- <module name="RightCurly"/>
-
- <!-- Check for annotations
- http://checkstyle.sourceforge.net/config_annotation.html#MissingDeprecated
- -->
- <module name="AnnotationUseStyle"/>
- <module name="MissingDeprecated"/>
- <module name="MissingOverride"/>
-
- <!-- Checks for common coding problems -->
- <!-- See http://checkstyle.sf.net/config_coding.html -->
- <module name="CovariantEquals"/>
- <module name="AvoidInlineConditionals"/>
- <module name="InnerAssignment" />
- <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
- <module name="EmptyStatement"/>
- <module name="EqualsHashCode"/>
- <module name="HiddenField">
- <property name="ignoreConstructorParameter" value="true"/>
- <property name="ignoreAbstractMethods" value="true"/>
- <property name="ignoreSetter" value="true"/>
- </module>
- <module name="IllegalInstantiation"/>
- <module name="InnerAssignment"/>
- <!--
- <module name="MagicNumber"/>
- -->
- <module name="MissingSwitchDefault"/>
- <module name="RedundantThrows"/>
- <module name="SimplifyBooleanExpression"/>
- <module name="SimplifyBooleanReturn"/>
- <module name="StringLiteralEquality"/>
- <module name="SuperFinalize"/>
- <module name="IllegalCatch"/>
- <module name="IllegalThrows"/>
- <module name="PackageDeclaration"/>
- <module name="JUnitTestCase"/>
- <module name="DeclarationOrder"/>
- <module name="ExplicitInitialization"/>
- <module name="DefaultComesLast"/>
- <module name="MissingCtor"/>
- <module name="FallThrough"/>
- <module name="MultipleStringLiterals"/>
- <module name="MultipleVariableDeclarations"/>
- <module name="UnnecessaryParentheses"/>
- <module name="ParameterAssignment"/>
- <module name="SuperClone"/>
- <module name="EqualsAvoidNull"/>
- <module name="NoClone"/>
- <module name="NoFinalizer"/>
-
- <!-- Checks for class design -->
- <!-- See http://checkstyle.sf.net/config_design.html -->
- <!--
- <module name="DesignForExtension"/>
- -->
- <module name="FinalClass"/>
- <module name="HideUtilityClassConstructor"/>
- <module name="InterfaceIsType"/>
- <module name="VisibilityModifier"/>
- <module name="MutableException"/>
-
-
- <!-- Miscellaneous other checks. -->
- <!-- See http://checkstyle.sf.net/config_misc.html -->
- <module name="ArrayTypeStyle"/>
- <module name="FinalParameters">
- <property name="tokens" value="CTOR_DEF"/>
- </module>
- <module name="Indentation"/>
-
- <module name="TodoComment"/>
- <module name="UpperEll"/>
-
- <module name="BooleanExpressionComplexity"/>
- <module name="UpperEll"/>
-
- <module name="ArrayTypeStyle"/>
-
- </module>
- <module name="StrictDuplicateCode"/>
- <module name="NewlineAtEndOfFile"/>
-
-</module>
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<!--
+
+ Checkstyle configuration that checks the sun coding conventions from:
+
+ - the Java Language Specification at
+ http://java.sun.com/docs/books/jls/second_edition/html/index.html
+
+ - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+
+ - the Javadoc guidelines at
+ http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+
+ - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+
+ - some best practices
+
+ Checkstyle is very configurable. Be sure to read the documentation at
+ http://checkstyle.sf.net (or in your downloaded distribution).
+
+ Most Checks are configurable, be sure to consult the documentation.
+
+ To completely disable a check, just comment it out or delete it from the file.
+
+ Finally, it is worth reading the documentation.
+
+-->
+
+<module name="Checker">
+ <!--
+ If you set the basedir property below, then all reported file
+ names will be relative to the specified directory. See
+ http://checkstyle.sourceforge.net/5.x/config.html#Checker
+-->
+ <property name="basedir" value="/home/beem/"/>
+
+ <property name="severity" value="warning"/>
+
+ <!-- Checks that a package-info.java file exists for each package. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
+ <module name="JavadocPackage">
+ <property name="allowLegacy" value="true"/>
+ </module>
+
+ <!-- Checks whether files end with a new line. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+ <module name="NewlineAtEndOfFile"/>
+
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+ <module name="Translation"/>
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="FileLength"/>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <!-- we want tab
+ <module name="FileTabCharacter"/>
+ -->
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <module name="RegexpSingleline">
+ <property name="format" value="\s+$"/>
+ <property name="minimum" value="0"/>
+ <property name="maximum" value="0"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+
+
+ <module name="TreeWalker">
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+ <module name="JavadocMethod">
+ <property name="allowUndeclaredRTE" value="true"/>
+ </module>
+ <module name="JavadocType"/>
+ <module name="JavadocVariable">
+ <property name="scope" value="package" />
+ </module>
+ <module name="JavadocStyle">
+ <property name="checkEmptyJavadoc" value="true"/>
+ </module>
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <module name="ConstantName"/>
+ <module name="LocalFinalVariableName"/>
+ <module name="LocalVariableName"/>
+ <module name="MemberName">
+ <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
+ <property name="severity" value="error"/>
+ </module>
+ <module name="MethodName"/>
+ <module name="PackageName"/>
+ <module name="ParameterName"/>
+ <module name="StaticVariableName"/>
+ <module name="TypeName"/>
+
+
+ <!-- Checks for Headers -->
+ <!-- See http://checkstyle.sf.net/config_header.html -->
+ <!-- <module name="Header"> -->
+ <!-- The follow property value demonstrates the ability -->
+ <!-- to have access to ANT properties. In this case it uses -->
+ <!-- the ${basedir} property to allow Checkstyle to be run -->
+ <!-- from any directory within a project. See property -->
+ <!-- expansion, -->
+ <!-- http://checkstyle.sf.net/config.html#properties -->
+ <!-- <property -->
+ <!-- name="headerFile" -->
+ <!-- value="${basedir}/java.header"/> -->
+ <!-- </module> -->
+
+ <!-- Following interprets the header file as regular expressions. -->
+ <!-- <module name="RegexpHeader"/> -->
+
+
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport"/>
+ <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+ <module name="AvoidStaticImport">
+ <property name="excludes" value="*"/>
+ </module>
+
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="LineLength">
+ <property name="max" value="120" />
+ </module>
+ <module name="MethodLength"/>
+ <module name="ParameterNumber"/>
+ <module name="AnonInnerLength">
+ <property name="max" value="60" />
+ </module>
+
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="EmptyForIteratorPad"/>
+ <module name="GenericWhitespace"/>
+ <module name="MethodParamPad"/>
+ <module name="NoWhitespaceAfter"/>
+ <module name="NoWhitespaceBefore"/>
+ <module name="OperatorWrap"/>
+ <module name="ParenPad"/>
+ <module name="TypecastParenPad"/>
+ <!-- We want mixed tabulation
+ <module name="TabCharacter"/>
+ -->
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround"/>
+
+
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+ <module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
+
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See http://checkstyle.sf.net/config_blocks.html -->
+ <module name="AvoidNestedBlocks"/>
+ <module name="EmptyBlock"/>
+ <module name="LeftCurly"/>
+ <!--
+ <module name="NeedBraces"/>
+ -->
+ <module name="RightCurly"/>
+
+ <!-- Check for annotations
+ http://checkstyle.sourceforge.net/config_annotation.html#MissingDeprecated
+ -->
+ <module name="AnnotationUseStyle"/>
+ <module name="MissingDeprecated"/>
+ <module name="MissingOverride"/>
+
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <module name="CovariantEquals"/>
+ <module name="AvoidInlineConditionals"/>
+ <module name="InnerAssignment" />
+ <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
+ <module name="EmptyStatement"/>
+ <module name="EqualsHashCode"/>
+ <module name="HiddenField">
+ <property name="ignoreConstructorParameter" value="true"/>
+ <property name="ignoreAbstractMethods" value="true"/>
+ <property name="ignoreSetter" value="true"/>
+ </module>
+ <module name="IllegalInstantiation"/>
+ <module name="InnerAssignment"/>
+ <!--
+ <module name="MagicNumber"/>
+ -->
+ <module name="MissingSwitchDefault"/>
+ <module name="RedundantThrows"/>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+ <module name="StringLiteralEquality"/>
+ <module name="SuperFinalize"/>
+ <module name="IllegalCatch"/>
+ <module name="IllegalThrows"/>
+ <module name="PackageDeclaration"/>
+ <module name="JUnitTestCase"/>
+ <module name="DeclarationOrder"/>
+ <module name="ExplicitInitialization"/>
+ <module name="DefaultComesLast"/>
+ <module name="MissingCtor"/>
+ <module name="FallThrough"/>
+ <module name="MultipleStringLiterals"/>
+ <module name="MultipleVariableDeclarations"/>
+ <module name="UnnecessaryParentheses"/>
+ <module name="ParameterAssignment"/>
+ <module name="SuperClone"/>
+ <module name="EqualsAvoidNull"/>
+ <module name="NoClone"/>
+ <module name="NoFinalizer"/>
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <!--
+ <module name="DesignForExtension"/>
+ -->
+ <module name="FinalClass"/>
+ <module name="HideUtilityClassConstructor"/>
+ <module name="InterfaceIsType"/>
+ <module name="VisibilityModifier"/>
+ <module name="MutableException"/>
+
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <module name="ArrayTypeStyle"/>
+ <module name="FinalParameters">
+ <property name="tokens" value="CTOR_DEF"/>
+ </module>
+ <module name="Indentation"/>
+
+ <module name="TodoComment"/>
+ <module name="UpperEll"/>
+
+ <module name="BooleanExpressionComplexity"/>
+ <module name="UpperEll"/>
+
+ <module name="ArrayTypeStyle"/>
+
+ </module>
+ <module name="StrictDuplicateCode"/>
+ <module name="NewlineAtEndOfFile"/>
+
+</module>
--- a/res/layout/contactlist.xml Wed Sep 16 22:45:41 2009 +0200
+++ b/res/layout/contactlist.xml Thu Sep 17 16:33:18 2009 +0200
@@ -1,29 +1,29 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout android:id="@+id/linlayoutBase"
- android:layout_width="fill_parent" android:layout_height="fill_parent"
- android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
-
- <LinearLayout android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- <Button android:id="@+id/btn1" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="Left"
- android:layout_weight="1">
- </Button>
- <Button android:id="@+id/btn2" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="GroupName"
- android:layout_weight="1">
- </Button>
- <Button android:id="@+id/btn3" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="Right"
- android:layout_weight="1">
- </Button>
- </LinearLayout>
-
- <LinearLayout android:layout_width="fill_parent"
- android:layout_height="fill_parent" android:orientation="horizontal">
- <ListView android:id="@+id/contactlist" android:layout_width="fill_parent"
- android:layout_height="fill_parent" />
- </LinearLayout>
-
-
-</LinearLayout>
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout android:id="@+id/linlayoutBase"
+ android:layout_width="fill_parent" android:layout_height="fill_parent"
+ android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <LinearLayout android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <Button android:id="@+id/contactlist_left" android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:text="Left"
+ android:layout_weight="1">
+ </Button>
+ <Button android:id="@+id/contactlist_group" android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:text="@string/contact_list_all_contact"
+ android:layout_weight="1">
+ </Button>
+ <Button android:id="@+id/contactlist_right" android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:text="Right"
+ android:layout_weight="1">
+ </Button>
+ </LinearLayout>
+
+ <LinearLayout android:layout_width="fill_parent"
+ android:layout_height="fill_parent" android:orientation="horizontal">
+ <ListView android:id="@+id/contactlist" android:layout_width="fill_parent"
+ android:layout_height="fill_parent" />
+ </LinearLayout>
+
+
+</LinearLayout>
--- a/res/values-en/strings.xml Wed Sep 16 22:45:41 2009 +0200
+++ b/res/values-en/strings.xml Thu Sep 17 16:33:18 2009 +0200
@@ -206,5 +206,6 @@
-->
<string name="contact_list_menu_add_contact">Add a contact</string>
<string name="contact_list_menu_settings">Settings</string>
+ <string name="contact_list_all_contact">All contacts</string>
</resources>
--- a/res/values-fr/strings.xml Wed Sep 16 22:45:41 2009 +0200
+++ b/res/values-fr/strings.xml Thu Sep 17 16:33:18 2009 +0200
@@ -200,5 +200,6 @@
-->
<string name="contact_list_menu_add_contact">Ajouter un contact</string>
<string name="contact_list_menu_settings">Paramètres</string>
+ <string name="contact_list_all_contact">Tous les contacts</string>
</resources>
--- a/src/com/beem/project/beem/service/RosterAdapter.java Wed Sep 16 22:45:41 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java Thu Sep 17 16:33:18 2009 +0200
@@ -90,7 +90,6 @@
mAdaptee.removeEntry(entry);
} else {
mAdaptee.getGroup(group).removeEntry(entry);
- mRosterListener.onEntryDeleteFromGroup(group, contact.getJID());
}
} catch (XMPPException e) {
e.printStackTrace();
@@ -197,7 +196,7 @@
* Event which is fired when an entry is deleted for a group.
* @param group the group the entry was.
* @param jid the jid of the entry which is deleted.
- */
+ * /
public void onEntryDeleteFromGroup(String group, String jid) {
//Log.i(TAG, "entry delete listener");
final int n = mRemoteRosListeners.beginBroadcast();
@@ -211,7 +210,7 @@
}
mRemoteRosListeners.finishBroadcast();
- }
+ } */
/**
* {@inheritDoc}
--- a/src/com/beem/project/beem/service/aidl/IBeemRosterListener.aidl Wed Sep 16 22:45:41 2009 +0200
+++ b/src/com/beem/project/beem/service/aidl/IBeemRosterListener.aidl Thu Sep 17 16:33:18 2009 +0200
@@ -7,5 +7,4 @@
void onEntriesUpdated(in List<String> addresses);
void onEntriesDeleted(in List<String> addresses);
void onPresenceChanged(in PresenceAdapter presence);
- void onEntryDeleteFromGroup(in String group, in String jid);
}
\ No newline at end of file
--- a/src/com/beem/project/beem/ui/ContactList.java Wed Sep 16 22:45:41 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Thu Sep 17 16:33:18 2009 +0200
@@ -25,6 +25,7 @@
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
+import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@@ -50,7 +51,9 @@
private static final int REQUEST_CODE = 1;
private BeemContactList mAdapter;
private IRoster mRoster;
- private List<Contact> mListContact;
+ private List<Contact> mListContact = null;
+ private List<String> mListGroup;
+ private int mPosCurGroup = -1;
private Handler mHandler;
private IXmppFacade mXmppFacade;
private final ServiceConnection mServConn = new BeemServiceConnection();
@@ -103,8 +106,63 @@
protected void onCreate(Bundle saveBundle) {
super.onCreate(saveBundle);
setContentView(R.layout.contactlist);
+ mAdapter = new BeemContactList(this);
+ Button b = (Button) findViewById(R.id.contactlist_group);
+ b.setOnClickListener(new OnClickGroupName());
+ b = (Button) findViewById(R.id.contactlist_left);
+ b.setOnClickListener(new OnClickLeft());
+ b = (Button) findViewById(R.id.contactlist_right);
+ b.setOnClickListener(new OnClickRight());
+ mHandler = new Handler();
- mHandler = new Handler();
+ }
+
+ private class OnClickGroupName implements View.OnClickListener {
+ @Override
+ public void onClick(View arg0) {
+
+ }
+ }
+
+ private class OnClickLeft implements View.OnClickListener {
+ @Override
+ public void onClick(View arg0) {
+ mPosCurGroup--;
+ if (mPosCurGroup < -1)
+ mPosCurGroup = mListGroup.size() - 1;
+ Button b = (Button) findViewById(R.id.contactlist_group);
+ if (mPosCurGroup == -1)
+ b.setText(R.string.contact_list_all_contact);
+ else
+ b.setText(mListGroup.get(mPosCurGroup));
+ try {
+ buildContactList(mRoster.getContactList(), mRoster.getGroupsNames());
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ mAdapter.notifyDataSetChanged();
+ mAdapter.notifyDataSetChanged();
+ }
+ }
+
+ private class OnClickRight implements View.OnClickListener {
+ @Override
+ public void onClick(View arg0) {
+ mPosCurGroup++;
+ if (mPosCurGroup == mListGroup.size())
+ mPosCurGroup = -1;
+ Button b = (Button) findViewById(R.id.contactlist_group);
+ if (mPosCurGroup == -1)
+ b.setText(R.string.contact_list_all_contact);
+ else
+ b.setText(mListGroup.get(mPosCurGroup));
+ try {
+ buildContactList(mRoster.getContactList(), mRoster.getGroupsNames());
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ mAdapter.notifyDataSetChanged();
+ }
}
@Override
@@ -139,10 +197,30 @@
}
}
- private void buildContactList(List<Contact> listContact) {
- mListContact = listContact;
- Collections.sort(mListContact, new ComparatorContactListByStatusAndName<Contact>());
- mAdapter = new BeemContactList(this);
+ class ComparatorString implements Comparator<String> {
+ @Override
+ public int compare(String g1, String g2) {
+ return (g1.compareToIgnoreCase(g2));
+ }
+ }
+
+ private void buildContactList(List<Contact> listContact, List<String> listGroup) {
+ mListGroup = listGroup;
+ Collections.sort(mListGroup);// , new ComparatorString());
+ if (mListContact != null)
+ mListContact.clear();
+ if (mPosCurGroup == -1)
+ mListContact = listContact;
+ else {
+ String curGroup = mListGroup.get(mPosCurGroup);
+ for (Contact c : listContact) {
+ if (c.getGroups().contains(curGroup)) {
+ mListContact.add(c);
+ }
+ }
+ }
+
+ BeemContactListSort();
ListView listView = (ListView) findViewById(R.id.contactlist);
listView.setOnItemClickListener(new BeemContactListOnClick());
@@ -172,28 +250,38 @@
}
}
+ private void BeemContactListSort() {
+ Collections.sort(mListContact, new ComparatorContactListByStatusAndName<Contact>());
+ }
+
private class BeemRosterListener extends IBeemRosterListener.Stub {
private class RunnableChange implements Runnable {
@Override
public void run() {
+ BeemContactListSort();
mAdapter.notifyDataSetChanged();
}
}
@Override
public void onEntriesAdded(List<String> addresses) throws RemoteException {
- /*
- * TODO: C'est OK.
- */
+ for (String newName : addresses) {
+ Contact c = new Contact(newName);
+ mListContact.add(c);
+ }
mHandler.post(new RunnableChange());
}
@Override
public void onEntriesDeleted(List<String> addresses) throws RemoteException {
- mListContact.removeAll(addresses);
- /*
- * TODO: Raffrichir la liste.
- */
+ for (String cToDelete : addresses) {
+ for (Contact c : mListContact) {
+ if (c.getJID().equals(cToDelete)) {
+ mListContact.remove(c);
+ break;
+ }
+ }
+ }
mHandler.post(new RunnableChange());
}
@@ -215,14 +303,6 @@
}
}
}
-
- @Override
- public void onEntryDeleteFromGroup(String group, String jid) throws RemoteException {
- /*
- * TODO:
- */
- mHandler.post(new RunnableChange());
- }
}
private class BeemContactList extends BaseAdapter {
@@ -255,7 +335,6 @@
Contact c = mListContact.get(position);
bindView(convertView, c);
-
return convertView;
}
@@ -333,7 +412,7 @@
mRoster = mXmppFacade.getRoster();
if (mRoster != null) {
mRoster.addRosterListener(mBeemRosterListener);
- buildContactList(mRoster.getContactList());
+ buildContactList(mRoster.getContactList(), mRoster.getGroupsNames());
}
} catch (RemoteException e) {
e.printStackTrace();
--- a/src/com/beem/project/beem/ui/Login.java Wed Sep 16 22:45:41 2009 +0200
+++ b/src/com/beem/project/beem/ui/Login.java Thu Sep 17 16:33:18 2009 +0200
@@ -102,8 +102,6 @@
if (mIsConfigured)
bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
- else
- mButtonLogin.setEnabled(false);
}
--- a/src/com/beem/project/beem/ui/SendIM.java Wed Sep 16 22:45:41 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIM.java Thu Sep 17 16:33:18 2009 +0200
@@ -443,12 +443,6 @@
}
}
- @Override
- public void onEntryDeleteFromGroup(String group, String jid) throws RemoteException {
- // TODO Auto-generated method stub
-
- }
-
}
/**