Notifications should set the refresh flag, fix some bugs with the reengagement fragment, eliminated some bugs with empty title tasks

pull/14/head
Sam Bosley 12 years ago
parent 3f1b904ee3
commit d9e66624ad

@ -42,6 +42,7 @@ import com.todoroo.astrid.dao.TaskDao.TaskCriteria;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Flags;
import com.todoroo.astrid.voice.VoiceOutputService;
public class Notifications extends BroadcastReceiver {
@ -378,6 +379,7 @@ public class Notifications extends BroadcastReceiver {
notificationManager.notify(notificationId, notification);
AndroidUtilities.sleepDeep(500);
}
Flags.set(Flags.REFRESH); // Forces a reload when app launches
if (voiceReminder || maxOutVolumeForMultipleRingReminders) {
AndroidUtilities.sleepDeep(2000);

@ -24,10 +24,29 @@ public class ReengagementFragment extends DisposableTaskListFragment {
// hide quick add
getView().findViewById(R.id.taskListFooter).setVisibility(View.GONE);
Resources r = getActivity().getResources();
super.initializeData();
setupSpeechBubble();
}
@Override
protected View getListBody(ViewGroup root) {
ViewGroup parent = (ViewGroup) getActivity().getLayoutInflater().inflate(R.layout.task_list_body_reengagement, root, false);
View taskListView = super.getListBody(parent);
parent.addView(taskListView, 0);
return parent;
}
@Override
protected void refresh() {
super.refresh();
setupSpeechBubble();
}
private void setupSpeechBubble() {
Resources r = getActivity().getResources();
TextView snooze = (TextView) getView().findViewById(R.id.reminder_snooze);
snooze.setBackgroundColor(r.getColor(ThemeService.getThemeColor()));
TextView reminder = (TextView) getView().findViewById(R.id.reminder_message);
@ -51,14 +70,4 @@ public class ReengagementFragment extends DisposableTaskListFragment {
reminder.setText(extras.getString(EXTRA_TEXT));
}
@Override
protected View getListBody(ViewGroup root) {
ViewGroup parent = (ViewGroup) getActivity().getLayoutInflater().inflate(R.layout.task_list_body_reengagement, root, false);
View taskListView = super.getListBody(parent);
parent.addView(taskListView, 0);
return parent;
}
}

@ -35,6 +35,7 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.TaskApiDao.TaskCriteria;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Flags;
public class ReengagementReceiver extends BroadcastReceiver {
@ -119,6 +120,7 @@ public class ReengagementReceiver extends BroadcastReceiver {
}
manager.notify(0, notification);
Flags.set(Flags.REFRESH); // Forces a reload when app launches
ReengagementService.scheduleReengagementAlarm(context);
}

@ -735,8 +735,8 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
protected void refresh() {
if (taskAdapter != null)
taskAdapter.flushCaches();
loadTaskListContent(true);
taskService.cleanup();
loadTaskListContent(true);
}
/**

@ -247,7 +247,19 @@ public class TaskService {
* Clean up tasks. Typically called on startup
*/
public void cleanup() {
taskDao.deleteWhere(TaskCriteria.hasNoTitle());
TodorooCursor<Task> cursor = taskDao.query(
Query.select(Task.ID).where(TaskCriteria.hasNoTitle()));
try {
if(cursor.getCount() == 0)
return;
for(cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
long id = cursor.getLong(0);
taskDao.delete(id);
}
} finally {
cursor.close();
}
}
/**

Loading…
Cancel
Save