Use builder for timer notification

pull/322/head
Alex Baker 9 years ago
parent 31a99d73ae
commit 6aaefdf44f

@ -10,6 +10,7 @@ import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.support.v7.app.NotificationCompat;
import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
@ -72,15 +73,16 @@ public class TimerPlugin {
String appName = r.getString(R.string.app_name); String appName = r.getString(R.string.app_name);
String text = r.getString(R.string.TPl_notification, String text = r.getString(R.string.TPl_notification,
r.getQuantityString(R.plurals.Ntasks, count, count)); r.getQuantityString(R.plurals.Ntasks, count, count));
Notification notification = new Notification( Notification notification = new NotificationCompat.Builder(context)
R.drawable.timers_notification, text, System.currentTimeMillis()); .setContentIntent(pendingIntent)
notification.setLatestEventInfo(context, appName, .setContentTitle(appName)
text, pendingIntent); .setContentText(text)
notification.flags |= Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR; .setWhen(System.currentTimeMillis())
notification.flags &= ~Notification.FLAG_AUTO_CANCEL; .setSmallIcon(R.drawable.timers_notification)
.setAutoCancel(false)
.setOngoing(true)
.build();
notificationManager.notify(Constants.NOTIFICATION_TIMER, notification); notificationManager.notify(Constants.NOTIFICATION_TIMER, notification);
} }
} }
} }

Loading…
Cancel
Save