Only show waiting on me filter if there are things in it

pull/14/head
Sam Bosley 11 years ago
parent 4fca170e1e
commit 8c4d37e49a

@ -440,4 +440,13 @@ public class DatabaseDao<TYPE extends AbstractModel> {
cursor.moveToFirst();
return new TodorooCursor<TYPE>(cursor, properties);
}
public int count(Query query) {
TodorooCursor<TYPE> cursor = query(query);
try {
return cursor.getCount();
} finally {
cursor.close();
}
}
}

@ -63,7 +63,8 @@ public final class CoreFilterExposer extends BroadcastReceiver implements Astrid
if (Preferences.getBoolean(R.string.p_show_today_filter, true))
filters.add(getTodayFilter(r));
if (Preferences.getBoolean(R.string.p_show_waiting_on_me_filter, true))
if (Preferences.getBoolean(R.string.p_show_waiting_on_me_filter, true) &&
PluginServices.getWaitingOnMeDao().count(Query.select(WaitingOnMe.ID).where(WaitingOnMe.DELETED_AT.eq(0))) > 0);
filters.add(getWaitingOnMeFilter(r));
// transmit filter list

@ -352,12 +352,7 @@ public class TaskService {
* @return how many tasks are matched by this query
*/
public int count(Query query) {
TodorooCursor<Task> cursor = taskDao.query(query);
try {
return cursor.getCount();
} finally {
cursor.close();
}
return taskDao.count(query);
}
/**

Loading…
Cancel
Save