diff --git a/astrid/astrid.launch b/astrid/astrid.launch index 6a8eb7356..f9929e151 100644 --- a/astrid/astrid.launch +++ b/astrid/astrid.launch @@ -4,7 +4,7 @@ - + diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java index 90bc4b808..279dfa0a7 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java @@ -329,6 +329,14 @@ public final class TaskEditActivity extends TabActivity { /** Save task model from values in UI components */ private void save() { + // abandon editing in this case + if(title.getText().length() == 0) { + if(isNewTask()) + taskService.delete(model); + discardButtonClick(); + return; + } + for(TaskEditControlSet controlSet : controls) controlSet.writeToModel(); diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java index 6e7056721..d36c2109a 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java @@ -6,7 +6,9 @@ import java.util.Map.Entry; import android.app.AlertDialog; import android.app.ListActivity; +import android.appwidget.AppWidgetManager; import android.content.BroadcastReceiver; +import android.content.ComponentName; import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; @@ -32,6 +34,7 @@ import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; +import android.widget.RemoteViews; import android.widget.TextView; import android.widget.Toast; import android.widget.AbsListView.OnScrollListener; @@ -65,6 +68,7 @@ import com.todoroo.astrid.service.MetadataService; import com.todoroo.astrid.service.StartupService; import com.todoroo.astrid.service.TaskService; import com.todoroo.astrid.utility.Constants; +import com.todoroo.astrid.widget.TasksWidget; /** * Primary activity for the Bente application. Shows a list of upcoming @@ -370,6 +374,12 @@ public class TaskListActivity extends ListActivity implements OnScrollListener { protected void onStop() { super.onStop(); FlurryAgent.onEndSession(this); + + // update the widget + AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this); + RemoteViews views = new TasksWidget.UpdateService().buildUpdate(this); + ComponentName widgetName = new ComponentName(this, TasksWidget.class); + appWidgetManager.updateAppWidget(widgetName, views); } @Override @@ -401,7 +411,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener { for(Parcelable detail : details) taskAdapter.addDetails(getListView(), taskId, (TaskDetail)detail); } catch (Exception e) { - exceptionService.reportError("receive-detail-" + //$NON-NLS-1$ + exceptionService.reportError("receive-detail-" + intent.getStringExtra(AstridApiConstants.EXTRAS_PLUGIN), e); } } @@ -573,11 +583,11 @@ public class TaskListActivity extends ListActivity implements OnScrollListener { R.string.TAd_contextDeleteTask); if(Constants.DEBUG) { - menu.add("--- debug ---"); //$NON-NLS-1$ + menu.add("--- debug ---"); menu.add(id, CONTEXT_MENU_DEBUG, Menu.NONE, - "when alarm?"); //$NON-NLS-1$ + "when alarm?"); menu.add(id, CONTEXT_MENU_DEBUG + 1, Menu.NONE, - "make notification"); //$NON-NLS-1$ + "make notification"); } if(contextMenuItemCache == null) @@ -621,7 +631,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener { dialogUtilities.okDialog( this, "if this were real life, I would display your " + //$NON-NLS-1$ - "add-ons so you could enable/disable/rearrange them.", //$NON-NLS-1$ + "add-ons so you could enable/disable/rearrange them.", null); return true; case MENU_SETTINGS_ID: @@ -666,20 +676,20 @@ public class TaskListActivity extends ListActivity implements OnScrollListener { reminderService.setScheduler(new AlarmScheduler() { @Override public void createAlarm(Task theTask, long time, int type) { - Toast.makeText(TaskListActivity.this, "Scheduled Alarm: " + //$NON-NLS-1$ + Toast.makeText(TaskListActivity.this, "Scheduled Alarm: " + new Date(time), Toast.LENGTH_LONG).show(); reminderService.setScheduler(null); } }); reminderService.scheduleAlarm(task); if(reminderService.getScheduler() != null) - Toast.makeText(this, "No alarms", Toast.LENGTH_LONG).show(); //$NON-NLS-1$ + Toast.makeText(this, "No alarms", Toast.LENGTH_LONG).show(); return true; } case CONTEXT_MENU_DEBUG + 1: { itemId = item.getGroupId(); - new Notifications().showNotification(itemId, 0, "test reminder"); //$NON-NLS-1$ + new Notifications().showNotification(itemId, 0, "test reminder"); return true; } diff --git a/astrid/src/com/todoroo/astrid/widget/TasksWidget.java b/astrid/src/com/todoroo/astrid/widget/TasksWidget.java index eefc45078..3dc74e460 100644 --- a/astrid/src/com/todoroo/astrid/widget/TasksWidget.java +++ b/astrid/src/com/todoroo/astrid/widget/TasksWidget.java @@ -87,7 +87,7 @@ public class TasksWidget extends AppWidgetProvider { views.setOnClickPendingIntent(R.id.taskbody, pendingIntent); Filter inboxFilter = CoreFilterExposer.buildInboxFilter(getResources()); - inboxFilter.sqlQuery += TaskService.defaultTaskOrder() + " LIMIT " + numberOfTasks; + inboxFilter.sqlQuery += "ORDER BY " + TaskService.defaultTaskOrder() + " LIMIT " + numberOfTasks; DependencyInjectionService.getInstance().inject(this); TodorooCursor cursor = null; try {