From 5439a7e3cb7ba16f8033f26313e3672b04b7cff7 Mon Sep 17 00:00:00 2001 From: Gabor Keszthelyi Date: Tue, 11 Jul 2017 12:06:11 +0200 Subject: [PATCH] Fix having a duplicate view task screen after and edit. #379 --- .../src/main/java/org/dmfs/tasks/EditTaskFragment.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java b/opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java index ff5e91ad3..d019af6b5 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java +++ b/opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java @@ -569,7 +569,7 @@ public void onContentLoaded(ContentSet contentSet) } /* - * Don't start the model loader here, let onItemSelected do that. + * Don't start the model loader here, let onItemSelected do that. */ setListUri(TaskLists.getContentUri(mAuthority), LIST_LOADER_VISIBLE_LISTS_FILTER); } @@ -742,6 +742,8 @@ public void saveAndExit() // TODO: put that in a background task Activity activity = getActivity(); + boolean isNewTask = mValues.isInsert(); + if (mEditor != null) { mEditor.updateValues(); @@ -804,7 +806,10 @@ public void saveAndExit() activity.setResult(Activity.RESULT_OK, new Intent().setData(mTaskUri)); Toast.makeText(activity, R.string.activity_edit_task_task_saved, Toast.LENGTH_SHORT).show(); activity.finish(); - activity.startActivity(new Intent("android.intent.action.VIEW", mTaskUri)); + if (isNewTask) + { + activity.startActivity(new Intent("android.intent.action.VIEW", mTaskUri)); + } } else {