From 52fbe3b63b02b147644a68a07da5f549b76311b6 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Wed, 29 Feb 2012 13:39:09 -0800 Subject: [PATCH] Refresh ideas tab when switching between tasks on tablet --- astrid/res/values/strings-core.xml | 4 ++-- .../astrid/activity/TaskEditFragment.java | 4 ++++ .../com/todoroo/astrid/ui/WebServicesView.java | 16 +++++++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml index 6ba10a21d..49988970d 100644 --- a/astrid/res/values/strings-core.xml +++ b/astrid/res/values/strings-core.xml @@ -512,8 +512,8 @@ Auto-load Ideas Tab - Web searches for Ideas tab will be performed when task is edited - Web searches for Ideas tab will be performed when tab is clicked + Web searches for Ideas tab will be performed when tab is clicked + Web searches for Ideas tab will be performed only when manually requested Color Theme diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java b/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java index e95ed9f4c..33bfc6024 100755 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java @@ -772,6 +772,10 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener { model = null; remoteId = 0; populateFields(intent); + if (webServices != null) { + webServices.setTask(model); + webServices.reset(); + } } /** Populate UI component values from the model */ diff --git a/astrid/src/com/todoroo/astrid/ui/WebServicesView.java b/astrid/src/com/todoroo/astrid/ui/WebServicesView.java index 18f514651..0ae7e798e 100644 --- a/astrid/src/com/todoroo/astrid/ui/WebServicesView.java +++ b/astrid/src/com/todoroo/astrid/ui/WebServicesView.java @@ -1,7 +1,5 @@ package com.todoroo.astrid.ui; -import com.todoroo.astrid.helper.AsyncImageView; - import java.io.IOException; import java.io.StringReader; import java.io.UnsupportedEncodingException; @@ -45,6 +43,7 @@ import com.todoroo.andlib.service.RestClient; import com.todoroo.andlib.utility.Preferences; import com.todoroo.astrid.data.Task; import com.todoroo.astrid.helper.AmazonRequestsHelper; +import com.todoroo.astrid.helper.AsyncImageView; import com.todoroo.astrid.producteev.api.StringEscapeUtils; import com.todoroo.astrid.service.StatisticsConstants; import com.todoroo.astrid.service.StatisticsService; @@ -78,19 +77,21 @@ public class WebServicesView extends LinearLayout { public WebServicesView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); + initialize(); } public WebServicesView(Context context, AttributeSet attrs) { super(context, attrs); + initialize(); } public WebServicesView(Context context) { super(context); + initialize(); } public void setTask(Task task) { this.task = task; - initialize(); } public int[] getScrollableViews() { @@ -127,6 +128,15 @@ public class WebServicesView extends LinearLayout { } } + public void reset() { + if (!Preferences.getBoolean(R.string.p_autoIdea, true)) { + removeAllViews(); + initialize(); + } else { + refresh(); + } + } + public void onPageSelected(Runnable runnable) { if(!pageLoaded && Preferences.getBoolean(R.string.p_autoIdea, true)) refresh();