# HG changeset patch
# User "Vincent Veronis"
# Date 1318932607 -7200
# Node ID d26b442143f95c5ad5f844ef2afcc25a25a3e0f5
# Parent 4ee4a608f97b5ff15c807cc5dc199592898b8c1b
Update custom notification layout
diff -r 4ee4a608f97b -r d26b442143f9 res/values/styles.xml
--- a/res/values/styles.xml Tue Oct 18 01:02:23 2011 +0200
+++ b/res/values/styles.xml Tue Oct 18 12:10:07 2011 +0200
@@ -9,25 +9,27 @@
- false
- 4px
-
-
-
-
-
+
-
-
-
-
-
+
+
\ No newline at end of file
diff -r 4ee4a608f97b -r d26b442143f9 src/com/beem/project/beem/BeemService.java
--- a/src/com/beem/project/beem/BeemService.java Tue Oct 18 01:02:23 2011 +0200
+++ b/src/com/beem/project/beem/BeemService.java Tue Oct 18 12:10:07 2011 +0200
@@ -78,6 +78,7 @@
import android.os.Message;
import android.os.RemoteException;
import android.util.Log;
+import android.widget.RemoteViews;
import com.beem.project.beem.service.XmppConnectionAdapter;
import com.beem.project.beem.service.XmppFacade;
@@ -160,7 +161,7 @@
@Override
public void onCreate() {
super.onCreate();
-
+ Log.d(TAG, "ONCREATE");
HandlerThread thread = new HandlerThread("BeemServiceThread");
thread.start();
mServiceLooper = thread.getLooper();
@@ -169,18 +170,20 @@
configure(ProviderManager.getInstance());
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Roster.setDefaultSubscriptionMode(SubscriptionMode.manual);
- Log.d(TAG, "ONCREATE");
- Notification mStatusNotification;
- mStatusNotification = new Notification(com.beem.project.beem.R.drawable.beem_status_icon, "Beem",
- System.currentTimeMillis());
- mStatusNotification.defaults = Notification.DEFAULT_LIGHTS;
- mStatusNotification.flags = Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT;
-
- mStatusNotification.setLatestEventInfo(this, "Beem", "Beem",
- PendingIntent.getActivity(this, 0, new Intent(this, Login.class), 0));
- // bypass the preferences for notification
- mNotificationManager.notify(BeemService.NOTIFICATION_STATUS_ID, mStatusNotification);
+ Notification notification = new Notification();
+ Intent notificationIntent = new Intent();
+ PendingIntent contentIntent = PendingIntent.getActivity(this, (int) System.currentTimeMillis(),
+ notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+ RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.notification);
+ //contentView.setImageViewResource(R.id.status, R.drawable.beem_status_icon);
+ contentView.setTextViewText(R.id.pseudo, "Custom notification");
+ contentView.setTextViewText(R.id.msgstatus, "This is a custom layout");
+ notification.contentView = contentView;
+ notification.contentIntent = contentIntent;
+ notification.flags = Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT;
+ notification.icon = R.drawable.beem_status_icon;
+ mNotificationManager.notify(R.string.app_name, notification);
}