Fixed issues with comment count consistency:

pull/14/head
Sam Bosley 13 years ago
parent 4418372224
commit c277c50c7e

@ -1,5 +1,6 @@
package com.todoroo.astrid.actfm; package com.todoroo.astrid.actfm;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
@ -36,6 +37,7 @@ import com.todoroo.astrid.actfm.ActFmCameraModule.ClearImageCallback;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncService; import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.activity.AstridActivity; import com.todoroo.astrid.activity.AstridActivity;
import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.adapter.UpdateAdapter; import com.todoroo.astrid.adapter.UpdateAdapter;
import com.todoroo.astrid.dao.UpdateDao; import com.todoroo.astrid.dao.UpdateDao;
import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.TagData;
@ -198,9 +200,16 @@ public class TagUpdatesFragment extends ListFragment {
cursor.requery(); cursor.requery();
getActivity().startManagingCursor(cursor); getActivity().startManagingCursor(cursor);
} }
if (getActivity() instanceof TagUpdatesActivity)
setLastViewed();
}
if(tagData != null && tagData.getValue(Task.REMOTE_ID) <= 0) { public void setLastViewed() {
if(tagData != null && tagData.getValue(Task.REMOTE_ID) > 0) {
Preferences.setLong(UPDATES_LAST_VIEWED + tagData.getValue(TagData.REMOTE_ID), DateUtilities.now()); Preferences.setLong(UPDATES_LAST_VIEWED + tagData.getValue(TagData.REMOTE_ID), DateUtilities.now());
Activity activity = getActivity();
if (activity instanceof TaskListActivity)
((TaskListActivity) activity).setCommentsCount(0);
} }
} }

@ -230,6 +230,10 @@ public class TagViewFragment extends TaskListFragment {
tagDataService.save(tagData); tagDataService.save(tagData);
} }
updateCommentCount();
}
private void updateCommentCount() {
if (tagData != null) { if (tagData != null) {
long lastViewedComments = Preferences.getLong(TagUpdatesFragment.UPDATES_LAST_VIEWED + tagData.getValue(TagData.REMOTE_ID), 0); long lastViewedComments = Preferences.getLong(TagUpdatesFragment.UPDATES_LAST_VIEWED + tagData.getValue(TagData.REMOTE_ID), 0);
int unreadCount = 0; int unreadCount = 0;
@ -441,6 +445,7 @@ public class TagViewFragment extends TaskListFragment {
getActivity().registerReceiver(notifyReceiver, intentFilter); getActivity().registerReceiver(notifyReceiver, intentFilter);
showListSettingsPopover(); showListSettingsPopover();
updateCommentCount();
} }
@Override @Override

@ -84,6 +84,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
if (frag != null) { if (frag != null) {
setupPopoverWithFragment(commentsPopover, frag, null); setupPopoverWithFragment(commentsPopover, frag, null);
commentsPopover.show(listsNav); commentsPopover.show(listsNav);
frag.setLastViewed();
} }
} else { } else {
// In this case we should be in LAYOUT_SINGLE--delegate to the task list fragment // In this case we should be in LAYOUT_SINGLE--delegate to the task list fragment

Loading…
Cancel
Save