Loading AndroidManifest.xml +15 −0 Original line number Diff line number Diff line Loading @@ -216,11 +216,17 @@ <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.android.tasks.TASK_START" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.QUICKBOOT_POWERON" /> </intent-filter> </receiver> <receiver android:name="org.dmfs.provider.tasks.broadcast.DueAlarmBroadcastHandler" > <intent-filter> <action android:name="org.dmfs.android.tasks.TASK_DUE" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> Loading Loading @@ -281,6 +287,15 @@ <intent-filter> <action android:name="org.dmfs.tasks.action.notification.DELAY_1D" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.tasks.action.notification.UNDO" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.tasks.action.notification.DESTRUCT" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.tasks.action.notification.ACTION_UNDO_TIMEOUT" /> </intent-filter> </service> <!-- Dashclock extension --> Loading res/layout-v11/undo_notification.xml 0 → 100644 +85 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ** ** Copyright 2012, Google Inc. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:internal="http://schemas.android.com/apk/prv/res/android" android:id="@+id/status_bar_latest_event_content" android:layout_width="match_parent" android:layout_height="64dp" internal:layout_maxHeight="64dp" internal:layout_minHeight="64dp" > <ImageView android:layout_width="@android:dimen/notification_large_icon_width" android:layout_height="@android:dimen/notification_large_icon_height" android:background="@android:color/black" android:scaleType="center" android:src="@drawable/ic_notification_completed" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="fill_vertical" android:layout_marginLeft="@android:dimen/notification_large_icon_width" android:layout_marginStart="@android:dimen/notification_large_icon_width" android:gravity="top" android:minHeight="@android:dimen/notification_large_icon_height" android:orientation="horizontal" android:paddingBottom="2dp" android:paddingTop="2dp" > <TextView android:id="@+id/description_text" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" android:layout_weight="1" android:ellipsize="marquee" android:fadingEdge="horizontal" android:gravity="center_vertical" /> <ImageView android:layout_width="1dip" android:layout_height="match_parent" android:layout_marginBottom="10dip" android:layout_marginRight="12dip" android:layout_marginTop="10dip" android:src="#aaaaaa" /> <ImageView android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center_vertical" android:layout_marginRight="4dip" android:src="@drawable/ic_history" /> <TextView android:textColor="@android:color/white" android:textSize="16sp" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginLeft="4dip" android:gravity="center_vertical" android:paddingEnd="16dip" android:paddingRight="16dip" android:text="@string/notification_undo" android:textAllCaps="true" /> </LinearLayout> </FrameLayout> No newline at end of file res/values-de/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -170,8 +170,10 @@ <string name="notification_task_due_date">Aufgabe fällig am %1s</string> <string name="notification_task_start_date">Aufgabe beginnt am %1s</string> <string name="notification_action_complete">erledigt</string> <string name="notification_action_completed">erledigt</string> <string name="notification_action_delay_1h">+1 Stunde</string> <string name="notification_action_delay_1d">+1 Tag</string> <string name="notification_undo">Rückgänging</string> <!-- Strings for time UI widgets --> <string name="button_add_one_hour">+1 Stunde</string> Loading res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -172,8 +172,11 @@ <string name="notification_task_due_date">Task due %1s</string> <string name="notification_task_start_date">Task starts %1s</string> <string name="notification_action_complete">complete</string> <string name="notification_action_completed">Completed</string> <string name="notification_action_delay_1h">+1 hour</string> <string name="notification_action_delay_1d">+1 day</string> <string name="notification_undo">Undo</string> <!-- Strings for time UI widgets --> Loading src/org/dmfs/tasks/notification/AlarmBroadcastReceiver.java +2 −100 Original line number Diff line number Diff line Loading @@ -17,24 +17,13 @@ package org.dmfs.tasks.notification; import java.util.TimeZone; import org.dmfs.provider.tasks.broadcast.DueAlarmBroadcastHandler; import org.dmfs.provider.tasks.broadcast.StartAlarmBroadcastHandler; import org.dmfs.tasks.R; import org.dmfs.tasks.utils.DueDateFormatter; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.support.v4.app.NotificationCompat; import android.support.v4.app.TaskStackBuilder; import android.text.format.DateUtils; import android.text.format.Time; /** Loading @@ -49,8 +38,6 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver private static String PREFS_NAME = "alarm_preferences"; private static String PREF_ALARM_ACTIVATED = "preference_alarm_activated"; private final int NOTIFICATION_DATE_FORMAT = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_MONTH | DateUtils.FORMAT_SHOW_TIME; /** * Is called on an incoming alarm broadcast. Creates a notifications for this alarm. Loading @@ -71,42 +58,7 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver boolean startAllDay = intent.getBooleanExtra(StartAlarmBroadcastHandler.EXTRA_TASK_START_ALLDAY, false); int notificationId = (int) taskId; String startString = context.getString(R.string.notification_task_start_date, new DueDateFormatter(context, NOTIFICATION_DATE_FORMAT).format(makeTime(startDate, startAllDay), false)); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); // build notification NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context).setSmallIcon(R.drawable.ic_notification_completed) .setContentTitle(context.getString(R.string.notification_task_start_title, title)).setContentText(startString); // dismisses the notification on click mBuilder.setAutoCancel(true); // set status bar test mBuilder.setTicker(title); // enable light, sound and vibration mBuilder.setDefaults(Notification.DEFAULT_ALL); // add actions mBuilder.addAction(NotificationActionIntentService.getCompleteAction(context, notificationId, taskId)); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(Intent.ACTION_VIEW); resultIntent.setData(intent.getData()); // The stack builder object will contain an artificial back stack for the // started Activity. // This ensures that navigating backward from the Activity leads out of // your application to the Home screen. TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); // Adds the Intent that starts the Activity to the top of the stack stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); notificationManager.notify(notificationId, mBuilder.build()); NotificationActionUtils.sendStartNotification(context, title, intent.getData(), notificationId, taskId, startDate, startAllDay); } } Loading @@ -122,48 +74,7 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver String timezone = intent.getStringExtra(DueAlarmBroadcastHandler.EXTRA_TASK_TIMEZONE); int notificationId = (int) taskId; String dueString = context.getString(R.string.notification_task_due_date, new DueDateFormatter(context, NOTIFICATION_DATE_FORMAT).format(makeTime(dueDate, dueAllDay), false)); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); // build notification NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context).setSmallIcon(R.drawable.ic_notification_completed) .setContentTitle(context.getString(R.string.notification_task_due_title, title)).setContentText(dueString); // dismisses the notification on click mBuilder.setAutoCancel(true); // set status bar test mBuilder.setTicker(title); // enable light, sound and vibration mBuilder.setDefaults(Notification.DEFAULT_ALL); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(Intent.ACTION_VIEW); resultIntent.setData(intent.getData()); // The stack builder object will contain an artificial back stack for the // started Activity. // This ensures that navigating backward from the Activity leads out of // your application to the Home screen. TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); // Adds the Intent that starts the Activity to the top of the stack stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); // add actions if (!dueAllDay) { mBuilder.addAction(NotificationActionIntentService.getDelay1hAction(context, notificationId, taskId, dueDate, timezone)); } mBuilder.addAction(NotificationActionIntentService.getDelay1dAction(context, notificationId, taskId, dueDate, timezone)); mBuilder.addAction(NotificationActionIntentService.getCompleteAction(context, notificationId, taskId)); mBuilder.setContentIntent(resultPendingIntent); notificationManager.notify(notificationId, mBuilder.build()); NotificationActionUtils.sendDueAlarmNotification(context, title, intent.getData(), notificationId, taskId, dueDate, dueAllDay, timezone); } } Loading @@ -186,13 +97,4 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver return settings.getBoolean(PREF_ALARM_ACTIVATED, true); } private static Time makeTime(long timestamp, boolean allday) { Time result = new Time(allday ? Time.TIMEZONE_UTC : TimeZone.getDefault().getID()); result.set(timestamp); result.allDay = allday; return result; } } Loading
AndroidManifest.xml +15 −0 Original line number Diff line number Diff line Loading @@ -216,11 +216,17 @@ <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.android.tasks.TASK_START" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.QUICKBOOT_POWERON" /> </intent-filter> </receiver> <receiver android:name="org.dmfs.provider.tasks.broadcast.DueAlarmBroadcastHandler" > <intent-filter> <action android:name="org.dmfs.android.tasks.TASK_DUE" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> Loading Loading @@ -281,6 +287,15 @@ <intent-filter> <action android:name="org.dmfs.tasks.action.notification.DELAY_1D" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.tasks.action.notification.UNDO" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.tasks.action.notification.DESTRUCT" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.tasks.action.notification.ACTION_UNDO_TIMEOUT" /> </intent-filter> </service> <!-- Dashclock extension --> Loading
res/layout-v11/undo_notification.xml 0 → 100644 +85 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ** ** Copyright 2012, Google Inc. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:internal="http://schemas.android.com/apk/prv/res/android" android:id="@+id/status_bar_latest_event_content" android:layout_width="match_parent" android:layout_height="64dp" internal:layout_maxHeight="64dp" internal:layout_minHeight="64dp" > <ImageView android:layout_width="@android:dimen/notification_large_icon_width" android:layout_height="@android:dimen/notification_large_icon_height" android:background="@android:color/black" android:scaleType="center" android:src="@drawable/ic_notification_completed" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="fill_vertical" android:layout_marginLeft="@android:dimen/notification_large_icon_width" android:layout_marginStart="@android:dimen/notification_large_icon_width" android:gravity="top" android:minHeight="@android:dimen/notification_large_icon_height" android:orientation="horizontal" android:paddingBottom="2dp" android:paddingTop="2dp" > <TextView android:id="@+id/description_text" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" android:layout_weight="1" android:ellipsize="marquee" android:fadingEdge="horizontal" android:gravity="center_vertical" /> <ImageView android:layout_width="1dip" android:layout_height="match_parent" android:layout_marginBottom="10dip" android:layout_marginRight="12dip" android:layout_marginTop="10dip" android:src="#aaaaaa" /> <ImageView android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center_vertical" android:layout_marginRight="4dip" android:src="@drawable/ic_history" /> <TextView android:textColor="@android:color/white" android:textSize="16sp" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginLeft="4dip" android:gravity="center_vertical" android:paddingEnd="16dip" android:paddingRight="16dip" android:text="@string/notification_undo" android:textAllCaps="true" /> </LinearLayout> </FrameLayout> No newline at end of file
res/values-de/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -170,8 +170,10 @@ <string name="notification_task_due_date">Aufgabe fällig am %1s</string> <string name="notification_task_start_date">Aufgabe beginnt am %1s</string> <string name="notification_action_complete">erledigt</string> <string name="notification_action_completed">erledigt</string> <string name="notification_action_delay_1h">+1 Stunde</string> <string name="notification_action_delay_1d">+1 Tag</string> <string name="notification_undo">Rückgänging</string> <!-- Strings for time UI widgets --> <string name="button_add_one_hour">+1 Stunde</string> Loading
res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -172,8 +172,11 @@ <string name="notification_task_due_date">Task due %1s</string> <string name="notification_task_start_date">Task starts %1s</string> <string name="notification_action_complete">complete</string> <string name="notification_action_completed">Completed</string> <string name="notification_action_delay_1h">+1 hour</string> <string name="notification_action_delay_1d">+1 day</string> <string name="notification_undo">Undo</string> <!-- Strings for time UI widgets --> Loading
src/org/dmfs/tasks/notification/AlarmBroadcastReceiver.java +2 −100 Original line number Diff line number Diff line Loading @@ -17,24 +17,13 @@ package org.dmfs.tasks.notification; import java.util.TimeZone; import org.dmfs.provider.tasks.broadcast.DueAlarmBroadcastHandler; import org.dmfs.provider.tasks.broadcast.StartAlarmBroadcastHandler; import org.dmfs.tasks.R; import org.dmfs.tasks.utils.DueDateFormatter; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.support.v4.app.NotificationCompat; import android.support.v4.app.TaskStackBuilder; import android.text.format.DateUtils; import android.text.format.Time; /** Loading @@ -49,8 +38,6 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver private static String PREFS_NAME = "alarm_preferences"; private static String PREF_ALARM_ACTIVATED = "preference_alarm_activated"; private final int NOTIFICATION_DATE_FORMAT = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_MONTH | DateUtils.FORMAT_SHOW_TIME; /** * Is called on an incoming alarm broadcast. Creates a notifications for this alarm. Loading @@ -71,42 +58,7 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver boolean startAllDay = intent.getBooleanExtra(StartAlarmBroadcastHandler.EXTRA_TASK_START_ALLDAY, false); int notificationId = (int) taskId; String startString = context.getString(R.string.notification_task_start_date, new DueDateFormatter(context, NOTIFICATION_DATE_FORMAT).format(makeTime(startDate, startAllDay), false)); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); // build notification NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context).setSmallIcon(R.drawable.ic_notification_completed) .setContentTitle(context.getString(R.string.notification_task_start_title, title)).setContentText(startString); // dismisses the notification on click mBuilder.setAutoCancel(true); // set status bar test mBuilder.setTicker(title); // enable light, sound and vibration mBuilder.setDefaults(Notification.DEFAULT_ALL); // add actions mBuilder.addAction(NotificationActionIntentService.getCompleteAction(context, notificationId, taskId)); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(Intent.ACTION_VIEW); resultIntent.setData(intent.getData()); // The stack builder object will contain an artificial back stack for the // started Activity. // This ensures that navigating backward from the Activity leads out of // your application to the Home screen. TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); // Adds the Intent that starts the Activity to the top of the stack stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); notificationManager.notify(notificationId, mBuilder.build()); NotificationActionUtils.sendStartNotification(context, title, intent.getData(), notificationId, taskId, startDate, startAllDay); } } Loading @@ -122,48 +74,7 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver String timezone = intent.getStringExtra(DueAlarmBroadcastHandler.EXTRA_TASK_TIMEZONE); int notificationId = (int) taskId; String dueString = context.getString(R.string.notification_task_due_date, new DueDateFormatter(context, NOTIFICATION_DATE_FORMAT).format(makeTime(dueDate, dueAllDay), false)); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); // build notification NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context).setSmallIcon(R.drawable.ic_notification_completed) .setContentTitle(context.getString(R.string.notification_task_due_title, title)).setContentText(dueString); // dismisses the notification on click mBuilder.setAutoCancel(true); // set status bar test mBuilder.setTicker(title); // enable light, sound and vibration mBuilder.setDefaults(Notification.DEFAULT_ALL); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(Intent.ACTION_VIEW); resultIntent.setData(intent.getData()); // The stack builder object will contain an artificial back stack for the // started Activity. // This ensures that navigating backward from the Activity leads out of // your application to the Home screen. TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); // Adds the Intent that starts the Activity to the top of the stack stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); // add actions if (!dueAllDay) { mBuilder.addAction(NotificationActionIntentService.getDelay1hAction(context, notificationId, taskId, dueDate, timezone)); } mBuilder.addAction(NotificationActionIntentService.getDelay1dAction(context, notificationId, taskId, dueDate, timezone)); mBuilder.addAction(NotificationActionIntentService.getCompleteAction(context, notificationId, taskId)); mBuilder.setContentIntent(resultPendingIntent); notificationManager.notify(notificationId, mBuilder.build()); NotificationActionUtils.sendDueAlarmNotification(context, title, intent.getData(), notificationId, taskId, dueDate, dueAllDay, timezone); } } Loading @@ -186,13 +97,4 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver return settings.getBoolean(PREF_ALARM_ACTIVATED, true); } private static Time makeTime(long timestamp, boolean allday) { Time result = new Time(allday ? Time.TIMEZONE_UTC : TimeZone.getDefault().getID()); result.set(timestamp); result.allDay = allday; return result; } }