--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/subscription.xml Thu Apr 23 17:03:53 2009 +0200
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout 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="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+
+ <Button android:id="@+id/SubscriptionAccept"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="1"
+ android:text="@string/AcceptButton"/>
+
+ <Button android:id="@+id/SubscriptionRefuse"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="1"
+ android:text="@string/RefuseButton"/>
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
--- a/res/values/strings.xml Thu Apr 23 16:59:45 2009 +0200
+++ b/res/values/strings.xml Thu Apr 23 17:03:53 2009 +0200
@@ -3,6 +3,8 @@
<string name="app_name">Beem</string>
<string name="OkButton">Ok</string>
<string name="ClearButton">Clear</string>
+ <string name="AcceptButton">Accept</string>
+ <string name="RefuseButton">Refuse</string>
<!-- Beem class -->
@@ -62,4 +64,5 @@
<string name="ChangeStatusOk">Updating status</string>
<string name="ChangeStatusNoChange">Nothing to change</string>
+
</resources>
--- a/src/com/beem/project/beem/BeemService.java Thu Apr 23 16:59:45 2009 +0200
+++ b/src/com/beem/project/beem/BeemService.java Thu Apr 23 17:03:53 2009 +0200
@@ -14,6 +14,7 @@
import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType;
import android.app.Notification;
import android.app.NotificationManager;
+import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -26,6 +27,8 @@
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.SendIM;
+import com.beem.project.beem.ui.Subscription;
/**
* This class is for the Beem service.
@@ -72,7 +75,7 @@
*/
@Override
public void onCreate() {
-
+
super.onCreate();
mSettings = getSharedPreferences(getString(R.string.PreferenceFileName), MODE_PRIVATE);
mLogin = mSettings.getString(getString(R.string.PreferenceLoginKey), "");
@@ -117,7 +120,7 @@
public void sendNotification(int id, Notification notif) {
mNotificationManager.notify(id, notif);
}
-
+
/**
* Initialise la configuration de la connexion.
*/
@@ -168,7 +171,7 @@
@Override
public void processPacket(Packet packet) {
// TODO Auto-generated method stub
- Log.i("TEST", "Une demande recue");
+ Log.d("TEST", "Une demande recue");
}
}, filter);
}
@@ -185,7 +188,7 @@
}
-
+
@Override
public void onConnect() throws RemoteException {
// TODO Auto-generated method stub
@@ -205,8 +208,17 @@
@Override
public void processPacket(Packet packet) {
- // TODO Auto-generated method stub
- Log.i("TEST", "Une demande recue");
+ String from = packet.getFrom();
+ Notification notif = new Notification(com.beem.project.beem.R.drawable.signal, "Demande d'ajout", System
+ .currentTimeMillis());
+ notif.defaults = Notification.DEFAULT_ALL;
+ notif.flags = Notification.FLAG_AUTO_CANCEL;
+ Intent intent = new Intent(BeemService.this, Subscription.class);
+ intent.putExtra("from", from);
+ notif.setLatestEventInfo(BeemService.this, from, "demande d'ajout de " + from, PendingIntent.getActivity(BeemService.this, 0,
+ intent, PendingIntent.FLAG_ONE_SHOT));
+ int id = packet.hashCode();
+ sendNotification(id, notif);
}
}, filter);
@@ -228,7 +240,7 @@
@Override
public void connectionFailed(String errorMsg) throws RemoteException {
// TODO Auto-generated method stub
-
+
}
});
} catch (RemoteException e) {
@@ -245,5 +257,5 @@
mConnection.disconnect();
}
-
+
}
--- a/src/com/beem/project/beem/service/BeemChatManager.java Thu Apr 23 16:59:45 2009 +0200
+++ b/src/com/beem/project/beem/service/BeemChatManager.java Thu Apr 23 17:03:53 2009 +0200
@@ -15,7 +15,6 @@
import org.jivesoftware.smackx.ChatState;
import org.jivesoftware.smackx.ChatStateListener;
-import android.R;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Intent;
--- a/src/com/beem/project/beem/ui/ContactList.java Thu Apr 23 16:59:45 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Thu Apr 23 17:03:53 2009 +0200
@@ -9,6 +9,7 @@
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
+import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
@@ -126,6 +127,8 @@
startActivityForResult(new Intent(this, ContactListSettings.class), PREFERENCECHANGED);
return true;
case R.id.account_about:
+ Intent t = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.beem-project.com"));
+ startActivity(t);
return true;
case R.id.account_create:
startActivity(new Intent(this, AccountCreation.class));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/Subscription.java Thu Apr 23 17:03:53 2009 +0200
@@ -0,0 +1,23 @@
+/**
+ *
+ */
+package com.beem.project.beem.ui;
+
+import com.beem.project.beem.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.Button;
+
+/**
+ * @author nikita
+ *
+ */
+public class Subscription extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.subscription);
+ //mOk = (Button) findViewById(R.id.SubscriptionAccept);
+ }
+}