diff --git a/app/src/androidTest/java/com/todoroo/andlib/test/TranslationTests.java b/app/src/androidTest/java/com/todoroo/andlib/test/TranslationTests.java index 5aaaa55b1..d8cb7c4ad 100644 --- a/app/src/androidTest/java/com/todoroo/andlib/test/TranslationTests.java +++ b/app/src/androidTest/java/com/todoroo/andlib/test/TranslationTests.java @@ -125,7 +125,7 @@ public class TranslationTests { } }); - assertTrue(failures.toString(), errorCount(failures) == 0); + assertEquals(failures.toString(), 0, errorCount(failures)); } /** check if string contains contains substrings */ diff --git a/app/src/androidTest/java/com/todoroo/astrid/sync/SyncModelTest.java b/app/src/androidTest/java/com/todoroo/astrid/sync/SyncModelTest.java index 805f4ffa2..6eb020da5 100644 --- a/app/src/androidTest/java/com/todoroo/astrid/sync/SyncModelTest.java +++ b/app/src/androidTest/java/com/todoroo/astrid/sync/SyncModelTest.java @@ -1,6 +1,6 @@ package com.todoroo.astrid.sync; -import static junit.framework.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import androidx.test.ext.junit.runners.AndroidJUnit4; import com.todoroo.astrid.data.Task; @@ -14,12 +14,12 @@ public class SyncModelTest extends NewSyncTestCase { @Test public void testCreateTaskMakesUuid() { Task task = createTask(); - assertFalse(Task.NO_UUID.equals(task.getUuid())); + assertNotEquals(Task.NO_UUID, task.getUuid()); } @Test public void testCreateTagMakesUuid() { TagData tag = createTagData(); - assertFalse(Task.NO_UUID.equals(tag.getRemoteId())); + assertNotEquals(Task.NO_UUID, tag.getRemoteId()); } } diff --git a/app/src/androidTest/java/org/tasks/data/LocationDaoTest.kt b/app/src/androidTest/java/org/tasks/data/LocationDaoTest.kt index b5f273952..4f9a92edb 100644 --- a/app/src/androidTest/java/org/tasks/data/LocationDaoTest.kt +++ b/app/src/androidTest/java/org/tasks/data/LocationDaoTest.kt @@ -37,7 +37,7 @@ class LocationDaoTest : InjectingTestCase() { @Test fun getPlaceWithLessPrecision() { - locationDao.insert(newPlace(with(LATITUDE, 50.7547), with(LONGITUDE, -2.2279))); + locationDao.insert(newPlace(with(LATITUDE, 50.7547), with(LONGITUDE, -2.2279))) val place = locationDao.findPlace(50.754712.toLikeString(), (-2.227945).toLikeString()) assertEquals(50.7547, place?.latitude) assertEquals(-2.2279, place?.longitude) diff --git a/app/src/androidTest/java/org/tasks/makers/GeofenceMaker.kt b/app/src/androidTest/java/org/tasks/makers/GeofenceMaker.kt index dbbe971f1..1e5346972 100644 --- a/app/src/androidTest/java/org/tasks/makers/GeofenceMaker.kt +++ b/app/src/androidTest/java/org/tasks/makers/GeofenceMaker.kt @@ -4,9 +4,7 @@ import com.natpryce.makeiteasy.Instantiator import com.natpryce.makeiteasy.Property import com.natpryce.makeiteasy.PropertyLookup import com.natpryce.makeiteasy.PropertyValue -import com.todoroo.astrid.helper.UUIDHelper import org.tasks.data.Geofence -import org.tasks.data.Place object GeofenceMaker { val PLACE: Property = Property.newProperty() diff --git a/app/src/main/java/com/todoroo/andlib/sql/Field.java b/app/src/main/java/com/todoroo/andlib/sql/Field.java index c35b4998f..2a3a9af06 100644 --- a/app/src/main/java/com/todoroo/andlib/sql/Field.java +++ b/app/src/main/java/com/todoroo/andlib/sql/Field.java @@ -6,7 +6,6 @@ package com.todoroo.andlib.sql; -import static com.todoroo.andlib.sql.SqlConstants.COMMA; import static com.todoroo.andlib.sql.SqlConstants.LEFT_PARENTHESIS; import static com.todoroo.andlib.sql.SqlConstants.RIGHT_PARENTHESIS; import static com.todoroo.andlib.sql.SqlConstants.SPACE; @@ -28,13 +27,6 @@ public class Field extends DBObject { return UnaryCriterion.eq(this, value); } - public Criterion neq(Object value) { - if (value == null) { - return UnaryCriterion.isNotNull(this); - } - return UnaryCriterion.neq(this, value); - } - public Criterion gt(Object value) { return UnaryCriterion.gt(this, value); } @@ -55,26 +47,6 @@ public class Field extends DBObject { return UnaryCriterion.like(this, value); } - public Criterion in(final Iterable value) { - final Field field = this; - return new Criterion(Operator.in) { - - @Override - protected void populate(StringBuilder sb) { - sb.append(field) - .append(SPACE) - .append(Operator.in) - .append(SPACE) - .append(LEFT_PARENTHESIS) - .append(SPACE); - for (T t : value) { - sb.append(t.toString()).append(COMMA); - } - sb.deleteCharAt(sb.length() - 1).append(RIGHT_PARENTHESIS); - } - }; - } - public Criterion in(final Query query) { final Field field = this; return new Criterion(Operator.in) { diff --git a/app/src/main/java/com/todoroo/andlib/sql/Operator.java b/app/src/main/java/com/todoroo/andlib/sql/Operator.java index ff312e12d..89239f649 100644 --- a/app/src/main/java/com/todoroo/andlib/sql/Operator.java +++ b/app/src/main/java/com/todoroo/andlib/sql/Operator.java @@ -13,11 +13,8 @@ public final class Operator { public static final Operator and = new Operator("AND"); public static final Operator or = new Operator("OR"); public static final Operator not = new Operator("NOT"); - public static final Operator exists = new Operator("EXISTS"); public static final Operator like = new Operator("LIKE"); public static final Operator in = new Operator("IN"); - static final Operator neq = new Operator("<>"); - static final Operator isNotNull = new Operator("IS NOT NULL"); static final Operator gt = new Operator(">"); static final Operator gte = new Operator(">="); static final Operator lt = new Operator("<"); diff --git a/app/src/main/java/com/todoroo/andlib/sql/QueryTemplate.java b/app/src/main/java/com/todoroo/andlib/sql/QueryTemplate.java index 6b51f3ed1..6833e2c98 100644 --- a/app/src/main/java/com/todoroo/andlib/sql/QueryTemplate.java +++ b/app/src/main/java/com/todoroo/andlib/sql/QueryTemplate.java @@ -7,7 +7,6 @@ package com.todoroo.andlib.sql; import static com.todoroo.andlib.sql.SqlConstants.COMMA; -import static com.todoroo.andlib.sql.SqlConstants.LIMIT; import static com.todoroo.andlib.sql.SqlConstants.ORDER_BY; import static com.todoroo.andlib.sql.SqlConstants.SPACE; import static com.todoroo.andlib.sql.SqlConstants.WHERE; @@ -25,7 +24,6 @@ public final class QueryTemplate { private final ArrayList criterions = new ArrayList<>(); private final ArrayList joins = new ArrayList<>(); private final ArrayList orders = new ArrayList<>(); - private Integer limit = null; public QueryTemplate join(Join... join) { joins.addAll(asList(join)); @@ -48,9 +46,6 @@ public final class QueryTemplate { visitJoinClause(sql); visitWhereClause(sql); visitOrderByClause(sql); - if (limit != null) { - sql.append(LIMIT).append(SPACE).append(limit); - } return sql.toString(); } @@ -80,9 +75,4 @@ public final class QueryTemplate { sql.append(join).append(SPACE); } } - - public QueryTemplate limit(int limitValue) { - this.limit = limitValue; - return this; - } } diff --git a/app/src/main/java/com/todoroo/andlib/sql/SqlConstants.java b/app/src/main/java/com/todoroo/andlib/sql/SqlConstants.java index fa11ad4e0..991724d13 100644 --- a/app/src/main/java/com/todoroo/andlib/sql/SqlConstants.java +++ b/app/src/main/java/com/todoroo/andlib/sql/SqlConstants.java @@ -10,16 +10,15 @@ public final class SqlConstants { public static final Field COUNT = Field.field("COUNT(*)"); public static final String SELECT = "SELECT"; - public static final String SPACE = " "; + static final String SPACE = " "; public static final String AS = "AS"; public static final String FROM = "FROM"; public static final String ON = "ON"; - public static final String ALL = "*"; + static final String ALL = "*"; public static final String AND = "AND"; public static final String OR = "OR"; public static final String WHERE = "WHERE"; public static final String NOT = "NOT"; - public static final String LIMIT = "LIMIT"; static final String COMMA = ","; static final String JOIN = "JOIN"; static final String LEFT_PARENTHESIS = "("; diff --git a/app/src/main/java/com/todoroo/andlib/sql/UnaryCriterion.java b/app/src/main/java/com/todoroo/andlib/sql/UnaryCriterion.java index 118e75013..30c5d98f9 100644 --- a/app/src/main/java/com/todoroo/andlib/sql/UnaryCriterion.java +++ b/app/src/main/java/com/todoroo/andlib/sql/UnaryCriterion.java @@ -28,10 +28,6 @@ public class UnaryCriterion extends Criterion { return input.replace("'", "''"); } - static Criterion neq(Field field, Object value) { - return new UnaryCriterion(field, Operator.neq, value); - } - static Criterion gt(Field field, Object value) { return new UnaryCriterion(field, Operator.gt, value); } @@ -57,15 +53,6 @@ public class UnaryCriterion extends Criterion { }; } - static Criterion isNotNull(Field field) { - return new UnaryCriterion(field, Operator.isNotNull, null) { - @Override - protected void populateOperator(StringBuilder sb) { - sb.append(SPACE).append(operator); - } - }; - } - public static Criterion like(Field field, String value) { return new UnaryCriterion(field, Operator.like, value) { @Override @@ -87,7 +74,6 @@ public class UnaryCriterion extends Criterion { sb.append(expression); } - @SuppressWarnings("WeakerAccess") void populateOperator(StringBuilder sb) { sb.append(operator); } diff --git a/app/src/main/java/com/todoroo/astrid/activity/BeastModePreferences.java b/app/src/main/java/com/todoroo/astrid/activity/BeastModePreferences.java index cd9523563..7665d2dae 100644 --- a/app/src/main/java/com/todoroo/astrid/activity/BeastModePreferences.java +++ b/app/src/main/java/com/todoroo/astrid/activity/BeastModePreferences.java @@ -110,14 +110,12 @@ public class BeastModePreferences extends ThemedInjectingAppCompatActivity @Override public boolean onMenuItemClick(MenuItem item) { - switch (item.getItemId()) { - case R.id.menu_reset_to_defaults: - String[] prefsArray = getResources().getStringArray(R.array.TEA_control_sets_prefs); - adapter.setItems(asList(prefsArray)); - return true; - default: - return onOptionsItemSelected(item); + if (item.getItemId() == R.id.menu_reset_to_defaults) { + String[] prefsArray = getResources().getStringArray(R.array.TEA_control_sets_prefs); + adapter.setItems(asList(prefsArray)); + return true; } + return onOptionsItemSelected(item); } @Override diff --git a/app/src/main/java/com/todoroo/astrid/adapter/FilterAdapter.java b/app/src/main/java/com/todoroo/astrid/adapter/FilterAdapter.java index 665b026fa..c5229703e 100644 --- a/app/src/main/java/com/todoroo/astrid/adapter/FilterAdapter.java +++ b/app/src/main/java/com/todoroo/astrid/adapter/FilterAdapter.java @@ -146,12 +146,6 @@ public class FilterAdapter extends BaseAdapter { return newArrayList(items); } - public int indexOf(FilterListItem item, int defaultValue) { - assertMainThread(); - int index = items.indexOf(item); - return index == -1 ? defaultValue : index; - } - @NonNull @Override public View getView(int position, View convertView, @NonNull ViewGroup parent) { diff --git a/app/src/main/java/com/todoroo/astrid/adapter/FilterViewHolder.java b/app/src/main/java/com/todoroo/astrid/adapter/FilterViewHolder.java index 95ad2853f..3f10bf2bc 100644 --- a/app/src/main/java/com/todoroo/astrid/adapter/FilterViewHolder.java +++ b/app/src/main/java/com/todoroo/astrid/adapter/FilterViewHolder.java @@ -3,7 +3,6 @@ package com.todoroo.astrid.adapter; import static com.todoroo.andlib.utility.AndroidUtilities.preLollipop; import android.app.Activity; -import android.content.Intent; import android.content.res.ColorStateList; import android.graphics.drawable.Drawable; import android.view.View; @@ -27,7 +26,6 @@ import org.tasks.R; import org.tasks.billing.Inventory; import org.tasks.filters.PlaceFilter; import org.tasks.locale.Locale; -import org.tasks.preferences.SyncPreferences; import org.tasks.themes.ColorProvider; import org.tasks.themes.CustomIcons; import org.tasks.themes.DrawableUtil; @@ -99,15 +97,6 @@ public class FilterViewHolder extends RecyclerView.ViewHolder { } } - FilterViewHolder(@NonNull View itemView, Activity activity) { - super(itemView); - - ButterKnife.bind(this, itemView); - - icon.setOnClickListener( - v -> activity.startActivity(new Intent(activity, SyncPreferences.class))); - } - FilterViewHolder(@NonNull View itemView) { super(itemView); } diff --git a/app/src/main/java/com/todoroo/astrid/adapter/NavigationDrawerAdapter.java b/app/src/main/java/com/todoroo/astrid/adapter/NavigationDrawerAdapter.java index cc6c7795e..0ab8c83a3 100644 --- a/app/src/main/java/com/todoroo/astrid/adapter/NavigationDrawerAdapter.java +++ b/app/src/main/java/com/todoroo/astrid/adapter/NavigationDrawerAdapter.java @@ -103,10 +103,6 @@ public class NavigationDrawerAdapter extends RecyclerView.Adapter { return differ.getCurrentList().size(); } - public Filter getSelected() { - return selected; - } - public void setSelected(Filter selected) { this.selected = selected; notifyDataSetChanged(); diff --git a/app/src/main/java/com/todoroo/astrid/core/CustomFilterActivity.java b/app/src/main/java/com/todoroo/astrid/core/CustomFilterActivity.java index 33d44a19f..3c6abb0d2 100644 --- a/app/src/main/java/com/todoroo/astrid/core/CustomFilterActivity.java +++ b/app/src/main/java/com/todoroo/astrid/core/CustomFilterActivity.java @@ -304,10 +304,9 @@ public class CustomFilterActivity extends ThemedInjectingAppCompatActivity @Override public boolean onMenuItemClick(MenuItem item) { - switch (item.getItemId()) { - case R.id.menu_save: - saveAndView(); - return true; + if (item.getItemId() == R.id.menu_save) { + saveAndView(); + return true; } return onOptionsItemSelected(item); } diff --git a/app/src/main/java/com/todoroo/astrid/core/CustomFilterAdapter.java b/app/src/main/java/com/todoroo/astrid/core/CustomFilterAdapter.java index 94c4c2a5e..d4ae607bd 100644 --- a/app/src/main/java/com/todoroo/astrid/core/CustomFilterAdapter.java +++ b/app/src/main/java/com/todoroo/astrid/core/CustomFilterAdapter.java @@ -206,8 +206,7 @@ class CustomFilterAdapter extends ArrayAdapter { viewHolder.filterCount.setText(locale.formatNumber(item.end)); } - private class ViewHolder { - + private static class ViewHolder { CriterionInstance item; ImageView type; TextView name; diff --git a/app/src/main/java/com/todoroo/astrid/core/SortHelper.java b/app/src/main/java/com/todoroo/astrid/core/SortHelper.java index 35c35ddec..580ac3796 100644 --- a/app/src/main/java/com/todoroo/astrid/core/SortHelper.java +++ b/app/src/main/java/com/todoroo/astrid/core/SortHelper.java @@ -10,10 +10,8 @@ import static org.tasks.db.QueryUtils.showCompleted; import static org.tasks.db.QueryUtils.showHidden; import static org.tasks.db.QueryUtils.showRecentlyCompleted; -import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Functions; import com.todoroo.andlib.sql.Order; -import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.astrid.data.Task; import org.tasks.R; import org.tasks.preferences.Preferences; diff --git a/app/src/main/java/com/todoroo/astrid/files/FilesControlSet.java b/app/src/main/java/com/todoroo/astrid/files/FilesControlSet.java index 583e5cfa9..9208f9777 100644 --- a/app/src/main/java/com/todoroo/astrid/files/FilesControlSet.java +++ b/app/src/main/java/com/todoroo/astrid/files/FilesControlSet.java @@ -86,7 +86,7 @@ public class FilesControlSet extends TaskEditControlFragment { } @OnClick(R.id.add_attachment) - void addAttachment(View view) { + void addAttachment() { newAddAttachmentDialog(this).show(getParentFragmentManager(), FRAG_TAG_ADD_ATTACHMENT_DIALOG); } diff --git a/app/src/main/java/com/todoroo/astrid/service/TaskMover.java b/app/src/main/java/com/todoroo/astrid/service/TaskMover.java index 05da5eae7..f03b0f91e 100644 --- a/app/src/main/java/com/todoroo/astrid/service/TaskMover.java +++ b/app/src/main/java/com/todoroo/astrid/service/TaskMover.java @@ -8,7 +8,6 @@ import static com.todoroo.andlib.utility.DateUtilities.now; import static java.util.Collections.emptyList; import androidx.annotation.Nullable; -import com.google.common.collect.Lists; import com.todoroo.astrid.api.CaldavFilter; import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.GtasksFilter; diff --git a/app/src/main/java/com/todoroo/astrid/subtasks/SubtasksFilterUpdater.java b/app/src/main/java/com/todoroo/astrid/subtasks/SubtasksFilterUpdater.java index 458aee468..d4f063fc6 100644 --- a/app/src/main/java/com/todoroo/astrid/subtasks/SubtasksFilterUpdater.java +++ b/app/src/main/java/com/todoroo/astrid/subtasks/SubtasksFilterUpdater.java @@ -157,10 +157,7 @@ public class SubtasksFilterUpdater { private void verifyTreeModel(TaskListMetadata list, Filter filter) { boolean changedThings = false; Set keySet = idToNode.keySet(); - Set currentIds = new HashSet<>(); - for (String id : keySet) { - currentIds.add(id); - } + Set currentIds = new HashSet<>(keySet); Set idsInQuery = new HashSet<>(); String sql = filter.getSqlQuery().replaceAll("ORDER BY .*", ""); // $NON-NLS-1$//$NON-NLS-2$ sql = sql + " ORDER BY created"; // $NON-NLS-1$ @@ -214,7 +211,7 @@ public class SubtasksFilterUpdater { private String[] getOrderedIds() { ArrayList ids = new ArrayList<>(); orderedIdHelper(treeRoot, ids); - return ids.toArray(new String[ids.size()]); + return ids.toArray(new String[0]); } private String getOrderString() { diff --git a/app/src/main/java/com/todoroo/astrid/subtasks/SubtasksHelper.java b/app/src/main/java/com/todoroo/astrid/subtasks/SubtasksHelper.java index d11be95fc..cfe2d9873 100644 --- a/app/src/main/java/com/todoroo/astrid/subtasks/SubtasksHelper.java +++ b/app/src/main/java/com/todoroo/astrid/subtasks/SubtasksHelper.java @@ -8,7 +8,6 @@ import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.GtasksFilter; import com.todoroo.astrid.core.BuiltInFilterExposer; import com.todoroo.astrid.dao.TaskDao; -import com.todoroo.astrid.dao.TaskDao.TaskCriteria; import com.todoroo.astrid.data.Task; import com.todoroo.astrid.subtasks.SubtasksFilterUpdater.Node; import java.util.ArrayList; @@ -71,7 +70,7 @@ public class SubtasksHelper { ids.add(idString); } } - return ids.toArray(new String[ids.size()]); + return ids.toArray(new String[0]); } /** Takes a subtasks string containing local ids and remaps it to one containing UUIDs */ @@ -107,7 +106,7 @@ public class SubtasksHelper { root, idMap, uuid -> { - Long localId = -1L; + long localId = -1L; try { localId = Long.parseLong(uuid); } catch (NumberFormatException e) { diff --git a/app/src/main/java/com/todoroo/astrid/sync/SyncResultCallback.java b/app/src/main/java/com/todoroo/astrid/sync/SyncResultCallback.java deleted file mode 100644 index 035f8e746..000000000 --- a/app/src/main/java/com/todoroo/astrid/sync/SyncResultCallback.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2012 Todoroo Inc - * - * See the file "LICENSE" for the full license governing this code. - */ - -package com.todoroo.astrid.sync; - -public interface SyncResultCallback { - - /** Provider started sync */ - void started(); - - /** Provider finished sync */ - void finished(); -} diff --git a/app/src/main/java/com/todoroo/astrid/timers/TimerControlSet.java b/app/src/main/java/com/todoroo/astrid/timers/TimerControlSet.java index 6b01fa1b6..a111e3105 100644 --- a/app/src/main/java/com/todoroo/astrid/timers/TimerControlSet.java +++ b/app/src/main/java/com/todoroo/astrid/timers/TimerControlSet.java @@ -135,7 +135,7 @@ public class TimerControlSet extends TaskEditControlFragment { } @OnClick(R.id.timer_container) - void timerClicked(View view) { + void timerClicked() { if (timerActive()) { Task task = callback.stopTimer(); elapsed.setTimeDuration(task.getElapsedSeconds()); diff --git a/app/src/main/java/com/todoroo/astrid/ui/HideUntilControlSet.java b/app/src/main/java/com/todoroo/astrid/ui/HideUntilControlSet.java index d8fe7ccb7..b67cee2b0 100644 --- a/app/src/main/java/com/todoroo/astrid/ui/HideUntilControlSet.java +++ b/app/src/main/java/com/todoroo/astrid/ui/HideUntilControlSet.java @@ -82,7 +82,7 @@ public class HideUntilControlSet extends TaskEditControlFragment implements OnIt private HideUntilValue selectedValue; @OnClick(R.id.clear) - void clearHideUntil(View view) { + void clearHideUntil() { updateSpinnerOptions(0); selection = 0; spinner.setSelection(selection); @@ -337,7 +337,7 @@ public class HideUntilControlSet extends TaskEditControlFragment implements OnIt * * @author Tim Su */ - private class HideUntilValue { + private static class HideUntilValue { final String labelSpinner; final String labelDisplay; diff --git a/app/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.java b/app/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.java index 1b929ca65..33e36d5c7 100644 --- a/app/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.java +++ b/app/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.java @@ -151,7 +151,7 @@ public class ReminderControlSet extends TaskEditControlFragment { } @OnClick(R.id.alarms_add) - void addAlarm(View view) { + void addAlarm() { List options = getOptions(); if (options.size() == 1) { addNewAlarm(); diff --git a/app/src/main/java/com/todoroo/astrid/utility/TitleParser.java b/app/src/main/java/com/todoroo/astrid/utility/TitleParser.java index 289e168b4..520bdae8f 100644 --- a/app/src/main/java/com/todoroo/astrid/utility/TitleParser.java +++ b/app/src/main/java/com/todoroo/astrid/utility/TitleParser.java @@ -175,7 +175,7 @@ public class TitleParser { private static void dayHelper(Task task) { String inputText = task.getTitle(); Calendar cal = null; - Boolean containsSpecificTime = false; + boolean containsSpecificTime = false; String[] daysOfWeek = { "(?i)(\\(|\\b)today(\\)|\\b)", "(?i)(\\(|\\b)tomorrow(\\)|\\b)", diff --git a/app/src/main/java/org/tasks/activities/FilterSettingsActivity.java b/app/src/main/java/org/tasks/activities/FilterSettingsActivity.java index ba4c4591f..dd317f629 100644 --- a/app/src/main/java/org/tasks/activities/FilterSettingsActivity.java +++ b/app/src/main/java/org/tasks/activities/FilterSettingsActivity.java @@ -65,7 +65,7 @@ public class FilterSettingsActivity extends BaseListSettingsActivity { } @OnTextChanged(R.id.name) - void onTextChanged(CharSequence ignored) { + void onTextChanged() { nameLayout.setError(null); } diff --git a/app/src/main/java/org/tasks/activities/TagSettingsActivity.java b/app/src/main/java/org/tasks/activities/TagSettingsActivity.java index b53344c96..15de6b58f 100644 --- a/app/src/main/java/org/tasks/activities/TagSettingsActivity.java +++ b/app/src/main/java/org/tasks/activities/TagSettingsActivity.java @@ -86,7 +86,7 @@ public class TagSettingsActivity extends BaseListSettingsActivity { } @OnTextChanged(R.id.name) - void onTextChanged(CharSequence ignored) { + void onTextChanged() { nameLayout.setError(null); } diff --git a/app/src/main/java/org/tasks/backup/TasksJsonExporter.java b/app/src/main/java/org/tasks/backup/TasksJsonExporter.java index 12a46350c..c03b27475 100755 --- a/app/src/main/java/org/tasks/backup/TasksJsonExporter.java +++ b/app/src/main/java/org/tasks/backup/TasksJsonExporter.java @@ -261,7 +261,6 @@ public class TasksJsonExporter { public enum ExportType { EXPORT_TYPE_SERVICE, - EXPORT_TYPE_MANUAL, - EXPORT_TYPE_ON_UPGRADE + EXPORT_TYPE_MANUAL } } diff --git a/app/src/main/java/org/tasks/backup/XmlReader.java b/app/src/main/java/org/tasks/backup/XmlReader.java index 55a0b8611..ecb1c4738 100644 --- a/app/src/main/java/org/tasks/backup/XmlReader.java +++ b/app/src/main/java/org/tasks/backup/XmlReader.java @@ -51,13 +51,6 @@ public class XmlReader { return value == null || XML_NULL.equals(value) ? null : Double.parseDouble(value); } - public void readDouble(String name, ValueWriter writer) { - Double value = readDouble(name); - if (value != null) { - writer.write(value); - } - } - public interface ValueWriter { void write(T value); diff --git a/app/src/main/java/org/tasks/caldav/BaseCaldavCalendarSettingsActivity.java b/app/src/main/java/org/tasks/caldav/BaseCaldavCalendarSettingsActivity.java index cfdc945b3..99d93a43c 100644 --- a/app/src/main/java/org/tasks/caldav/BaseCaldavCalendarSettingsActivity.java +++ b/app/src/main/java/org/tasks/caldav/BaseCaldavCalendarSettingsActivity.java @@ -103,7 +103,7 @@ public abstract class BaseCaldavCalendarSettingsActivity extends BaseListSetting } @OnTextChanged(R.id.name) - void onNameChanged(CharSequence text) { + void onNameChanged() { nameLayout.setError(null); } diff --git a/app/src/main/java/org/tasks/caldav/PatchableDavResource.kt b/app/src/main/java/org/tasks/caldav/PatchableDavResource.kt index 6dfd7247d..b5ba7eb16 100644 --- a/app/src/main/java/org/tasks/caldav/PatchableDavResource.kt +++ b/app/src/main/java/org/tasks/caldav/PatchableDavResource.kt @@ -10,12 +10,8 @@ import okhttp3.RequestBody import okhttp3.Response import java.io.IOException import java.net.HttpURLConnection -import java.util.logging.Logger -class PatchableDavResource : DavResource { - constructor(client: OkHttpClient, url: HttpUrl, log: Logger) : super(client, url, log) - - constructor(client: OkHttpClient, url: HttpUrl) : super(client, url) +class PatchableDavResource(client: OkHttpClient, url: HttpUrl) : DavResource(client, url) { /** * Sends a PROPPATCH request to this resource. Follows up to [MAX_REDIRECTS] redirects. diff --git a/app/src/main/java/org/tasks/caldav/Response.java b/app/src/main/java/org/tasks/caldav/Response.java index 72250e334..67d2a9cc4 100644 --- a/app/src/main/java/org/tasks/caldav/Response.java +++ b/app/src/main/java/org/tasks/caldav/Response.java @@ -1,42 +1,19 @@ package org.tasks.caldav; -import java.io.IOException; import kotlin.Unit; import kotlin.jvm.functions.Function1; -import timber.log.Timber; -public class Response implements Function1 { +class Response implements Function1 { - private final boolean parseBody; private okhttp3.Response response; - private String body; - - public Response() { - this(false); - } - - public Response(boolean parseBody) { - this.parseBody = parseBody; - } @Override public Unit invoke(okhttp3.Response response) { this.response = response; - if (parseBody) { - try { - body = response.body().string(); - } catch (IOException e) { - Timber.e(e); - } - } return null; } public okhttp3.Response get() { return response; } - - public String getBody() { - return body; - } } diff --git a/app/src/main/java/org/tasks/calendars/CalendarPicker.java b/app/src/main/java/org/tasks/calendars/CalendarPicker.java index fab7be306..6f453657f 100644 --- a/app/src/main/java/org/tasks/calendars/CalendarPicker.java +++ b/app/src/main/java/org/tasks/calendars/CalendarPicker.java @@ -58,7 +58,7 @@ public class CalendarPicker extends InjectingDialogFragment { adapter = new SingleCheckedArrayAdapter(getActivity(), calendarNames, theme.getThemeAccent()) { @Override - protected int getDrawable(int position) { + protected int getDrawable() { return R.drawable.ic_outline_event_24px; } diff --git a/app/src/main/java/org/tasks/data/CaldavDao.java b/app/src/main/java/org/tasks/data/CaldavDao.java index db4d47f65..7be78a27d 100644 --- a/app/src/main/java/org/tasks/data/CaldavDao.java +++ b/app/src/main/java/org/tasks/data/CaldavDao.java @@ -132,9 +132,6 @@ public abstract class CaldavDao { @Query("SELECT * FROM caldav_lists WHERE cdl_account = :account AND cdl_url = :url LIMIT 1") public abstract CaldavCalendar getCalendarByUrl(String account, String url); - @Query("SELECT * FROM caldav_accounts WHERE cda_name = :name COLLATE NOCASE LIMIT 1") - public abstract CaldavAccount getAccountByName(String name); - @Query( "SELECT caldav_accounts.* from caldav_accounts" + " INNER JOIN caldav_tasks ON cd_task = :task" diff --git a/app/src/main/java/org/tasks/data/GoogleTask.java b/app/src/main/java/org/tasks/data/GoogleTask.java index e9d9ee8f2..c714cba08 100644 --- a/app/src/main/java/org/tasks/data/GoogleTask.java +++ b/app/src/main/java/org/tasks/data/GoogleTask.java @@ -22,9 +22,6 @@ public class GoogleTask { public static final Table TABLE = new Table("google_tasks"); - public static final Property.IntegerProperty ORDER = - new Property.IntegerProperty(GoogleTask.TABLE, "gt_order"); - public static final Property.IntegerProperty PARENT = new Property.IntegerProperty(TABLE, "gt_parent"); @@ -135,10 +132,6 @@ public class GoogleTask { this.moved = moved; } - public int getIndent() { - return parent > 0 ? 1 : 0; - } - public long getRemoteOrder() { return remoteOrder; } diff --git a/app/src/main/java/org/tasks/data/GoogleTaskDao.java b/app/src/main/java/org/tasks/data/GoogleTaskDao.java index ca6111f70..616c37cbe 100644 --- a/app/src/main/java/org/tasks/data/GoogleTaskDao.java +++ b/app/src/main/java/org/tasks/data/GoogleTaskDao.java @@ -127,7 +127,7 @@ public abstract class GoogleTaskDao { @Query("SELECT gt_task FROM google_tasks WHERE gt_remote_id = :remoteId") public abstract long getTask(String remoteId); - @SuppressWarnings({RoomWarnings.CURSOR_MISMATCH, "AndroidUnresolvedRoomSqlReference"}) + @SuppressWarnings({RoomWarnings.CURSOR_MISMATCH}) @Query( "SELECT google_tasks.*, gt_order AS primary_sort, NULL AS secondary_sort FROM google_tasks JOIN tasks ON tasks._id = gt_task WHERE gt_parent = 0 AND gt_list_id = :listId AND tasks.deleted = 0 UNION SELECT c.*, p.gt_order AS primary_sort, c.gt_order AS secondary_sort FROM google_tasks AS c LEFT JOIN google_tasks AS p ON c.gt_parent = p.gt_task JOIN tasks ON tasks._id = c.gt_task WHERE c.gt_parent > 0 AND c.gt_list_id = :listId AND tasks.deleted = 0 ORDER BY primary_sort ASC, secondary_sort ASC") abstract List getByLocalOrder(String listId); diff --git a/app/src/main/java/org/tasks/data/Location.java b/app/src/main/java/org/tasks/data/Location.java index 3b6ebd9ef..d836eed82 100644 --- a/app/src/main/java/org/tasks/data/Location.java +++ b/app/src/main/java/org/tasks/data/Location.java @@ -40,90 +40,38 @@ public class Location implements Serializable, Parcelable { place = in.readParcelable(Place.class.getClassLoader()); } - public long getId() { - return geofence.getId(); - } - - public void setId(long id) { - geofence.setId(id); - } - public long getTask() { return geofence.getTask(); } - public void setTask(long task) { - geofence.setTask(task); - } - - @Nullable public String getName() { - return place.getName(); - } - - public void setName(String name) { - place.setName(name); - } - public double getLatitude() { return place.getLatitude(); } - public void setLatitude(double latitude) { - place.setLatitude(latitude); - } - public double getLongitude() { return place.getLongitude(); } - public void setLongitude(double longitude) { - place.setLongitude(longitude); - } - public int getRadius() { return geofence.getRadius(); } - public void setRadius(int radius) { - geofence.setRadius(radius); - } - - public String getAddress() { - return place.getAddress(); - } - public String getPhone() { return place.getPhone(); } - public void setPhone(String phone) { - place.setPhone(phone); - } - public String getUrl() { return place.getUrl(); } - public void setUrl(String url) { - place.setUrl(url); - } - public boolean isArrival() { return geofence.isArrival(); } - public void setArrival(boolean arrival) { - geofence.setArrival(arrival); - } - public boolean isDeparture() { return geofence.isDeparture(); } - public void setDeparture(boolean departure) { - geofence.setDeparture(departure); - } - public String getDisplayName() { return place.getDisplayName(); } diff --git a/app/src/main/java/org/tasks/data/MergedGeofence.java b/app/src/main/java/org/tasks/data/MergedGeofence.java index 2c67fb14b..b2e66fb08 100644 --- a/app/src/main/java/org/tasks/data/MergedGeofence.java +++ b/app/src/main/java/org/tasks/data/MergedGeofence.java @@ -8,10 +8,6 @@ public class MergedGeofence { boolean departure; int radius; - public Place getPlace() { - return place; - } - public String getUid() { return place.getUid(); } diff --git a/app/src/main/java/org/tasks/data/SubsetCaldav.java b/app/src/main/java/org/tasks/data/SubsetCaldav.java index cd6fe35cf..0b8c39654 100644 --- a/app/src/main/java/org/tasks/data/SubsetCaldav.java +++ b/app/src/main/java/org/tasks/data/SubsetCaldav.java @@ -14,14 +14,6 @@ public class SubsetCaldav { return cd_calendar; } - public long getParent() { - return cd_parent; - } - - public void setParent(long parent) { - cd_parent = parent; - } - public String getRemoteParent() { return cd_remote_parent; } diff --git a/app/src/main/java/org/tasks/data/TaskContainer.java b/app/src/main/java/org/tasks/data/TaskContainer.java index a41c97677..e5e7e6a70 100644 --- a/app/src/main/java/org/tasks/data/TaskContainer.java +++ b/app/src/main/java/org/tasks/data/TaskContainer.java @@ -1,6 +1,5 @@ package org.tasks.data; -import androidx.annotation.Nullable; import androidx.room.Embedded; import com.todoroo.astrid.data.Task; @@ -49,14 +48,6 @@ public class TaskContainer { return task.isCompleted(); } - public int getPriority() { - return task.getPriority(); - } - - public String getRecurrence() { - return task.getRecurrence(); - } - public boolean hasDueDate() { return task.hasDueDate(); } diff --git a/app/src/main/java/org/tasks/dialogs/AddAttachmentDialog.java b/app/src/main/java/org/tasks/dialogs/AddAttachmentDialog.java index 75bca11c0..cee9e980d 100644 --- a/app/src/main/java/org/tasks/dialogs/AddAttachmentDialog.java +++ b/app/src/main/java/org/tasks/dialogs/AddAttachmentDialog.java @@ -19,7 +19,6 @@ import org.tasks.injection.DialogFragmentComponent; import org.tasks.injection.ForActivity; import org.tasks.injection.InjectingDialogFragment; import org.tasks.preferences.Device; -import org.tasks.preferences.Preferences; public class AddAttachmentDialog extends InjectingDialogFragment { @@ -31,7 +30,6 @@ public class AddAttachmentDialog extends InjectingDialogFragment { @Inject @ForActivity Context context; @Inject DialogBuilder dialogBuilder; @Inject Device device; - @Inject Preferences preferences; public static AddAttachmentDialog newAddAttachmentDialog(FilesControlSet target) { AddAttachmentDialog dialog = new AddAttachmentDialog(); diff --git a/app/src/main/java/org/tasks/dialogs/AlertDialogBuilder.java b/app/src/main/java/org/tasks/dialogs/AlertDialogBuilder.java index cda81d8eb..f9f7a8503 100644 --- a/app/src/main/java/org/tasks/dialogs/AlertDialogBuilder.java +++ b/app/src/main/java/org/tasks/dialogs/AlertDialogBuilder.java @@ -69,11 +69,6 @@ public class AlertDialogBuilder { return this; } - public AlertDialogBuilder setView(int layoutResId) { - builder.setView(layoutResId); - return this; - } - public AlertDialogBuilder setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) { builder.setOnCancelListener(onCancelListener); return this; diff --git a/app/src/main/java/org/tasks/dialogs/ColorPalettePicker.kt b/app/src/main/java/org/tasks/dialogs/ColorPalettePicker.kt index 829dc7e67..91c72ab91 100644 --- a/app/src/main/java/org/tasks/dialogs/ColorPalettePicker.kt +++ b/app/src/main/java/org/tasks/dialogs/ColorPalettePicker.kt @@ -22,7 +22,6 @@ import org.tasks.dialogs.ColorWheelPicker.Companion.newColorWheel import org.tasks.injection.DialogFragmentComponent import org.tasks.injection.InjectingDialogFragment import org.tasks.themes.ColorProvider -import org.tasks.themes.ThemeAccent import org.tasks.themes.ThemeColor import javax.inject.Inject diff --git a/app/src/main/java/org/tasks/dialogs/ThemePickerDialog.kt b/app/src/main/java/org/tasks/dialogs/ThemePickerDialog.kt index 83962da4e..35161693c 100644 --- a/app/src/main/java/org/tasks/dialogs/ThemePickerDialog.kt +++ b/app/src/main/java/org/tasks/dialogs/ThemePickerDialog.kt @@ -89,7 +89,7 @@ class ThemePickerDialog : InjectingDialogFragment() { Handler().post { ThemeBase(which).setDefaultNightMode() activity?.recreate() - activity?.overridePendingTransition(R.anim.fragment_fade_enter, R.anim.fragment_fade_exit); + activity?.overridePendingTransition(R.anim.fragment_fade_enter, R.anim.fragment_fade_exit) } } } diff --git a/app/src/main/java/org/tasks/filters/FilterCriteriaProvider.java b/app/src/main/java/org/tasks/filters/FilterCriteriaProvider.java index 4396b2969..68dcf3298 100644 --- a/app/src/main/java/org/tasks/filters/FilterCriteriaProvider.java +++ b/app/src/main/java/org/tasks/filters/FilterCriteriaProvider.java @@ -17,7 +17,6 @@ import com.todoroo.astrid.api.TextInputCriterion; import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task.Priority; -import com.todoroo.astrid.gtasks.GtasksListService; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -33,7 +32,6 @@ import org.tasks.data.Tag; import org.tasks.data.TagData; import org.tasks.data.TagDataDao; import org.tasks.injection.ForApplication; -import org.tasks.sync.SyncAdapters; public class FilterCriteriaProvider { @@ -55,8 +53,6 @@ public class FilterCriteriaProvider { public FilterCriteriaProvider( @ForApplication Context context, TagDataDao tagDataDao, - GtasksListService gtasksListService, - SyncAdapters syncAdapters, GoogleTaskListDao googleTaskListDao, CaldavDao caldavDao) { this.context = context; diff --git a/app/src/main/java/org/tasks/filters/RecentlyModifiedFilter.java b/app/src/main/java/org/tasks/filters/RecentlyModifiedFilter.java index dd272acca..2ba9bcc37 100644 --- a/app/src/main/java/org/tasks/filters/RecentlyModifiedFilter.java +++ b/app/src/main/java/org/tasks/filters/RecentlyModifiedFilter.java @@ -6,7 +6,6 @@ import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Order; import com.todoroo.andlib.sql.QueryTemplate; import com.todoroo.astrid.api.Filter; -import com.todoroo.astrid.core.SortHelper; import com.todoroo.astrid.data.Task; import org.tasks.time.DateTime; diff --git a/app/src/main/java/org/tasks/filters/TagFilters.java b/app/src/main/java/org/tasks/filters/TagFilters.java index f440aaa42..119ab9aa3 100644 --- a/app/src/main/java/org/tasks/filters/TagFilters.java +++ b/app/src/main/java/org/tasks/filters/TagFilters.java @@ -14,10 +14,6 @@ public class TagFilters { return filter; } - public String getName() { - return tagData.getName(); - } - @Override public boolean equals(Object o) { if (this == o) { diff --git a/app/src/main/java/org/tasks/injection/ActivityComponent.java b/app/src/main/java/org/tasks/injection/ActivityComponent.java index 315278ed7..980b95272 100644 --- a/app/src/main/java/org/tasks/injection/ActivityComponent.java +++ b/app/src/main/java/org/tasks/injection/ActivityComponent.java @@ -36,7 +36,6 @@ import org.tasks.reminders.NotificationActivity; import org.tasks.reminders.SnoozeActivity; import org.tasks.tags.TagPickerActivity; import org.tasks.tags.TagPickerViewModel; -import org.tasks.themes.Theme; import org.tasks.ui.TaskListViewModel; import org.tasks.voice.VoiceCommandActivity; import org.tasks.widget.ShortcutConfigActivity; @@ -49,8 +48,6 @@ public interface ActivityComponent { void inject(GtasksLoginActivity gtasksLoginActivity); - Theme getTheme(); - FragmentComponent plus(FragmentModule module); DialogFragmentComponent plus(DialogFragmentModule dialogFragmentModule); diff --git a/app/src/main/java/org/tasks/jobs/ReverseGeocodeWork.kt b/app/src/main/java/org/tasks/jobs/ReverseGeocodeWork.kt index 9d54128a3..cc857f06a 100644 --- a/app/src/main/java/org/tasks/jobs/ReverseGeocodeWork.kt +++ b/app/src/main/java/org/tasks/jobs/ReverseGeocodeWork.kt @@ -43,7 +43,7 @@ class ReverseGeocodeWork(context: Context, workerParams: WorkerParameters) : Inj Timber.d("found $result") Result.success() } catch (e: IOException) { - tracker.reportException(e); + tracker.reportException(e) Result.failure() } } diff --git a/app/src/main/java/org/tasks/locale/Locale.java b/app/src/main/java/org/tasks/locale/Locale.java index 607045450..7a144616f 100644 --- a/app/src/main/java/org/tasks/locale/Locale.java +++ b/app/src/main/java/org/tasks/locale/Locale.java @@ -200,8 +200,4 @@ public class Locale implements Serializable { } } } - - public String getLanguage() { - return appLocale.getLanguage(); - } } diff --git a/app/src/main/java/org/tasks/locale/LocalePickerDialog.java b/app/src/main/java/org/tasks/locale/LocalePickerDialog.java index f29b9d974..5a0364423 100644 --- a/app/src/main/java/org/tasks/locale/LocalePickerDialog.java +++ b/app/src/main/java/org/tasks/locale/LocalePickerDialog.java @@ -4,7 +4,6 @@ import static android.app.Activity.RESULT_OK; import static com.google.common.collect.Lists.transform; import android.app.Dialog; -import android.content.Context; import android.content.Intent; import android.os.Bundle; import java.util.ArrayList; @@ -13,17 +12,13 @@ import javax.inject.Inject; import org.tasks.R; import org.tasks.dialogs.DialogBuilder; import org.tasks.injection.DialogFragmentComponent; -import org.tasks.injection.ForActivity; import org.tasks.injection.InjectingDialogFragment; -import org.tasks.themes.ThemeAccent; public class LocalePickerDialog extends InjectingDialogFragment { public static final String EXTRA_LOCALE = "extra_locale"; - @Inject @ForActivity Context context; @Inject DialogBuilder dialogBuilder; - @Inject ThemeAccent themeAccent; @Inject Locale locale; public static LocalePickerDialog newLocalePickerDialog() { diff --git a/app/src/main/java/org/tasks/notifications/NotificationDao.java b/app/src/main/java/org/tasks/notifications/NotificationDao.java index a99a16f72..ce112f2da 100644 --- a/app/src/main/java/org/tasks/notifications/NotificationDao.java +++ b/app/src/main/java/org/tasks/notifications/NotificationDao.java @@ -19,7 +19,7 @@ public interface NotificationDao { void insertAll(List notifications); @Query("DELETE FROM notification WHERE task = :taskId") - int delete(long taskId); + void delete(long taskId); @Query("DELETE FROM notification WHERE task IN(:taskIds)") void deleteAll(List taskIds); diff --git a/app/src/main/java/org/tasks/preferences/AttributionActivity.java b/app/src/main/java/org/tasks/preferences/AttributionActivity.java index b06a18798..e2aaac024 100644 --- a/app/src/main/java/org/tasks/preferences/AttributionActivity.java +++ b/app/src/main/java/org/tasks/preferences/AttributionActivity.java @@ -22,7 +22,7 @@ import io.reactivex.disposables.CompositeDisposable; import io.reactivex.schedulers.Schedulers; import java.io.InputStream; import java.io.InputStreamReader; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -124,7 +124,7 @@ public class AttributionActivity extends ThemedInjectingAppCompatActivity { () -> { InputStream licenses = context.getAssets().open("licenses.json"); InputStreamReader reader = - new InputStreamReader(licenses, Charset.forName("UTF-8")); + new InputStreamReader(licenses, StandardCharsets.UTF_8); AttributionList list = new GsonBuilder().create().fromJson(reader, AttributionList.class); return list.libraries; diff --git a/app/src/main/java/org/tasks/preferences/beast/BeastModeViewHolder.java b/app/src/main/java/org/tasks/preferences/beast/BeastModeViewHolder.java index 94cba75b1..b0ed2af22 100644 --- a/app/src/main/java/org/tasks/preferences/beast/BeastModeViewHolder.java +++ b/app/src/main/java/org/tasks/preferences/beast/BeastModeViewHolder.java @@ -29,7 +29,7 @@ class BeastModeViewHolder extends RecyclerView.ViewHolder { } @OnTouch(R.id.grabber) - boolean onTouch(View view, MotionEvent event) { + boolean onTouch(MotionEvent event) { if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) { itemTouchHelper.startDrag(this); } diff --git a/app/src/main/java/org/tasks/preferences/fragments/Advanced.kt b/app/src/main/java/org/tasks/preferences/fragments/Advanced.kt index 9689b33a6..823f1fbeb 100644 --- a/app/src/main/java/org/tasks/preferences/fragments/Advanced.kt +++ b/app/src/main/java/org/tasks/preferences/fragments/Advanced.kt @@ -238,7 +238,5 @@ class Advanced : InjectingPreferenceFragment() { .show() } - override fun inject(component: FragmentComponent) { - component.inject(this); - } + override fun inject(component: FragmentComponent) = component.inject(this) } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/preferences/fragments/Backups.kt b/app/src/main/java/org/tasks/preferences/fragments/Backups.kt index 168fc3c03..c593537cd 100644 --- a/app/src/main/java/org/tasks/preferences/fragments/Backups.kt +++ b/app/src/main/java/org/tasks/preferences/fragments/Backups.kt @@ -166,7 +166,5 @@ class Backups : InjectingPreferenceFragment() { FileHelper.uri2String(preferences.backupDirectory) } - override fun inject(component: FragmentComponent) { - component.inject(this); - } + override fun inject(component: FragmentComponent) = component.inject(this) } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/preferences/fragments/DashClock.kt b/app/src/main/java/org/tasks/preferences/fragments/DashClock.kt index 4bf091ef6..a320ef657 100644 --- a/app/src/main/java/org/tasks/preferences/fragments/DashClock.kt +++ b/app/src/main/java/org/tasks/preferences/fragments/DashClock.kt @@ -7,8 +7,6 @@ import com.todoroo.astrid.api.Filter import org.tasks.LocalBroadcastManager import org.tasks.R import org.tasks.activities.FilterSelectionActivity -import org.tasks.billing.Inventory -import org.tasks.billing.PurchaseActivity import org.tasks.injection.FragmentComponent import org.tasks.injection.InjectingPreferenceFragment import org.tasks.preferences.DefaultFilterProvider diff --git a/app/src/main/java/org/tasks/preferences/fragments/HelpAndFeedback.kt b/app/src/main/java/org/tasks/preferences/fragments/HelpAndFeedback.kt index c81e0f000..3ac7b9886 100644 --- a/app/src/main/java/org/tasks/preferences/fragments/HelpAndFeedback.kt +++ b/app/src/main/java/org/tasks/preferences/fragments/HelpAndFeedback.kt @@ -65,9 +65,7 @@ class HelpAndFeedback : InjectingPreferenceFragment() { } } - override fun inject(component: FragmentComponent) { - component.inject(this); - } + override fun inject(component: FragmentComponent) = component.inject(this) override fun getMenu() = 0 } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/preferences/fragments/Synchronization.kt b/app/src/main/java/org/tasks/preferences/fragments/Synchronization.kt index bebccbf14..9ea5fbf8d 100644 --- a/app/src/main/java/org/tasks/preferences/fragments/Synchronization.kt +++ b/app/src/main/java/org/tasks/preferences/fragments/Synchronization.kt @@ -232,7 +232,5 @@ class Synchronization : InjectingPreferenceFragment() { else defaultFilter.listingTitle } - override fun inject(component: FragmentComponent) { - component.inject(this); - } + override fun inject(component: FragmentComponent) = component.inject(this) } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/preferences/fragments/TaskDefaults.kt b/app/src/main/java/org/tasks/preferences/fragments/TaskDefaults.kt index cfd1f9057..ac4b304df 100644 --- a/app/src/main/java/org/tasks/preferences/fragments/TaskDefaults.kt +++ b/app/src/main/java/org/tasks/preferences/fragments/TaskDefaults.kt @@ -96,7 +96,5 @@ class TaskDefaults : InjectingPreferenceFragment() { else defaultFilter.listingTitle } - override fun inject(component: FragmentComponent) { - component.inject(this); - } + override fun inject(component: FragmentComponent) = component.inject(this) } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/sync/SyncExecutor.java b/app/src/main/java/org/tasks/sync/SyncExecutor.java deleted file mode 100644 index 95532e96f..000000000 --- a/app/src/main/java/org/tasks/sync/SyncExecutor.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.tasks.sync; - -import static java.util.concurrent.Executors.newSingleThreadExecutor; - -import com.google.common.util.concurrent.ThreadFactoryBuilder; -import com.todoroo.astrid.sync.SyncResultCallback; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.RejectedExecutionException; -import javax.inject.Inject; -import org.tasks.analytics.Tracker; -import org.tasks.injection.ApplicationScope; -import timber.log.Timber; - -@ApplicationScope -public class SyncExecutor { - - private final ExecutorService executor = - newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("sync-executor-%d").build()); - - private final Tracker tracker; - - @Inject - public SyncExecutor(Tracker tracker) { - this.tracker = tracker; - } - - public void execute(SyncResultCallback callback, Runnable command) { - try { - executor.execute(wrapWithExceptionHandling(callback, command)); - } catch (RejectedExecutionException e) { - Timber.e(e); - tracker.reportException(e); - callback.finished(); - } - } - - private Runnable wrapWithExceptionHandling( - final SyncResultCallback callback, final Runnable command) { - return () -> { - try { - command.run(); - } catch (Exception e) { - Timber.e(e); - tracker.reportException(e); - executor.shutdownNow(); - callback.finished(); - } - }; - } -} diff --git a/app/src/main/java/org/tasks/tags/CheckBoxTriStates.java b/app/src/main/java/org/tasks/tags/CheckBoxTriStates.java index 36c74316e..8022d1527 100644 --- a/app/src/main/java/org/tasks/tags/CheckBoxTriStates.java +++ b/app/src/main/java/org/tasks/tags/CheckBoxTriStates.java @@ -59,10 +59,6 @@ public class CheckBoxTriStates extends AppCompatCheckBox { init(); } - public State getState() { - return state; - } - public void setState(State state, boolean notify) { if (this.state != state) { this.state = state; @@ -153,7 +149,6 @@ public class CheckBoxTriStates extends AppCompatCheckBox { } static class SavedState extends BaseSavedState { - @SuppressWarnings("hiding") public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { @Override diff --git a/app/src/main/java/org/tasks/tags/TagPickerViewModel.java b/app/src/main/java/org/tasks/tags/TagPickerViewModel.java index b9a148e40..30b7a04aa 100644 --- a/app/src/main/java/org/tasks/tags/TagPickerViewModel.java +++ b/app/src/main/java/org/tasks/tags/TagPickerViewModel.java @@ -81,10 +81,6 @@ public class TagPickerViewModel extends ViewModel { disposables.dispose(); } - public boolean isChecked(TagData tagData) { - return selected.contains(tagData); - } - State getState(TagData tagData) { if (partiallySelected.contains(tagData)) { return State.PARTIALLY_CHECKED; diff --git a/app/src/main/java/org/tasks/tasklist/DragAndDropRecyclerAdapter.java b/app/src/main/java/org/tasks/tasklist/DragAndDropRecyclerAdapter.java index e2d88e4d8..085fde59f 100644 --- a/app/src/main/java/org/tasks/tasklist/DragAndDropRecyclerAdapter.java +++ b/app/src/main/java/org/tasks/tasklist/DragAndDropRecyclerAdapter.java @@ -215,11 +215,8 @@ public class DragAndDropRecyclerAdapter extends TaskListRecyclerAdapter { } if (targetIndent < minIndent) { task.setTargetIndent(minIndent); - } else if (targetIndent > maxIndent) { - task.setTargetIndent(maxIndent); - } else { - task.setTargetIndent(targetIndent); - } + } else + task.setTargetIndent(Math.min(targetIndent, maxIndent)); } dX = (task.getTargetIndent() - task.getIndent()) * shiftSize; diff --git a/app/src/main/java/org/tasks/tasklist/SubtaskViewHolder.java b/app/src/main/java/org/tasks/tasklist/SubtaskViewHolder.java index fc372a981..e251ed88b 100644 --- a/app/src/main/java/org/tasks/tasklist/SubtaskViewHolder.java +++ b/app/src/main/java/org/tasks/tasklist/SubtaskViewHolder.java @@ -2,7 +2,6 @@ package org.tasks.tasklist; import static com.todoroo.andlib.utility.AndroidUtilities.atLeastLollipop; -import android.annotation.SuppressLint; import android.graphics.Paint; import android.util.DisplayMetrics; import android.view.View; @@ -43,8 +42,6 @@ public class SubtaskViewHolder extends RecyclerView.ViewHolder { @BindView(R.id.chip_group) ChipGroup chipGroup; - private int indent; - SubtaskViewHolder( ViewGroup view, Callbacks callbacks, @@ -104,12 +101,12 @@ public class SubtaskViewHolder extends RecyclerView.ViewHolder { } @OnClick(R.id.title) - void openSubtask(View v) { + void openSubtask() { callbacks.openSubtask(task.getTask()); } @OnClick(R.id.completeBox) - void onCompleteBoxClick(View v) { + void onCompleteBoxClick() { if (task == null) { return; } @@ -124,12 +121,7 @@ public class SubtaskViewHolder extends RecyclerView.ViewHolder { setupTitleAndCheckbox(); } - public int getIndent() { - return indent; - } - private void setIndent(int indent) { - this.indent = indent; int indentSize = getIndentSize(indent); if (atLeastLollipop()) { MarginLayoutParams layoutParams = (MarginLayoutParams) rowBody.getLayoutParams(); diff --git a/app/src/main/java/org/tasks/tasklist/TaskListRecyclerAdapter.java b/app/src/main/java/org/tasks/tasklist/TaskListRecyclerAdapter.java index b027a852b..14a941d09 100644 --- a/app/src/main/java/org/tasks/tasklist/TaskListRecyclerAdapter.java +++ b/app/src/main/java/org/tasks/tasklist/TaskListRecyclerAdapter.java @@ -14,7 +14,6 @@ import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.dao.TaskDao; import org.tasks.data.TaskContainer; -import org.tasks.dialogs.DateTimePicker; import org.tasks.intents.TaskIntents; import org.tasks.tasklist.ViewHolder.ViewHolderCallbacks; diff --git a/app/src/main/java/org/tasks/tasklist/ViewHolder.java b/app/src/main/java/org/tasks/tasklist/ViewHolder.java index 564283a1c..58a06a5dc 100644 --- a/app/src/main/java/org/tasks/tasklist/ViewHolder.java +++ b/app/src/main/java/org/tasks/tasklist/ViewHolder.java @@ -293,7 +293,7 @@ public class ViewHolder extends RecyclerView.ViewHolder { } @OnClick(R.id.completeBox) - void onCompleteBoxClick(View v) { + void onCompleteBoxClick() { if (task == null) { return; } diff --git a/app/src/main/java/org/tasks/themes/ColorUtil.java b/app/src/main/java/org/tasks/themes/ColorUtil.java index 1b554bc90..004260cca 100644 --- a/app/src/main/java/org/tasks/themes/ColorUtil.java +++ b/app/src/main/java/org/tasks/themes/ColorUtil.java @@ -28,24 +28,6 @@ class ColorUtil { return Color.HSVToColor(hsv); } - /** - * lightens a given color - * @param base base color - * @param amount amount between 0 and 100 - * @return lightened - */ - public static int lighten(int base, int amount) { - float[] hsv = new float[3]; - Color.colorToHSV(base, hsv); - float[] hsl = hsv2hsl(hsv); - hsl[2] += amount / 100f; - if (hsl[2] > 1) - hsl[2] = 1f; - hsv = hsl2hsv(hsl); - return Color.HSVToColor(hsv); - } - - /** * Converts HSV (Hue, Saturation, Value) color to HSL (Hue, Saturation, Lightness) * Credit goes to xpansive @@ -104,8 +86,4 @@ class ColorUtil { light + sat //Value }; } - - public static String colorToHex(int color) { - return String.format("#%06X", (0xFFFFFF & color)); - } } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/ui/CalendarControlSet.java b/app/src/main/java/org/tasks/ui/CalendarControlSet.java index 9f3d4cb15..be23519a4 100644 --- a/app/src/main/java/org/tasks/ui/CalendarControlSet.java +++ b/app/src/main/java/org/tasks/ui/CalendarControlSet.java @@ -193,7 +193,7 @@ public class CalendarControlSet extends TaskEditControlFragment { } @OnClick(R.id.clear) - void clearCalendar(View view) { + void clearCalendar() { if (isNullOrEmpty(eventUri)) { clear(); } else { diff --git a/app/src/main/java/org/tasks/ui/ChipProvider.java b/app/src/main/java/org/tasks/ui/ChipProvider.java index 7fed21f79..e92b9fa10 100644 --- a/app/src/main/java/org/tasks/ui/ChipProvider.java +++ b/app/src/main/java/org/tasks/ui/ChipProvider.java @@ -144,16 +144,6 @@ public class ChipProvider { return chips; } - public void apply(Chip chip, Filter filter) { - apply( - chip, - getIcon(filter.icon, R.drawable.ic_outline_cloud_24px), - filter.listingTitle, - filter.tint, - true, - true); - } - public void apply(Chip chip, @NonNull TagData tagData) { apply( chip, diff --git a/app/src/main/java/org/tasks/ui/LocationControlSet.java b/app/src/main/java/org/tasks/ui/LocationControlSet.java index 997e76752..9ce58cc04 100644 --- a/app/src/main/java/org/tasks/ui/LocationControlSet.java +++ b/app/src/main/java/org/tasks/ui/LocationControlSet.java @@ -187,7 +187,7 @@ public class LocationControlSet extends TaskEditControlFragment { } @OnClick(R.id.geofence_options) - void geofenceOptions(View view) { + void geofenceOptions() { if (permissionRequestor.requestFineLocation()) { showGeofenceOptions(); } diff --git a/app/src/main/java/org/tasks/ui/PriorityControlSet.java b/app/src/main/java/org/tasks/ui/PriorityControlSet.java index 83f473946..1a3ad8d95 100644 --- a/app/src/main/java/org/tasks/ui/PriorityControlSet.java +++ b/app/src/main/java/org/tasks/ui/PriorityControlSet.java @@ -6,7 +6,6 @@ import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.CompoundButton; import androidx.annotation.Nullable; import androidx.appcompat.widget.AppCompatRadioButton; import androidx.core.widget.CompoundButtonCompat; @@ -48,7 +47,7 @@ public class PriorityControlSet extends TaskEditControlFragment { } @OnClick({R.id.priority_high, R.id.priority_medium, R.id.priority_low, R.id.priority_none}) - void onPriorityChanged(CompoundButton button) { + void onPriorityChanged() { priority = getPriority(); } diff --git a/app/src/main/java/org/tasks/ui/SingleCheckedArrayAdapter.java b/app/src/main/java/org/tasks/ui/SingleCheckedArrayAdapter.java index 3e367d3c4..9e15fb987 100644 --- a/app/src/main/java/org/tasks/ui/SingleCheckedArrayAdapter.java +++ b/app/src/main/java/org/tasks/ui/SingleCheckedArrayAdapter.java @@ -54,7 +54,7 @@ public class SingleCheckedArrayAdapter extends ArrayAdapter { DrawableCompat.setTintList(wrapped, tintList); view.setCheckMarkDrawable(wrapped); } - int drawable = getDrawable(position); + int drawable = getDrawable(); if (drawable > 0) { Drawable original = ContextCompat.getDrawable(context, drawable); Drawable wrapped = DrawableCompat.wrap(original.mutate()); @@ -71,7 +71,7 @@ public class SingleCheckedArrayAdapter extends ArrayAdapter { return view; } - protected int getDrawable(int position) { + protected int getDrawable() { return 0; } diff --git a/app/src/main/java/org/tasks/ui/Toaster.java b/app/src/main/java/org/tasks/ui/Toaster.java index 2c0c8a950..5df9e9ccc 100644 --- a/app/src/main/java/org/tasks/ui/Toaster.java +++ b/app/src/main/java/org/tasks/ui/Toaster.java @@ -21,18 +21,10 @@ public class Toaster { this.locale = locale; } - public void longToast(@StringRes int resId, String arg) { - longToast(context.getString(resId, arg)); - } - public void longToast(@StringRes int resId, int number) { longToast(context.getString(resId, locale.formatNumber(number))); } - public void longToast(@StringRes int resId, double number) { - longToast(context.getString(resId, locale.formatNumber(number))); - } - public void longToast(@StringRes int resId) { longToast(context.getString(resId)); } diff --git a/app/src/main/java/org/tasks/voice/VoiceCommandActivity.java b/app/src/main/java/org/tasks/voice/VoiceCommandActivity.java index ee888d317..1d7734205 100644 --- a/app/src/main/java/org/tasks/voice/VoiceCommandActivity.java +++ b/app/src/main/java/org/tasks/voice/VoiceCommandActivity.java @@ -23,15 +23,14 @@ public class VoiceCommandActivity extends InjectingAppCompatActivity { Intent intent = getIntent(); - switch (intent.getAction()) { - case "com.google.android.gm.action.AUTO_SEND": - final String text = intent.getStringExtra(Intent.EXTRA_TEXT); - if (!Strings.isNullOrEmpty(text)) { - taskCreator.basicQuickAddTask(text); - Toast.makeText(context, getString(R.string.voice_command_added_task), Toast.LENGTH_LONG) - .show(); - } - finish(); + if ("com.google.android.gm.action.AUTO_SEND".equals(intent.getAction())) { + final String text = intent.getStringExtra(Intent.EXTRA_TEXT); + if (!Strings.isNullOrEmpty(text)) { + taskCreator.basicQuickAddTask(text); + Toast.makeText(context, getString(R.string.voice_command_added_task), Toast.LENGTH_LONG) + .show(); + } + finish(); } } diff --git a/app/src/main/java/org/tasks/widget/WidgetPreferences.java b/app/src/main/java/org/tasks/widget/WidgetPreferences.java index 606910d71..794a51c6d 100644 --- a/app/src/main/java/org/tasks/widget/WidgetPreferences.java +++ b/app/src/main/java/org/tasks/widget/WidgetPreferences.java @@ -61,10 +61,6 @@ public class WidgetPreferences { return preferences.getInt(getKey(R.string.p_widget_opacity), 100); } - public void setOpacity(int value) { - preferences.setInt(getKey(R.string.p_widget_opacity), value); - } - public void setColor(int color) { preferences.setInt(getKey(R.string.p_widget_color_v2), color); } diff --git a/app/src/main/res/layout/activity_location_settings.xml b/app/src/main/res/layout/activity_location_settings.xml index 536d9451b..c850d331e 100644 --- a/app/src/main/res/layout/activity_location_settings.xml +++ b/app/src/main/res/layout/activity_location_settings.xml @@ -1,6 +1,5 @@ diff --git a/app/src/release/res/values/keys.xml b/app/src/release/res/values/keys.xml index 504ddb57c..62bd1234e 100644 --- a/app/src/release/res/values/keys.xml +++ b/app/src/release/res/values/keys.xml @@ -1,6 +1,6 @@ - - Tasks + + Tasks org.tasks AEdPqrEAAAAI49v5bBusi_bq1bgLBB1LIsepNV0eBrFkQrBZkw \ No newline at end of file