Refresh ideas tab when switching between tasks on tablet

pull/14/head
Sam Bosley 13 years ago
parent 05e569e003
commit 52fbe3b63b

@ -512,8 +512,8 @@
<!-- Preferences: Auto-load Ideas Tab --> <!-- Preferences: Auto-load Ideas Tab -->
<string name="EPr_ideaAuto_title">Auto-load Ideas Tab</string> <string name="EPr_ideaAuto_title">Auto-load Ideas Tab</string>
<string name="EPr_ideaAuto_desc_enabled">Web searches for Ideas tab will be performed when task is edited</string> <string name="EPr_ideaAuto_desc_enabled">Web searches for Ideas tab will be performed when tab is clicked</string>
<string name="EPr_ideaAuto_desc_disabled">Web searches for Ideas tab will be performed when tab is clicked</string> <string name="EPr_ideaAuto_desc_disabled">Web searches for Ideas tab will be performed only when manually requested</string>
<!-- Preference: Theme --> <!-- Preference: Theme -->
<string name="EPr_theme_title">Color Theme</string> <string name="EPr_theme_title">Color Theme</string>

@ -772,6 +772,10 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
model = null; model = null;
remoteId = 0; remoteId = 0;
populateFields(intent); populateFields(intent);
if (webServices != null) {
webServices.setTask(model);
webServices.reset();
}
} }
/** Populate UI component values from the model */ /** Populate UI component values from the model */

@ -1,7 +1,5 @@
package com.todoroo.astrid.ui; package com.todoroo.astrid.ui;
import com.todoroo.astrid.helper.AsyncImageView;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -45,6 +43,7 @@ import com.todoroo.andlib.service.RestClient;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.helper.AmazonRequestsHelper; import com.todoroo.astrid.helper.AmazonRequestsHelper;
import com.todoroo.astrid.helper.AsyncImageView;
import com.todoroo.astrid.producteev.api.StringEscapeUtils; import com.todoroo.astrid.producteev.api.StringEscapeUtils;
import com.todoroo.astrid.service.StatisticsConstants; import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.StatisticsService; import com.todoroo.astrid.service.StatisticsService;
@ -78,19 +77,21 @@ public class WebServicesView extends LinearLayout {
public WebServicesView(Context context, AttributeSet attrs, int defStyle) { public WebServicesView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
initialize();
} }
public WebServicesView(Context context, AttributeSet attrs) { public WebServicesView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
initialize();
} }
public WebServicesView(Context context) { public WebServicesView(Context context) {
super(context); super(context);
initialize();
} }
public void setTask(Task task) { public void setTask(Task task) {
this.task = task; this.task = task;
initialize();
} }
public int[] getScrollableViews() { 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) { public void onPageSelected(Runnable runnable) {
if(!pageLoaded && Preferences.getBoolean(R.string.p_autoIdea, true)) if(!pageLoaded && Preferences.getBoolean(R.string.p_autoIdea, true))
refresh(); refresh();

Loading…
Cancel
Save