From ffd7c2a43dcdc650f484da91f9b9b54a17bdbbe7 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 3 May 2012 11:30:02 -0700 Subject: [PATCH] Suppress popup notifications when that task is being edited --- astrid/src/com/todoroo/astrid/activity/AstridActivity.java | 5 +++++ .../src/com/todoroo/astrid/activity/TaskEditFragment.java | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/astrid/src/com/todoroo/astrid/activity/AstridActivity.java b/astrid/src/com/todoroo/astrid/activity/AstridActivity.java index 6f2ed2872..41634ae23 100644 --- a/astrid/src/com/todoroo/astrid/activity/AstridActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/AstridActivity.java @@ -343,6 +343,10 @@ public class AstridActivity extends FragmentActivity public void onReceive(Context context, final Intent intent) { // Process in app notification long taskId = intent.getLongExtra(NotificationFragment.TOKEN_ID, 0); + TaskEditFragment tef = getTaskEditFragment(); + if (tef != null && tef.getTaskIdInProgress() == taskId) + return; + if (taskId > 0) { String text = intent.getStringExtra(Notifications.EXTRAS_TEXT); try { @@ -370,6 +374,7 @@ public class AstridActivity extends FragmentActivity public void onReceive(Context context, final Intent intent) { long taskId = intent.getLongExtra( AstridApiConstants.EXTRAS_TASK_ID, 0); + if (taskId > 0) { long oldDueDate = intent.getLongExtra( AstridApiConstants.EXTRAS_OLD_DUE_DATE, 0); diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java b/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java index 7b77b1595..4e4298ab3 100755 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java @@ -759,6 +759,12 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener { } + public long getTaskIdInProgress() { + if (model != null && model.getId() > 0) + return model.getId(); + return getActivity().getIntent().getLongExtra(TOKEN_ID, -1); + } + private void setIsNewTask(boolean isNewTask) { this.isNewTask = isNewTask; if (isNewTask) {