Fix default values for new tasks from widget

pull/996/head
Alex Baker 6 years ago
parent d3d8b9611a
commit a6d10ed479

@ -14,8 +14,8 @@ public class TaskIntents {
return getEditTaskIntent(context, null, task); return getEditTaskIntent(context, null, task);
} }
public static Intent getNewTaskIntent(Context context) { public static Intent getNewTaskIntent(Context context, @Nullable Filter filter) {
Intent intent = TaskIntents.getTaskListIntent(context, null); Intent intent = TaskIntents.getTaskListIntent(context, filter);
intent.putExtra(MainActivity.CREATE_TASK, 0L); intent.putExtra(MainActivity.CREATE_TASK, 0L);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
return intent; return intent;

@ -153,7 +153,7 @@ public class TasksWidget extends InjectingAppWidgetProvider {
} }
private PendingIntent getNewTaskIntent(Context context, Filter filter, int widgetId) { private PendingIntent getNewTaskIntent(Context context, Filter filter, int widgetId) {
Intent intent = TaskIntents.getNewTaskIntent(context); Intent intent = TaskIntents.getNewTaskIntent(context, filter);
intent.setAction("new_task"); intent.setAction("new_task");
return PendingIntent.getActivity(context, widgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT); return PendingIntent.getActivity(context, widgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
} }

@ -7,5 +7,5 @@ import org.tasks.intents.TaskIntents
@RequiresApi(api = VERSION_CODES.N) @RequiresApi(api = VERSION_CODES.N)
class TileService : TileService() { class TileService : TileService() {
override fun onClick() = startActivityAndCollapse(TaskIntents.getNewTaskIntent(this)) override fun onClick() = startActivityAndCollapse(TaskIntents.getNewTaskIntent(this, null))
} }
Loading…
Cancel
Save