Implement the not-loading of ideas tab if preference tab is selected

pull/14/head
Tim Su 13 years ago
parent c29c2cd103
commit a7f59317f8

@ -491,9 +491,9 @@
<string name="EPr_fullTask_desc_disabled">First two lines of task title will be shown</string>
<!-- Preferences: Auto-load Ideas Tab -->
<string name="EPr_ideaAuto_title">Show full task title</string>
<string name="EPr_ideaAuto_desc_enabled">Full task title will be shown</string>
<string name="EPr_ideaAuto_desc_disabled">First two lines of task title will be shown</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_disabled">Web searches for Ideas tab will be performed when tab is clicked</string>
<!-- Preference: Theme -->
<string name="EPr_theme_title">Color Theme</string>

@ -87,7 +87,7 @@
android:defaultValue="true" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_ideaAuto"
android:key="@string/p_autoIdea"
android:title="@string/EPr_ideaAuto_title"
android:defaultValue="true" />

@ -313,7 +313,7 @@ public class EditPreferences extends TodorooPreferenceActivity {
else if (booleanPreference(preference, value, R.string.p_statistics,
R.string.EPr_statistics_desc_disabled, R.string.EPr_statistics_desc_enabled))
;
else if (booleanPreference(preference, value, R.string.p_idea_autoload,
else if (booleanPreference(preference, value, R.string.p_autoIdea,
R.string.EPr_ideaAuto_desc_disabled, R.string.EPr_ideaAuto_desc_enabled))
;

@ -71,7 +71,6 @@ import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.EditPeopleControlSet;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.gcal.GCalControlSet;
import com.todoroo.astrid.helper.TaskEditControlSet;
@ -185,9 +184,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
@Autowired
private ExceptionService exceptionService;
@Autowired
private Database database;
@Autowired
private TaskService taskService;
@ -515,7 +511,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
R.layout.control_set_assigned,
R.layout.control_set_default_display,
R.string.actfm_EPA_assign_label_long, REQUEST_LOG_IN);
if(Locale.getDefault().getCountry().equals("US")) {
if(Locale.getDefault().getCountry().equals("US")) { //$NON-NLS-1$
taskRabbitControl = new TaskRabbitControlSet(this, R.layout.control_set_default_display);
controls.add(taskRabbitControl);
peopleControlSet.addListener(taskRabbitControl);
@ -1269,17 +1265,31 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
}
@Override
public void onPageSelected(int position) {
this.setPagerHeightForPosition(position);
public void onPageSelected(final int position) {
final Runnable onPageSelected = new Runnable() {
@Override
public void run() {
setPagerHeightForPosition(position);
NestableScrollView scrollView = (NestableScrollView)getView().findViewById(R.id.edit_scroll);
if((tabStyle == TAB_STYLE_WEB && position == 1) ||
(tabStyle == TAB_STYLE_ACTIVITY_WEB && position == 2))
scrollView.
setScrollabelViews(webServices.getScrollableViews());
else
scrollView.setScrollabelViews(null);
}
};
NestableScrollView scrollView = (NestableScrollView)getView().findViewById(R.id.edit_scroll);
if((tabStyle == TAB_STYLE_WEB && position == 1) ||
(tabStyle == TAB_STYLE_ACTIVITY_WEB && position == 2))
scrollView.
setScrollabelViews(webServices.getScrollableViews());
if(getTabForPosition(position) == TAB_VIEW_WEB_SERVICES)
webServices.onPageSelected(new Runnable() {
@Override
public void run() {
onPageSelected.run();
}
});
else
scrollView.setScrollabelViews(null);
onPageSelected.run();
}
@Override
@ -1287,7 +1297,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
return;
}
// EditNoteActivity Lisener when there are new updates/comments
// EditNoteActivity Listener when there are new updates/comments
@Override
public void updatesChanged() {
setCurrentTab(TAB_VIEW_UPDATES);

@ -42,6 +42,7 @@ import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService;
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.producteev.api.StringEscapeUtils;
@ -68,6 +69,7 @@ public class WebServicesView extends LinearLayout {
private Activity activity;
public TaskRabbitControlSet taskRabbitControl;
private final AtomicBoolean notConnected = new AtomicBoolean(false);
private boolean pageLoaded = false;
private LinearLayout.LayoutParams rowParams;
@ -112,13 +114,22 @@ public class WebServicesView extends LinearLayout {
Math.round(ROW_HEIGHT * metrics.density));
rowParams.rightMargin = Math.round(10 * metrics.density);
refresh();
if(Preferences.getBoolean(R.string.p_autoIdea, true))
refresh();
}
public void onPageSelected(Runnable runnable) {
if(!pageLoaded)
refresh();
runnable.run();
}
public void refresh() {
if(TextUtils.isEmpty(task.getValue(Task.TITLE)))
return;
pageLoaded = true;
removeAllViews();
initializeTaskRabbit();
@ -128,7 +139,6 @@ public class WebServicesView extends LinearLayout {
addSectionDivider();
initializeGoogleSearch();
}
private void showNotConnected() {

Loading…
Cancel
Save