+ private void set_up_notif(final String _headline)
+ {
+ NotificationManager mNotificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
+ thenotif = new Notification(R.drawable.icon, headline, System.currentTimeMillis());
+ thenotifid = (int)SystemClock.elapsedRealtime();
+
+ Intent intent = new Intent(this, NotifSlave.class);
+
+ headline = _headline;
+
+ intent.setAction("com.joshuawise.dumload.NotifSlave");
+ /* no extras to make the notifslave die */
+ intent.setData((Uri.parse("suckit://"+SystemClock.elapsedRealtime())));
+
+ PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, 0);
+ thenotif.defaults |= 0;
+ thenotif.flags |= Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR;
+
+ remote = new RemoteViews(getPackageName(), R.layout.textnotif);
+ remote.setImageViewResource(R.id.image, R.drawable.icon);
+ remote.setTextViewText(R.id.headline, headline);
+ remote.setTextViewText(R.id.status, "Beginning upload...");
+ thenotif.contentView = remote;
+ thenotif.contentIntent = contentIntent;
+
+ mNotificationManager.notify(thenotifid, thenotif);
+ }
+
+ private void destroy_notif()
+ {
+ NotificationManager mNotificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
+ mNotificationManager.cancel(thenotifid);
+ }
+
+ private void update_notif(String text)
+ {
+ NotificationManager mNotificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
+
+ remote = new RemoteViews(getPackageName(), R.layout.textnotif);
+ remote.setImageViewResource(R.id.image, R.drawable.icon);
+ remote.setTextViewText(R.id.headline, headline);
+ remote.setTextViewText(R.id.status, text);
+ thenotif.contentView = remote;
+
+ mNotificationManager.notify(thenotifid, thenotif);
+ }
+
+ private void update_notif(int n, int total)
+ {
+ NotificationManager mNotificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
+
+ remote = new RemoteViews(getPackageName(), R.layout.progressnotif);
+ remote.setImageViewResource(R.id.image, R.drawable.icon);
+ remote.setTextViewText(R.id.headline, headline);
+ remote.setProgressBar(R.id.status, total, n, false);
+ thenotif.contentView = remote;
+
+ mNotificationManager.notify(thenotifid, thenotif);
+ }
+