diff --git a/astrid/AndroidManifest.xml b/astrid/AndroidManifest.xml index 981ce9bd4..72c1cb1a1 100644 --- a/astrid/AndroidManifest.xml +++ b/astrid/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionName="3.2.2 (build your own filters, easy sorting, customizable widget, ui improvements)" + android:versionCode="149"> diff --git a/astrid/plugin-src/com/todoroo/astrid/producteev/ProducteevControlSet.java b/astrid/plugin-src/com/todoroo/astrid/producteev/ProducteevControlSet.java index f9e2dee52..2cc21669c 100644 --- a/astrid/plugin-src/com/todoroo/astrid/producteev/ProducteevControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/producteev/ProducteevControlSet.java @@ -74,9 +74,7 @@ public class ProducteevControlSet implements TaskEditControlSet { @Override public void onNothingSelected(AdapterView spinnerParent) { - responsibleSelector.setAdapter(null); - responsibleSelector.setEnabled(false); - view.findViewById(R.id.producteev_TEA_task_assign_label).setVisibility(View.GONE); + // } }); } @@ -88,7 +86,9 @@ public class ProducteevControlSet implements TaskEditControlSet { */ private void refreshResponsibleSpinner(ArrayList newUsers) { Metadata metadata = ProducteevDataService.getInstance().getTaskMetadata(myTask.getId()); - Long responsibleId = metadata.getValue(ProducteevTask.RESPONSIBLE_ID); + long responsibleId = -1; + if(metadata.containsNonNullValue(ProducteevTask.RESPONSIBLE_ID)) + responsibleId = metadata.getValue(ProducteevTask.RESPONSIBLE_ID); refreshResponsibleSpinner(newUsers, responsibleId); } @@ -98,7 +98,7 @@ public class ProducteevControlSet implements TaskEditControlSet { * @param newUsers the new userlist to show in the responsibleSelector * @param responsibleId the id of the responsible user to set in the spinner */ - private void refreshResponsibleSpinner(ArrayList newUsers, Long responsibleId) { + private void refreshResponsibleSpinner(ArrayList newUsers, long responsibleId) { // Fill the responsible-spinner and set the current responsible this.users = (newUsers == null ? new ArrayList() : newUsers); @@ -116,7 +116,7 @@ public class ProducteevControlSet implements TaskEditControlSet { for (int i = 0; i < this.users.size() ; i++) { if (this.users.get(i).getId() == responsibleId) { - responsibleSpinnerIndex=i; + responsibleSpinnerIndex = i; break; } } @@ -131,7 +131,9 @@ public class ProducteevControlSet implements TaskEditControlSet { metadata = ProducteevTask.newMetadata(); // Fill the dashboard-spinner and set the current dashboard - long dashboardId = metadata.getValue(ProducteevTask.DASHBOARD_ID); + long dashboardId = -1; + if(metadata.containsNonNullValue(ProducteevTask.DASHBOARD_ID)) + dashboardId = metadata.getValue(ProducteevTask.DASHBOARD_ID); StoreObject[] dashboardsData = ProducteevDataService.getInstance().getDashboards(); dashboards = new ArrayList(dashboardsData.length); diff --git a/astrid/plugin-src/com/todoroo/astrid/producteev/ProducteevFilterExposer.java b/astrid/plugin-src/com/todoroo/astrid/producteev/ProducteevFilterExposer.java index e1dbf5791..a5bc993a0 100644 --- a/astrid/plugin-src/com/todoroo/astrid/producteev/ProducteevFilterExposer.java +++ b/astrid/plugin-src/com/todoroo/astrid/producteev/ProducteevFilterExposer.java @@ -10,11 +10,11 @@ import android.content.BroadcastReceiver; import android.content.ContentValues; import android.content.Context; import android.content.Intent; -import android.util.Pair; import com.timsu.astrid.R; import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.QueryTemplate; +import com.todoroo.andlib.utility.Pair; import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.FilterCategory; @@ -63,16 +63,16 @@ public class ProducteevFilterExposer extends BroadcastReceiver { String title = context.getString(R.string.producteev_FEx_responsible_title, user); ContentValues values = new ContentValues(); values.put(Metadata.KEY.name, ProducteevTask.METADATA_KEY); - values.put(ProducteevTask.DASHBOARD_ID.name, ids.first); + values.put(ProducteevTask.DASHBOARD_ID.name, ids.getLeft()); values.put(ProducteevTask.ID.name, 0); values.put(ProducteevTask.CREATOR_ID.name, 0); - values.put(ProducteevTask.RESPONSIBLE_ID.name, ids.second); + values.put(ProducteevTask.RESPONSIBLE_ID.name, ids.getRight()); Filter filter = new Filter(user, title, new QueryTemplate().join( ProducteevDataService.METADATA_JOIN).where(Criterion.and( MetadataCriteria.withKey(ProducteevTask.METADATA_KEY), TaskCriteria.isActive(), TaskCriteria.isVisible(), - ProducteevTask.RESPONSIBLE_ID.eq(ids.second))), + ProducteevTask.RESPONSIBLE_ID.eq(ids.getRight()))), values); return filter; diff --git a/astrid/src-legacy/com/timsu/astrid/data/AbstractController.java b/astrid/src-legacy/com/timsu/astrid/data/AbstractController.java index 9aa7d4439..a7dc5ea8b 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/AbstractController.java +++ b/astrid/src-legacy/com/timsu/astrid/data/AbstractController.java @@ -30,6 +30,7 @@ import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.DependencyInjectionService; /** Abstract controller class. Mostly contains some static fields */ +@SuppressWarnings("nls") abstract public class AbstractController { protected Context context; diff --git a/astrid/src-legacy/com/timsu/astrid/data/AbstractModel.java b/astrid/src-legacy/com/timsu/astrid/data/AbstractModel.java index 8faebb456..40dc3d911 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/AbstractModel.java +++ b/astrid/src-legacy/com/timsu/astrid/data/AbstractModel.java @@ -26,6 +26,7 @@ import android.content.ContentValues; import android.database.Cursor; /** A data object backed by a database */ +@SuppressWarnings("nls") public abstract class AbstractModel { /* Data Source Ordering: @@ -40,7 +41,7 @@ public abstract class AbstractModel { protected ContentValues setValues = new ContentValues(); /** Cached values from database */ - private ContentValues values = new ContentValues(); + private final ContentValues values = new ContentValues(); /** Cursor into the database */ private Cursor cursor = null; diff --git a/astrid/src-legacy/com/timsu/astrid/data/Identifier.java b/astrid/src-legacy/com/timsu/astrid/data/Identifier.java index 68a228116..8b6b20730 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/Identifier.java +++ b/astrid/src-legacy/com/timsu/astrid/data/Identifier.java @@ -21,7 +21,7 @@ package com.timsu.astrid.data; /** Identifier of a single object. Extend this class to create your own */ public abstract class Identifier { - private long id; + private final long id; public Identifier(long id) { this.id = id; @@ -50,6 +50,6 @@ public abstract class Identifier { @Override public String toString() { - return getClass().getSimpleName() + ": " + id; + return getClass().getSimpleName() + ": " + id; //$NON-NLS-1$ } } diff --git a/astrid/src-legacy/com/timsu/astrid/data/alerts/Alert.java b/astrid/src-legacy/com/timsu/astrid/data/alerts/Alert.java index 656deff4c..39d13a28f 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/alerts/Alert.java +++ b/astrid/src-legacy/com/timsu/astrid/data/alerts/Alert.java @@ -34,6 +34,7 @@ import com.timsu.astrid.data.task.TaskIdentifier; /** A single alert on a task */ +@SuppressWarnings("nls") public class Alert extends AbstractModel { /** Version number of this model */ diff --git a/astrid/src-legacy/com/timsu/astrid/data/alerts/AlertController.java b/astrid/src-legacy/com/timsu/astrid/data/alerts/AlertController.java index 6b2fb04cc..55905ebe5 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/alerts/AlertController.java +++ b/astrid/src-legacy/com/timsu/astrid/data/alerts/AlertController.java @@ -36,6 +36,7 @@ import com.timsu.astrid.data.alerts.Alert.AlertDatabaseHelper; import com.timsu.astrid.data.task.TaskIdentifier; /** Controller for Tag-related operations */ +@SuppressWarnings("nls") public class AlertController extends AbstractController { private SQLiteDatabase alertDatabase; diff --git a/astrid/src-legacy/com/timsu/astrid/data/sync/SyncDataController.java b/astrid/src-legacy/com/timsu/astrid/data/sync/SyncDataController.java index 6c6319621..1bbc42431 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/sync/SyncDataController.java +++ b/astrid/src-legacy/com/timsu/astrid/data/sync/SyncDataController.java @@ -35,6 +35,7 @@ import com.timsu.astrid.data.task.TaskIdentifier; import com.timsu.astrid.data.task.TaskModelForSync; /** Controller for Tag-related operations */ +@SuppressWarnings("nls") public class SyncDataController extends AbstractController { private SQLiteDatabase syncDatabase; diff --git a/astrid/src-legacy/com/timsu/astrid/data/sync/SyncMapping.java b/astrid/src-legacy/com/timsu/astrid/data/sync/SyncMapping.java index fe64bae87..7dbc1a59d 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/sync/SyncMapping.java +++ b/astrid/src-legacy/com/timsu/astrid/data/sync/SyncMapping.java @@ -32,6 +32,7 @@ import com.timsu.astrid.data.task.TaskIdentifier; /** A single tag on a task */ +@SuppressWarnings("nls") public class SyncMapping extends AbstractModel { diff --git a/astrid/src-legacy/com/timsu/astrid/data/tag/AbstractTagModel.java b/astrid/src-legacy/com/timsu/astrid/data/tag/AbstractTagModel.java index 4d49ce47c..1f68deccb 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/tag/AbstractTagModel.java +++ b/astrid/src-legacy/com/timsu/astrid/data/tag/AbstractTagModel.java @@ -38,6 +38,7 @@ import com.timsu.astrid.data.AbstractModel; * @author timsu * */ +@SuppressWarnings("nls") public abstract class AbstractTagModel extends AbstractModel { /** Version number of this model */ diff --git a/astrid/src-legacy/com/timsu/astrid/data/tag/TagController.java b/astrid/src-legacy/com/timsu/astrid/data/tag/TagController.java index dfecf35fc..eb0ececf1 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/tag/TagController.java +++ b/astrid/src-legacy/com/timsu/astrid/data/tag/TagController.java @@ -32,11 +32,12 @@ import android.database.sqlite.SQLiteDatabase; import com.timsu.astrid.data.AbstractController; import com.timsu.astrid.data.tag.AbstractTagModel.TagModelDatabaseHelper; import com.timsu.astrid.data.tag.TagToTaskMapping.TagToTaskMappingDatabaseHelper; -import com.timsu.astrid.data.task.TaskIdentifier; import com.timsu.astrid.data.task.AbstractTaskModel.TaskModelDatabaseHelper; +import com.timsu.astrid.data.task.TaskIdentifier; import com.todoroo.astrid.provider.Astrid2TaskProvider; /** Controller for Tag-related operations */ +@SuppressWarnings("nls") @Deprecated public class TagController extends AbstractController { diff --git a/astrid/src-legacy/com/timsu/astrid/data/tag/TagModelForView.java b/astrid/src-legacy/com/timsu/astrid/data/tag/TagModelForView.java index 560b5560b..a4847990f 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/tag/TagModelForView.java +++ b/astrid/src-legacy/com/timsu/astrid/data/tag/TagModelForView.java @@ -25,6 +25,7 @@ import com.timsu.astrid.data.AbstractController; /** Tag model for viewing purposes. Contains task name */ +@SuppressWarnings("nls") public class TagModelForView extends AbstractTagModel { static String[] FIELD_LIST = new String[] { diff --git a/astrid/src-legacy/com/timsu/astrid/data/tag/TagToTaskMapping.java b/astrid/src-legacy/com/timsu/astrid/data/tag/TagToTaskMapping.java index 1a9fee375..78e6ee731 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/tag/TagToTaskMapping.java +++ b/astrid/src-legacy/com/timsu/astrid/data/tag/TagToTaskMapping.java @@ -32,6 +32,7 @@ import com.timsu.astrid.data.task.TaskIdentifier; /** A single tag on a task */ +@SuppressWarnings("nls") public class TagToTaskMapping extends AbstractModel { /** Version number of this model */ diff --git a/astrid/src-legacy/com/timsu/astrid/data/task/AbstractTaskModel.java b/astrid/src-legacy/com/timsu/astrid/data/task/AbstractTaskModel.java index 05be526f7..4f194d4b2 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/task/AbstractTaskModel.java +++ b/astrid/src-legacy/com/timsu/astrid/data/task/AbstractTaskModel.java @@ -41,6 +41,7 @@ import com.timsu.astrid.data.enums.RepeatInterval; * @author timsu * */ +@SuppressWarnings("nls") public abstract class AbstractTaskModel extends AbstractModel { /** Version number of this model */ @@ -262,7 +263,8 @@ public abstract class AbstractTaskModel extends AbstractModel { // --- utility methods - /** Gets task color. Requires definiteDueDate and importance */ + /** Gets task color. Requires definiteDueDate and importance + * @param context */ protected int getTaskColorResource(Context context) { if(getDefiniteDueDate() != null && getDefiniteDueDate().getTime() < System.currentTimeMillis()) { diff --git a/astrid/src-legacy/com/timsu/astrid/data/task/TaskController.java b/astrid/src-legacy/com/timsu/astrid/data/task/TaskController.java index 5c1e28057..324a74239 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/task/TaskController.java +++ b/astrid/src-legacy/com/timsu/astrid/data/task/TaskController.java @@ -51,6 +51,7 @@ import com.todoroo.astrid.widget.TasksWidget.UpdateService; * */ @Deprecated +@SuppressWarnings("nls") public class TaskController extends AbstractController { private SQLiteDatabase database; @@ -291,6 +292,7 @@ public class TaskController extends AbstractController { * * @param task * @param values + * @param duringSync */ private void onTaskSave(AbstractTaskModel task, ContentValues values, boolean duringSync) { // save task completed date @@ -325,15 +327,15 @@ public class TaskController extends AbstractController { ContentResolver cr = context.getContentResolver(); Uri uri = Uri.parse(uriAsString); - Integer estimated = null; - if(values.containsKey(AbstractTaskModel.ESTIMATED_SECONDS)) - estimated = values.getAsInteger(AbstractTaskModel.ESTIMATED_SECONDS); - else { // read from event - Cursor event = cr.query(uri, new String[] {"dtstart", "dtend"}, - null, null, null); - event.moveToFirst(); - estimated = (event.getInt(1) - event.getInt(0))/1000; - } +// Integer estimated = null; +// if(values.containsKey(AbstractTaskModel.ESTIMATED_SECONDS)) +//// estimated = values.getAsInteger(AbstractTaskModel.ESTIMATED_SECONDS); +// else { // read from event +// Cursor event = cr.query(uri, new String[] {"dtstart", "dtend"}, +// null, null, null); +// event.moveToFirst(); +//// estimated = (event.getInt(1) - event.getInt(0))/1000; +// } // create new start and end date for this event ContentValues newValues = new ContentValues(); @@ -569,9 +571,10 @@ public class TaskController extends AbstractController { } } - /** Updates the alarm for the task identified by the given id */ + /** Updates the alarm for the task identified by the given id + * @param taskId */ public void updateAlarmForTask(TaskIdentifier taskId) throws SQLException { - TaskModelForNotify task = fetchTaskForNotify(taskId); +// TaskModelForNotify task = fetchTaskForNotify(taskId); AlertController alertController = new AlertController(context); alertController.open(); // ReminderService.updateAlarm(context, this, alertController, task); diff --git a/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForHandlers.java b/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForHandlers.java index b0a88756a..8d9708db6 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForHandlers.java +++ b/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForHandlers.java @@ -57,6 +57,7 @@ public class TaskModelForHandlers extends AbstractTaskModel { * @param taskController * @param repeatInfo */ + @SuppressWarnings("deprecation") public void repeatTaskBy(Context context, TaskController taskController, RepeatInfo repeatInfo) { diff --git a/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForProvider.java b/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForProvider.java index 5b3d90b53..32160f8be 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForProvider.java +++ b/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForProvider.java @@ -30,6 +30,7 @@ import com.timsu.astrid.data.enums.Importance; /** Fields that you would want to see in the TaskView activity */ +@SuppressWarnings("nls") public class TaskModelForProvider extends AbstractTaskModel { static String[] FIELD_LIST = new String[] { diff --git a/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForWidget.java b/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForWidget.java index 61cffecf1..49ccc6aeb 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForWidget.java +++ b/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForWidget.java @@ -29,6 +29,7 @@ import com.timsu.astrid.data.enums.Importance; /** Fields that you would want to see in the TaskView activity */ +@SuppressWarnings("nls") public class TaskModelForWidget extends AbstractTaskModel { static String[] FIELD_LIST = new String[] { diff --git a/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForXml.java b/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForXml.java index 9d9b4cc60..ceaea7ba8 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForXml.java +++ b/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForXml.java @@ -10,6 +10,7 @@ import com.timsu.astrid.data.enums.Importance; import com.timsu.astrid.data.enums.RepeatInterval; import com.todoroo.astrid.backup.BackupDateUtilities; +@SuppressWarnings("nls") public class TaskModelForXml extends AbstractTaskModel { static String[] FIELD_LIST = new String[] { diff --git a/astrid/src-legacy/com/timsu/astrid/utilities/LegacyTasksXmlExporter.java b/astrid/src-legacy/com/timsu/astrid/utilities/LegacyTasksXmlExporter.java index 923f6f3fb..ef165f2e5 100644 --- a/astrid/src-legacy/com/timsu/astrid/utilities/LegacyTasksXmlExporter.java +++ b/astrid/src-legacy/com/timsu/astrid/utilities/LegacyTasksXmlExporter.java @@ -30,7 +30,7 @@ import com.timsu.astrid.data.task.TaskIdentifier; import com.timsu.astrid.data.task.TaskModelForXml; import com.todoroo.astrid.backup.BackupDateUtilities; -@SuppressWarnings("nls") +@SuppressWarnings({"nls", "deprecation"}) public class LegacyTasksXmlExporter { private TaskController taskController; @@ -242,17 +242,17 @@ public class LegacyTasksXmlExporter { this.output = file; } - private final Runnable doBackgroundExport = new Runnable() { - public void run() { - /*Looper.prepare(); - try { - doTasksExport(); - } catch (IOException e) { - Log.e("TasksXmlExporter", "IOException in doTasksExport " + e.getMessage()); - } - Looper.loop();*/ - } - }; +// private final Runnable doBackgroundExport = new Runnable() { +// public void run() { +// /*Looper.prepare(); +// try { +// doTasksExport(); +// } catch (IOException e) { +// Log.e("TasksXmlExporter", "IOException in doTasksExport " + e.getMessage()); +// } +// Looper.loop();*/ +// } +// }; public void setTaskController(TaskController taskController) { this.taskController = taskController; diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java index c01519cc1..9fdff2af8 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java @@ -39,6 +39,7 @@ import android.content.IntentFilter; import android.content.res.Resources; import android.os.Bundle; import android.text.format.DateUtils; +import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -232,10 +233,16 @@ public final class TaskEditActivity extends TabActivity { controls.add(new RepeatControlSet(this, extrasAddons)); LinearLayout addonsAddons = (LinearLayout) findViewById(R.id.tab_addons_addons); - AddOn producteevAddon = addOnService.getAddOn(AddOnService.PRODUCTEEV_PACKAGE, "Producteev"); //$NON-NLS-1$ - if (addOnService.isInstalled(producteevAddon) && ProducteevUtilities.INSTANCE.isLoggedIn()) { - controls.add(new ProducteevControlSet(this, addonsAddons)); + + try { + AddOn producteevAddon = addOnService.getAddOn(AddOnService.PRODUCTEEV_PACKAGE, "Producteev"); //$NON-NLS-1$ + if (addOnService.isInstalled(producteevAddon) && ProducteevUtilities.INSTANCE.isLoggedIn()) { + controls.add(new ProducteevControlSet(this, addonsAddons)); + } + } catch (Exception e) { + Log.e("astrid-error", "loading-control-set", e); //$NON-NLS-1$ //$NON-NLS-2$ } + if(addOnService.hasPowerPack()) { controls.add(new GCalControlSet(this, addonsAddons)); controls.add(new TimerControlSet(this, addonsAddons));