--- a/AndroidManifest.xml Fri Apr 24 21:20:06 2009 +0200
+++ b/AndroidManifest.xml Fri Apr 24 21:41:32 2009 +0200
@@ -2,7 +2,8 @@
<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:name="BeemApplication" android:icon="@drawable/signal">
+ <application android:label="@string/app_name" android:name="BeemApplication"
+ android:icon="@drawable/signal">
<activity android:name=".ui.ContactList" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -31,5 +32,5 @@
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
<uses-permission android:name="com.beem.project.beem.BEEM_SERVICE"></uses-permission>
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"></uses-permission>
-<uses-sdk android:minSdkVersion="2"></uses-sdk>
+ <uses-sdk android:minSdkVersion="2"></uses-sdk>
</manifest>
Binary file res/drawable/away.png has changed
Binary file res/drawable/beem_contactlist_header_1.png has changed
Binary file res/drawable/buddie_robot.png has changed
Binary file res/drawable/chat.png has changed
Binary file res/drawable/connecting.png has changed
Binary file res/drawable/dnd.png has changed
Binary file res/drawable/error.png has changed
Binary file res/drawable/invisible.png has changed
Binary file res/drawable/logo.jpg has changed
Binary file res/drawable/message.png has changed
Binary file res/drawable/notify_message.png has changed
Binary file res/drawable/notify_signal.png has changed
Binary file res/drawable/online.png has changed
Binary file res/drawable/requested.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/drawable/scrollbar_vertical_thumb.xml Fri Apr 24 21:41:32 2009 +0200
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient android:startColor="#3333FF" android:endColor="#8080FF"
+ android:angle="0"/>
+ <corners android:radius="6dp" />
+</shape>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/drawable/scrollbar_vertical_track.xml Fri Apr 24 21:41:32 2009 +0200
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient android:startColor="#505050" android:endColor="#C0C0C0"
+ android:angle="0"/>
+ <corners android:radius="0dp" />
+</shape>
Binary file res/drawable/signal.png has changed
Binary file res/drawable/xmpp.jpg has changed
Binary file res/drawable/xmpp.png has changed
--- a/res/layout/contactlistcontact.xml Fri Apr 24 21:20:06 2009 +0200
+++ b/res/layout/contactlistcontact.xml Fri Apr 24 21:41:32 2009 +0200
@@ -5,12 +5,13 @@
android:layout_height="wrap_content"
android:paddingLeft="10px"
android:paddingRight="10px"
- android:background="@drawable/beem_sendim_header_1"
android:gravity="center_vertical" >
<ImageView android:id="@+id/contactliststatus"
- android:layout_weight="5"
- android:layout_width="fill_parent"
+ android:adjustViewBounds="true"
+ android:maxWidth="15dip"
+ android:maxHeight="15dip"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical" />
@@ -30,8 +31,11 @@
</LinearLayout>
<ImageView android:id="@+id/contactlistavatar"
- android:layout_weight="5"
- android:layout_width="fill_parent"
+ android:adjustViewBounds="true"
+ android:maxWidth="50dip"
+ android:maxHeight="50dip"
+ android:padding="1dip"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical" />
--- a/res/layout/contactlistsettings.xml Fri Apr 24 21:20:06 2009 +0200
+++ b/res/layout/contactlistsettings.xml Fri Apr 24 21:41:32 2009 +0200
@@ -2,90 +2,22 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
-<LinearLayout
- android:orientation="vertical" android:layout_width="fill_parent"
- android:layout_height="fill_parent">
-
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:text="Server connection"
- android:textSize="18sp" />
-
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal" android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- <TextView android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="Host/Port:"
- android:minWidth="90dp" android:textSize="14sp" />
- <EditText android:id="@+id/host" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:singleLine="true"
- android:textSize="14sp" android:autoText="false" android:capitalize="none"
- android:layout_weight="2" android:scrollHorizontally="true" />
- <EditText android:id="@+id/port" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:singleLine="true"
- android:textSize="14sp" android:autoText="false" android:capitalize="none"
- android:layout_weight="3" android:scrollHorizontally="true" />
- </LinearLayout>
-
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal" android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- <TextView android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="Userid:"
- android:minWidth="90dp" android:textSize="14sp" />
- <EditText android:id="@+id/userid" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:singleLine="true"
- android:textSize="14sp" android:autoText="false" android:capitalize="none"
- android:scrollHorizontally="true" />
- </LinearLayout>
-
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal" android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- <TextView android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="Password:"
- android:minWidth="90dp" android:textSize="14sp" />
- <EditText android:id="@+id/password" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:singleLine="true"
- android:password="true" android:textSize="14sp" android:autoText="false"
- android:capitalize="none" android:scrollHorizontally="true" />
- </LinearLayout>
-
- <Spinner android:id="@+id/proxy_type" android:layout_width="fill_parent"
- android:layout_height="wrap_content" />
-
- <LinearLayout android:id="@+id/proxy_layout"
- android:orientation="vertical" android:layout_width="fill_parent"
- android:layout_height="wrap_content">
+ <LinearLayout android:orientation="vertical"
+ android:layout_width="fill_parent" android:layout_height="fill_parent">
<TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:text="Proxy informations"
+ android:layout_height="wrap_content" android:text="Server connection"
android:textSize="18sp" />
-
- <LinearLayout android:orientation="horizontal"
- android:layout_width="fill_parent" android:layout_height="wrap_content">
- <TextView android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="Host/Port:"
- android:minWidth="90dp" android:textSize="14sp" />
- <EditText android:id="@+id/proxy_host" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:singleLine="true"
- android:textSize="14sp" android:autoText="false" android:capitalize="none"
- android:layout_weight="2" android:scrollHorizontally="true" />
- <EditText android:id="@+id/proxy_port" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:singleLine="true"
- android:textSize="14sp" android:autoText="false" android:capitalize="none"
- android:layout_weight="3" android:scrollHorizontally="true" />
- </LinearLayout>
-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="Login :"
+ android:layout_height="wrap_content" android:text="Userid:"
android:minWidth="90dp" android:textSize="14sp" />
- <EditText android:id="@+id/proxy_login"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:singleLine="true" android:textSize="14sp" android:autoText="false"
- android:capitalize="none" android:scrollHorizontally="true" />
+ <EditText android:id="@+id/userid" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:singleLine="true"
+ android:textSize="14sp" android:autoText="false" android:capitalize="none"
+ android:scrollHorizontally="true" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
@@ -94,23 +26,100 @@
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Password:"
android:minWidth="90dp" android:textSize="14sp" />
- <EditText android:id="@+id/proxy_pwd" android:layout_width="fill_parent"
+ <EditText android:id="@+id/password" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:singleLine="true"
android:password="true" android:textSize="14sp" android:autoText="false"
android:capitalize="none" android:scrollHorizontally="true" />
</LinearLayout>
- </LinearLayout>
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal" android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:text="Service:"
+ android:minWidth="90dp" android:textSize="14sp" />
+ <EditText android:id="@+id/service" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:singleLine="true"
+ android:textSize="14sp" android:autoText="false" android:capitalize="none"
+ android:scrollHorizontally="true" />
+ </LinearLayout>
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal" android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:text="Host/Port:"
+ android:minWidth="90dp" android:textSize="14sp" />
+ <EditText android:id="@+id/host" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:singleLine="true"
+ android:textSize="14sp" android:autoText="false" android:capitalize="none"
+ android:layout_weight="2" android:scrollHorizontally="true" />
+ <EditText android:id="@+id/port" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:singleLine="true"
+ android:textSize="14sp" android:autoText="false" android:capitalize="none"
+ android:layout_weight="3" android:scrollHorizontally="true" />
+ </LinearLayout>
+
+ <TextView android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:text="Proxy informations"
+ android:textSize="18sp" />
+
+ <Spinner android:id="@+id/proxy_type" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" />
+
+ <LinearLayout android:id="@+id/proxy_layout"
+ android:orientation="vertical" android:layout_width="fill_parent"
+ android:layout_height="0sp">
+
+ <TextView android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:text="Proxy informations"
+ android:textSize="18sp" />
- <Button android:id="@+id/ok" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:layout_gravity="center_horizontal"
- android:text="OK">
- <requestFocus />
- </Button>
- <Button android:id="@+id/reconnect" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:layout_gravity="center_horizontal"
- android:text="Reconnect">
- <requestFocus />
- </Button>
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="fill_parent" android:layout_height="wrap_content">
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:text="Host/Port:"
+ android:minWidth="90dp" android:textSize="14sp" />
+ <EditText android:id="@+id/proxy_host"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:singleLine="true" android:textSize="14sp" android:autoText="false"
+ android:capitalize="none" android:layout_weight="2"
+ android:scrollHorizontally="true" />
+ <EditText android:id="@+id/proxy_port"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:singleLine="true" android:textSize="14sp" android:autoText="false"
+ android:capitalize="none" android:layout_weight="3"
+ android:scrollHorizontally="true" />
+ </LinearLayout>
-</LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal" android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:text="Login :"
+ android:minWidth="90dp" android:textSize="14sp" />
+ <EditText android:id="@+id/proxy_login"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:singleLine="true" android:textSize="14sp" android:autoText="false"
+ android:capitalize="none" android:scrollHorizontally="true" />
+ </LinearLayout>
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal" android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:text="Password:"
+ android:minWidth="90dp" android:textSize="14sp" />
+ <EditText android:id="@+id/proxy_pwd" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:singleLine="true"
+ android:password="true" android:textSize="14sp" android:autoText="false"
+ android:capitalize="none" android:scrollHorizontally="true" />
+ </LinearLayout>
+ </LinearLayout>
+ <Button android:id="@+id/ok" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:layout_gravity="center_horizontal"
+ android:text="OK">
+ <requestFocus />
+ </Button>
+ </LinearLayout>
</ScrollView>
\ No newline at end of file
--- a/res/layout/sendim.xml Fri Apr 24 21:20:06 2009 +0200
+++ b/res/layout/sendim.xml Fri Apr 24 21:41:32 2009 +0200
@@ -7,31 +7,34 @@
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:paddingLeft="10px"
- android:paddingRight="10px"
- android:background="@drawable/beem_sendim_header_1"
android:gravity="center_vertical" >
- <ImageView android:id="@+id/sendimavatar"
- android:layout_weight="5"
- android:layout_width="fill_parent"
+ <ImageView
+ android:id="@+id/sendimavatar"
+ android:src="@drawable/avatar"
+ android:adjustViewBounds="true"
+ android:maxWidth="70dip"
+ android:maxHeight="70dip"
+ android:padding="10dip"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:gravity="center_vertical" />
+ />
<LinearLayout
android:orientation="vertical"
- android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView android:id="@+id/sendimlogin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:paddingLeft="20sp" />
+ android:paddingLeft="10sp" />
<TextView android:id="@+id/sendimstatus"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
+ android:lines="1"
+ android:scrollHorizontally="true"
android:hint="@string/SendIMNoStatusSet"
- android:paddingLeft="20sp" />
+ android:paddingLeft="15sp" />
</LinearLayout>
</LinearLayout>
@@ -76,6 +79,9 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/beem_sendim_textview"
+ android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track"
+ android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb"
+ android:scrollbarSize="12dip"
android:layout_weight="1">
<TextView android:id="@+id/sendimlist"
--- a/res/menu/contactlistmenu.xml Fri Apr 24 21:20:06 2009 +0200
+++ b/res/menu/contactlistmenu.xml Fri Apr 24 21:41:32 2009 +0200
@@ -1,6 +1,6 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:title="@string/MenuConnection" android:id="@+id/account_edit" android:icon="@drawable/xmpp"/>
- <item android:title="@string/MenuAddContact" android:id="@+id/add_contact" />
- <item android:title="@string/MenuAccountAbout" android:id="@+id/account_about"/>
+ <item android:title="@string/MenuAddContact" android:id="@+id/add_contact" android:icon="@drawable/buddie_robot"/>
+ <item android:title="@string/MenuAccountAbout" android:id="@+id/account_about" android:icon="@drawable/signal"/>
<item android:title="@string/MenuAccountCreate" android:id="@+id/account_create"/>
</menu>
--- a/res/values/strings.xml Fri Apr 24 21:20:06 2009 +0200
+++ b/res/values/strings.xml Fri Apr 24 21:41:32 2009 +0200
@@ -27,6 +27,7 @@
<string name="PreferenceJID">Jabber ID</string>
<string name="PreferenceLoginKey">login</string>
<string name="PreferencePasswordKey">password</string>
+ <string name="PreferenceService">service</string>
<string name="PreferencePortKey">port</string>
<string name="PreferenceProxyHost">proxy_host</string>
<string name="PreferenceProxyPort">proxy_port</string>
@@ -64,5 +65,7 @@
<string name="ChangeStatusOk">Updating status</string>
<string name="ChangeStatusNoChange">Nothing to change</string>
+ <!-- BeemChatManager -->
+ <string name="BeemChatManagerNewMessage">You have got a new message</string>
</resources>
--- a/src/com/beem/project/beem/BeemApplication.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/BeemApplication.java Fri Apr 24 21:41:32 2009 +0200
@@ -5,6 +5,7 @@
import java.util.LinkedList;
import java.util.List;
+
import android.app.Activity;
import android.app.Application;
import android.app.ProgressDialog;
@@ -18,9 +19,13 @@
import android.os.Message;
import android.os.RemoteException;
import android.util.Log;
+import android.widget.Toast;
+
import com.beem.project.beem.service.aidl.IBeemConnectionListener;
import com.beem.project.beem.service.aidl.IXmppConnection;
import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.ui.AddContact;
+import com.beem.project.beem.ui.ContactList;
import com.beem.project.beem.utils.Status;
/**
@@ -61,10 +66,10 @@
try {
mConnection = mFacade.createConnection();
if (!mConnection.isAuthentificated()) {
- mProgressDialog.show();
mConnection.addConnectionListener(mConnectionListener);
mApplicationContext.startService(BeemApplication.SERVICE_INTENT);
}else {
+ mProgressDialog.dismiss();
synchronized (mQueue) {
for (Message msg : mQueue) {
msg.sendToTarget();
@@ -111,6 +116,8 @@
*/
public synchronized void startBeemService() {
if (!mIsConnected) {
+ mProgressDialog.setMessage("Connecting...");
+ mProgressDialog.show();
// the connection will be made on service connect
mApplicationContext.bindService(BeemApplication.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
}
@@ -207,7 +214,6 @@
* Constructor.
*/
public ConnectionListener() {
-
}
/**
@@ -215,9 +221,7 @@
*/
@Override
public void connectionClosed() throws RemoteException {
- // TODO Auto-generated method stub
- Log.e("BeemApp", "test1");
-
+ Log.e(TAG, "Connection Close");
}
/**
@@ -252,8 +256,6 @@
*/
@Override
public void reconnectingIn(int seconds) throws RemoteException {
- // TODO Auto-generated method stub
- mProgressDialog.show();
}
/**
@@ -261,9 +263,6 @@
*/
@Override
public void reconnectionFailed() throws RemoteException {
- // TODO Auto-generated method stub
- Log.e("BeemApp", "test3");
-
}
/**
@@ -271,8 +270,6 @@
*/
@Override
public void reconnectionSuccessful() throws RemoteException {
- // TODO Auto-generated method stub
-
}
@Override
--- a/src/com/beem/project/beem/BeemService.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/BeemService.java Fri Apr 24 21:41:32 2009 +0200
@@ -49,6 +49,7 @@
private String mLogin;
private String mPassword;
private String mHost;
+ private String mService;
private int mPort;
private ConnectionConfiguration mConnectionConfiguration;
private ProxyInfo mProxyInfo;
@@ -83,6 +84,7 @@
mPassword = mSettings.getString(getString(R.string.PreferencePasswordKey), "");
mHost = mSettings.getString(getString(R.string.PreferenceHostKey), "");
mPort = mSettings.getInt(getString(R.string.PreferencePortKey), 5222);
+ mService = mSettings.getString(getString(R.string.PreferenceService), "");
// TODO penser a commenter
// mHost = "10.0.2.2";
@@ -139,7 +141,7 @@
int pport = mSettings.getInt(getString(R.string.PreferenceProxyPort), 1080);
ProxyInfo.ProxyType type = ProxyType.valueOf(stype);
mProxyInfo = new ProxyInfo(type, phost, pport, puser, ppass);
- mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort, mProxyInfo);
+ mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort, mService, mProxyInfo);
} else {
mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort);
}
--- a/src/com/beem/project/beem/service/BeemChatManager.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/service/BeemChatManager.java Fri Apr 24 21:41:32 2009 +0200
@@ -23,6 +23,7 @@
import android.util.Log;
import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
import com.beem.project.beem.service.aidl.IChat;
import com.beem.project.beem.service.aidl.IChatManager;
import com.beem.project.beem.service.aidl.IChatManagerListener;
@@ -140,7 +141,7 @@
public void chatCreated(Chat chat, boolean locally) {
IChat newchat = getChat(chat);
if (!locally) {
- // chat.addMessageListener(mChatListener);
+ // chat.addMessageListener(mChatListener);
notifyNewChat(newchat);
}
chat.addMessageListener(mChatListener);
@@ -162,15 +163,15 @@
private void notifyNewChat(IChat chat) {
try {
String text = chat.getParticipant().getJID();
- Notification notif = new Notification(com.beem.project.beem.R.drawable.signal, text, System
+ Notification notif = new Notification(com.beem.project.beem.R.drawable.notify_message, text, System
.currentTimeMillis());
notif.defaults = Notification.DEFAULT_ALL;
notif.flags = Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(mService, SendIM.class);
// TODO use prefix for name
intent.putExtra("contact", chat.getParticipant());
- notif.setLatestEventInfo(mService, text, "nouveau message", PendingIntent.getActivity(mService, 0,
- intent, PendingIntent.FLAG_ONE_SHOT));
+ notif.setLatestEventInfo(mService, text, mService.getString(R.string.BeemChatManagerNewMessage),
+ PendingIntent.getActivity(mService, 0, intent, PendingIntent.FLAG_ONE_SHOT));
int id = chat.hashCode();
mService.sendNotification(id, notif);
} catch (RemoteException e) {
--- a/src/com/beem/project/beem/service/Contact.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/service/Contact.java Fri Apr 24 21:41:32 2009 +0200
@@ -142,6 +142,7 @@
public void setStatus(Presence presence) {
Log.i(TAG,"PRESENCE");
mStatus = Status.getStatusFromPresence(presence);
+ mMsgState = presence.getStatus();
}
/**
--- a/src/com/beem/project/beem/service/RosterAdapter.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java Fri Apr 24 21:41:32 2009 +0200
@@ -220,6 +220,7 @@
}
c.addRes(StringUtils.parseResource(presence.getFrom()));
c.setStatus(mAdaptee.getPresence(presence.getFrom()));
+ c.setMsgState(presence.getStatus());
/* redispatch vers les IBeemRosterListener */
final int n = mRemoteRosListeners.beginBroadcast();
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Fri Apr 24 21:41:32 2009 +0200
@@ -88,7 +88,10 @@
return true;
} catch (XMPPException e) {
Log.e(TAG, "Error while connecting", e);
- mConListener.connectionFailed(e.getXMPPError().getMessage()); //
+ if (e.getXMPPError() != null)
+ mConListener.connectionFailed(e.getXMPPError().getMessage()); //
+ else
+ mConListener.connectionFailed("Error On Connection");
}
return false;
}
--- a/src/com/beem/project/beem/service/XmppFacade.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppFacade.java Fri Apr 24 21:41:32 2009 +0200
@@ -97,7 +97,7 @@
Notification mStatusNotification;
String text = (msg == null ? "" : msg);
- mStatusNotification = new Notification(com.beem.project.beem.R.drawable.signal, text, System.currentTimeMillis());
+ mStatusNotification = new Notification(com.beem.project.beem.R.drawable.notify_signal, text, System.currentTimeMillis());
mStatusNotification.defaults = Notification.DEFAULT_ALL;
mStatusNotification.flags = Notification.FLAG_NO_CLEAR;
--- a/src/com/beem/project/beem/ui/ChangeStatus.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/ui/ChangeStatus.java Fri Apr 24 21:41:32 2009 +0200
@@ -1,16 +1,14 @@
package com.beem.project.beem.ui;
import android.app.Activity;
-
+import android.content.Context;
import android.content.Intent;
-
-import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
-
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
+import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
@@ -22,7 +20,6 @@
import com.beem.project.beem.BeemApplication;
import com.beem.project.beem.BeemService;
import com.beem.project.beem.R;
-
import com.beem.project.beem.service.aidl.IXmppFacade;
import com.beem.project.beem.utils.Status;
@@ -44,18 +41,20 @@
private static final int UNAVAILABLE_IDX = 4;
private SharedPreferences mSettings;
private ArrayAdapter<String> mAdapter;
- private Context mContext = this;
private Toast mToast;
+ private static Integer nb = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.changestatus);
-
+
+ nb++;
+ Log.i("nb de oncreate changestatus", nb.toString());
// Beem Application specific
mHandler = new Handler();
mBeemApplication = BeemApplication.getApplication(this);
-
+
+ setContentView(R.layout.changestatus);
mStatusText = (TextView) findViewById(R.id.ChangeStatusText);
mOk = (Button) findViewById(R.id.ChangeStatusOk);
mClear = (Button) findViewById(R.id.ChangeStatusClear);
@@ -67,7 +66,7 @@
mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, STATUS);
mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mSpinner.setAdapter(mAdapter);
- mToast = Toast.makeText(mContext, R.string.ChangeStatusOk, Toast.LENGTH_LONG);
+ mToast = Toast.makeText(this, R.string.ChangeStatusOk, Toast.LENGTH_LONG);
showSettings();
}
--- a/src/com/beem/project/beem/ui/ContactList.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Fri Apr 24 21:41:32 2009 +0200
@@ -42,8 +42,10 @@
private static final String CHILD = "CHILD";
private static final String GROUP = "GROUP";
private IXmppFacade mService = null;
+ private ExpandableListAdapter mAdapter;
private BeemApplication mBeemApplication;
private BeemRosterListener mRosterListener;
+ private SharedPreferences mSettings;
private IRoster mRoster;
@SuppressWarnings("unchecked")
@@ -60,9 +62,19 @@
@Override
protected void onCreate(Bundle saveBundle) {
super.onCreate(saveBundle);
+ mRosterListener = new BeemRosterListener();
+ mSettings = getSharedPreferences(getString(R.string.PreferenceFileName), MODE_PRIVATE);
mBeemApplication = BeemApplication.getApplication(this);
- mRosterListener = new BeemRosterListener();
- mBeemApplication.startBeemService();
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ if (!mBeemApplication.isConnected()) {
+ mBeemApplication = BeemApplication.getApplication(this);
+ mBeemApplication.startBeemService();
+ }
mBeemApplication.callWhenConnectedToServer(new Handler(), new Runnable() {
@Override
public void run() {
@@ -79,17 +91,10 @@
e.printStackTrace();
}
}
- callbackShowContactList();
+ if (mAdapter == null)
+ callbackShowContactList();
}
});
-
- // bug fixe temporaire des betises de marseille
-
- SharedPreferences mSettings = getSharedPreferences(getString(R.string.PreferenceFileName), MODE_PRIVATE);
- SharedPreferences.Editor editor = mSettings.edit();
- editor.putInt(getString(R.string.PreferencePortKey), 5222);
- editor.commit();
-
}
@Override
@@ -153,25 +158,18 @@
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PREFERENCECHANGED) {
if (resultCode == RESULT_OK) {
+ mAdapter = null;
+ setListAdapter(mAdapter);
mBeemApplication.stopBeemService();
- mBeemApplication.startBeemService();
}
}
}
- private boolean isStatusOK(int status) {
- if (status == Status.CONTACT_STATUS_AVAILABLE || status == Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT
- || status == Status.CONTACT_STATUS_AWAY || status == Status.CONTACT_STATUS_BUSY)
- return true;
- return false;
- }
-
private void showContactList(List<String> listGroup, List<Contact> listContact) {
- ExpandableListAdapter Adapter;
List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
List<List<Map<String, Contact>>> childData = new ArrayList<List<Map<String, Contact>>>();
-
- if (listGroup.size() == 0)
+ int groupSize = listGroup.size();
+ if (groupSize == 0)
listGroup.add("Default");
for (int i = 0; i < listGroup.size(); i++) {
Map<String, String> curGroupMap = new HashMap<String, String>();
@@ -182,18 +180,20 @@
List<Map<String, Contact>> children = new ArrayList<Map<String, Contact>>();
for (int j = 0; j < listContact.size(); ++j) {
Contact c = listContact.get(j);
- Log.i(TAG, c.getID() + " " + c.getJID());
- Map<String, Contact> curChildMap = new HashMap<String, Contact>();
- children.add(curChildMap);
- curChildMap.put(CHILD, c);
+ if (groupSize == 0 || c.getGroups().contains(listGroup.get(i)) ) {
+ Log.i(TAG, c.getID() + " " + c.getJID());
+ Map<String, Contact> curChildMap = new HashMap<String, Contact>();
+ children.add(curChildMap);
+ curChildMap.put(CHILD, c);
+ }
}
childData.add(children);
}
- Adapter = new ContactExpandableListAdapter(this, groupData, R.layout.contactlistgroup, new String[] { GROUP },
+ mAdapter = new ContactExpandableListAdapter(this, groupData, R.layout.contactlistgroup, new String[] { GROUP },
new int[] { R.id.textgroup }, childData, R.layout.contactlistcontact, new String[] { CHILD }, new int[] {
R.id.contactliststatus, R.id.contactlistpseudo, R.id.contactlistmsgperso, R.id.contactlistavatar });
- setListAdapter(Adapter);
+ setListAdapter(mAdapter);
}
/**
@@ -314,4 +314,4 @@
}
}
-}
\ No newline at end of file
+}
--- a/src/com/beem/project/beem/ui/ContactListSettings.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactListSettings.java Fri Apr 24 21:41:32 2009 +0200
@@ -1,8 +1,12 @@
package com.beem.project.beem.ui;
import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
+import android.text.Layout;
+import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
@@ -11,7 +15,9 @@
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
+import android.widget.TextView;
import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.LinearLayout.LayoutParams;
import com.beem.project.beem.R;
@@ -48,17 +54,6 @@
showSettings();
Button ok = (Button) findViewById(R.id.ok);
ok.setOnClickListener(mOkListener);
-
- Button reco = (Button) findViewById(R.id.reconnect);
- reco.setOnClickListener(new OnClickListener () {
-
- @Override
- public void onClick(View v) {
- setResult(RESULT_OK);
- finish();
- }
-
- });
}
private OnItemSelectedListener mProxyType = new OnItemSelectedListener() {
@@ -68,12 +63,16 @@
String value = parent.getSelectedItem().toString();
LinearLayout ll = (LinearLayout) findViewById(R.id.proxy_layout);
SharedPreferences.Editor editor = mSettings.edit();
-
+ LayoutParams lp = (LayoutParams) ll.getLayoutParams();
if (value.equals(getString(R.string.PreferenceProxyTypeNone))) {
- ll.setVisibility(LinearLayout.INVISIBLE);
+ ll.setVisibility(LinearLayout.INVISIBLE);
+ lp.height = 0;
+ ll.setLayoutParams(lp);
editor.putBoolean(getString(R.string.PreferenceUseProxy), false);
} else {
ll.setVisibility(LinearLayout.VISIBLE);
+ lp.height = LayoutParams.WRAP_CONTENT;
+ ll.setLayoutParams(lp);
editor.putBoolean(getString(R.string.PreferenceUseProxy), true);
}
if (!value.equals(getPreferenceString(R.string.PreferenceProxyType))) {
@@ -92,7 +91,7 @@
private OnClickListener mOkListener = new OnClickListener() {
public void onClick(View v) {
SharedPreferences.Editor editor = mSettings.edit();
-
+
if (isChanged(R.id.host, R.string.PreferenceHostKey)) {
editor.putString(getString(R.string.PreferenceHostKey), getWidgetText(R.id.host));
mIsChanged = true;
@@ -109,13 +108,19 @@
editor.putString(getString(R.string.PreferencePasswordKey), getWidgetText(R.id.password));
mIsChanged = true;
}
+ if (isChanged(R.id.service, R.string.PreferenceService)) {
+ editor.putString(getString(R.string.PreferenceService), getWidgetText(R.id.service));
+ mIsChanged = true;
+ }
if (isChanged(R.id.proxy_host, R.string.PreferenceProxyHost)) {
editor.putString(getString(R.string.PreferenceProxyHost), getWidgetText(R.id.proxy_host));
mIsChanged = true;
}
- if (Integer.parseInt(getWidgetText(R.id.proxy_port)) != mSettings.getInt(getString(R.string.PreferenceProxyPort), 1080) ) {
- editor.putInt(getString(R.string.PreferenceProxyPort), Integer.parseInt(getWidgetText(R.id.proxy_port)));
+ if (Integer.parseInt(getWidgetText(R.id.proxy_port)) != mSettings.getInt(
+ getString(R.string.PreferenceProxyPort), 0)) {
+ editor
+ .putInt(getString(R.string.PreferenceProxyPort), Integer.parseInt(getWidgetText(R.id.proxy_port)));
mIsChanged = true;
}
if (isChanged(R.id.proxy_login, R.string.PreferenceProxyUser)) {
@@ -149,6 +154,8 @@
e.setText(getPreferenceString(R.string.PreferenceLoginKey));
e = (EditText) findViewById(R.id.password);
e.setText(getPreferenceString(R.string.PreferencePasswordKey));
+ e = (EditText) findViewById(R.id.service);
+ e.setText(getPreferenceString(R.string.PreferenceService));
e = (EditText) findViewById(R.id.proxy_host);
e.setText(getPreferenceString(R.string.PreferenceProxyHost));
--- a/src/com/beem/project/beem/ui/SendIM.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIM.java Fri Apr 24 21:41:32 2009 +0200
@@ -109,7 +109,9 @@
@Override
protected void onResume() {
super.onResume();
- mBeemApplication.startBeemService();
+ mBeemApplication = BeemApplication.getApplication(this);
+ if (!mBeemApplication.isConnected())
+ mBeemApplication.startBeemService();
mBeemApplication.callWhenConnectedToServer(mHandler, new Runnable() {
@Override
@@ -206,9 +208,8 @@
}
/**
- * Callback for menu creation. <<<<<<< local
- * @param menu the menu created =======
- * @param menu The created menu >>>>>>> other
+ * Callback for menu creation.
+ * @param The created menu
* @return true on success, false otherwise
*/
@Override