--- a/AndroidManifest.xml Fri Oct 30 19:22:49 2009 +0100
+++ b/AndroidManifest.xml Fri Oct 30 19:24:39 2009 +0100
@@ -30,6 +30,12 @@
android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
</intent-filter>
</activity>
+ <activity android:name=".ui.Chat" android:label="@string/chat_name"
+ android:launchMode="singleTop">
+ <intent-filter android:label="Beem Connection">
+ <action android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
+ </intent-filter>
+ </activity>
<activity android:name=".ui.ChangeStatus" android:label="@string/ChangeStatusActTitle">
<intent-filter android:label="Beem Connection">
<action
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/chat.xml Fri Oct 30 19:24:39 2009 +0100
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <ImageView android:id="@+id/chat_contact_status_icon"
+ android:adjustViewBounds="true" android:maxWidth="15dip"
+ android:maxHeight="12px" android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:gravity="center_vertical" />
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+ <TextView android:id="@+id/chat_contact_name"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:lines="1" android:singleLine="true" android:paddingLeft="15sp"
+ android:textSize="14sp" android:textStyle="bold" android:textColor="#FFFFFF" />
+ <TextView android:id="@+id/chat_contact_status_msg"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:lines="1"
+ android:paddingLeft="15sp"
+ android:autoLink="all" android:textSize="12sp" android:textColor="#FFFFFF" />
+ </LinearLayout>
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <EditText android:id="@+id/chat_input"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:cursorVisible="false" android:hint="@string/chat_input_default_value" />
+ </LinearLayout>
+</LinearLayout>
--- a/res/values-fr/strings.xml Fri Oct 30 19:22:49 2009 +0100
+++ b/res/values-fr/strings.xml Fri Oct 30 19:24:39 2009 +0100
@@ -246,4 +246,6 @@
<string name="userinfo_yes">Oui</string>
<string name="userinfo_no">Non</string>
<string name="userinfo_sureresend">Etes vous sûr de vouloir renvoyer l\'invitation ?</string>
+<string name="chat_input_default_value">Saisissez votre message</string>
+<string name="chat_name">Beem - Chat</string>
</resources>
--- a/res/values/strings.xml Fri Oct 30 19:22:49 2009 +0100
+++ b/res/values/strings.xml Fri Oct 30 19:24:39 2009 +0100
@@ -82,7 +82,7 @@
<string name="SettingsPassword">Modify my password</string>
<string name="SettingsCheckboxText">Using Gmail</string>
<string name="SettingsGmail">Use my Gmail account</string>
- <string name="SettingsProxy">Beem - Settings - Proxy server</string>
+ <string name="SettingsProxy">Proxy</string>
<string name="SettingsProxyProxy">Use a proxy server</string>
<string name="SettingsProxySummary">Check this box if you\'re behind a proxy server</string>
<string name="SettingsProxyType">Protocol</string>
@@ -91,7 +91,7 @@
<string name="SettingsProxyPort">Port definition of the proxy server</string>
<string name="SettingsProxyUser">Optional, allow to authenticate yourself on the proxy server</string>
<string name="SettingsProxyPassword">Optional, allow to authenticate yourself on the proxy server</string>
- <string name="SettingsAdvanced">Beem - Settings - Advanced options</string>
+ <string name="SettingsAdvanced">Advanced</string>
<string name="SettingsAdvancedOptions">Use specific server option</string>
<string name="SettingsAdvancedRecoDelay">Modify reconnection delay</string>
<string name="SettingsAdvancedSpecOpt">Check this box if you want to use a specific server for your connection</string>
@@ -247,4 +247,6 @@
<string name="userinfo_no">No</string>
<string name="userinfo_sureresend">Are you sure you want to resend invit?</string>
+<string name="chat_name">Beem - Chat</string>
+<string name="chat_input_default_value">Type your message</string>
</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/Chat.java Fri Oct 30 19:24:39 2009 +0100
@@ -0,0 +1,180 @@
+package com.beem.project.beem.ui;
+
+import java.util.List;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.util.Log;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.Message;
+import com.beem.project.beem.service.PresenceAdapter;
+import com.beem.project.beem.service.aidl.IBeemRosterListener;
+import com.beem.project.beem.service.aidl.IChat;
+import com.beem.project.beem.service.aidl.IMessageListener;
+import com.beem.project.beem.service.aidl.IRoster;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.utils.BeemBroadcastReceiver;
+
+public class Chat extends Activity {
+
+ private static final String TAG = "Chat";
+ private static final Intent SERVICE_INTENT = new Intent();
+ static {
+ SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+ }
+
+ private Handler _handler = new Handler();
+
+ private IRoster _roster;
+ private Contact _contact;
+
+ private TextView _contactNameTextView;
+ private TextView _contactStatusMsgTextView;
+ private EditText _input;
+
+ private final ServiceConnection _conn = new BeemServiceConnection();
+ private BeemBroadcastReceiver _broadcastReceiver;
+
+
+ /**
+ * Constructor.
+ */
+ public Chat() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ protected void onCreate(Bundle savedBundle) {
+ super.onCreate(savedBundle);
+
+ _contactNameTextView = (TextView) findViewById(R.id.chat_contact_name);
+ _contactStatusMsgTextView = (TextView) findViewById(R.id.chat_contact_status_msg);
+
+ setContentView(R.layout.chat);
+
+ _broadcastReceiver = new BeemBroadcastReceiver(_conn);
+ this.registerReceiver(_broadcastReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ protected void onDestroy() {
+ super.onDestroy();
+ this.unregisterReceiver(_broadcastReceiver);
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ protected void onStart() {
+ super.onStart();
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ protected void onStop() {
+ super.onStop();
+ }
+
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+
+ _contact = new Contact(intent.getData());
+ }
+
+ /**
+ *
+ * @author Jamu
+ *
+ */
+ private final class BeemServiceConnection implements ServiceConnection {
+
+ private IXmppFacade _xmppFacade;
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ _xmppFacade = IXmppFacade.Stub.asInterface(service);
+ _broadcastReceiver.setBinded(true);
+ try {
+ _roster = _xmppFacade.getRoster();
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ _xmppFacade = null;
+ _broadcastReceiver.setBinded(false);
+ }
+ }
+
+
+ /**
+ *
+ * @author Jamu
+ *
+ */
+ private class BeemRosterListener extends IBeemRosterListener.Stub {
+
+ @Override
+ public void onEntriesAdded(List<String> addresses) throws RemoteException {
+ // Nothing to do
+ }
+
+ @Override
+ public void onEntriesDeleted(List<String> addresses) throws RemoteException {
+ // Nothing to do
+ }
+
+ @Override
+ public void onEntriesUpdated(List<String> addresses) throws RemoteException {
+ // Nothing to do
+ }
+
+ @Override
+ public void onEntryDeleteFromGroup(String group, String jid) throws RemoteException {
+ // Nothing to do
+ }
+
+ @Override
+ public void onPresenceChanged(PresenceAdapter presence) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+ }
+
+ /**
+ *
+ * @author Jamu
+ *
+ */
+ private class OnMessageListener extends IMessageListener.Stub {
+
+ @Override
+ public void processMessage(IChat chat, Message msg) throws RemoteException {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void stateChanged(IChat chat) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+ }
+}