Invalidate details cache every couple of days

pull/14/head
Tim Su 15 years ago
parent 5373b09cdf
commit 26488ecb9c

@ -422,20 +422,24 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
if(task.isCompleted()) if(task.isCompleted())
continue; continue;
if(task.getValue(Task.DETAILS_DATE) < task.getValue(Task.MODIFICATION_DATE)) { if(task.getValue(Task.DETAILS_DATE) >= task.getValue(Task.MODIFICATION_DATE))
taskDetailLoader.put(task.getId(), new StringBuilder(task.getValue(Task.DETAILS))); continue;
Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_REQUEST_DETAILS); if(task.getValue(Task.DETAILS_DATE) < DateUtilities.now() - 3 * DateUtilities.ONE_DAY)
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, task.getId()); continue;
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_EXTENDED, false);
activity.sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ); taskDetailLoader.put(task.getId(), new StringBuilder(task.getValue(Task.DETAILS)));
if(TextUtils.isEmpty(task.getValue(Task.DETAILS))) { Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_REQUEST_DETAILS);
task.setValue(Task.DETAILS, DETAIL_SEPARATOR); broadcastIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, task.getId());
} broadcastIntent.putExtra(AstridApiConstants.EXTRAS_EXTENDED, false);
task.setValue(Task.DETAILS_DATE, DateUtilities.now()); activity.sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
taskService.save(task);
if(TextUtils.isEmpty(task.getValue(Task.DETAILS))) {
task.setValue(Task.DETAILS, DETAIL_SEPARATOR);
} }
task.setValue(Task.DETAILS_DATE, DateUtilities.now());
taskService.save(task);
} }
} catch (Exception e) { } catch (Exception e) {
// suppress silently // suppress silently

Loading…
Cancel
Save