diff --git a/src/androidTest/java/com/todoroo/astrid/service/TitleParserTest.java b/src/androidTest/java/com/todoroo/astrid/service/TitleParserTest.java index 90556df08..cb84f525f 100644 --- a/src/androidTest/java/com/todoroo/astrid/service/TitleParserTest.java +++ b/src/androidTest/java/com/todoroo/astrid/service/TitleParserTest.java @@ -160,7 +160,7 @@ public class TitleParserTest extends DatabaseTestCase { // ----------------Days begin----------------// - public void disabled_testDays() throws Exception{ + public void disabled_testDays() { Calendar today = Calendar.getInstance(); Task task = new Task(); diff --git a/src/generic/java/org/tasks/dialogs/LocationPickerDialog.java b/src/generic/java/org/tasks/dialogs/LocationPickerDialog.java index 2d0837fea..04dad55ad 100644 --- a/src/generic/java/org/tasks/dialogs/LocationPickerDialog.java +++ b/src/generic/java/org/tasks/dialogs/LocationPickerDialog.java @@ -4,6 +4,7 @@ import android.support.v4.app.FragmentManager; import org.tasks.location.OnLocationPickedHandler; +@SuppressWarnings("EmptyMethod") public class LocationPickerDialog { public LocationPickerDialog(OnLocationPickedHandler onLocationPickedHandler) { diff --git a/src/generic/java/org/tasks/location/GeofenceApi.java b/src/generic/java/org/tasks/location/GeofenceApi.java index 7806f3101..b7373b0c6 100644 --- a/src/generic/java/org/tasks/location/GeofenceApi.java +++ b/src/generic/java/org/tasks/location/GeofenceApi.java @@ -4,6 +4,7 @@ import java.util.List; import javax.inject.Inject; +@SuppressWarnings("EmptyMethod") public class GeofenceApi { @Inject diff --git a/src/main/java/com/commonsware/cwac/tlv/TouchListView.java b/src/main/java/com/commonsware/cwac/tlv/TouchListView.java index fb266b473..7d12305c3 100644 --- a/src/main/java/com/commonsware/cwac/tlv/TouchListView.java +++ b/src/main/java/com/commonsware/cwac/tlv/TouchListView.java @@ -432,8 +432,8 @@ public class TouchListView extends ListView { } public interface GrabberClickListener { - public void onClick(View v); - public void onLongClick(View v); + void onClick(View v); + void onLongClick(View v); } public interface DropListener { diff --git a/src/main/java/com/todoroo/andlib/data/DatabaseDao.java b/src/main/java/com/todoroo/andlib/data/DatabaseDao.java index 46d53bddf..63606e453 100644 --- a/src/main/java/com/todoroo/andlib/data/DatabaseDao.java +++ b/src/main/java/com/todoroo/andlib/data/DatabaseDao.java @@ -32,10 +32,8 @@ public class DatabaseDao { private static final Logger log = LoggerFactory.getLogger(DatabaseDao.class); private final Class modelClass; - - private Table table; - - private Database database; + private final Table table; + private final Database database; public DatabaseDao(Database database, Class modelClass) { this.modelClass = modelClass; @@ -56,7 +54,7 @@ public class DatabaseDao { // --- listeners public interface ModelUpdateListener { - public void onModelUpdated(MTYPE model); + void onModelUpdated(MTYPE model); } private final ArrayList> listeners = new ArrayList<>(); @@ -214,7 +212,7 @@ public class DatabaseDao { } private interface DatabaseChangeOp { - public boolean makeChange(); + boolean makeChange(); } private boolean insertOrUpdateAndRecordChanges(TYPE item, DatabaseChangeOp op) { diff --git a/src/main/java/com/todoroo/andlib/data/Property.java b/src/main/java/com/todoroo/andlib/data/Property.java index 755d825a6..d1a2446e6 100644 --- a/src/main/java/com/todoroo/andlib/data/Property.java +++ b/src/main/java/com/todoroo/andlib/data/Property.java @@ -124,13 +124,13 @@ public abstract class Property extends Field implements Cloneable { * */ public interface PropertyVisitor { - public RETURN visitInteger(Property property, PARAMETER data); + RETURN visitInteger(Property property, PARAMETER data); - public RETURN visitLong(Property property, PARAMETER data); + RETURN visitLong(Property property, PARAMETER data); - public RETURN visitDouble(Property property, PARAMETER data); + RETURN visitDouble(Property property, PARAMETER data); - public RETURN visitString(Property property, PARAMETER data); + RETURN visitString(Property property, PARAMETER data); } // --- children diff --git a/src/main/java/com/todoroo/andlib/utility/AndroidUtilities.java b/src/main/java/com/todoroo/andlib/utility/AndroidUtilities.java index 215a8893b..d51247a84 100644 --- a/src/main/java/com/todoroo/andlib/utility/AndroidUtilities.java +++ b/src/main/java/com/todoroo/andlib/utility/AndroidUtilities.java @@ -241,7 +241,7 @@ public class AndroidUtilities { } public interface SerializedPut { - public void put(T object, String key, char type, String value) throws NumberFormatException; + void put(T object, String key, char type, String value) throws NumberFormatException; } private static void fromSerialized(String string, T object, SerializedPut putter) { @@ -294,19 +294,6 @@ public class AndroidUtilities { return result; } - /** - * Returns true if a and b or null or a.equals(b) - */ - public static boolean equals(Object a, Object b) { - if(a == null && b == null) { - return true; - } - if(a == null) { - return false; - } - return a.equals(b); - } - /** * Copy a file from one place to another * @throws Exception diff --git a/src/main/java/com/todoroo/astrid/activity/AstridActivity.java b/src/main/java/com/todoroo/astrid/activity/AstridActivity.java index 7ddc3bbc4..6760adeb3 100644 --- a/src/main/java/com/todoroo/astrid/activity/AstridActivity.java +++ b/src/main/java/com/todoroo/astrid/activity/AstridActivity.java @@ -47,7 +47,7 @@ import javax.inject.Inject; * @author Arne * */ -public class AstridActivity extends InjectingAppCompatActivity +public abstract class AstridActivity extends InjectingAppCompatActivity implements NavigationDrawerFragment.OnFilterItemClickedListener, TaskListFragment.OnTaskListItemClickedListener { diff --git a/src/main/java/com/todoroo/astrid/activity/TaskEditFragment.java b/src/main/java/com/todoroo/astrid/activity/TaskEditFragment.java index 2935e4adc..b4911b5d5 100755 --- a/src/main/java/com/todoroo/astrid/activity/TaskEditFragment.java +++ b/src/main/java/com/todoroo/astrid/activity/TaskEditFragment.java @@ -426,8 +426,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener { Class openControl = (Class) getActivity().getIntent().getSerializableExtra(TOKEN_OPEN_CONTROL); - for (int i = 0; i < itemOrder.length; i++) { - String item = itemOrder[i]; + for (String item : itemOrder) { if (item.equals(hideAlwaysTrigger)) { break; // As soon as we hit the hide section, we're done } else { diff --git a/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java b/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java index 692fffa50..7007198cc 100644 --- a/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java +++ b/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java @@ -195,10 +195,7 @@ public class TaskListFragment extends InjectingListFragment implements OnSortSel TaskListFragment newFragment; try { newFragment = (TaskListFragment) component.newInstance(); - } catch (java.lang.InstantiationException e) { - log.error(e.getMessage(), e); - newFragment = new TaskListFragment(); - } catch (IllegalAccessException e) { + } catch (java.lang.InstantiationException | IllegalAccessException e) { log.error(e.getMessage(), e); newFragment = new TaskListFragment(); } @@ -225,7 +222,7 @@ public class TaskListFragment extends InjectingListFragment implements OnSortSel * does during the onAttach() callback */ public interface OnTaskListItemClickedListener { - public void onTaskListItemClicked(long taskId); + void onTaskListItemClicked(long taskId); } @Override diff --git a/src/main/java/com/todoroo/astrid/adapter/TaskAdapter.java b/src/main/java/com/todoroo/astrid/adapter/TaskAdapter.java index a180701ee..c301afb34 100644 --- a/src/main/java/com/todoroo/astrid/adapter/TaskAdapter.java +++ b/src/main/java/com/todoroo/astrid/adapter/TaskAdapter.java @@ -75,7 +75,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { private static final Logger log = LoggerFactory.getLogger(TaskAdapter.class); public interface OnCompletedTaskListener { - public void onCompletedTask(Task item, boolean newState); + void onCompletedTask(Task item, boolean newState); } private static final StringProperty TAGS = new StringProperty(null, "group_concat(nullif(" + TaskListFragment.TAGS_METADATA_JOIN + "." + TaskToTagMetadata.TAG_NAME.name + ", '')"+ ", ' | ')").as("tags"); diff --git a/src/main/java/com/todoroo/astrid/backup/TasksXmlExporter.java b/src/main/java/com/todoroo/astrid/backup/TasksXmlExporter.java index ce35b1986..d114417cd 100644 --- a/src/main/java/com/todoroo/astrid/backup/TasksXmlExporter.java +++ b/src/main/java/com/todoroo/astrid/backup/TasksXmlExporter.java @@ -219,7 +219,7 @@ public class TasksXmlExporter { } } - private synchronized void serializeMetadata(Task task) throws IOException { + private synchronized void serializeMetadata(Task task) { metadataDao.byTask(task.getId(), new Callback() { @Override public void apply(Metadata metadata) { @@ -296,11 +296,7 @@ public class TasksXmlExporter { xml.attribute(null, property.name, valueString); } catch (UnsupportedOperationException e) { // didn't read this value, do nothing - } catch (IllegalArgumentException e) { - throw new RuntimeException(e); - } catch (IllegalStateException e) { - throw new RuntimeException(e); - } catch (IOException e) { + } catch (IllegalArgumentException | IllegalStateException | IOException e) { throw new RuntimeException(e); } return null; diff --git a/src/main/java/com/todoroo/astrid/dao/DatabaseUpdateListener.java b/src/main/java/com/todoroo/astrid/dao/DatabaseUpdateListener.java index 307316454..290306cf2 100644 --- a/src/main/java/com/todoroo/astrid/dao/DatabaseUpdateListener.java +++ b/src/main/java/com/todoroo/astrid/dao/DatabaseUpdateListener.java @@ -1,5 +1,5 @@ package com.todoroo.astrid.dao; public interface DatabaseUpdateListener { - public void onDatabaseUpdated(); + void onDatabaseUpdated(); } diff --git a/src/main/java/com/todoroo/astrid/dao/TaskDao.java b/src/main/java/com/todoroo/astrid/dao/TaskDao.java index 029b4d259..108760e4a 100644 --- a/src/main/java/com/todoroo/astrid/dao/TaskDao.java +++ b/src/main/java/com/todoroo/astrid/dao/TaskDao.java @@ -209,7 +209,7 @@ public class TaskDao { } } - public boolean createNew(Task item) { + public void createNew(Task item) { if(!item.containsValue(Task.CREATION_DATE)) { item.setCreationDate(DateUtilities.now()); } @@ -230,12 +230,9 @@ public class TaskDao { setDefaultReminders(preferences, item); ContentValues values = item.getSetValues(); - boolean result = dao.createNew(item); - if(result) { + if(dao.createNew(item)) { afterSave(item, values); } - - return result; } public static void createDefaultHideUntil(Preferences preferences, Task item) { @@ -260,21 +257,19 @@ public class TaskDao { } } - public boolean saveExisting(Task item) { + public void saveExisting(Task item) { ContentValues values = item.getSetValues(); if(values == null || values.size() == 0) { - return false; + return; } if(!TaskApiDao.insignificantChange(values)) { if(!values.containsKey(Task.MODIFICATION_DATE.name)) { item.setModificationDate(DateUtilities.now()); } } - boolean result = dao.saveExisting(item); - if(result) { + if(dao.saveExisting(item)) { afterSave(item, values); } - return result; } private static final Property[] SQL_CONSTRAINT_MERGE_PROPERTIES = new Property[] { diff --git a/src/main/java/com/todoroo/astrid/dao/UserActivityDao.java b/src/main/java/com/todoroo/astrid/dao/UserActivityDao.java index 6b7827987..fc8bfbb69 100644 --- a/src/main/java/com/todoroo/astrid/dao/UserActivityDao.java +++ b/src/main/java/com/todoroo/astrid/dao/UserActivityDao.java @@ -20,11 +20,11 @@ public class UserActivityDao { dao = new RemoteModelDao<>(database, UserActivity.class); } - public boolean createNew(UserActivity item) { + public void createNew(UserActivity item) { if (!item.containsValue(UserActivity.CREATED_AT)) { item.setCreatedAt(DateUtilities.now()); } - return dao.createNew(item); + dao.createNew(item); } public boolean saveExisting(UserActivity item) { diff --git a/src/main/java/com/todoroo/astrid/files/FilesControlSet.java b/src/main/java/com/todoroo/astrid/files/FilesControlSet.java index 6c3885532..18fe9f57c 100644 --- a/src/main/java/com/todoroo/astrid/files/FilesControlSet.java +++ b/src/main/java/com/todoroo/astrid/files/FilesControlSet.java @@ -171,8 +171,8 @@ public class FilesControlSet extends PopupControlSet { } } - public static interface PlaybackExceptionHandler { - public void playbackFailed(); + public interface PlaybackExceptionHandler { + void playbackFailed(); } private static void play(String file, PlaybackExceptionHandler handler) { diff --git a/src/main/java/com/todoroo/astrid/gtasks/GtasksMetadataService.java b/src/main/java/com/todoroo/astrid/gtasks/GtasksMetadataService.java index afcc42811..bb6f70f97 100644 --- a/src/main/java/com/todoroo/astrid/gtasks/GtasksMetadataService.java +++ b/src/main/java/com/todoroo/astrid/gtasks/GtasksMetadataService.java @@ -55,7 +55,7 @@ public final class GtasksMetadataService { * Clears metadata information. Used when user logs out of sync provider */ public void clearMetadata() { - metadataDao.deleteWhere(Metadata.KEY.eq(getMetadataKey())); + metadataDao.deleteWhere(Metadata.KEY.eq(GtasksMetadata.METADATA_KEY)); } /** @@ -64,7 +64,7 @@ public final class GtasksMetadataService { public void saveTaskAndMetadata(GtasksTaskContainer task) { task.prepareForSaving(); taskDao.save(task.task); - synchronizeMetadata(task.task.getId(), task.metadata, getMetadataKey()); + synchronizeMetadata(task.task.getId(), task.metadata, GtasksMetadata.METADATA_KEY); } /** @@ -73,7 +73,7 @@ public final class GtasksMetadataService { */ public Metadata getTaskMetadata(long taskId) { return metadataDao.getFirst(Query.select(Metadata.PROPERTIES).where( - MetadataCriteria.byTaskAndwithKey(taskId, getMetadataKey()))); + MetadataCriteria.byTaskAndwithKey(taskId, GtasksMetadata.METADATA_KEY))); } /** @@ -118,10 +118,6 @@ public final class GtasksMetadataService { } } - private String getMetadataKey() { - return GtasksMetadata.METADATA_KEY; - } - public synchronized void findLocalMatch(GtasksTaskContainer remoteTask) { if(remoteTask.task.getId() != Task.NO_ID) { return; @@ -141,7 +137,7 @@ public final class GtasksMetadataService { private Metadata getMetadataByGtaskId(String gtaskId) { return metadataDao.getFirst(Query.select(Metadata.PROPERTIES).where(Criterion.and( - Metadata.KEY.eq(getMetadataKey()), + Metadata.KEY.eq(GtasksMetadata.METADATA_KEY), GtasksMetadata.ID.eq(gtaskId)))); } diff --git a/src/main/java/com/todoroo/astrid/gtasks/GtasksPreferenceService.java b/src/main/java/com/todoroo/astrid/gtasks/GtasksPreferenceService.java index 6abc47aae..606ef9a50 100644 --- a/src/main/java/com/todoroo/astrid/gtasks/GtasksPreferenceService.java +++ b/src/main/java/com/todoroo/astrid/gtasks/GtasksPreferenceService.java @@ -33,10 +33,6 @@ public class GtasksPreferenceService { this.preferences = preferences; } - public String getIdentifier() { - return IDENTIFIER; - } - public String getDefaultList() { return preferences.getStringValue(PREF_DEFAULT_LIST); } @@ -57,74 +53,52 @@ public class GtasksPreferenceService { protected static final String PREF_LAST_SYNC = "_last_sync"; //$NON-NLS-1$ - protected static final String PREF_LAST_ATTEMPTED_SYNC = "_last_attempted"; //$NON-NLS-1$ - - protected static final String PREF_LAST_ERROR = "_last_err"; //$NON-NLS-1$ - protected static final String PREF_ONGOING = "_ongoing"; //$NON-NLS-1$ /** * @return true if we have a token for this user, false otherwise */ public boolean isLoggedIn() { - return preferences.getStringValue(getIdentifier() + PREF_TOKEN) != null; + return preferences.getStringValue(IDENTIFIER + PREF_TOKEN) != null; } /** authentication token, or null if doesn't exist */ public String getToken() { - return preferences.getStringValue(getIdentifier() + PREF_TOKEN); + return preferences.getStringValue(IDENTIFIER + PREF_TOKEN); } /** Sets the authentication token. Set to null to clear. */ public void setToken(String setting) { - preferences.setString(getIdentifier() + PREF_TOKEN, setting); + preferences.setString(IDENTIFIER + PREF_TOKEN, setting); } /** @return Last Successful Sync Date, or 0 */ public long getLastSyncDate() { - return preferences.getLong(getIdentifier() + PREF_LAST_SYNC, 0); - } - - /** @return Last Attempted Sync Date, or 0 if it was successful */ - public long getLastAttemptedSyncDate() { - return preferences.getLong(getIdentifier() + PREF_LAST_ATTEMPTED_SYNC, 0); - } - - /** @return Last Error, or null if no last error */ - public String getLastError() { - return preferences.getStringValue(getIdentifier() + PREF_LAST_ERROR); + return preferences.getLong(IDENTIFIER + PREF_LAST_SYNC, 0); } /** @return Last Error, or null if no last error */ public boolean isOngoing() { - return preferences.getBoolean(getIdentifier() + PREF_ONGOING, false); + return preferences.getBoolean(IDENTIFIER + PREF_ONGOING, false); } /** Deletes Last Successful Sync Date */ public void clearLastSyncDate() { - preferences.clear(getIdentifier() + PREF_LAST_SYNC); - } - - /** Set Last Error */ - public void setLastError(String error) { - preferences.setString(getIdentifier() + PREF_LAST_ERROR, error); + preferences.clear(IDENTIFIER + PREF_LAST_SYNC); } /** Set Ongoing */ public void stopOngoing() { - preferences.setBoolean(getIdentifier() + PREF_ONGOING, false); + preferences.setBoolean(IDENTIFIER + PREF_ONGOING, false); } /** Set Last Successful Sync Date */ public void recordSuccessfulSync() { - preferences.setLong(getIdentifier() + PREF_LAST_SYNC, DateUtilities.now() + 1000); - preferences.setLong(getIdentifier() + PREF_LAST_ATTEMPTED_SYNC, 0); + preferences.setLong(IDENTIFIER + PREF_LAST_SYNC, DateUtilities.now() + 1000); } /** Set Last Attempted Sync Date */ public void recordSyncStart() { - preferences.setLong(getIdentifier() + PREF_LAST_ATTEMPTED_SYNC, DateUtilities.now()); - preferences.clear(getIdentifier() + PREF_LAST_ERROR); - preferences.setBoolean(getIdentifier() + PREF_ONGOING, true); + preferences.setBoolean(IDENTIFIER + PREF_ONGOING, true); } } diff --git a/src/main/java/com/todoroo/astrid/gtasks/OrderedMetadataListUpdater.java b/src/main/java/com/todoroo/astrid/gtasks/OrderedMetadataListUpdater.java index b3ec8f095..4b7c3158e 100644 --- a/src/main/java/com/todoroo/astrid/gtasks/OrderedMetadataListUpdater.java +++ b/src/main/java/com/todoroo/astrid/gtasks/OrderedMetadataListUpdater.java @@ -22,7 +22,7 @@ abstract public class OrderedMetadataListUpdater { private MetadataDao metadataDao; public interface OrderedListIterator { - public void processTask(long taskId, Metadata metadata); + void processTask(long taskId, Metadata metadata); } // --- abstract and empty @@ -297,7 +297,7 @@ abstract public class OrderedMetadataListUpdater { // --- task cascading operations public interface OrderedListNodeVisitor { - public void visitNode(Node node); + void visitNode(Node node); } /** diff --git a/src/main/java/com/todoroo/astrid/gtasks/sync/GtasksSyncV2Provider.java b/src/main/java/com/todoroo/astrid/gtasks/sync/GtasksSyncV2Provider.java index 9f47ab54f..0d9d6bda6 100644 --- a/src/main/java/com/todoroo/astrid/gtasks/sync/GtasksSyncV2Provider.java +++ b/src/main/java/com/todoroo/astrid/gtasks/sync/GtasksSyncV2Provider.java @@ -56,7 +56,6 @@ public class GtasksSyncV2Provider { public class SyncExceptionHandler { public void handleException(String tag, Exception e) { - getUtilities().setLastError(e.toString()); log.error("{}: {}", tag, e.getMessage(), e); } } @@ -64,7 +63,7 @@ public class GtasksSyncV2Provider { private final SyncExceptionHandler handler = new SyncExceptionHandler(); private void finishSync(SyncResultCallback callback) { - getUtilities().recordSuccessfulSync(); + gtasksPreferenceService.recordSuccessfulSync(); callback.finished(); } @@ -111,10 +110,6 @@ public class GtasksSyncV2Provider { return context.getString(R.string.gtasks_GPr_header); } - public GtasksPreferenceService getUtilities() { - return gtasksPreferenceService; - } - public void signOut() { gtasksPreferenceService.clearLastSyncDate(); gtasksPreferenceService.setToken(null); diff --git a/src/main/java/com/todoroo/astrid/notes/EditNoteActivity.java b/src/main/java/com/todoroo/astrid/notes/EditNoteActivity.java index 207ca3468..5a104bedb 100644 --- a/src/main/java/com/todoroo/astrid/notes/EditNoteActivity.java +++ b/src/main/java/com/todoroo/astrid/notes/EditNoteActivity.java @@ -91,8 +91,8 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene private final List listeners = new LinkedList<>(); public interface UpdatesChangedListener { - public void updatesChanged(); - public void commentAdded(); + void updatesChanged(); + void commentAdded(); } public EditNoteActivity( diff --git a/src/main/java/com/todoroo/astrid/reminders/ReminderService.java b/src/main/java/com/todoroo/astrid/reminders/ReminderService.java index 26594be1b..9031dbee9 100644 --- a/src/main/java/com/todoroo/astrid/reminders/ReminderService.java +++ b/src/main/java/com/todoroo/astrid/reminders/ReminderService.java @@ -384,7 +384,7 @@ public final class ReminderService { * Interface for testing */ public interface AlarmScheduler { - public void createAlarm(Context context, Task task, long time, int type); + void createAlarm(Context context, Task task, long time, int type); } public void setScheduler(AlarmScheduler scheduler) { diff --git a/src/main/java/com/todoroo/astrid/reminders/SnoozeCallback.java b/src/main/java/com/todoroo/astrid/reminders/SnoozeCallback.java index d3cf503b6..73f406d87 100644 --- a/src/main/java/com/todoroo/astrid/reminders/SnoozeCallback.java +++ b/src/main/java/com/todoroo/astrid/reminders/SnoozeCallback.java @@ -7,6 +7,6 @@ package com.todoroo.astrid.reminders; public interface SnoozeCallback { - public void snoozeForTime(long time); + void snoozeForTime(long time); } diff --git a/src/main/java/com/todoroo/astrid/service/StartupService.java b/src/main/java/com/todoroo/astrid/service/StartupService.java index 84f41759b..764dcccb3 100644 --- a/src/main/java/com/todoroo/astrid/service/StartupService.java +++ b/src/main/java/com/todoroo/astrid/service/StartupService.java @@ -17,7 +17,6 @@ import com.todoroo.andlib.data.DatabaseDao.ModelUpdateListener; import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.DialogUtilities; -import com.todoroo.astrid.backup.BackupConstants; import com.todoroo.astrid.backup.TasksXmlImporter; import com.todoroo.astrid.dao.Database; import com.todoroo.astrid.dao.DatabaseUpdateListener; diff --git a/src/main/java/com/todoroo/astrid/service/SynchronizeMetadataCallback.java b/src/main/java/com/todoroo/astrid/service/SynchronizeMetadataCallback.java index ce0ece695..74a10387b 100644 --- a/src/main/java/com/todoroo/astrid/service/SynchronizeMetadataCallback.java +++ b/src/main/java/com/todoroo/astrid/service/SynchronizeMetadataCallback.java @@ -3,5 +3,5 @@ package com.todoroo.astrid.service; import com.todoroo.astrid.data.Metadata; public interface SynchronizeMetadataCallback { - public void beforeDeleteMetadata(Metadata m); + void beforeDeleteMetadata(Metadata m); } diff --git a/src/main/java/com/todoroo/astrid/service/TaskService.java b/src/main/java/com/todoroo/astrid/service/TaskService.java index 4e2ba0e6f..f9c05c1eb 100644 --- a/src/main/java/com/todoroo/astrid/service/TaskService.java +++ b/src/main/java/com/todoroo/astrid/service/TaskService.java @@ -236,8 +236,8 @@ public class TaskService { * Parse quick add markup for the given task * @param tags an empty array to apply tags to */ - boolean parseQuickAddMarkup(Task task, ArrayList tags) { - return TitleParser.parse(tagService, task, tags); + void parseQuickAddMarkup(Task task, ArrayList tags) { + TitleParser.parse(tagService, task, tags); } /** diff --git a/src/main/java/com/todoroo/astrid/subtasks/AstridOrderedListUpdater.java b/src/main/java/com/todoroo/astrid/subtasks/AstridOrderedListUpdater.java index 132da2219..f8f6ffc08 100644 --- a/src/main/java/com/todoroo/astrid/subtasks/AstridOrderedListUpdater.java +++ b/src/main/java/com/todoroo/astrid/subtasks/AstridOrderedListUpdater.java @@ -29,7 +29,7 @@ public abstract class AstridOrderedListUpdater { } public interface OrderedListNodeVisitor { - public void visitNode(Node node); + void visitNode(Node node); } public static class Node { diff --git a/src/main/java/com/todoroo/astrid/subtasks/SubtasksHelper.java b/src/main/java/com/todoroo/astrid/subtasks/SubtasksHelper.java index 2e58f89b1..c682caaee 100644 --- a/src/main/java/com/todoroo/astrid/subtasks/SubtasksHelper.java +++ b/src/main/java/com/todoroo/astrid/subtasks/SubtasksHelper.java @@ -148,8 +148,8 @@ public class SubtasksHelper { return AstridOrderedListUpdater.serializeTree(tree); } - public static interface TreeRemapHelper { - public T getKeyFromOldUuid(String uuid); + public interface TreeRemapHelper { + T getKeyFromOldUuid(String uuid); } public static void remapTree(Node root, HashMap idMap, TreeRemapHelper helper) { diff --git a/src/main/java/com/todoroo/astrid/sync/SyncResultCallback.java b/src/main/java/com/todoroo/astrid/sync/SyncResultCallback.java index a8d5b1252..c36d6956e 100644 --- a/src/main/java/com/todoroo/astrid/sync/SyncResultCallback.java +++ b/src/main/java/com/todoroo/astrid/sync/SyncResultCallback.java @@ -9,10 +9,10 @@ public interface SyncResultCallback { /** * Provider started sync */ - public void started(); + void started(); /** * Provider finished sync */ - public void finished(); + void finished(); } diff --git a/src/main/java/com/todoroo/astrid/ui/AstridTimePicker.java b/src/main/java/com/todoroo/astrid/ui/AstridTimePicker.java index db1ae658b..51ab13929 100644 --- a/src/main/java/com/todoroo/astrid/ui/AstridTimePicker.java +++ b/src/main/java/com/todoroo/astrid/ui/AstridTimePicker.java @@ -37,7 +37,7 @@ public class AstridTimePicker extends LinearLayout { private boolean lastSelectionWasPm; // false for AM, true for PM public interface TimePickerEnabledChangedListener { - public void timePickerEnabledChanged(boolean hasTime); + void timePickerEnabledChanged(boolean hasTime); } public AstridTimePicker(Context context, AttributeSet attrs) { diff --git a/src/main/java/com/todoroo/astrid/ui/CalendarView.java b/src/main/java/com/todoroo/astrid/ui/CalendarView.java index d767e0bea..fa91a2646 100644 --- a/src/main/java/com/todoroo/astrid/ui/CalendarView.java +++ b/src/main/java/com/todoroo/astrid/ui/CalendarView.java @@ -73,7 +73,7 @@ public class CalendarView extends View { private int currentHighlightDay = -1; public interface OnSelectedDateListener { - public void onSelectedDate(Date date); + void onSelectedDate(Date date); } private OnSelectedDateListener onSelectedDateListener; diff --git a/src/main/java/com/todoroo/astrid/ui/DateAndTimeDialog.java b/src/main/java/com/todoroo/astrid/ui/DateAndTimeDialog.java index 4d56995ac..e07d3b1c0 100644 --- a/src/main/java/com/todoroo/astrid/ui/DateAndTimeDialog.java +++ b/src/main/java/com/todoroo/astrid/ui/DateAndTimeDialog.java @@ -19,7 +19,7 @@ import org.tasks.preferences.ActivityPreferences; public class DateAndTimeDialog extends Dialog { public interface DateAndTimeDialogListener { - public void onDateAndTimeSelected(long date); + void onDateAndTimeSelected(long date); } private final DateAndTimePicker dateAndTimePicker; diff --git a/src/main/java/com/todoroo/astrid/ui/PopupControlSet.java b/src/main/java/com/todoroo/astrid/ui/PopupControlSet.java index 8fe6741b5..2c086fea1 100644 --- a/src/main/java/com/todoroo/astrid/ui/PopupControlSet.java +++ b/src/main/java/com/todoroo/astrid/ui/PopupControlSet.java @@ -36,7 +36,8 @@ public abstract class PopupControlSet extends TaskEditControlSetBase { final PopupDialogClickListener okListener = new PopupDialogClickListener() { @Override public boolean onClick(DialogInterface d, int which) { - return onOkClick(); + onOkClick(); + return true; } }; @@ -133,13 +134,8 @@ public abstract class PopupControlSet extends TaskEditControlSetBase { // Subclasses can override } - /** - * @return true if the dialog should be dismissed as the result of - * the click. Default is true. - */ - protected boolean onOkClick() { + protected void onOkClick() { refreshDisplayView(); - return true; } protected void onCancelClick() { diff --git a/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.java b/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.java index e3307c1f7..6b3af6b9c 100644 --- a/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.java +++ b/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.java @@ -141,7 +141,7 @@ public class ReminderControlSet extends TaskEditControlSetBase implements Adapte return alertItem; } - private View addAlarmRow(final View alertItem, String text, Long timestamp, final View.OnClickListener onRemove) { + private void addAlarmRow(final View alertItem, String text, Long timestamp, final View.OnClickListener onRemove) { alertItem.setTag(timestamp); TextView display = (TextView) alertItem.findViewById(R.id.alarm_string); display.setText(text); @@ -156,7 +156,6 @@ public class ReminderControlSet extends TaskEditControlSetBase implements Adapte } }); updateSpinner(); - return alertItem; } private void updateSpinner() { diff --git a/src/main/java/com/todoroo/astrid/voice/AACRecorder.java b/src/main/java/com/todoroo/astrid/voice/AACRecorder.java index 0927e0795..b7b4cbf75 100644 --- a/src/main/java/com/todoroo/astrid/voice/AACRecorder.java +++ b/src/main/java/com/todoroo/astrid/voice/AACRecorder.java @@ -19,7 +19,7 @@ public class AACRecorder { private AACRecorderCallbacks listener; public interface AACRecorderCallbacks { - public void encodingFinished(); + void encodingFinished(); } @TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1) diff --git a/src/main/java/org/tasks/injection/InjectingActivity.java b/src/main/java/org/tasks/injection/InjectingActivity.java index b8d9b706d..f278b381d 100644 --- a/src/main/java/org/tasks/injection/InjectingActivity.java +++ b/src/main/java/org/tasks/injection/InjectingActivity.java @@ -5,7 +5,7 @@ import android.os.Bundle; import dagger.ObjectGraph; -public class InjectingActivity extends Activity implements Injector { +public abstract class InjectingActivity extends Activity implements Injector { private ObjectGraph objectGraph; @Override diff --git a/src/main/java/org/tasks/injection/InjectingAppCompatActivity.java b/src/main/java/org/tasks/injection/InjectingAppCompatActivity.java index 0e64a2a76..eeb94a0d6 100644 --- a/src/main/java/org/tasks/injection/InjectingAppCompatActivity.java +++ b/src/main/java/org/tasks/injection/InjectingAppCompatActivity.java @@ -5,7 +5,7 @@ import android.support.v7.app.AppCompatActivity; import dagger.ObjectGraph; -public class InjectingAppCompatActivity extends AppCompatActivity implements Injector { +public abstract class InjectingAppCompatActivity extends AppCompatActivity implements Injector { private ObjectGraph objectGraph; @Override diff --git a/src/main/java/org/tasks/injection/InjectingIntentService.java b/src/main/java/org/tasks/injection/InjectingIntentService.java index d200b64e8..e4e216ca1 100644 --- a/src/main/java/org/tasks/injection/InjectingIntentService.java +++ b/src/main/java/org/tasks/injection/InjectingIntentService.java @@ -3,7 +3,7 @@ package org.tasks.injection; import android.app.IntentService; import android.content.Intent; -public class InjectingIntentService extends IntentService { +public abstract class InjectingIntentService extends IntentService { public InjectingIntentService(String name) { super(name); diff --git a/src/main/java/org/tasks/injection/InjectingListActivity.java b/src/main/java/org/tasks/injection/InjectingListActivity.java index aa760b0ac..693f69f2e 100644 --- a/src/main/java/org/tasks/injection/InjectingListActivity.java +++ b/src/main/java/org/tasks/injection/InjectingListActivity.java @@ -5,7 +5,7 @@ import android.os.Bundle; import dagger.ObjectGraph; -public class InjectingListActivity extends ListActivity implements Injector { +public abstract class InjectingListActivity extends ListActivity implements Injector { private ObjectGraph objectGraph; @Override diff --git a/src/main/java/org/tasks/ui/NavigationDrawerFragment.java b/src/main/java/org/tasks/ui/NavigationDrawerFragment.java index 32653a7f4..535a5b8a2 100644 --- a/src/main/java/org/tasks/ui/NavigationDrawerFragment.java +++ b/src/main/java/org/tasks/ui/NavigationDrawerFragment.java @@ -45,7 +45,6 @@ import org.tasks.injection.ForApplication; import org.tasks.injection.InjectingFragment; import org.tasks.preferences.AppearancePreferences; import org.tasks.preferences.BasicPreferences; -import org.tasks.preferences.Preferences; import javax.inject.Inject; @@ -85,7 +84,6 @@ public class NavigationDrawerFragment extends InjectingFragment { private int mCurrentSelectedPosition = 0; @Inject FilterCounter filterCounter; - @Inject Preferences preferences; @Inject FilterProvider filterProvider; @Inject @ForApplication Context context; @@ -383,7 +381,7 @@ public class NavigationDrawerFragment extends InjectingFragment { } public interface OnFilterItemClickedListener { - public boolean onFilterItemClicked(FilterListItem item); + boolean onFilterItemClicked(FilterListItem item); } public void clear() { @@ -429,10 +427,6 @@ public class NavigationDrawerFragment extends InjectingFragment { new IntentFilter(AstridApiConstants.BROADCAST_EVENT_REFRESH)); } - public void restoreLastSelected() { - selectItem(mCurrentSelectedPosition); - } - /** * Receiver which receives refresh intents * diff --git a/src/main/res/drawable-hdpi/ic_action_help_white.png b/src/main/res/drawable-hdpi/ic_action_help_white.png deleted file mode 100644 index a88801f87..000000000 Binary files a/src/main/res/drawable-hdpi/ic_action_help_white.png and /dev/null differ diff --git a/src/main/res/drawable-xhdpi/ic_action_help_white.png b/src/main/res/drawable-xhdpi/ic_action_help_white.png deleted file mode 100644 index 849292b62..000000000 Binary files a/src/main/res/drawable-xhdpi/ic_action_help_white.png and /dev/null differ diff --git a/src/main/res/drawable-xxhdpi/ic_action_help_white.png b/src/main/res/drawable-xxhdpi/ic_action_help_white.png deleted file mode 100644 index c49a9f8d0..000000000 Binary files a/src/main/res/drawable-xxhdpi/ic_action_help_white.png and /dev/null differ diff --git a/src/main/res/drawable/ic_action_help_white.png b/src/main/res/drawable/ic_action_help_white.png deleted file mode 100644 index 67d720016..000000000 Binary files a/src/main/res/drawable/ic_action_help_white.png and /dev/null differ diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml index 67bc2d26f..576f13776 100644 --- a/src/main/res/values/styles.xml +++ b/src/main/res/values/styles.xml @@ -204,10 +204,4 @@ 18sp -