Fixed bug where neither widget nor task list would respect default settings

pull/14/head
Tim Su 16 years ago
parent 0ced4fc3d9
commit 0ae7d4ddd2

@ -89,7 +89,7 @@ public class SortSelectionActivity {
}
@SuppressWarnings("nls")
public static String adjustSortAndFlags(String originalSql, int flags, int sort) {
public static String adjustQueryForFlagsAndSort(String originalSql, int flags, int sort) {
// sort
if(!originalSql.toUpperCase().contains("ORDER BY")) {
Order order;
@ -136,10 +136,10 @@ public class SortSelectionActivity {
// --- internal implementation
/** preference key for sort flags */
public static final String PREF_SORT_FLAGS = "tla_flags"; //$NON-NLS-1$
public static final String PREF_SORT_FLAGS = "sort_flags"; //$NON-NLS-1$
/** preference key for sort sort */
public static final String PREF_SORT_SORT = "tla_sort"; //$NON-NLS-1$
public static final String PREF_SORT_SORT = "sort_sort"; //$NON-NLS-1$
private SortSelectionActivity() {
// use the static method

@ -363,6 +363,9 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
} catch (VerifyError e) {
// failed check, no gestures :P
}
sortFlags = Preferences.getInt(SortSelectionActivity.PREF_SORT_FLAGS, 0);
sortSort= Preferences.getInt(SortSelectionActivity.PREF_SORT_SORT, 0);
}
public void bindServices() {
@ -525,7 +528,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
* @param withCustomId force task with given custom id to be part of list
*/
protected void setUpTaskList() {
sqlQueryTemplate.set(SortSelectionActivity.adjustSortAndFlags(filter.sqlQuery,
sqlQueryTemplate.set(SortSelectionActivity.adjustQueryForFlagsAndSort(filter.sqlQuery,
sortFlags, sortSort));
// perform query

@ -100,10 +100,10 @@ public class TasksWidget extends AppWidgetProvider {
TodorooCursor<Task> cursor = null;
try {
Filter inboxFilter = CoreFilterExposer.buildInboxFilter(getResources());
int sort = Preferences.getInt(SortSelectionActivity.PREF_SORT_SORT, 0);
int flags = Preferences.getInt(SortSelectionActivity.PREF_SORT_FLAGS, 0);
String query = SortSelectionActivity.adjustSortAndFlags(
inboxFilter.sqlQuery, sort, flags) + " LIMIT " + numberOfTasks;
int sort = Preferences.getInt(SortSelectionActivity.PREF_SORT_SORT, 0);
String query = SortSelectionActivity.adjustQueryForFlagsAndSort(
inboxFilter.sqlQuery, flags, sort) + " LIMIT " + numberOfTasks;
database.openForReading();
cursor = taskService.fetchFiltered(query, null, Task.TITLE, Task.DUE_DATE);

Loading…
Cancel
Save