From 846968cc2a097dc8f9b612ccf7f0baba5088fbf8 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Fri, 1 Feb 2013 14:53:07 -0800 Subject: [PATCH] Removed some dead code --- .../com/todoroo/astrid/data/UpdateApiDao.java | 21 -------------- .../actfm/sync/AstridNewSyncMigrator.java | 5 +++- .../astrid/notes/EditNoteActivity.java | 29 ++----------------- 3 files changed, 7 insertions(+), 48 deletions(-) delete mode 100644 api/src/com/todoroo/astrid/data/UpdateApiDao.java diff --git a/api/src/com/todoroo/astrid/data/UpdateApiDao.java b/api/src/com/todoroo/astrid/data/UpdateApiDao.java deleted file mode 100644 index 1a599812b..000000000 --- a/api/src/com/todoroo/astrid/data/UpdateApiDao.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) 2012 Todoroo Inc - * - * See the file "LICENSE" for the full license governing this code. - */ -package com.todoroo.astrid.data; - - -/** - * Data access object for accessing Astrid's {@link Update} table. - * - * @author Andrey Marchenko - * - */ -//public class UpdateApiDao extends ContentResolverDao{ -// -// public UpdateApiDao(Context context) { -// super(Update.class, context, Update.CONTENT_URI); -// } -// -//} diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java index a8856a6ea..88a5a6aec 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java @@ -123,7 +123,10 @@ public class AstridNewSyncMigrator { } }); - // TODO: Migrate updates here, somehow + // ---------- + // Migrate unsynced task comments to UserActivity table + // ---------- + TodorooCursor updates = updateDao.query(Query.select(Update.PROPERTIES).where( Criterion.and(Criterion.or(Update.UUID.eq(0), Update.UUID.isNull()), Criterion.or(Update.ACTION_CODE.eq(UserActivity.ACTION_TAG_COMMENT), Update.ACTION_CODE.eq(UserActivity.ACTION_TASK_COMMENT))))); diff --git a/astrid/plugin-src/com/todoroo/astrid/notes/EditNoteActivity.java b/astrid/plugin-src/com/todoroo/astrid/notes/EditNoteActivity.java index cd803adeb..f790ddcbb 100644 --- a/astrid/plugin-src/com/todoroo/astrid/notes/EditNoteActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/notes/EditNoteActivity.java @@ -256,7 +256,6 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene Linkify.addLinks(notes, Linkify.ALL); } - Activity activity = fragment.getActivity(); if (activity != null) { Bitmap bitmap = activity.getIntent().getParcelableExtra(TaskEditFragment.TOKEN_PICTURE_IN_PROGRESS); if (bitmap != null) { @@ -457,36 +456,15 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene userActivity.setValue(UserActivity.TARGET_ID, task.getUuid()); userActivity.setValue(UserActivity.TARGET_NAME, task.getValue(Task.TITLE)); userActivity.setValue(UserActivity.CREATED_AT, DateUtilities.now()); + if (usePicture && pendingCommentPicture != null) { + userActivity.setValue(UserActivity.PICTURE, RemoteModel.PictureHelper.uploadPictureJson(pendingCommentPicture).toString()); + } - // TODO: Fix picture uploading -// if (usePicture && pendingCommentPicture != null) { -// update.setValue(Update.PICTURE, Update.PICTURE_LOADING); -// try { -// String updateString = ImageDiskCache.getPictureHash(update); -// imageCache.put(updateString, pendingCommentPicture); -// update.setValue(Update.PICTURE, updateString); -// } -// catch (Exception e) { -// Log.e("EditNoteActivity", "Failed to put image to disk..."); -// } -// } -// update.putTransitory(SyncFlags.ACTFM_SUPPRESS_SYNC, true); userActivityDao.createNew(userActivity); -// -// final long updateId = userActivity.getId(); -// final Bitmap tempPicture = usePicture ? pendingCommentPicture : null; -// new Thread() { -// @Override -// public void run() { -// actFmSyncService.pushUpdate(updateId, tempPicture); -// -// } -// }.start(); commentField.setText(""); //$NON-NLS-1$ pendingCommentPicture = usePicture ? null : pendingCommentPicture; if (usePicture) { - Activity activity = fragment.getActivity(); if (activity != null) activity.getIntent().removeExtra(TaskEditFragment.TOKEN_PICTURE_IN_PROGRESS); } @@ -582,7 +560,6 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene CameraResultCallback callback = new CameraResultCallback() { @Override public void handleCameraResult(Bitmap bitmap) { - Activity activity = fragment.getActivity(); if (activity != null) { activity.getIntent().putExtra(TaskEditFragment.TOKEN_PICTURE_IN_PROGRESS, bitmap); }