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

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

@ -313,7 +313,7 @@ public class EditPreferences extends TodorooPreferenceActivity {
else if (booleanPreference(preference, value, R.string.p_statistics, else if (booleanPreference(preference, value, R.string.p_statistics,
R.string.EPr_statistics_desc_disabled, R.string.EPr_statistics_desc_enabled)) 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)) 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.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.EditPeopleControlSet; import com.todoroo.astrid.actfm.EditPeopleControlSet;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.gcal.GCalControlSet; import com.todoroo.astrid.gcal.GCalControlSet;
import com.todoroo.astrid.helper.TaskEditControlSet; import com.todoroo.astrid.helper.TaskEditControlSet;
@ -185,9 +184,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
@Autowired @Autowired
private ExceptionService exceptionService; private ExceptionService exceptionService;
@Autowired
private Database database;
@Autowired @Autowired
private TaskService taskService; private TaskService taskService;
@ -515,7 +511,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
R.layout.control_set_assigned, R.layout.control_set_assigned,
R.layout.control_set_default_display, R.layout.control_set_default_display,
R.string.actfm_EPA_assign_label_long, REQUEST_LOG_IN); 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); taskRabbitControl = new TaskRabbitControlSet(this, R.layout.control_set_default_display);
controls.add(taskRabbitControl); controls.add(taskRabbitControl);
peopleControlSet.addListener(taskRabbitControl); peopleControlSet.addListener(taskRabbitControl);
@ -1269,8 +1265,11 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
} }
@Override @Override
public void onPageSelected(int position) { public void onPageSelected(final int position) {
this.setPagerHeightForPosition(position); final Runnable onPageSelected = new Runnable() {
@Override
public void run() {
setPagerHeightForPosition(position);
NestableScrollView scrollView = (NestableScrollView)getView().findViewById(R.id.edit_scroll); NestableScrollView scrollView = (NestableScrollView)getView().findViewById(R.id.edit_scroll);
if((tabStyle == TAB_STYLE_WEB && position == 1) || if((tabStyle == TAB_STYLE_WEB && position == 1) ||
@ -1279,7 +1278,18 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
setScrollabelViews(webServices.getScrollableViews()); setScrollabelViews(webServices.getScrollableViews());
else else
scrollView.setScrollabelViews(null); scrollView.setScrollabelViews(null);
}
};
if(getTabForPosition(position) == TAB_VIEW_WEB_SERVICES)
webServices.onPageSelected(new Runnable() {
@Override
public void run() {
onPageSelected.run();
}
});
else
onPageSelected.run();
} }
@Override @Override
@ -1287,7 +1297,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
return; return;
} }
// EditNoteActivity Lisener when there are new updates/comments // EditNoteActivity Listener when there are new updates/comments
@Override @Override
public void updatesChanged() { public void updatesChanged() {
setCurrentTab(TAB_VIEW_UPDATES); 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.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService; import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.service.RestClient; import com.todoroo.andlib.service.RestClient;
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.producteev.api.StringEscapeUtils; import com.todoroo.astrid.producteev.api.StringEscapeUtils;
@ -68,6 +69,7 @@ public class WebServicesView extends LinearLayout {
private Activity activity; private Activity activity;
public TaskRabbitControlSet taskRabbitControl; public TaskRabbitControlSet taskRabbitControl;
private final AtomicBoolean notConnected = new AtomicBoolean(false); private final AtomicBoolean notConnected = new AtomicBoolean(false);
private boolean pageLoaded = false;
private LinearLayout.LayoutParams rowParams; private LinearLayout.LayoutParams rowParams;
@ -112,13 +114,22 @@ public class WebServicesView extends LinearLayout {
Math.round(ROW_HEIGHT * metrics.density)); Math.round(ROW_HEIGHT * metrics.density));
rowParams.rightMargin = Math.round(10 * metrics.density); rowParams.rightMargin = Math.round(10 * metrics.density);
if(Preferences.getBoolean(R.string.p_autoIdea, true))
refresh(); refresh();
} }
public void onPageSelected(Runnable runnable) {
if(!pageLoaded)
refresh();
runnable.run();
}
public void refresh() { public void refresh() {
if(TextUtils.isEmpty(task.getValue(Task.TITLE))) if(TextUtils.isEmpty(task.getValue(Task.TITLE)))
return; return;
pageLoaded = true;
removeAllViews(); removeAllViews();
initializeTaskRabbit(); initializeTaskRabbit();
@ -128,7 +139,6 @@ public class WebServicesView extends LinearLayout {
addSectionDivider(); addSectionDivider();
initializeGoogleSearch(); initializeGoogleSearch();
} }
private void showNotConnected() { private void showNotConnected() {

Loading…
Cancel
Save