From 6a5e65184d454a6d836e0ab918a4a3bdd0842ce2 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Mon, 5 Aug 2013 12:14:00 -0500 Subject: [PATCH] Remove unused return values --- .../todoroo/andlib/utility/AndroidUtilities.java | 7 +++---- .../com/todoroo/astrid/sync/SyncProvider.java | 2 +- .../astrid/actfm/sync/ActFmSyncThread.java | 3 +-- .../todoroo/astrid/alarms/AlarmControlSet.java | 4 +--- .../todoroo/astrid/backup/TasksXmlImporter.java | 11 +++-------- .../com/todoroo/astrid/tags/TagCaseMigrator.java | 4 ++-- .../com/todoroo/astrid/tags/TagsControlSet.java | 6 ++---- .../astrid/data/alerts/AlertController.java | 16 ++++++---------- .../astrid/data/sync/SyncDataController.java | 5 ++--- .../com/timsu/astrid/data/sync/SyncMapping.java | 8 ++++---- .../todoroo/astrid/adapter/FilterAdapter.java | 8 ++++---- .../todoroo/astrid/service/MetadataService.java | 4 ++-- .../com/todoroo/astrid/service/TaskService.java | 5 ++--- .../src/com/todoroo/astrid/ui/AstridDialog.java | 3 +-- .../com/todoroo/astrid/ui/DraggableListView.java | 11 +++-------- .../src/com/todoroo/astrid/utility/Entities.java | 6 ++---- .../astrid/voice/Api6VoiceOutputAssistant.java | 6 +----- .../todoroo/astrid/voice/VoiceOutputService.java | 5 ++--- 18 files changed, 42 insertions(+), 72 deletions(-) diff --git a/api/src/com/todoroo/andlib/utility/AndroidUtilities.java b/api/src/com/todoroo/andlib/utility/AndroidUtilities.java index a5941bbdb..8140cbc3a 100644 --- a/api/src/com/todoroo/andlib/utility/AndroidUtilities.java +++ b/api/src/com/todoroo/andlib/utility/AndroidUtilities.java @@ -665,14 +665,13 @@ public class AndroidUtilities { * @param args arguments * @return method return value, or null if nothing was called or exception */ - public static Object callApiMethod(int minSdk, Object receiver, + public static void callApiMethod(int minSdk, Object receiver, String methodName, Class[] params, Object... args) { if (getSdkVersion() < minSdk) { - return null; + return; } - return AndroidUtilities.callMethod(receiver.getClass(), - receiver, methodName, params, args); + AndroidUtilities.callMethod(receiver.getClass(), receiver, methodName, params, args); } /** diff --git a/api/src/com/todoroo/astrid/sync/SyncProvider.java b/api/src/com/todoroo/astrid/sync/SyncProvider.java index e809c72cd..771d949a3 100644 --- a/api/src/com/todoroo/astrid/sync/SyncProvider.java +++ b/api/src/com/todoroo/astrid/sync/SyncProvider.java @@ -80,7 +80,7 @@ public abstract class SyncProvider { * * @param task task to create */ - abstract protected TYPE create(TYPE task) throws IOException; + abstract protected void create(TYPE task) throws IOException; /** * Push variables from given task to the remote server, and read the newly diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java index 542d3771e..c1f9fc1f2 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java @@ -149,7 +149,7 @@ public class ActFmSyncThread { return instance; } - public static ActFmSyncThread initializeSyncComponents(TaskDao taskDao, TagDataDao tagDataDao, UserActivityDao userActivityDao, + public static void initializeSyncComponents(TaskDao taskDao, TagDataDao tagDataDao, UserActivityDao userActivityDao, TaskAttachmentDao taskAttachmentDao, TaskListMetadataDao taskListMetadataDao) { if (instance == null) { synchronized (ActFmSyncThread.class) { @@ -170,7 +170,6 @@ public class ActFmSyncThread { } } } - return instance; } private ActFmSyncThread(List> messageQueue, Object syncMonitor) { diff --git a/astrid/plugin-src/com/todoroo/astrid/alarms/AlarmControlSet.java b/astrid/plugin-src/com/todoroo/astrid/alarms/AlarmControlSet.java index 7278b9da9..82e60f9a1 100644 --- a/astrid/plugin-src/com/todoroo/astrid/alarms/AlarmControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/alarms/AlarmControlSet.java @@ -95,7 +95,7 @@ public final class AlarmControlSet extends TaskEditControlSet { return null; } - private boolean addAlarm(Date alert) { + private void addAlarm(Date alert) { final View alertItem = LayoutInflater.from(activity).inflate(R.layout.alarm_edit_row, null); alertsContainer.addView(alertItem); @@ -141,7 +141,5 @@ public final class AlarmControlSet extends TaskEditControlSet { alertsContainer.removeView(alertItem); } }); - - return true; } } diff --git a/astrid/plugin-src/com/todoroo/astrid/backup/TasksXmlImporter.java b/astrid/plugin-src/com/todoroo/astrid/backup/TasksXmlImporter.java index a78f98a6c..e41dde85a 100644 --- a/astrid/plugin-src/com/todoroo/astrid/backup/TasksXmlImporter.java +++ b/astrid/plugin-src/com/todoroo/astrid/backup/TasksXmlImporter.java @@ -457,7 +457,7 @@ public class TasksXmlImporter { } } - private boolean parseSync() { + private void parseSync() { String service = xpp.getAttributeValue(null, BackupConstants.SYNC_ATTR_SERVICE); String remoteId = xpp.getAttributeValue(null, BackupConstants.SYNC_ATTR_REMOTE_ID); if (service != null && remoteId != null) { @@ -473,20 +473,15 @@ public class TasksXmlImporter { metadata.setValue(Metadata.VALUE3, taskId); metadata.setValue(Metadata.VALUE4, syncOnComplete ? "1" : "0"); //$NON-NLS-1$ //$NON-NLS-2$ metadataService.save(metadata); - return true; } - return false; } - private boolean parseAlert() { - // drop it - return false; + private void parseAlert() { } - private boolean parseTag() { + private void parseTag() { String tagName = xpp.getAttributeValue(null, BackupConstants.TAG_ATTR_NAME); tags.add(tagName); - return true; } private void saveTags() { diff --git a/astrid/plugin-src/com/todoroo/astrid/tags/TagCaseMigrator.java b/astrid/plugin-src/com/todoroo/astrid/tags/TagCaseMigrator.java index fa008b884..5e42bb289 100644 --- a/astrid/plugin-src/com/todoroo/astrid/tags/TagCaseMigrator.java +++ b/astrid/plugin-src/com/todoroo/astrid/tags/TagCaseMigrator.java @@ -146,8 +146,8 @@ public class TagCaseMigrator { } @Deprecated - private int renameCaseSensitive(String oldTag, String newTag) { // Need this for tag case migration process - return renameHelper(oldTag, newTag, true); + private void renameCaseSensitive(String oldTag, String newTag) { // Need this for tag case migration process + renameHelper(oldTag, newTag, true); } @Deprecated diff --git a/astrid/plugin-src/com/todoroo/astrid/tags/TagsControlSet.java b/astrid/plugin-src/com/todoroo/astrid/tags/TagsControlSet.java index b17347bc7..3b62b8d48 100644 --- a/astrid/plugin-src/com/todoroo/astrid/tags/TagsControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/tags/TagsControlSet.java @@ -144,7 +144,7 @@ public final class TagsControlSet extends PopupControlSet { /** * Adds a tag to the tag field */ - boolean addTag(String tagName, boolean reuse) { + void addTag(String tagName, boolean reuse) { LayoutInflater inflater = activity.getLayoutInflater(); // check if already exists @@ -153,7 +153,7 @@ public final class TagsControlSet extends PopupControlSet { View view = newTags.getChildAt(i); lastText = (TextView) view.findViewById(R.id.text1); if (lastText.getText().equals(tagName)) { - return false; + return; } } @@ -224,8 +224,6 @@ public final class TagsControlSet extends PopupControlSet { } } }); - - return true; } /** 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 7a0a65487..4a1a79e18 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/alerts/AlertController.java +++ b/astrid/src-legacy/com/timsu/astrid/data/alerts/AlertController.java @@ -91,24 +91,20 @@ public class AlertController extends LegacyAbstractController { /** * Remove all alerts from the task */ - public boolean removeAlerts(TaskIdentifier taskId) - throws SQLException { - return alertDatabase.delete(alertsTable, - String.format("%s = ?", - Alert.TASK), - new String[]{taskId.idAsString()}) > 0; + public void removeAlerts(TaskIdentifier taskId) throws SQLException { + alertDatabase.delete(alertsTable, + String.format("%s = ?", Alert.TASK), + new String[]{taskId.idAsString()}); } /** * Add the given tag to the task */ - public boolean addAlert(TaskIdentifier taskId, Date date) - throws SQLException { + public void addAlert(TaskIdentifier taskId, Date date) throws SQLException { ContentValues values = new ContentValues(); values.put(Alert.DATE, date.getTime()); values.put(Alert.TASK, taskId.getId()); - return alertDatabase.insert(alertsTable, Alert.TASK, - values) >= 0; + alertDatabase.insert(alertsTable, Alert.TASK, values); } // --- boilerplate 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 3649b923f..a2a93d299 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/sync/SyncDataController.java +++ b/astrid/src-legacy/com/timsu/astrid/data/sync/SyncDataController.java @@ -44,11 +44,10 @@ public class SyncDataController extends LegacyAbstractController { /** * Indicate that this task's properties were updated */ - public boolean addToUpdatedList(TaskIdentifier taskId) throws SQLException { + public void addToUpdatedList(TaskIdentifier taskId) throws SQLException { ContentValues values = new ContentValues(); values.put(SyncMapping.UPDATED, 1); - return syncDatabase.update(syncTable, values, - SyncMapping.TASK + " = " + taskId.getId(), null) > 0; + syncDatabase.update(syncTable, values, SyncMapping.TASK + " = " + taskId.getId(), null); } public static void taskUpdated(Context context, AbstractTaskModel task) { 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 f5a97d52b..c0aa04fc4 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/sync/SyncMapping.java +++ b/astrid/src-legacy/com/timsu/astrid/data/sync/SyncMapping.java @@ -137,8 +137,8 @@ public class SyncMapping extends LegacyAbstractModel { } } - public TaskIdentifier getTask() { - return new TaskIdentifier(retrieveLong(TASK)); + public void getTask() { + new TaskIdentifier(retrieveLong(TASK)); } public int getSyncServiceId() { @@ -149,8 +149,8 @@ public class SyncMapping extends LegacyAbstractModel { return retrieveString(REMOTE_ID); } - public boolean isUpdated() { - return retrieveInteger(UPDATED) == 1; + public void isUpdated() { + retrieveInteger(UPDATED); } private void setTask(TaskIdentifier task) { diff --git a/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java b/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java index 4b2bbbb47..41f0c2214 100644 --- a/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java @@ -260,12 +260,12 @@ public class FilterAdapter extends ArrayAdapter { return newCount; } - public int incrementFilterCount(Filter filter) { - return adjustFilterCount(filter, 1); + public void incrementFilterCount(Filter filter) { + adjustFilterCount(filter, 1); } - public int decrementFilterCount(Filter filter) { - return adjustFilterCount(filter, -1); + public void decrementFilterCount(Filter filter) { + adjustFilterCount(filter, -1); } public void refreshFilterCount(final Filter filter) { diff --git a/astrid/src/com/todoroo/astrid/service/MetadataService.java b/astrid/src/com/todoroo/astrid/service/MetadataService.java index 260b6c1ee..5f87f72ef 100644 --- a/astrid/src/com/todoroo/astrid/service/MetadataService.java +++ b/astrid/src/com/todoroo/astrid/service/MetadataService.java @@ -76,8 +76,8 @@ public class MetadataService { * * @param where */ - public int deleteWhere(Criterion where) { - return metadataDao.deleteWhere(where); + public void deleteWhere(Criterion where) { + metadataDao.deleteWhere(where); } /** diff --git a/astrid/src/com/todoroo/astrid/service/TaskService.java b/astrid/src/com/todoroo/astrid/service/TaskService.java index 65b0f761f..040be2859 100644 --- a/astrid/src/com/todoroo/astrid/service/TaskService.java +++ b/astrid/src/com/todoroo/astrid/service/TaskService.java @@ -215,10 +215,10 @@ public class TaskService { return newTask; } - public Task cloneReusableTask(Task task, String tagName, String tagUuid) { + public void cloneReusableTask(Task task, String tagName, String tagUuid) { Task newTask = fetchById(task.getId(), Task.PROPERTIES); if (newTask == null) { - return new Task(); + return; } newTask.clearValue(Task.ID); newTask.clearValue(Task.UUID); @@ -232,7 +232,6 @@ public class TaskService { if (!RemoteModel.isUuidEmpty(tagUuid)) { TagService.getInstance().createLink(newTask, tagName, tagUuid); } - return newTask; } /** diff --git a/astrid/src/com/todoroo/astrid/ui/AstridDialog.java b/astrid/src/com/todoroo/astrid/ui/AstridDialog.java index b861a23fe..130fc5a76 100644 --- a/astrid/src/com/todoroo/astrid/ui/AstridDialog.java +++ b/astrid/src/com/todoroo/astrid/ui/AstridDialog.java @@ -54,7 +54,7 @@ public class AstridDialog extends Dialog { return this; } - public AstridDialog setButtonListeners(View.OnClickListener... listeners) { + public void setButtonListeners(View.OnClickListener... listeners) { int index = 0; for (View.OnClickListener l : listeners) { buttons[index].setOnClickListener(l); @@ -63,7 +63,6 @@ public class AstridDialog extends Dialog { break; } } - return this; } public AstridDialog setAstridText(int resId) { diff --git a/astrid/src/com/todoroo/astrid/ui/DraggableListView.java b/astrid/src/com/todoroo/astrid/ui/DraggableListView.java index 90d89db92..c4ab6aa7d 100644 --- a/astrid/src/com/todoroo/astrid/ui/DraggableListView.java +++ b/astrid/src/com/todoroo/astrid/ui/DraggableListView.java @@ -363,22 +363,19 @@ public class DraggableListView extends ListView { } } - /** - * @return true if drag was initiated - */ - protected boolean initiateDrag(MotionEvent ev) { + protected void initiateDrag(MotionEvent ev) { int x = (int) mTouchCurrentX; int y = (int) mTouchCurrentY; int itemNum = pointToPosition(x, y); if (itemNum == AdapterView.INVALID_POSITION) { - return false; + return; } View item = getChildAt(itemNum - getFirstVisiblePosition()); if (!isDraggableRow()) { - return false; + return; } mDragPoint = new Point(x - item.getLeft(), y - item.getTop()); @@ -406,8 +403,6 @@ public class DraggableListView extends ListView { Vibrator v = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE); v.vibrate(50); - - return true; } private void startDragging(Bitmap bm, int x, int y) { diff --git a/astrid/src/com/todoroo/astrid/utility/Entities.java b/astrid/src/com/todoroo/astrid/utility/Entities.java index 0f376c453..610477836 100644 --- a/astrid/src/com/todoroo/astrid/utility/Entities.java +++ b/astrid/src/com/todoroo/astrid/utility/Entities.java @@ -1237,15 +1237,14 @@ class Entities { * @throws NullPointerException if the key is null. * @see #get(int) */ - public Object put(int key, Object value) { + public void put(int key, Object value) { // Makes sure the key is not already in the hashtable. Entry tab[] = table; int index = (key & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index]; e != null; e = e.next) { if (e.hash == key) { - Object old = e.value; e.value = value; - return old; + return; } } @@ -1261,7 +1260,6 @@ class Entities { Entry e = new Entry(key, key, value, tab[index]); tab[index] = e; count++; - return null; } /** diff --git a/astrid/src/com/todoroo/astrid/voice/Api6VoiceOutputAssistant.java b/astrid/src/com/todoroo/astrid/voice/Api6VoiceOutputAssistant.java index 09c1c1d43..53536a5c7 100644 --- a/astrid/src/com/todoroo/astrid/voice/Api6VoiceOutputAssistant.java +++ b/astrid/src/com/todoroo/astrid/voice/Api6VoiceOutputAssistant.java @@ -52,7 +52,7 @@ public class Api6VoiceOutputAssistant implements OnInitListener, VoiceOutputAssi } @Override - public boolean handleActivityResult(int requestCode, int resultCode) { + public void handleActivityResult(int requestCode, int resultCode) { if (requestCode == MY_DATA_CHECK_CODE) { if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) { // success, create the TTS instance @@ -63,11 +63,7 @@ public class Api6VoiceOutputAssistant implements OnInitListener, VoiceOutputAssi installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); context.startActivity(installIntent); } - - return true; } - - return false; } private void initTTS() { diff --git a/astrid/src/com/todoroo/astrid/voice/VoiceOutputService.java b/astrid/src/com/todoroo/astrid/voice/VoiceOutputService.java index c4cd3468d..f330eb28f 100644 --- a/astrid/src/com/todoroo/astrid/voice/VoiceOutputService.java +++ b/astrid/src/com/todoroo/astrid/voice/VoiceOutputService.java @@ -24,7 +24,7 @@ public class VoiceOutputService { public interface VoiceOutputAssistant { public void checkIsTTSInstalled(); - public boolean handleActivityResult(int requestCode, int resultCode); + public void handleActivityResult(int requestCode, int resultCode); public void queueSpeak(String textToSpeak); @@ -39,8 +39,7 @@ public class VoiceOutputService { } @Override - public boolean handleActivityResult(int requestCode, int resultCode) { - return false; + public void handleActivityResult(int requestCode, int resultCode) { } @Override