Loading AndroidManifest.xml +33 −13 Original line number Diff line number Diff line Loading @@ -146,8 +146,16 @@ <intent-filter> <action android:name="android.intent.action.PROVIDER_CHANGED" /> <data android:scheme="content" /> <data android:host="org.dmfs.tasks" /> <data android:host="org.dmfs.tasks" android:scheme="content" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.android.tasks.TASK_START" /> <data android:host="org.dmfs.tasks" android:scheme="content" /> </intent-filter> <meta-data Loading Loading @@ -177,8 +185,16 @@ <intent-filter> <action android:name="android.intent.action.PROVIDER_CHANGED" /> <data android:scheme="content" /> <data android:host="org.dmfs.tasks" /> <data android:host="org.dmfs.tasks" android:scheme="content" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.android.tasks.TASK_START" /> <data android:host="org.dmfs.tasks" android:mimeType="vnd.android.cursor.item/org.dmfs.tasks.tasks" /> </intent-filter> </receiver> <receiver android:name="org.dmfs.provider.tasks.broadcast.AccountsChangeBroadcastReceiver" > Loading @@ -187,16 +203,20 @@ </intent-filter> </receiver> <!-- custom alarm receivers --> <receiver android:name=".AlarmBroadcastReceiver" > <receiver android:name="org.dmfs.tasks.AlarmBroadcastReceiver" > <intent-filter> <action android:name="org.dmfs.android.tasks.taskdue" /> <data android:scheme="content" /> <data android:host="org.dmfs.tasks" /> <action android:name="org.dmfs.android.tasks.TASK_DUE" /> <data android:host="org.dmfs.tasks" android:mimeType="vnd.android.cursor.item/org.dmfs.tasks.tasks" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.android.tasks.taskstart" /> <data android:scheme="content" /> <data android:host="org.dmfs.tasks" /> <action android:name="org.dmfs.android.tasks.TASK_START" /> <data android:host="org.dmfs.tasks" android:mimeType="vnd.android.cursor.item/org.dmfs.tasks.tasks" /> </intent-filter> </receiver> </application> Loading src/org/dmfs/tasks/AlarmBroadcastReceiver.java +4 −25 Original line number Diff line number Diff line package org.dmfs.tasks; import java.net.URI; import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.provider.tasks.broadcast.DueAlarmBroadcastHandler; import org.dmfs.provider.tasks.broadcast.StartAlarmBroadcastHandler; Loading @@ -13,7 +10,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.support.v4.app.NotificationCompat; import android.support.v4.app.TaskStackBuilder; Loading Loading @@ -63,16 +59,14 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver mBuilder.setDefaults(Notification.DEFAULT_ALL); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(context, ViewTaskActivity.class); resultIntent.setData(getUriForTask(taskId)); 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 back stack for the Intent (but not the Intent itself) stackBuilder.addParentStack(ViewTaskActivity.class); // 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); Loading Loading @@ -106,16 +100,14 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver mBuilder.setDefaults(Notification.DEFAULT_ALL); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(context, ViewTaskActivity.class); resultIntent.setData(getUriForTask(taskId)); 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 back stack for the Intent (but not the Intent itself) stackBuilder.addParentStack(ViewTaskActivity.class); // 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); Loading @@ -129,19 +121,6 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver } /** * Helper that constructs a task {@link URI} for a given task id. * * @param taskId * The task row id. * @return The task {@link URI}. */ private Uri getUriForTask(long taskId) { return Uri.withAppendedPath(Tasks.CONTENT_URI, "/" + taskId); } public static void setAlarmPreference(Context context, boolean value) { SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0); Loading Loading
AndroidManifest.xml +33 −13 Original line number Diff line number Diff line Loading @@ -146,8 +146,16 @@ <intent-filter> <action android:name="android.intent.action.PROVIDER_CHANGED" /> <data android:scheme="content" /> <data android:host="org.dmfs.tasks" /> <data android:host="org.dmfs.tasks" android:scheme="content" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.android.tasks.TASK_START" /> <data android:host="org.dmfs.tasks" android:scheme="content" /> </intent-filter> <meta-data Loading Loading @@ -177,8 +185,16 @@ <intent-filter> <action android:name="android.intent.action.PROVIDER_CHANGED" /> <data android:scheme="content" /> <data android:host="org.dmfs.tasks" /> <data android:host="org.dmfs.tasks" android:scheme="content" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.android.tasks.TASK_START" /> <data android:host="org.dmfs.tasks" android:mimeType="vnd.android.cursor.item/org.dmfs.tasks.tasks" /> </intent-filter> </receiver> <receiver android:name="org.dmfs.provider.tasks.broadcast.AccountsChangeBroadcastReceiver" > Loading @@ -187,16 +203,20 @@ </intent-filter> </receiver> <!-- custom alarm receivers --> <receiver android:name=".AlarmBroadcastReceiver" > <receiver android:name="org.dmfs.tasks.AlarmBroadcastReceiver" > <intent-filter> <action android:name="org.dmfs.android.tasks.taskdue" /> <data android:scheme="content" /> <data android:host="org.dmfs.tasks" /> <action android:name="org.dmfs.android.tasks.TASK_DUE" /> <data android:host="org.dmfs.tasks" android:mimeType="vnd.android.cursor.item/org.dmfs.tasks.tasks" /> </intent-filter> <intent-filter> <action android:name="org.dmfs.android.tasks.taskstart" /> <data android:scheme="content" /> <data android:host="org.dmfs.tasks" /> <action android:name="org.dmfs.android.tasks.TASK_START" /> <data android:host="org.dmfs.tasks" android:mimeType="vnd.android.cursor.item/org.dmfs.tasks.tasks" /> </intent-filter> </receiver> </application> Loading
src/org/dmfs/tasks/AlarmBroadcastReceiver.java +4 −25 Original line number Diff line number Diff line package org.dmfs.tasks; import java.net.URI; import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.provider.tasks.broadcast.DueAlarmBroadcastHandler; import org.dmfs.provider.tasks.broadcast.StartAlarmBroadcastHandler; Loading @@ -13,7 +10,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.support.v4.app.NotificationCompat; import android.support.v4.app.TaskStackBuilder; Loading Loading @@ -63,16 +59,14 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver mBuilder.setDefaults(Notification.DEFAULT_ALL); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(context, ViewTaskActivity.class); resultIntent.setData(getUriForTask(taskId)); 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 back stack for the Intent (but not the Intent itself) stackBuilder.addParentStack(ViewTaskActivity.class); // 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); Loading Loading @@ -106,16 +100,14 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver mBuilder.setDefaults(Notification.DEFAULT_ALL); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(context, ViewTaskActivity.class); resultIntent.setData(getUriForTask(taskId)); 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 back stack for the Intent (but not the Intent itself) stackBuilder.addParentStack(ViewTaskActivity.class); // 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); Loading @@ -129,19 +121,6 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver } /** * Helper that constructs a task {@link URI} for a given task id. * * @param taskId * The task row id. * @return The task {@link URI}. */ private Uri getUriForTask(long taskId) { return Uri.withAppendedPath(Tasks.CONTENT_URI, "/" + taskId); } public static void setAlarmPreference(Context context, boolean value) { SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0); Loading