--- a/.classpath Thu Sep 17 10:46:45 2009 +0200
+++ b/.classpath Thu Sep 24 12:30:17 2009 +0200
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/smackx-debug.jar"/>
- <classpathentry kind="lib" path="libs/smackx-jingle.jar"/>
+ <classpathentry kind="lib" path="libs/smackx-jingle.jar" sourcepath="/home/darisk/devel/smack_src_3_1_0/jingle/extension/source"/>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
--- a/AndroidManifest.xml Thu Sep 17 10:46:45 2009 +0200
+++ b/AndroidManifest.xml Thu Sep 24 12:30:17 2009 +0200
@@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.beem.project.beem" android:versionCode="1"
android:versionName="1.0">
- <application android:label="@string/app_name" android:icon="@drawable/signal" android:theme="@style/Theme.BEEM.Default">
+ <application android:label="@string/app_name" android:icon="@drawable/signal" android:theme="@style/Theme.BEEM.Default" android:debuggable="true">
<activity android:name=".ui.Login" android:label="@string/app_name"
android:launchMode="singleTask">
<intent-filter>
--- a/INSTALL Thu Sep 17 10:46:45 2009 +0200
+++ b/INSTALL Thu Sep 24 12:30:17 2009 +0200
@@ -1,15 +1,13 @@
Howto Install Beem ?
1. Dependencies
- First you will need the Android SDK.
+ First you will need the Android SDK-1.5.
-2. ActivityCreator
+2. Android project
Use the script provides by the SDK to set the Android platform directory.
- > $SDK_DIR/tools/activitycreator --out . com.beem.project.beem.Beem
+ > $SDK_DIR/tools/android update project -t 2 -p $BEEM_DIRECTORY
3. Compile and install
Use ant to compile and install the application on the Android emulator
> ant install
-
-
--- a/checkstyle.xml Thu Sep 17 10:46:45 2009 +0200
+++ b/checkstyle.xml Thu Sep 24 12:30:17 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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/contactlist.xml Thu Sep 24 12:30:17 2009 +0200
@@ -0,0 +1,17 @@
+<?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">
+
+ <Gallery xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/gallery" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:spacing="10px" />
+
+ <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/layout/login.xml Thu Sep 17 10:46:45 2009 +0200
+++ b/res/layout/login.xml Thu Sep 24 12:30:17 2009 +0200
@@ -8,13 +8,4 @@
<TextView android:id="@+id/log_as_msg" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:gravity="center"
android:textColor="#FF0000" />
- <LinearLayout android:orientation="vertical"
- android:layout_width="fill_parent" android:layout_height="fill_parent"
- android:gravity="bottom">
- <Button android:id="@+id/log_as_settings" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:text="@string/login_settings_button" />
- <Button android:id="@+id/log_as_login" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:text="@string/login_login_button" />
- </LinearLayout>
-
</LinearLayout>
\ No newline at end of file
--- a/res/menu/sendimmenu.xml Thu Sep 17 10:46:45 2009 +0200
+++ b/res/menu/sendimmenu.xml Thu Sep 24 12:30:17 2009 +0200
@@ -1,3 +1,4 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:title="Insert a smiley" android:id="@+id/sendim_smiley"/>
+<item android:title="Call" android:id="@+id/sendim_call"></item>
</menu>
--- a/res/values-en/strings.xml Thu Sep 17 10:46:45 2009 +0200
+++ b/res/values-en/strings.xml Thu Sep 24 12:30:17 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 Thu Sep 17 10:46:45 2009 +0200
+++ b/res/values-fr/strings.xml Thu Sep 24 12:30:17 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/jingle/JingleService.java Thu Sep 17 10:46:45 2009 +0200
+++ b/src/com/beem/project/beem/jingle/JingleService.java Thu Sep 24 12:30:17 2009 +0200
@@ -5,7 +5,6 @@
import java.util.ArrayList;
import java.util.List;
-
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.jingle.JingleManager;
@@ -18,11 +17,14 @@
import org.jivesoftware.smackx.jingle.nat.BasicTransportManager;
import org.jivesoftware.smackx.jingle.nat.TransportCandidate;
+import android.util.Log;
+
/**
* Beem Jingle Service, manage jingle call.
* @author nikita
*/
public class JingleService {
+ private static final String TAG = "JingleService";
private JingleManager mJingleManager;
private List<JingleMediaManager> mMediaManagers;
private JingleSession mIn;
@@ -34,6 +36,7 @@
*/
public JingleService(final XMPPConnection xmppConnection) {
BasicTransportManager bt = new BasicTransportManager();
+ //JingleTransportManager tm = new ICETransportManager();
mMediaManagers = new ArrayList<JingleMediaManager>();
mMediaManagers.add(new MicrophoneRTPManager(bt));
@@ -101,8 +104,7 @@
@Override
public void sessionDeclined(String reason, JingleSession jingleSession) {
- // TODO Auto-generated method stub
- //System.out.println("Session " + jingleSession.getResponder() + "declined because " + reason);
+ Log.d(TAG, "Session " + jingleSession.getResponder() + "declined because " + reason);
}
@Override
@@ -112,6 +114,7 @@
//System.out.println("Je recois sur " + remoteCandidate.getIp() + ":" + remoteCandidate.getPort());
// TODO choose the right RTPReceiver depending on the payload type
//RTPReceiver rtpReceiver = new RTPReceiver(remoteCandidate.getPort());
+ Log.d(TAG, "Session " + jingleSession.getResponder() + "established");
}
@Override
@@ -152,12 +155,13 @@
@Override
public void sessionDeclined(final String reason, final JingleSession jingleSession) {
// System.out.println("Session " + jingleSession.getResponder() + "declined because " + reason);
+ Log.d(TAG, "Session " + jingleSession.getResponder() + "declined because " + reason);
}
@Override
public void sessionEstablished(final PayloadType pt, final TransportCandidate remoteCandidate,
final TransportCandidate localCandidate, final JingleSession jingleSession) {
- // System.out.println("Session established");
+ Log.d(TAG, "Session " + jingleSession.getResponder() + "established");
// String name = localCandidate.getName();
String ip = localCandidate.getIp();
int port = localCandidate.getPort();
--- a/src/com/beem/project/beem/service/Contact.java Thu Sep 17 10:46:45 2009 +0200
+++ b/src/com/beem/project/beem/service/Contact.java Thu Sep 24 12:30:17 2009 +0200
@@ -6,15 +6,12 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-
import org.jivesoftware.smack.RosterGroup;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.util.StringUtils;
-
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
-
import com.beem.project.beem.utils.Status;
/**
@@ -76,11 +73,13 @@
* JID of the contact
*/
public Contact(final String jid) {
- mJID = jid;
- mName = jid;
+ mJID = StringUtils.parseBareAddress(jid);
+ mName = mJID;
mStatus = Status.CONTACT_STATUS_DISCONNECT;
mRes = new ArrayList<String>();
- mRes.add("none");
+ String res = StringUtils.parseResource(jid);
+ if (!"".equals(res))
+ mRes.add(res);
mGroups = new ArrayList<String>();
}
@@ -94,7 +93,13 @@
public Contact(final Uri uri) {
if (!"xmpp".equals(uri.getScheme()))
throw new IllegalArgumentException();
- mJID = uri.getSchemeSpecificPart();
+ String enduri = uri.getEncodedSchemeSpecificPart();
+ mJID = StringUtils.parseBareAddress(enduri);
+ mName = mJID;
+ mStatus = Status.CONTACT_STATUS_DISCONNECT;
+ mRes = new ArrayList<String>();
+ mRes.add(StringUtils.parseResource(enduri));
+ mGroups = new ArrayList<String>();
}
/**
@@ -322,6 +327,26 @@
}
/**
+ * Get a URI to access the specific contact on this resource.
+ * @param resource the resource of the contact
+ * @return the URI
+ */
+ public Uri toUri(String resource) {
+ StringBuilder build = new StringBuilder("xmpp:");
+ String name = StringUtils.parseName(mJID);
+ build.append(name);
+ if (!"".equals(name))
+ build.append('@');
+ build.append(StringUtils.parseServer(mJID));
+ if (!"".equals(resource)) {
+ build.append('/');
+ build.append(resource);
+ }
+ Uri u = Uri.parse(build.toString());
+ return u;
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
--- a/src/com/beem/project/beem/service/RosterAdapter.java Thu Sep 17 10:46:45 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java Thu Sep 24 12:30:17 2009 +0200
@@ -1,3 +1,6 @@
+/**
+ *
+ */
package com.beem.project.beem.service;
@@ -11,7 +14,6 @@
import org.jivesoftware.smack.RosterListener;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Presence;
-import org.jivesoftware.smack.util.StringUtils;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
@@ -173,7 +175,7 @@
* @return a contact for this entry.
*/
private Contact getContactFromRosterEntry(RosterEntry entry) {
- String user = StringUtils.parseBareAddress(entry.getUser());
+ String user = entry.getUser();
Contact c = new Contact(user);
c.setStatus(mAdaptee.getPresence(user));
c.setGroups(entry.getGroups());
@@ -292,7 +294,7 @@
} catch (RemoteException e) {
// The RemoteCallbackList will take care of removing the
// dead listeners.
- Log.w(TAG, "Error while updating roster entries presence", e);
+ Log.w(TAG, "Error while updating roster entries", e);
}
}
mRemoteRosListeners.finishBroadcast();
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Thu Sep 17 10:46:45 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Thu Sep 24 12:30:17 2009 +0200
@@ -7,7 +7,8 @@
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.filter.PacketFilter;
+import org.jivesoftware.smack.PacketListener;
+
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smackx.ChatStateManager;
@@ -52,7 +53,7 @@
* @param config Configuration to use in order to connect
* @param login login to use on connect
* @param password password to use on connect
- *
+ * @param service the background service associated with the connection.
*/
public XmppConnectionAdapter(final ConnectionConfiguration config, final String login, final String password,
final BeemService service) {
@@ -64,6 +65,7 @@
* @param serviceName name of the service to connect to
* @param login login to use on connect
* @param password password to use on connect
+ * @param service the background service associated with the connection.
*/
public XmppConnectionAdapter(final String serviceName, final String login, final String password,
final BeemService service) {
@@ -75,6 +77,7 @@
* @param con The connection to adapt
* @param login The login to use
* @param password The password to use
+ * @param service the background service associated with the connection.
*/
public XmppConnectionAdapter(final XMPPConnection con, final String login, final String password,
final BeemService service) {
@@ -130,6 +133,10 @@
ChatStateManager.getInstance(mAdaptee);
triggerAsynchronousConnectEvent();
+ //Priority between -128 and 128
+ Presence p = new Presence(Presence.Type.available, "Beem : http://www.beem-project.com",
+ 128, Presence.Mode.available);
+ mAdaptee.sendPacket(p);
return true;
} catch (XMPPException e) {
Log.e(TAG, "Error while connecting", e);
@@ -151,6 +158,10 @@
return true;
}
+ /**
+ * Get the Smack XmppConnection.
+ * @return Smack XmppConnection
+ */
public XMPPConnection getAdaptee() {
return mAdaptee;
}
@@ -163,6 +174,10 @@
return mChatManager;
}
+ /**
+ * Get the context of the adapter.
+ * @return The context of the adapter
+ */
public BeemService getContext() {
return mService;
}
@@ -218,13 +233,15 @@
}
/**
+ * Set the privacy list to use.
* @param mPrivacyList the mPrivacyList to set
*/
- public void setPrivacyList(PrivacyListManagerAdapter privacyList) {
- this.mPrivacyList = privacyList;
+ public void setPrivacyList(PrivacyListManagerAdapter PrivacyList) {
+ this.mPrivacyList = PrivacyList;
}
/**
+ * Get the privacy list in use.
* @return the mPrivacyList
*/
public PrivacyListManagerAdapter getPrivacyList() {
@@ -356,7 +373,7 @@
} catch (RemoteException e) {
// The RemoteCallbackList will take care of removing the
// dead listeners.
- Log.w(TAG, "Eror while triggering remote connection listeners", e);
+ Log.w(TAG, "Error while triggering remote connection listeners", e);
}
}
mRemoteConnListeners.finishBroadcast();
--- a/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl Thu Sep 17 10:46:45 2009 +0200
+++ b/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl Thu Sep 24 12:30:17 2009 +0200
@@ -52,6 +52,5 @@
* make a jingle audio call
* @param jid the receiver id
*/
-
void call(in String jid);
}
--- a/src/com/beem/project/beem/ui/AddContact.java Thu Sep 17 10:46:45 2009 +0200
+++ b/src/com/beem/project/beem/ui/AddContact.java Thu Sep 24 12:30:17 2009 +0200
@@ -26,7 +26,7 @@
*/
public class AddContact extends Activity {
- protected static final String TAG = "AddContact";
+ private static final String TAG = "AddContact";
private final List<String> mGroup = new ArrayList<String>();
private IXmppFacade mXmppFacade;
private final ServiceConnection mServConn = new BeemServiceConnection();
@@ -37,7 +37,7 @@
public AddContact() { }
/**
- * @{InheritDoc}
+ * {@inheritDoc}
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -49,7 +49,7 @@
}
/**
- * @{InheritDoc}
+ * {@inheritDoc}
*/
@Override
protected void onStop() {
--- a/src/com/beem/project/beem/ui/ContactList.java Thu Sep 17 10:46:45 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Thu Sep 24 12:30:17 2009 +0200
@@ -1,19 +1,16 @@
package com.beem.project.beem.ui;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.jivesoftware.smack.util.StringUtils;
-import android.app.ExpandableListActivity;
+import android.app.Activity;
import android.content.ComponentName;
+import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
-import android.database.DataSetObserver;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
@@ -26,11 +23,15 @@
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-import android.view.View.OnClickListener;
-import android.view.View.OnLongClickListener;
-import android.widget.ExpandableListAdapter;
+import android.widget.AdapterView;
+import android.widget.BaseAdapter;
+import android.widget.Button;
+import android.widget.Gallery;
import android.widget.ImageView;
+import android.widget.ListView;
import android.widget.TextView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.AdapterView.OnItemLongClickListener;
import com.beem.project.beem.BeemService;
import com.beem.project.beem.R;
@@ -39,26 +40,42 @@
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.utils.PresenceType;
import com.beem.project.beem.utils.Status;
/**
* The contact list activity displays the roster of the user.
*/
-public class ContactList extends ExpandableListActivity {
+public class ContactList extends Activity {
- public static final String DEFAULT_GROUP = "Default";
private static final String TAG = "CONTACTLIST_ACT";
private static final int REQUEST_CODE = 1;
- private MyExpandableListAdapter mAdapter;
+ private BeemContactList mAdapter;
private IRoster mRoster;
- private Map<String, List<Contact>> mGroupMap;
- private List<String> mGroupName;
private List<Contact> mListContact;
+ private List<String> mListGroup;
+ private int mPosCurGroup = -1;
private Handler mHandler;
private IXmppFacade mXmppFacade;
private final ServiceConnection mServConn = new BeemServiceConnection();
/**
+ * Constructor.
+ */
+ public ContactList() {
+
+ }
+
+ @Override
+ protected void onCreate(Bundle saveBundle) {
+ super.onCreate(saveBundle);
+ setContentView(R.layout.contactlist);
+ mAdapter = new BeemContactList(this);
+ mHandler = new Handler();
+
+ }
+
+ /**
* Callback for menu creation.
* @param menu the menu created
* @return true on success, false otherwise
@@ -102,37 +119,151 @@
}
}
- @Override
- protected void onCreate(Bundle saveBundle) {
- super.onCreate(saveBundle);
- mHandler = new Handler();
- mGroupMap = new HashMap<String, List<Contact>>();
- mGroupName = new ArrayList<String>();
+ /**
+ * Event on middle groupe name.
+ */
+ private class OnClickGroupName implements View.OnClickListener {
+ /**
+ * Constructor.
+ */
+ public OnClickGroupName() {
+
+ }
+
+ @Override
+ public void onClick(View arg0) {
+
+ }
+ }
+
+ /**
+ * Event on left groupe name.
+ */
+ private class OnClickLeft implements View.OnClickListener {
+ /**
+ * Constructor.
+ */
+ public OnClickLeft() {
+
+ }
+
+ @Override
+ public void onClick(View arg0) {
+ mPosCurGroup--;
+ if (mPosCurGroup < 0)
+ mPosCurGroup = mListGroup.size() - 1;
+ buildBanner();
+ try {
+ buildContactList(mRoster.getContactList(), mRoster.getGroupsNames());
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ mAdapter.notifyDataSetChanged();
+ mAdapter.notifyDataSetChanged();
+ }
}
+ /**
+ * Event on right groupe name.
+ */
+ private class OnClickRight implements View.OnClickListener {
+
+ /**
+ * Constructor.
+ */
+ public OnClickRight() {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onClick(View v) {
+ mPosCurGroup++;
+ if (mPosCurGroup == mListGroup.size())
+ mPosCurGroup = -1;
+ buildBanner();
+ try {
+ buildContactList(mRoster.getContactList(), mRoster.getGroupsNames());
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ mAdapter.notifyDataSetChanged();
+ }
+ }
+
+ /**
+ * Build Banner button.
+ */
+ protected void buildBanner() {
+ /*
+ * Button bmid = (Button) findViewById(R.id.contactlist_group); Button bleft = (Button)
+ * findViewById(R.id.contactlist_left); Button bright = (Button) findViewById(R.id.contactlist_right); if
+ * (mPosCurGroup == -1) { bleft.setText(mListGroup.get(mListGroup.size() - 1));
+ * bmid.setText(R.string.contact_list_all_contact); bright.setText(mListGroup.get(mPosCurGroup + 1)); } else if
+ * (mPosCurGroup == 0) { bleft.setText(R.string.contact_list_all_contact);
+ * bmid.setText(mListGroup.get(mPosCurGroup)); bright.setText(mListGroup.get(mPosCurGroup + 1)); } else if
+ * (mPosCurGroup == mListGroup.size() -1 ) { bleft.setText(mListGroup.get(mPosCurGroup - 1));
+ * bmid.setText(mListGroup.get(mPosCurGroup)); bmid.setText(R.string.contact_list_all_contact); } else {
+ * bleft.setText(mListGroup.get(mPosCurGroup - 1)); bmid.setText(mListGroup.get(mPosCurGroup));
+ * bright.setText(mListGroup.get(mPosCurGroup + 1)); }
+ */
+ }
+
+ /**
+ * {@inheritDoc}
+ */
@Override
protected void onStart() {
super.onStart();
bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
protected void onStop() {
Log.e(TAG, "UNBINSERVICE");
super.onStop();
unbindService(mServConn);
- mGroupName.clear();
- mGroupMap.clear();
}
+ /**
+ * Comparator Contact by Name.
+ */
class ComparatorContactListByName<T> implements Comparator<T> {
+ /**
+ * Constructor.
+ */
+ public ComparatorContactListByName() {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
@Override
public int compare(T c1, T c2) {
return ((Contact) c1).getName().compareToIgnoreCase(((Contact) c2).getName());
}
}
+ /**
+ * Comparator Contact by status and name.
+ */
class ComparatorContactListByStatusAndName<T> implements Comparator<T> {
+ /**
+ * Constructor.
+ */
+ public ComparatorContactListByStatusAndName() {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
@Override
public int compare(T c1, T c2) {
if (((Contact) c1).getStatus() < ((Contact) c2).getStatus()) {
@@ -144,74 +275,143 @@
}
}
- private void buildContactList(List<Contact> listContact) {
- mListContact = listContact;
- Collections.sort(mListContact, new ComparatorContactListByStatusAndName<Contact>());
- Collections.sort(mGroupName);
- for (Contact contact : mListContact) {
- for (String group : contact.getGroups()) {
- addGroup(group);
- addContactInGroup(contact, group);
- }
- if (contact.getGroups().isEmpty()) {
- addGroup(DEFAULT_GROUP);
- addContactInGroup(contact, DEFAULT_GROUP);
+ /**
+ * Contact List construction.
+ * @param listContact Contact list.
+ * @param listGroup Group list.
+ */
+ private void buildContactList(List<Contact> listContact, List<String> listGroup) {
+ mListGroup = listGroup;
+ Collections.sort(mListGroup);
+ 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);
+ }
}
}
- Collections.sort(mGroupName);
- mAdapter = new MyExpandableListAdapter();
- setListAdapter(mAdapter);
+ sortBeemContactList();
+ ListView listView = (ListView) findViewById(R.id.contactlist);
+ listView.setOnItemClickListener(new BeemContactListOnClick());
+ listView.setOnItemLongClickListener(new BeemContactListOnLongClick());
+ listView.setAdapter(mAdapter);
+ Gallery g = (Gallery) findViewById(R.id.gallery);
+ g.setAdapter(new ImageAdapter(this));
+
}
- protected void addGroup(String group) {
- if (!mGroupMap.containsKey(group)) {
- mGroupMap.put(group, new ArrayList<Contact>());
- mGroupName.add(group);
+ /**
+ * Event simple click on item of the contact list.
+ */
+ public class BeemContactListOnClick implements OnItemClickListener {
+ /**
+ * Constructor.
+ */
+ public BeemContactListOnClick() {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onItemClick(AdapterView<?> arg0, View v, int pos, long lpos) {
+ Contact c = mListContact.get(pos);
+ Intent i = new Intent(ContactList.this, SendIM.class);
+ i.setData(c.toUri());
+ startActivity(i);
}
}
- protected void addContactInGroup(Contact c, String group) {
- boolean found = false;
- for (Contact tmpContact : mGroupMap.get(group)) {
- if (c.getJID().equals(tmpContact.getJID())) {
- found = true;
- break;
- }
+ /**
+ * Event long click on item of the contact list.
+ */
+ public class BeemContactListOnLongClick implements OnItemLongClickListener {
+ /**
+ * Constructor.
+ */
+ public BeemContactListOnLongClick() {
+
}
- if (!found)
- mGroupMap.get(group).add(c);
- }
- protected void delContactInGroup(Contact c, String group) {
- mGroupMap.get(group).remove(c);
- c.delGroup(group);
- if (mGroupMap.get(group).isEmpty()) {
- mGroupMap.remove(group);
- mGroupName.remove(group);
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onItemLongClick(AdapterView<?> arg0, View v, int pos, long lpos) {
+ Contact c = mListContact.get(pos);
+ ContactDialog dialogContact = new ContactDialog(ContactList.this, c, "MYSTATICGROUP");
+ dialogContact.setOwnerActivity(ContactList.this);
+ dialogContact.show();
+ return true;
}
}
+ /**
+ * Sort the contact list.
+ */
+ private void sortBeemContactList() {
+ Collections.sort(mListContact, new ComparatorContactListByStatusAndName<Contact>());
+ }
+
+ /**
+ * Listener on service event.
+ */
private class BeemRosterListener extends IBeemRosterListener.Stub {
+ /**
+ * Constructor.
+ */
+ public BeemRosterListener() {
+ }
+
+ /**
+ * Refresh the contact list.
+ */
+ private class RunnableChange implements Runnable {
+ /**
+ * Constructor.
+ */
+ public RunnableChange() {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void run() {
+ sortBeemContactList();
+ mAdapter.notifyDataSetChanged();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
@Override
public void onEntriesAdded(List<String> addresses) throws RemoteException {
- for (String str : addresses) {
- Contact curContact = mRoster.getContact(str);
- for (String group : curContact.getGroups()) {
- addGroup(group);
- addContactInGroup(curContact, group);
- }
+ for (String newName : addresses) {
+ Contact c = new Contact(newName);
+ mListContact.add(c);
}
mHandler.post(new RunnableChange());
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void onEntriesDeleted(List<String> addresses) throws RemoteException {
- for (String user : addresses) {
- List<Contact> tmpListContact = mGroupMap.get(DEFAULT_GROUP);
- for (Contact contact : tmpListContact) {
- if (contact.getJID().equals(user)) {
- delContactInGroup(contact, DEFAULT_GROUP);
+ for (String cToDelete : addresses) {
+ for (Contact c : mListContact) {
+ if (c.getJID().equals(cToDelete)) {
+ mListContact.remove(c);
break;
}
}
@@ -219,111 +419,110 @@
mHandler.post(new RunnableChange());
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void onEntriesUpdated(List<String> addresses) throws RemoteException {
- for (String str : addresses) {
- Contact curContact = mRoster.getContact(str);
- for (String group : curContact.getGroups()) {
- addGroup(group);
- addContactInGroup(curContact, group);
- }
- }
mHandler.post(new RunnableChange());
}
-
+
+ @Override
+ public void onEntryDeleteFromGroup(String group, String jid)
+ throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+ /**
+ * {@inheritDoc}
+ */
@Override
public void onPresenceChanged(PresenceAdapter presence) throws RemoteException {
+ //TODO gerer la presence au niveau de chaque ressources ?
+ String from = presence.getFrom();
+ boolean resfound = false;
for (Contact curContact : mListContact) {
- if (curContact.getJID().equals(StringUtils.parseBareAddress(presence.getFrom()))) {
+ if (curContact.getJID().equals(StringUtils.parseBareAddress(from))) {
+ String pres = StringUtils.parseResource(from);
+ for (String res : curContact.getMRes()) {
+ if (res.equals(pres)) {
+ resfound = true;
+ break;
+ }
+ }
curContact.setStatus(mRoster.getPresence(StringUtils.parseBareAddress(presence.getFrom())));
+ int status = presence.getStatus();
+ if (!resfound && (status != Status.CONTACT_STATUS_DISCONNECT && status != Status.CONTACT_STATUS_UNAVAILABLE))
+ curContact.addRes(pres);
+ else if (resfound && (status == Status.CONTACT_STATUS_DISCONNECT && status == Status.CONTACT_STATUS_UNAVAILABLE))
+ curContact.delRes(pres);
mHandler.post(new RunnableChange());
return;
}
}
}
- private class RunnableChange implements Runnable {
- @Override
- public void run() {
- mAdapter.changed();
- }
- }
-
- @Override
- public void onEntryDeleteFromGroup(String group, String jid) throws RemoteException {
- for (Contact contact : mListContact) {
- if (jid.equals(contact.getJID())) {
- delContactInGroup(contact, group);
- if (contact.getGroups().size() == 0) {
- addGroup(DEFAULT_GROUP);
- addContactInGroup(contact, DEFAULT_GROUP);
- }
- break;
- }
- }
- mHandler.post(new RunnableChange());
- }
+
}
- private class MyExpandableListAdapter implements ExpandableListAdapter {
-
- class MyOnClickListener implements OnClickListener {
-
- private final Contact mContact;
-
- /**
- * Constructor.
- */
- public MyOnClickListener(Contact contact) {
- mContact = contact;
- }
-
- @Override
- public void onClick(View v) {
- Intent i = new Intent(ContactList.this, SendIM.class);
- i.setData(mContact.toUri());
- startActivity(i);
- }
-
- }
-
- class MyOnLongClickListener implements OnLongClickListener {
-
- private final Contact mContact;
- private final String mGroup;
-
- /**
- * Constructor.
- */
- public MyOnLongClickListener(Contact contact, String group) {
- mContact = contact;
- mGroup = group;
- }
-
- /**
- * @{inheritDoc}
- */
- @Override
- public boolean onLongClick(View v) {
- createDialog(mContact, mGroup);
- return true;
- }
- }
-
- private final List<DataSetObserver> mObservers;
+ /**
+ * Adapter contact list.
+ */
+ private class BeemContactList extends BaseAdapter {
+ private LayoutInflater mInflater;
/**
* Constructor.
+ * @param context context activity.
*/
- public MyExpandableListAdapter() {
- mObservers = new ArrayList<DataSetObserver>();
+ public BeemContactList(final Context context) {
+ mInflater = LayoutInflater.from(context);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getCount() {
+ return mListContact.size();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getItem(int position) {
+ return position;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public boolean areAllItemsEnabled() {
- return true;
+ public long getItemId(int position) {
+ return position;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View v = convertView;
+ if (convertView == null) {
+ v = mInflater.inflate(R.layout.contactlistcontact, null);
+ }
+
+ Contact c = mListContact.get(position);
+ bindView(v, c);
+ return v;
+ }
+
+ /**
+ * Adapte curContact to the view.
+ * @param view the row view.
+ * @param curContact the current contact.
+ */
private void bindView(View view, Contact curContact) {
if (curContact != null) {
@@ -371,149 +570,62 @@
}
/*
- * TODO: Rajouter l'avatar du contact getAvatar() dans la classe imgV = (ImageView)
+ * Rajouter l'avatar du contact getAvatar() dans la classe imgV = (ImageView)
* view.findViewById(R.id.contactlistavatar); if (imgV != null) { imageDrawable =
* getResources().getDrawable(R.drawable.avatar); imgV.setImageDrawable(imageDrawable); }
*/
}
}
-
- public void changed() {
- Collections.sort(mGroupName);
- for (String name : mGroupName) {
- Collections.sort(mGroupMap.get(name), new ComparatorContactListByStatusAndName<Contact>());
- }
- for (DataSetObserver obs : mObservers) {
- obs.onChanged();
- }
- }
+ }
- void createDialog(Contact contact, String group) {
- ContactDialog dialogContact = new ContactDialog(ContactList.this, contact, group);
- dialogContact.setOwnerActivity(ContactList.this);
- dialogContact.show();
- }
+ /**
+ * Adapter banner list.
+ */
+ public class ImageAdapter extends BaseAdapter {
+ private Context mContext;
- @Override
- public Object getChild(int groupPosition, int childPosition) {
- try {
- return mGroupMap.get(mGroupName.get(groupPosition)).get(childPosition);
- } catch (NullPointerException e) {
- Log.e(TAG, "Child not found", e);
- return null;
- }
+ /**
+ * Constructor.
+ * @param c context activity.
+ */
+ public ImageAdapter(final Context c) {
+ mContext = c;
}
- @Override
- public long getChildId(int groupPosition, int childPosition) {
- try {
- mGroupMap.get(mGroupName.get(groupPosition)).get(childPosition);
- } catch (NullPointerException e) {
- Log.e(TAG, "Child not found", e);
- return 0;
- }
- return childPosition;
- }
-
+ /**
+ * {@inheritDoc}
+ */
@Override
- public int getChildrenCount(int groupPosition) {
- try {
- return mGroupMap.get(mGroupName.get(groupPosition)).size();
- } catch (NullPointerException e) {
- Log.e(TAG, "Child not found", e);
- return 0;
- }
- }
-
- @Override
- public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
- ViewGroup parent) {
- View v;
- if (convertView == null) {
- v = LayoutInflater.from(ContactList.this).inflate(R.layout.contactlistcontact, null);
- } else {
- v = convertView;
- }
- Contact contact = mGroupMap.get(mGroupName.get(groupPosition)).get(childPosition);
- bindView(v, contact);
-
- v.setOnLongClickListener(new MyOnLongClickListener(contact, mGroupName.get(groupPosition)));
- v.setOnClickListener(new MyOnClickListener(contact));
- return v;
+ public int getCount() {
+ return mListGroup.size();
}
- @Override
- public long getCombinedChildId(long groupId, long childId) {
- return 1000 * groupId + childId;
- }
-
- @Override
- public long getCombinedGroupId(long groupId) {
- return 1000 * groupId;
- }
-
+ /**
+ * {@inheritDoc}
+ */
@Override
- public Object getGroup(int groupPosition) {
- try {
- return mGroupMap.get(mGroupName.get(groupPosition));
- } catch (NullPointerException e) {
- Log.e(TAG, "Group not found", e);
- return null;
- }
- }
-
- @Override
- public int getGroupCount() {
- return mGroupMap.size();
- }
-
- @Override
- public long getGroupId(int groupPosition) {
- return groupPosition;
+ public Object getItem(int position) {
+ return position;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
- if (convertView == null) {
- convertView = LayoutInflater.from(ContactList.this).inflate(R.layout.contactlistgroup, null);
- }
- TextView groupTextView = (TextView) convertView.findViewById(R.id.textgroup);
- groupTextView.setText(mGroupName.get(groupPosition));
- return convertView;
- }
-
- @Override
- public boolean hasStableIds() {
- return false;
- }
-
- @Override
- public boolean isChildSelectable(int groupPosition, int childPosition) {
- return true;
+ public long getItemId(int position) {
+ return position;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public boolean isEmpty() {
- return mGroupMap.isEmpty();
- }
-
- @Override
- public void onGroupCollapsed(int groupPosition) {
+ public View getView(int position, View convertView, ViewGroup parent) {
+ TextView i = new TextView(mContext);
+ i.setText(mListGroup.get(position));
+ return i;
}
- @Override
- public void onGroupExpanded(int groupPosition) {
- }
-
- @Override
- public void registerDataSetObserver(DataSetObserver observer) {
- mObservers.add(observer);
- }
-
- @Override
- public void unregisterDataSetObserver(DataSetObserver observer) {
- mObservers.remove(observer);
- }
}
/**
@@ -525,7 +637,9 @@
/**
* Constructor.
*/
- public BeemServiceConnection() { }
+ public BeemServiceConnection() {
+ }
+
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
mXmppFacade = IXmppFacade.Stub.asInterface(service);
@@ -533,7 +647,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 Thu Sep 17 10:46:45 2009 +0200
+++ b/src/com/beem/project/beem/ui/Login.java Thu Sep 24 12:30:17 2009 +0200
@@ -13,9 +13,9 @@
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import android.widget.TextView;
import android.widget.Toast;
@@ -31,7 +31,7 @@
*/
public class Login extends Activity {
- //private static final String TAG = "LOG_AS";
+ // private static final String TAG = "LOG_AS";
private static final Intent SERVICE_INTENT = new Intent();
static {
SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
@@ -47,12 +47,11 @@
private SharedPreferences mSettings;
private boolean mIsConfigured;
- private Button mButtonLogin;
-
/**
* Constructor.
*/
- public Login() { }
+ public Login() {
+ }
/**
* Create an about "BEEM" dialog.
@@ -71,31 +70,13 @@
}
/**
- * @{inheritDoc}
+ * {@inheritDoc}
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSettings = getSharedPreferences(getString(R.string.settings_filename), MODE_PRIVATE);
setContentView(R.layout.login);
- Button button = (Button) findViewById(R.id.log_as_settings);
- button.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- startActivity(new Intent(Login.this, EditSettings.class));
- }
-
- });
- mButtonLogin = (Button) findViewById(R.id.log_as_login);
- mButtonLogin.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
- }
-
- });
mProgressDialog = new ProgressDialog(this);
}
@@ -113,14 +94,41 @@
@Override
public void onStart() {
super.onStart();
- Log.e("LOGIN", "BINDSERVICE");
mIsConfigured = mSettings.getBoolean(getString(R.string.PreferenceIsConfigured), false);
if (mIsConfigured)
bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
- else
- mButtonLogin.setEnabled(false);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.login, menu);
+ return true;
+ }
+ /**
+ * Callback for menu item selected.
+ * @param item the item selected
+ * @return true on success, false otherwise
+ */
+ @Override
+ public final boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.login_menu_settings:
+ startActivity(new Intent(Login.this, EditSettings.class));
+ return true;
+ case R.id.login_menu_about:
+ createAboutDialog();
+ return true;
+ default:
+ return false;
+ }
}
/**
@@ -131,7 +139,8 @@
/**
* Constructor.
*/
- public BeemConnectionListener() { }
+ public BeemConnectionListener() {
+ }
/**
* Runnable to display error message.
@@ -149,7 +158,7 @@
}
/**
- * @{inheritDoc}
+ * {@inheritDoc}
*/
@Override
public void run() {
@@ -159,11 +168,10 @@
}
/**
- * @{inheritDoc}
+ * {@inheritDoc}
*/
@Override
public void connectionClosed() throws RemoteException {
- Log.e("Login", "CONNECTIONCLOSED");
mIsConnected = false;
if (mXmppFacade != null) {
Login.this.unbindService(mServConn);
@@ -174,8 +182,6 @@
@Override
public void connectionClosedOnError() throws RemoteException {
- Log.e("Login", "CONNECTIONCLOSEONERROR");
-
}
@Override
@@ -194,12 +200,12 @@
/**
* Show an error message with a toast.
- * @param errorMsg The message to display.
+ * @param errorMsg The message to display.
*/
private void showToast(final String errorMsg) {
mConnectionHandler.post(new Runnable() {
/**
- * @{inheritDoc}
+ * @{inheritDoc
*/
@Override
public void run() {
@@ -217,7 +223,7 @@
mConnectionHandler.post(new Runnable() {
/**
- * @{inheritDoc}
+ * @{inheritDoc
*/
@Override
public void run() {
@@ -262,7 +268,8 @@
/**
* Constructor.
*/
- public BeemServiceConnection() { }
+ public BeemServiceConnection() {
+ }
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
--- a/src/com/beem/project/beem/ui/SendIM.java Thu Sep 17 10:46:45 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIM.java Thu Sep 24 12:30:17 2009 +0200
@@ -49,7 +49,7 @@
public class SendIM extends Activity implements OnClickListener, OnKeyListener {
private static final String TAG = "SEND_IM";
- public IRoster mRoster;
+ private IRoster mRoster;
private EditText mToSend;
private SendIMDialogSmiley mSmyDialog;
private SharedPreferences mSet;
@@ -207,6 +207,16 @@
case R.id.sendim_smiley:
mSmyDialog.show();
return true;
+ case R.id.sendim_call:
+ // TODO start the jingle call
+ // Bug a besoin du jid complet (resource compris)
+ try {
+ mXmppFacade.call(mContact.getJID());
+ } catch (RemoteException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return true;
default:
return false;
}
@@ -419,6 +429,12 @@
}
@Override
+ public void onEntryDeleteFromGroup(String group, String jid) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
public void onPresenceChanged(PresenceAdapter presence) throws RemoteException {
if (mContact.getJID().equals(StringUtils.parseBareAddress(presence.getFrom()))) {
mContact.setStatus(mRoster.getPresence(StringUtils.parseBareAddress(presence.getFrom())));
@@ -443,11 +459,7 @@
}
}
- @Override
- public void onEntryDeleteFromGroup(String group, String jid) throws RemoteException {
- // TODO Auto-generated method stub
- }
}