Fixed comments order bug

pull/14/head
Sam Bosley 12 years ago
parent 2e592c9eba
commit 61ef5ffda9

@ -8,6 +8,7 @@ import android.widget.ListView;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Order;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.adapter.UpdateAdapter;
@ -55,10 +56,10 @@ public class TaskCommentsFragment extends CommentsFragment {
@Override
protected Cursor getCursor() {
if (!task.containsNonNullValue(Task.REMOTE_ID))
return updateDao.query(Query.select(Update.PROPERTIES).where(Update.TASK_LOCAL.eq(task.getId())));
return updateDao.query(Query.select(Update.PROPERTIES).where(Update.TASK_LOCAL.eq(task.getId())).orderBy(Order.desc(Update.CREATION_DATE)));
else
return updateDao.query(Query.select(Update.PROPERTIES).where(Criterion.or(
Update.TASK.eq(task.getValue(Task.REMOTE_ID)), Update.TASK_LOCAL.eq(task.getId()))));
Update.TASK.eq(task.getValue(Task.REMOTE_ID)), Update.TASK_LOCAL.eq(task.getId()))).orderBy(Order.desc(Update.CREATION_DATE)));
}
@Override

@ -47,6 +47,7 @@ import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Order;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
@ -286,11 +287,11 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
TodorooCursor<Update> updates;
if (!task.containsNonNullValue(Task.REMOTE_ID)) {
updates = updateDao.query(Query.select(Update.PROPERTIES).where(Update.TASK_LOCAL.eq(task.getId())));
updates = updateDao.query(Query.select(Update.PROPERTIES).where(Update.TASK_LOCAL.eq(task.getId())).orderBy(Order.desc(Update.CREATION_DATE)));
}
else {
updates = updateDao.query(Query.select(Update.PROPERTIES).where(Criterion.or(
Update.TASK.eq(task.getValue(Task.REMOTE_ID)), Update.TASK_LOCAL.eq(task.getId()))));
Update.TASK.eq(task.getValue(Task.REMOTE_ID)), Update.TASK_LOCAL.eq(task.getId()))).orderBy(Order.desc(Update.CREATION_DATE)));
}
try {
Update update = new Update();

@ -315,6 +315,8 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
}
}
showEditComments = Preferences.getBoolean(R.string.p_show_task_edit_comments, true);
TypedValue tv = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.asCommentButtonImg, tv, false);
commentIcon = tv.data;
@ -350,9 +352,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
setUpUIComponents();
adjustInfoPopovers();
showEditComments = Preferences.getBoolean(R.string.p_show_task_edit_comments, true);
Preferences.setBoolean(R.string.p_showed_tap_task_help, true);
overrideFinishAnim = false;

@ -146,7 +146,7 @@ public class TagDataService {
criterion).
orderBy(Order.desc(Update.CREATION_DATE)));
if(tagData.getValue(TagData.REMOTE_ID) == 0)
return updateDao.query(Query.select(Update.PROPERTIES).where(Update.TAGS_LOCAL.like("%," + tagData.getId() + ",%")));
return updateDao.query(Query.select(Update.PROPERTIES).where(Update.TAGS_LOCAL.like("%," + tagData.getId() + ",%")).orderBy(Order.desc(Update.CREATION_DATE)));
return updateDao.query(Query.select(Update.PROPERTIES).where(Criterion.and(criterion,
Criterion.or(Update.TAGS.like("%," + tagData.getValue(TagData.REMOTE_ID) + ",%"),
Update.TAGS_LOCAL.like("%," + tagData.getId() + ",%")))).

Loading…
Cancel
Save