Addressing inspections

pull/699/head
Alex Baker 8 years ago
parent baa46d89a2
commit 351604f4a5

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="3">
<item index="0" class="java.lang.String" itemvalue="butterknife.*" />
<item index="1" class="java.lang.String" itemvalue="dagger.Provides" />
<item index="2" class="java.lang.String" itemvalue="javax.inject.Inject" />
</list>
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -107,7 +107,7 @@ configurations {
final DAGGER_VERSION = '2.9' final DAGGER_VERSION = '2.9'
final BUTTERKNIFE_VERSION = '8.8.1' final BUTTERKNIFE_VERSION = '8.8.1'
final GPS_VERSION = '12.0.0' final GPS_VERSION = '12.0.1'
final SUPPORT_VERSION = '27.1.0' final SUPPORT_VERSION = '27.1.0'
final ROOM_VERSION = '1.1.0-beta1' final ROOM_VERSION = '1.1.0-beta1'
final STETHO_VERSION = '1.5.0' final STETHO_VERSION = '1.5.0'

@ -26,8 +26,6 @@
</intent-filter> </intent-filter>
</receiver> </receiver>
<service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
</application> </application>
</manifest> </manifest>

@ -88,7 +88,7 @@ public class TranslationTests {
* translations in the default text * translations in the default text
*/ */
@Test @Test
public void testFormatStringsMatch() throws Exception { public void testFormatStringsMatch() {
final Resources resources = getTargetContext().getResources(); final Resources resources = getTargetContext().getResources();
final int[] strings = getResourceIds(R.string.class); final int[] strings = getResourceIds(R.string.class);
final FormatStringData[] formatStrings = new FormatStringData[strings.length]; final FormatStringData[] formatStrings = new FormatStringData[strings.length];
@ -149,7 +149,7 @@ public class TranslationTests {
* Test dollar sign resources * Test dollar sign resources
*/ */
@Test @Test
public void testSpecialStringsMatch() throws Exception { public void testSpecialStringsMatch() {
final StringBuilder failures = new StringBuilder(); final StringBuilder failures = new StringBuilder();
forEachLocale(r -> { forEachLocale(r -> {
@ -211,12 +211,12 @@ public class TranslationTests {
/** /**
* format characters * format characters
*/ */
public final char[] characters; final char[] characters;
/** /**
* the original string * the original string
*/ */
public final String string; final String string;
public FormatStringData(String string) { public FormatStringData(String string) {
this.string = string; this.string = string;
@ -243,7 +243,7 @@ public class TranslationTests {
/** /**
* test that the characters match * test that the characters match
*/ */
public boolean matches(FormatStringData other) { boolean matches(FormatStringData other) {
if (characters.length != other.characters.length) { if (characters.length != other.characters.length) {
return false; return false;
} }

@ -52,7 +52,7 @@ public class TitleParserTest extends InjectingTestCase {
* repeat, no lists * repeat, no lists
*/ */
@Test @Test
public void testNoRegexes() throws Exception { public void testNoRegexes() {
Task task = taskCreator.basicQuickAddTask("Jog"); Task task = taskCreator.basicQuickAddTask("Jog");
Task nothing = new Task(); Task nothing = new Task();
assertFalse(task.hasDueTime()); assertFalse(task.hasDueTime());
@ -230,7 +230,7 @@ public class TitleParserTest extends InjectingTestCase {
* tests all words using priority 0 * tests all words using priority 0
*/ */
@Test @Test
public void testPriority0() throws Exception { public void testPriority0() {
String[] acceptedStrings = { String[] acceptedStrings = {
"priority 0", "priority 0",
"least priority", "least priority",
@ -250,7 +250,7 @@ public class TitleParserTest extends InjectingTestCase {
} }
@Test @Test
public void testPriority1() throws Exception { public void testPriority1() {
String[] acceptedStringsAtEnd = { String[] acceptedStringsAtEnd = {
"priority 1", "priority 1",
"low priority", "low priority",
@ -284,7 +284,7 @@ public class TitleParserTest extends InjectingTestCase {
} }
@Test @Test
public void testPriority2() throws Exception { public void testPriority2() {
String[] acceptedStringsAtEnd = { String[] acceptedStringsAtEnd = {
"priority 2", "priority 2",
"high priority", "high priority",
@ -316,7 +316,7 @@ public class TitleParserTest extends InjectingTestCase {
} }
@Test @Test
public void testPriority3() throws Exception { public void testPriority3() {
String[] acceptedStringsAtEnd = { String[] acceptedStringsAtEnd = {
"priority 3", "priority 3",
"highest priority", "highest priority",
@ -358,7 +358,7 @@ public class TitleParserTest extends InjectingTestCase {
* test daily repeat from due date, but with no due date set * test daily repeat from due date, but with no due date set
*/ */
@Test @Test
public void testDailyWithNoDueDate() throws Exception { public void testDailyWithNoDueDate() {
String title = "Jog daily"; String title = "Jog daily";
Task task = taskCreator.createWithValues(null, title); Task task = taskCreator.createWithValues(null, title);
RRule rrule = new RRule(); RRule rrule = new RRule();
@ -389,7 +389,7 @@ public class TitleParserTest extends InjectingTestCase {
* test weekly repeat from due date, with no due date & time set * test weekly repeat from due date, with no due date & time set
*/ */
@Test @Test
public void testWeeklyWithNoDueDate() throws Exception { public void testWeeklyWithNoDueDate() {
String title = "Jog weekly"; String title = "Jog weekly";
Task task = taskCreator.createWithValues(null, title); Task task = taskCreator.createWithValues(null, title);
RRule rrule = new RRule(); RRule rrule = new RRule();
@ -419,7 +419,7 @@ public class TitleParserTest extends InjectingTestCase {
* test hourly repeat from due date, with no due date but no time * test hourly repeat from due date, with no due date but no time
*/ */
@Test @Test
public void testMonthlyFromNoDueDate() throws Exception { public void testMonthlyFromNoDueDate() {
String title = "Jog monthly"; String title = "Jog monthly";
Task task = taskCreator.createWithValues(null, title); Task task = taskCreator.createWithValues(null, title);
RRule rrule = new RRule(); RRule rrule = new RRule();
@ -446,7 +446,7 @@ public class TitleParserTest extends InjectingTestCase {
} }
@Test @Test
public void testDailyFromDueDate() throws Exception { public void testDailyFromDueDate() {
String title = "Jog daily starting from today"; String title = "Jog daily starting from today";
Task task = taskCreator.createWithValues(null, title); Task task = taskCreator.createWithValues(null, title);
RRule rrule = new RRule(); RRule rrule = new RRule();
@ -470,7 +470,7 @@ public class TitleParserTest extends InjectingTestCase {
} }
@Test @Test
public void testWeeklyFromDueDate() throws Exception { public void testWeeklyFromDueDate() {
String title = "Jog weekly starting from today"; String title = "Jog weekly starting from today";
Task task = taskCreator.createWithValues(null, title); Task task = taskCreator.createWithValues(null, title);
RRule rrule = new RRule(); RRule rrule = new RRule();
@ -501,7 +501,7 @@ public class TitleParserTest extends InjectingTestCase {
* tests all words using priority 0 * tests all words using priority 0
*/ */
@Test @Test
public void testTagsPound() throws Exception { public void testTagsPound() {
String[] acceptedStrings = { String[] acceptedStrings = {
"#tag", "#tag",
"#a", "#a",
@ -525,7 +525,7 @@ public class TitleParserTest extends InjectingTestCase {
* tests all words using priority 0 * tests all words using priority 0
*/ */
@Test @Test
public void testTagsAt() throws Exception { public void testTagsAt() {
String[] acceptedStrings = { String[] acceptedStrings = {
"@tag", "@tag",
"@a", "@a",

@ -15,7 +15,7 @@ import org.tasks.injection.TestComponent;
public class SubtasksHelperTest extends SubtasksTestCase { public class SubtasksHelperTest extends SubtasksTestCase {
private static final String[] EXPECTED_ORDER = {"-1", "1", "2", "3", "4", "5", "6"}; private static final String[] EXPECTED_ORDER = {"-1", "1", "2", "3", "4", "5", "6"};
private static String EXPECTED_REMOTE = "[\"-1\", [\"6\", \"4\", [\"3\", \"1\"]], \"2\", \"5\"]" private static final String EXPECTED_REMOTE = "[\"-1\", [\"6\", \"4\", [\"3\", \"1\"]], \"2\", \"5\"]"
.replaceAll("\\s", ""); .replaceAll("\\s", "");
@Inject TaskDao taskDao; @Inject TaskDao taskDao;

@ -31,10 +31,10 @@ public class SubtasksTestCase extends InjectingTestCase {
* E * E
* F * F
*/ */
public static final String DEFAULT_SERIALIZED_TREE = "[-1, [1, 2, [3, 4]], 5, 6]" static final String DEFAULT_SERIALIZED_TREE = "[-1, [1, 2, [3, 4]], 5, 6]"
.replaceAll("\\s", ""); .replaceAll("\\s", "");
protected SubtasksFilterUpdater updater; SubtasksFilterUpdater updater;
protected Filter filter; Filter filter;
@Inject TaskListMetadataDao taskListMetadataDao; @Inject TaskListMetadataDao taskListMetadataDao;
@Inject TaskDao taskDao; @Inject TaskDao taskDao;
@Inject Preferences preferences; @Inject Preferences preferences;
@ -52,7 +52,7 @@ public class SubtasksTestCase extends InjectingTestCase {
component.inject(this); component.inject(this);
} }
protected void expectParentAndPosition(Task task, Task parent, int positionInParent) { void expectParentAndPosition(Task task, Task parent, int positionInParent) {
String parentId = (parent == null ? "-1" : parent.getUuid()); String parentId = (parent == null ? "-1" : parent.getUuid());
Node n = updater.findNodeForTask(task.getUuid()); Node n = updater.findNodeForTask(task.getUuid());
assertNotNull("No node found for task " + task.getTitle(), n); assertNotNull("No node found for task " + task.getTitle(), n);

@ -10,12 +10,12 @@ import org.tasks.injection.TestComponent;
public class NewSyncTestCase extends InjectingTestCase { public class NewSyncTestCase extends InjectingTestCase {
public static final String SYNC_TASK_TITLE = "new title"; private static final String SYNC_TASK_TITLE = "new title";
public static final int SYNC_TASK_IMPORTANCE = Task.IMPORTANCE_MUST_DO; private static final int SYNC_TASK_IMPORTANCE = Task.IMPORTANCE_MUST_DO;
@Inject TaskDao taskDao; @Inject TaskDao taskDao;
@Inject TagDataDao tagDataDao; @Inject TagDataDao tagDataDao;
protected Task createTask(String title) { private Task createTask(String title) {
Task task = new Task(); Task task = new Task();
task.setTitle(title); task.setTitle(title);
task.setImportance(SYNC_TASK_IMPORTANCE); task.setImportance(SYNC_TASK_IMPORTANCE);
@ -24,11 +24,11 @@ public class NewSyncTestCase extends InjectingTestCase {
return task; return task;
} }
protected Task createTask() { Task createTask() {
return createTask(SYNC_TASK_TITLE); return createTask(SYNC_TASK_TITLE);
} }
protected TagData createTagData(String name) { private TagData createTagData(String name) {
TagData tag = new TagData(); TagData tag = new TagData();
tag.setName(name); tag.setName(name);
@ -36,7 +36,7 @@ public class NewSyncTestCase extends InjectingTestCase {
return tag; return tag;
} }
protected TagData createTagData() { TagData createTagData() {
return createTagData("new tag"); return createTagData("new tag");
} }

@ -7,7 +7,7 @@ import org.junit.Before;
public abstract class InjectingTestCase { public abstract class InjectingTestCase {
protected TestComponent component; private TestComponent component;
@Before @Before
public void setUp() { public void setUp() {

@ -24,7 +24,7 @@ import org.tasks.preferences.PermissivePermissionChecker;
@Module @Module
public class TestModule { public class TestModule {
private Context context; private final Context context;
public TestModule(Context context) { public TestModule(Context context) {
this.context = context; this.context = context;

@ -37,7 +37,7 @@ public class BackupServiceTests extends InjectingTestCase {
private static final long BACKUP_WAIT_TIME = 500L; private static final long BACKUP_WAIT_TIME = 500L;
File temporaryDirectory = null; private File temporaryDirectory = null;
@Inject TasksJsonExporter xmlExporter; @Inject TasksJsonExporter xmlExporter;
@Inject TaskDao taskDao; @Inject TaskDao taskDao;

@ -11,11 +11,11 @@ import org.tasks.data.GoogleTaskList;
public class GtaskListMaker { public class GtaskListMaker {
public static final Property<GoogleTaskList, Long> ID = newProperty(); public static final Property<GoogleTaskList, Long> ID = newProperty();
public static final Property<GoogleTaskList, Integer> ORDER = newProperty(); private static final Property<GoogleTaskList, Integer> ORDER = newProperty();
public static final Property<GoogleTaskList, String> REMOTE_ID = newProperty(); public static final Property<GoogleTaskList, String> REMOTE_ID = newProperty();
public static final Property<GoogleTaskList, Long> LAST_SYNC = newProperty(); public static final Property<GoogleTaskList, Long> LAST_SYNC = newProperty();
public static final Property<GoogleTaskList, String> NAME = newProperty(); public static final Property<GoogleTaskList, String> NAME = newProperty();
public static final Property<GoogleTaskList, Integer> COLOR = newProperty(); private static final Property<GoogleTaskList, Integer> COLOR = newProperty();
private static final Instantiator<GoogleTaskList> instantiator = lookup -> new GoogleTaskList() {{ private static final Instantiator<GoogleTaskList> instantiator = lookup -> new GoogleTaskList() {{
setDeleted(0L); setDeleted(0L);
setId(lookup.valueOf(GtaskListMaker.ID, 0L)); setId(lookup.valueOf(GtaskListMaker.ID, 0L));

@ -5,7 +5,7 @@ import static com.natpryce.makeiteasy.MakeItEasy.a;
import com.natpryce.makeiteasy.Instantiator; import com.natpryce.makeiteasy.Instantiator;
import com.natpryce.makeiteasy.PropertyValue; import com.natpryce.makeiteasy.PropertyValue;
public class Maker { class Maker {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T> T make(Instantiator<T> instantiator, public static <T> T make(Instantiator<T> instantiator,

@ -14,21 +14,21 @@ import org.tasks.time.DateTime;
public class TaskMaker { public class TaskMaker {
public static Property<Task, Long> ID = newProperty(); public static final Property<Task, Long> ID = newProperty();
public static Property<Task, String> TITLE = newProperty(); private static final Property<Task, String> TITLE = newProperty();
public static Property<Task, DateTime> DUE_DATE = newProperty(); public static final Property<Task, DateTime> DUE_DATE = newProperty();
public static Property<Task, DateTime> DUE_TIME = newProperty(); public static final Property<Task, DateTime> DUE_TIME = newProperty();
public static Property<Task, Integer> PRIORITY = newProperty(); private static final Property<Task, Integer> PRIORITY = newProperty();
public static Property<Task, DateTime> REMINDER_LAST = newProperty(); public static final Property<Task, DateTime> REMINDER_LAST = newProperty();
public static Property<Task, Long> RANDOM_REMINDER_PERIOD = newProperty(); public static final Property<Task, Long> RANDOM_REMINDER_PERIOD = newProperty();
public static Property<Task, Integer> HIDE_TYPE = newProperty(); public static final Property<Task, Integer> HIDE_TYPE = newProperty();
public static Property<Task, Integer> REMINDERS = newProperty(); public static final Property<Task, Integer> REMINDERS = newProperty();
public static Property<Task, DateTime> CREATION_TIME = newProperty(); public static final Property<Task, DateTime> CREATION_TIME = newProperty();
public static Property<Task, DateTime> COMPLETION_TIME = newProperty(); public static final Property<Task, DateTime> COMPLETION_TIME = newProperty();
public static Property<Task, DateTime> DELETION_TIME = newProperty(); public static final Property<Task, DateTime> DELETION_TIME = newProperty();
public static Property<Task, DateTime> SNOOZE_TIME = newProperty(); public static final Property<Task, DateTime> SNOOZE_TIME = newProperty();
public static Property<Task, RRule> RRULE = newProperty(); public static final Property<Task, RRule> RRULE = newProperty();
public static Property<Task, Boolean> AFTER_COMPLETE = newProperty(); public static final Property<Task, Boolean> AFTER_COMPLETE = newProperty();
private static final Instantiator<Task> instantiator = lookup -> { private static final Instantiator<Task> instantiator = lookup -> {
Task task = new Task(); Task task = new Task();

@ -120,8 +120,8 @@ public class GtasksListServiceTest extends InjectingTestCase {
setLists(taskList); setLists(taskList);
assertEquals( assertEquals(
asList(newGtaskList(with(ID, 1L), with(REMOTE_ID, "1"), with(LAST_SYNC, 0L))), singletonList(newGtaskList(with(ID, 1L), with(REMOTE_ID, "1"), with(LAST_SYNC, 0L))),
gtasksListService.getListsToUpdate(asList(taskList))); gtasksListService.getListsToUpdate(singletonList(taskList)));
} }
private void setLists(TaskList... list) { private void setLists(TaskList... list) {

@ -156,7 +156,7 @@ public class GtasksTaskListUpdaterTest extends InjectingTestCase {
createParentSiblingMaps(); createParentSiblingMaps();
} }
void createParentSiblingMaps() { private void createParentSiblingMaps() {
for (GoogleTaskList list : gtasksListService.getLists()) { for (GoogleTaskList list : gtasksListService.getLists()) {
gtasksTaskListUpdater.updateParentSiblingMapsFor(list); gtasksTaskListUpdater.updateParentSiblingMapsFor(list);
} }

@ -2,6 +2,6 @@ package org.tasks;
import android.support.multidex.MultiDexApplication; import android.support.multidex.MultiDexApplication;
public class BaseApplication extends MultiDexApplication { public abstract class BaseApplication extends MultiDexApplication {
} }

@ -71,8 +71,6 @@
</intent-filter> </intent-filter>
</receiver> </receiver>
<service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
<!-- SyncService for Google Tasks --> <!-- SyncService for Google Tasks -->
<service <service

@ -30,7 +30,7 @@ public class PurchaseHelper implements IabHelper.OnIabSetupFinishedListener {
private final Tracker tracker; private final Tracker tracker;
private final InventoryHelper inventory; private final InventoryHelper inventory;
private final Executor executor; private final Executor executor;
private LocalBroadcastManager localBroadcastManager; private final LocalBroadcastManager localBroadcastManager;
private PurchaseHelperCallback activityResultCallback; private PurchaseHelperCallback activityResultCallback;
private IabHelper iabHelper; private IabHelper iabHelper;

@ -26,7 +26,7 @@ public abstract class Property<TYPE> extends Field implements Cloneable {
/** /**
* The database table name this property * The database table name this property
*/ */
public final Table table; private final Table table;
/** /**
* The database column name for this property * The database column name for this property
@ -84,15 +84,6 @@ public abstract class Property<TYPE> extends Field implements Cloneable {
} }
} }
// --- children
public String getColumnName() {
if (hasAlias()) {
return alias;
}
return name;
}
/** /**
* Integer property type. See {@link Property} * Integer property type. See {@link Property}
* *

@ -16,7 +16,7 @@ import com.todoroo.andlib.sql.SqlTable;
*/ */
public final class Table extends SqlTable { public final class Table extends SqlTable {
public final String name; private final String name;
public Table(String name) { public Table(String name) {
this(name, null); this(name, null);

@ -9,14 +9,11 @@ package com.todoroo.andlib.sql;
import static com.todoroo.andlib.sql.SqlConstants.ALL; import static com.todoroo.andlib.sql.SqlConstants.ALL;
import static com.todoroo.andlib.sql.SqlConstants.COMMA; import static com.todoroo.andlib.sql.SqlConstants.COMMA;
import static com.todoroo.andlib.sql.SqlConstants.FROM; import static com.todoroo.andlib.sql.SqlConstants.FROM;
import static com.todoroo.andlib.sql.SqlConstants.LIMIT;
import static com.todoroo.andlib.sql.SqlConstants.ORDER_BY;
import static com.todoroo.andlib.sql.SqlConstants.SELECT; import static com.todoroo.andlib.sql.SqlConstants.SELECT;
import static com.todoroo.andlib.sql.SqlConstants.SPACE; import static com.todoroo.andlib.sql.SqlConstants.SPACE;
import static com.todoroo.andlib.sql.SqlConstants.WHERE; import static com.todoroo.andlib.sql.SqlConstants.WHERE;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import com.todoroo.astrid.data.Task;
import java.util.ArrayList; import java.util.ArrayList;
public final class Query { public final class Query {
@ -24,19 +21,13 @@ public final class Query {
private final ArrayList<Criterion> criterions = new ArrayList<>(); private final ArrayList<Criterion> criterions = new ArrayList<>();
private final ArrayList<Field> fields = new ArrayList<>(); private final ArrayList<Field> fields = new ArrayList<>();
private final ArrayList<Join> joins = new ArrayList<>(); private final ArrayList<Join> joins = new ArrayList<>();
private final ArrayList<Order> orders = new ArrayList<>();
private SqlTable table; private SqlTable table;
private String queryTemplate = null; private String queryTemplate = null;
private int limits = -1;
private Query(Field... fields) { private Query(Field... fields) {
this.fields.addAll(asList(fields)); this.fields.addAll(asList(fields));
} }
public static Query select() {
return new Query(Task.PROPERTIES);
}
public static Query select(Field... fields) { public static Query select(Field... fields) {
return new Query(fields); return new Query(fields);
} }
@ -56,16 +47,6 @@ public final class Query {
return this; return this;
} }
public Query orderBy(Order... order) {
orders.addAll(asList(order));
return this;
}
public Query limit(int limit) {
limits = limit;
return this;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
return this == o || !(o == null || getClass() != o.getClass()) && this.toString() return this == o || !(o == null || getClass() != o.getClass()) && this.toString()
@ -86,29 +67,13 @@ public final class Query {
visitJoinClause(sql); visitJoinClause(sql);
if (queryTemplate == null) { if (queryTemplate == null) {
visitWhereClause(sql); visitWhereClause(sql);
visitOrderByClause(sql);
visitLimitClause(sql);
} else { } else {
if (orders.size() > 0) {
throw new IllegalStateException("Can't have extras AND query template"); //$NON-NLS-1$
}
sql.append(queryTemplate); sql.append(queryTemplate);
} }
return sql.toString(); return sql.toString();
} }
private void visitOrderByClause(StringBuilder sql) {
if (orders.isEmpty()) {
return;
}
sql.append(ORDER_BY);
for (Order order : orders) {
sql.append(SPACE).append(order).append(COMMA);
}
sql.deleteCharAt(sql.length() - 1).append(SPACE);
}
private void visitWhereClause(StringBuilder sql) { private void visitWhereClause(StringBuilder sql) {
if (criterions.isEmpty()) { if (criterions.isEmpty()) {
return; return;
@ -144,12 +109,6 @@ public final class Query {
sql.deleteCharAt(sql.length() - 1).append(SPACE); sql.deleteCharAt(sql.length() - 1).append(SPACE);
} }
private void visitLimitClause(StringBuilder sql) {
if (limits > -1) {
sql.append(LIMIT).append(SPACE).append(limits).append(SPACE);
}
}
/** /**
* Add the SQL query template (comes after the "from") * Add the SQL query template (comes after the "from")
* *

@ -6,7 +6,7 @@
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
public final class SqlConstants { final class SqlConstants {
public static final String SELECT = "SELECT"; public static final String SELECT = "SELECT";
public static final String SPACE = " "; public static final String SPACE = " ";

@ -277,7 +277,7 @@ public class AndroidUtilities {
return extension; return extension;
} }
public interface SerializedPut<T> { interface SerializedPut<T> {
void put(T object, String key, char type, String value) throws NumberFormatException; void put(T object, String key, char type, String value) throws NumberFormatException;
} }

@ -78,7 +78,7 @@ import org.tasks.ui.TaskListViewModel;
public class TaskListFragment extends InjectingFragment implements public class TaskListFragment extends InjectingFragment implements
SwipeRefreshLayout.OnRefreshListener, Toolbar.OnMenuItemClickListener { SwipeRefreshLayout.OnRefreshListener, Toolbar.OnMenuItemClickListener {
public static final int VOICE_RECOGNITION_REQUEST_CODE = 1234; private static final int VOICE_RECOGNITION_REQUEST_CODE = 1234;
public static final String TAGS_METADATA_JOIN = "for_tags"; //$NON-NLS-1$ public static final String TAGS_METADATA_JOIN = "for_tags"; //$NON-NLS-1$
public static final String FILE_METADATA_JOIN = "for_actions"; //$NON-NLS-1$ public static final String FILE_METADATA_JOIN = "for_actions"; //$NON-NLS-1$
private static final String EXTRA_FILTER = "extra_filter"; private static final String EXTRA_FILTER = "extra_filter";
@ -429,7 +429,7 @@ public class TaskListFragment extends InjectingFragment implements
taskAdapter.setHelper(recyclerAdapter.getHelper()); taskAdapter.setHelper(recyclerAdapter.getHelper());
} }
public Property<?>[] taskProperties() { protected Property<?>[] taskProperties() {
return TaskAdapter.PROPERTIES; return TaskAdapter.PROPERTIES;
} }

@ -15,10 +15,12 @@ public class CheckableRelativeLayout extends RelativeLayout implements Checkable
super(context, attrs); super(context, attrs);
} }
@Override
public boolean isChecked() { public boolean isChecked() {
return checked; return checked;
} }
@Override
public void setChecked(boolean b) { public void setChecked(boolean b) {
if (b != checked) { if (b != checked) {
checked = b; checked = b;
@ -26,6 +28,7 @@ public class CheckableRelativeLayout extends RelativeLayout implements Checkable
} }
} }
@Override
public void toggle() { public void toggle() {
setChecked(!checked); setChecked(!checked);
} }

@ -374,13 +374,13 @@ public class FilterAdapter extends ArrayAdapter<FilterListItem> {
* ================================================================ views * ================================================================ views
* ====================================================================== */ * ====================================================================== */
public static class ViewHolder { static class ViewHolder {
public FilterListItem item; FilterListItem item;
public CheckedTextView name; CheckedTextView name;
public ImageView icon; ImageView icon;
public TextView size; TextView size;
public View view; View view;
} }
public class FilterListUpdateReceiver extends BroadcastReceiver { public class FilterListUpdateReceiver extends BroadcastReceiver {

@ -40,7 +40,7 @@ public class TaskAdapter {
FILE_ID_PROPERTY // File id FILE_ID_PROPERTY // File id
}, Property.class); }, Property.class);
private AsyncPagedListDiffer<Task> helper; private AsyncPagedListDiffer<Task> helper;
private Set<Long> selected = new HashSet<>(); private final Set<Long> selected = new HashSet<>();
private OnCompletedTaskListener onCompletedTaskListener = null; private OnCompletedTaskListener onCompletedTaskListener = null;
public int getCount() { public int getCount() {

@ -23,8 +23,6 @@ public class AstridApiConstants {
*/ */
public static final String EXTRAS_TASK_ID = "task_id"; public static final String EXTRAS_TASK_ID = "task_id";
public static final String EXTRAS_TASK = "task";
public static final String EXTRAS_ORIGINAL = "original";
/** /**
* Extras name for old task due date * Extras name for old task due date
*/ */

@ -99,7 +99,7 @@ public class Filter extends FilterListItem {
* @param listingTitle Title of this item as displayed on the lists page, e.g. Inbox * @param listingTitle Title of this item as displayed on the lists page, e.g. Inbox
* @param sqlQuery SQL query for this list (see {@link #sqlQuery} for examples). * @param sqlQuery SQL query for this list (see {@link #sqlQuery} for examples).
*/ */
protected Filter(String listingTitle, String sqlQuery, Map<String, Object> valuesForNewTasks) { Filter(String listingTitle, String sqlQuery, Map<String, Object> valuesForNewTasks) {
this.listingTitle = listingTitle; this.listingTitle = listingTitle;
this.sqlQuery = sqlQuery; this.sqlQuery = sqlQuery;
this.filterOverride = null; this.filterOverride = null;

@ -99,10 +99,6 @@ public class GtasksFilter extends Filter {
list = source.readParcelable(getClass().getClassLoader()); list = source.readParcelable(getClass().getClassLoader());
} }
public GoogleTaskList getList() {
return list;
}
public String getRemoteId() { public String getRemoteId() {
return list.getRemoteId(); return list.getRemoteId();
} }

@ -25,7 +25,7 @@ public final class PermaSql {
/** /**
* value to be replaced with the current time as long * value to be replaced with the current time as long
*/ */
public static final String VALUE_NOW = "NOW()"; //$NON-NLS-1$ private static final String VALUE_NOW = "NOW()"; //$NON-NLS-1$
/** /**
* value to be replaced by end of day as long * value to be replaced by end of day as long

@ -18,12 +18,12 @@ public class TaskAction {
/** /**
* Intent to call when invoking this operation * Intent to call when invoking this operation
*/ */
public PendingIntent intent = null; public PendingIntent intent;
/** /**
* Quick action icon * Quick action icon
*/ */
public int icon = 0; public int icon;
/** /**
* Create an EditOperation object * Create an EditOperation object

@ -22,11 +22,6 @@ public class BackupConstants {
*/ */
public static final String ASTRID_TAG = "astrid"; public static final String ASTRID_TAG = "astrid";
/**
* Attribute indicating application version
*/
public static final String ASTRID_ATTR_VERSION = "version";
/** /**
* Attribute indicating backup file format * Attribute indicating backup file format
*/ */

@ -188,7 +188,7 @@ public class PhoneStateChangedReceiver extends InjectingBroadcastReceiver {
return -1; return -1;
} }
public void triggerMissedCallNotification(final String name, final String number, private void triggerMissedCallNotification(final String name, final String number,
long contactId) { long contactId) {
final String title = context final String title = context
.getString(R.string.missed_call, TextUtils.isEmpty(name) ? number : name); .getString(R.string.missed_call, TextUtils.isEmpty(name) ? number : name);

@ -409,7 +409,9 @@ public class CustomFilterActivity extends ThemedInjectingAppCompatActivity imple
/** /**
* statistics for filter count * statistics for filter count
*/ */
public int start, end, max; int start;
public int end;
int max;
public String getTitleFromCriterion() { public String getTitleFromCriterion() {
if (criterion instanceof MultipleSelectCriterion) { if (criterion instanceof MultipleSelectCriterion) {
@ -428,7 +430,7 @@ public class CustomFilterActivity extends ThemedInjectingAppCompatActivity imple
throw new UnsupportedOperationException("Unknown criterion type"); //$NON-NLS-1$ throw new UnsupportedOperationException("Unknown criterion type"); //$NON-NLS-1$
} }
public String getValueFromCriterion() { String getValueFromCriterion() {
if (type == TYPE_UNIVERSE) { if (type == TYPE_UNIVERSE) {
return null; return null;
} }

@ -191,10 +191,10 @@ class CustomFilterAdapter extends ArrayAdapter<CriterionInstance> {
private class ViewHolder { private class ViewHolder {
public CriterionInstance item; CriterionInstance item;
public ImageView type; ImageView type;
public TextView name; TextView name;
public TextView filterCount; TextView filterCount;
} }

@ -22,7 +22,7 @@ import org.tasks.data.FilterDao;
public final class CustomFilterExposer { public final class CustomFilterExposer {
private static final int filter = R.drawable.ic_filter_list_24dp; private static final int filter = R.drawable.ic_filter_list_24dp;
private FilterDao filterDao; private final FilterDao filterDao;
@Inject @Inject
public CustomFilterExposer(FilterDao filterDao) { public CustomFilterExposer(FilterDao filterDao) {

@ -145,6 +145,7 @@ public abstract class Database extends RoomDatabase {
/** /**
* Close the database if it has been opened previously * Close the database if it has been opened previously
*/ */
@Override
public synchronized final void close() { public synchronized final void close() {
if (database != null) { if (database != null) {
try { try {
@ -159,7 +160,7 @@ public abstract class Database extends RoomDatabase {
/** /**
* @return sql database. opens database if not yet open * @return sql database. opens database if not yet open
*/ */
public synchronized final SupportSQLiteDatabase getDatabase() { private synchronized SupportSQLiteDatabase getDatabase() {
if (database == null) { if (database == null) {
openForWriting(); openForWriting();
} }

@ -235,7 +235,7 @@ public class FilesControlSet extends TaskEditControlFragment {
addAttachment(attachment); addAttachment(attachment);
} }
public interface PlaybackExceptionHandler { interface PlaybackExceptionHandler {
void playbackFailed(); void playbackFailed();
} }

@ -396,7 +396,7 @@ public class GtasksTaskListUpdater {
public final long taskId; public final long taskId;
final ArrayList<Node> children = new ArrayList<>(); final ArrayList<Node> children = new ArrayList<>();
public Node parent; Node parent;
Node(long taskId, Node parent) { Node(long taskId, Node parent) {
this.taskId = taskId; this.taskId = taskId;

@ -60,12 +60,6 @@ public class GtasksInvoker {
.setPageToken(pageToken)); .setPageToken(pageToken));
} }
public TaskList getGtaskList(String id) throws IOException {
return execute(service
.tasklists()
.get(id));
}
public com.google.api.services.tasks.model.Tasks getAllGtasksFromListId(String listId, public com.google.api.services.tasks.model.Tasks getAllGtasksFromListId(String listId,
boolean includeDeleted, boolean includeHidden, long lastSyncDate, String pageToken) boolean includeDeleted, boolean includeHidden, long lastSyncDate, String pageToken)
throws IOException { throws IOException {

@ -150,7 +150,7 @@ public class GtasksSyncService {
return sibling.get(); return sibling.get();
} }
public interface SyncOnSaveOperation { interface SyncOnSaveOperation {
void op(GtasksInvoker invoker) throws IOException; void op(GtasksInvoker invoker) throws IOException;
} }
@ -159,7 +159,7 @@ public class GtasksSyncService {
final GoogleTask googleTask; final GoogleTask googleTask;
public MoveOp(GoogleTask googleTask) { MoveOp(GoogleTask googleTask) {
this.googleTask = googleTask; this.googleTask = googleTask;
} }
@ -173,7 +173,7 @@ public class GtasksSyncService {
private final String listId; private final String listId;
public ClearOp(String listId) { ClearOp(String listId) {
this.listId = listId; this.listId = listId;
} }
@ -187,7 +187,7 @@ public class GtasksSyncService {
private final LinkedBlockingQueue<SyncOnSaveOperation> queue; private final LinkedBlockingQueue<SyncOnSaveOperation> queue;
public OperationPushThread(LinkedBlockingQueue<SyncOnSaveOperation> queue) { OperationPushThread(LinkedBlockingQueue<SyncOnSaveOperation> queue) {
this.queue = queue; this.queue = queue;
} }

@ -20,7 +20,7 @@ public class GtasksTaskContainer {
public final Task task; public final Task task;
public final ArrayList<GoogleTask> metadata; public final ArrayList<GoogleTask> metadata;
private final long updateTime; private final long updateTime;
public GoogleTask gtaskMetadata; public final GoogleTask gtaskMetadata;
public GtasksTaskContainer( public GtasksTaskContainer(
com.google.api.services.tasks.model.Task remoteTask, com.google.api.services.tasks.model.Task remoteTask,

@ -69,8 +69,8 @@ public class RepeatControlSet extends TaskEditControlFragment
implements CustomRecurrenceDialog.CustomRecurrenceCallback { implements CustomRecurrenceDialog.CustomRecurrenceCallback {
public static final int TAG = R.string.TEA_ctrl_repeat_pref; public static final int TAG = R.string.TEA_ctrl_repeat_pref;
public static final int TYPE_DUE_DATE = 1; private static final int TYPE_DUE_DATE = 1;
public static final int TYPE_COMPLETION_DATE = 2; private static final int TYPE_COMPLETION_DATE = 2;
private static final String FRAG_TAG_CUSTOM_RECURRENCE = "frag_tag_custom_recurrence"; private static final String FRAG_TAG_CUSTOM_RECURRENCE = "frag_tag_custom_recurrence";
private static final String EXTRA_RECURRENCE = "extra_recurrence"; private static final String EXTRA_RECURRENCE = "extra_recurrence";
private static final String EXTRA_DUE_DATE = "extra_due_date"; private static final String EXTRA_DUE_DATE = "extra_due_date";

@ -467,7 +467,7 @@ public class SubtasksFilterUpdater {
final ArrayList<Node> children = new ArrayList<>(); final ArrayList<Node> children = new ArrayList<>();
public String uuid; public String uuid;
public Node parent; public Node parent;
public int indent; int indent;
Node(String uuid, Node parent, int indent) { Node(String uuid, Node parent, int indent) {
this.uuid = uuid; this.uuid = uuid;

@ -39,12 +39,7 @@ public class TagFilterExposer {
} }
public List<Filter> getFilters() { public List<Filter> getFilters() {
ArrayList<Filter> list = new ArrayList<>(); return filterFromTags(tagService.getTagList());
list.addAll(filterFromTags(tagService.getTagList()));
// transmit filter list
return list;
} }
public Filter getFilterByUuid(String uuid) { public Filter getFilterByUuid(String uuid) {

@ -47,10 +47,6 @@ public class TimerPlugin {
updateTimer(task, true); updateTimer(task, true);
} }
public void stopTimer(Long task) {
stopTimer(taskDao.fetch(task));
}
public void stopTimer(Task task) { public void stopTimer(Task task) {
updateTimer(task, false); updateTimer(task, false);
} }

@ -313,15 +313,15 @@ public class HideUntilControlSet extends TaskEditControlFragment implements OnIt
*/ */
private class HideUntilValue { private class HideUntilValue {
public final String label; final String label;
public final int setting; final int setting;
public final long date; final long date;
public HideUntilValue(String label, int setting) { HideUntilValue(String label, int setting) {
this(label, setting, 0); this(label, setting, 0);
} }
public HideUntilValue(String label, int setting, long date) { HideUntilValue(String label, int setting, long date) {
this.label = label; this.label = label;
this.setting = setting; this.setting = setting;
this.date = date; this.date = date;

@ -24,14 +24,12 @@ import timber.log.Timber;
public class TitleParser { public class TitleParser {
public static boolean parse(TagService tagService, Task task, ArrayList<String> tags) { public static void parse(TagService tagService, Task task, ArrayList<String> tags) {
boolean markup; repeatHelper(task);
markup = repeatHelper(task);
listHelper(tagService, task, listHelper(tagService, task,
tags); // Don't need to know if tags affected things since we don't show alerts for them tags); // Don't need to know if tags affected things since we don't show alerts for them
markup = dayHelper(task) || markup; dayHelper(task);
markup = priorityHelper(task) || markup; priorityHelper(task);
return markup;
} }
public static String trimParenthesis(String pattern) { public static String trimParenthesis(String pattern) {
@ -100,7 +98,7 @@ public class TitleParser {
} }
//priorityHelper parses the string and sets the Task's importance //priorityHelper parses the string and sets the Task's importance
private static boolean priorityHelper(Task task) { private static void priorityHelper(Task task) {
String inputText = task.getTitle(); String inputText = task.getTitle();
String[] importanceStrings = { String[] importanceStrings = {
"()((^|[^\\w!])!+|(^|[^\\w!])!\\d)($|[^\\w!])", "()((^|[^\\w!])!+|(^|[^\\w!])!\\d)($|[^\\w!])",
@ -109,13 +107,11 @@ public class TitleParser {
"(?i)(\\sbang\\s?(\\d)$)", "(?i)(\\sbang\\s?(\\d)$)",
"(?i)()(\\shigh(est)?|\\slow(est)?|\\stop|\\sleast) ?priority$" "(?i)()(\\shigh(est)?|\\slow(est)?|\\stop|\\sleast) ?priority$"
}; };
boolean result = false;
for (String importanceString : importanceStrings) { for (String importanceString : importanceStrings) {
Pattern importancePattern = Pattern.compile(importanceString); Pattern importancePattern = Pattern.compile(importanceString);
while (true) { while (true) {
Matcher m = importancePattern.matcher(inputText); Matcher m = importancePattern.matcher(inputText);
if (m.find()) { if (m.find()) {
result = true;
task.setImportance(strToPriority(m.group(2).trim())); task.setImportance(strToPriority(m.group(2).trim()));
int start = m.start() == 0 ? 0 : m.start() + 1; int start = m.start() == 0 ? 0 : m.start() + 1;
inputText = inputText.substring(0, start) + inputText.substring(m.end()); inputText = inputText.substring(0, start) + inputText.substring(m.end());
@ -126,7 +122,6 @@ public class TitleParser {
} }
} }
task.setTitle(inputText.trim()); task.setTitle(inputText.trim());
return result;
} }
//helper for dayHelper. Converts am/pm to an int 0/1. //helper for dayHelper. Converts am/pm to an int 0/1.
@ -167,7 +162,7 @@ public class TitleParser {
//Handles setting the task's date. //Handles setting the task's date.
//Day of week (e.g. Monday, Tuesday,..) is overridden by a set date (e.g. October 23 2013). //Day of week (e.g. Monday, Tuesday,..) is overridden by a set date (e.g. October 23 2013).
//Vague times (e.g. breakfast, night) are overridden by a set time (9 am, at 10, 17:00) //Vague times (e.g. breakfast, night) are overridden by a set time (9 am, at 10, 17:00)
private static boolean dayHelper(Task task) { private static void dayHelper(Task task) {
String inputText = task.getTitle(); String inputText = task.getTitle();
Calendar cal = null; Calendar cal = null;
Boolean containsSpecificTime = false; Boolean containsSpecificTime = false;
@ -370,14 +365,12 @@ public class TitleParser {
} else { } else {
task.setDueDate(Task.createDueDate(Task.URGENCY_SPECIFIC_DAY, cal.getTime().getTime())); task.setDueDate(Task.createDueDate(Task.URGENCY_SPECIFIC_DAY, cal.getTime().getTime()));
} }
return true;
} }
return false;
} }
//---------------------DATE-------------------------- //---------------------DATE--------------------------
//Parses through the text and sets the frequency of the task. //Parses through the text and sets the frequency of the task.
private static boolean repeatHelper(Task task) { private static void repeatHelper(Task task) {
String inputText = task.getTitle(); String inputText = task.getTitle();
HashMap<String, Frequency> repeatTimes = new HashMap<>(); HashMap<String, Frequency> repeatTimes = new HashMap<>();
repeatTimes.put("(?i)\\bevery ?\\w{0,6} days?\\b", Frequency.DAILY); repeatTimes.put("(?i)\\bevery ?\\w{0,6} days?\\b", Frequency.DAILY);
@ -409,7 +402,7 @@ public class TitleParser {
rrule.setFreq(rtime); rrule.setFreq(rtime);
rrule.setInterval(findInterval(inputText)); rrule.setInterval(findInterval(inputText));
task.setRecurrence(rrule.toIcal()); task.setRecurrence(rrule.toIcal());
return true; return;
} }
} }
@ -423,10 +416,9 @@ public class TitleParser {
rrule.setInterval(1); rrule.setInterval(1);
String thing = rrule.toIcal(); String thing = rrule.toIcal();
task.setRecurrence(thing); task.setRecurrence(thing);
return true; return;
} }
} }
return false;
} }
//helper method for repeatHelper. //helper method for repeatHelper.

@ -63,6 +63,7 @@ public class VoiceOutputAssistant implements OnInitListener {
} }
} }
@Override
public void onInit(int status) { public void onInit(int status) {
// status can be either TextToSpeech.SUCCESS or TextToSpeech.ERROR. // status can be either TextToSpeech.SUCCESS or TextToSpeech.ERROR.
if (status == TextToSpeech.SUCCESS && mTts != null) { if (status == TextToSpeech.SUCCESS && mTts != null) {

@ -49,7 +49,7 @@ public class TaskerPlugin {
/** /**
* @see Setting#hostSupportsOnFireVariableReplacement(Bundle) * @see Setting#hostSupportsOnFireVariableReplacement(Bundle)
*/ */
public final static int EXTRA_HOST_CAPABILITY_SETTING_FIRE_VARIABLE_REPLACEMENT = 8; private final static int EXTRA_HOST_CAPABILITY_SETTING_FIRE_VARIABLE_REPLACEMENT = 8;
private final static String TAG = "TaskerPlugin"; private final static String TAG = "TaskerPlugin";
private final static String BASE_KEY = "net.dinglisch.android.tasker"; private final static String BASE_KEY = "net.dinglisch.android.tasker";
private final static String EXTRAS_PREFIX = BASE_KEY + ".extras."; private final static String EXTRAS_PREFIX = BASE_KEY + ".extras.";
@ -80,8 +80,6 @@ public class TaskerPlugin {
return value; return value;
} }
;
// ----------------------------- SETTING PLUGIN ONLY --------------------------------- // // ----------------------------- SETTING PLUGIN ONLY --------------------------------- //
private static boolean hostSupports(Bundle extrasFromHost, int capabilityFlag) { private static boolean hostSupports(Bundle extrasFromHost, int capabilityFlag) {
@ -95,7 +93,7 @@ public class TaskerPlugin {
// ---------------------------------- HELPER FUNCTIONS -------------------------------- // // ---------------------------------- HELPER FUNCTIONS -------------------------------- //
public static int getPackageVersionCode(PackageManager pm, String packageName) { private static int getPackageVersionCode(PackageManager pm, String packageName) {
int code = -1; int code = -1;
@ -167,7 +165,7 @@ public class TaskerPlugin {
* @param extrasFromHost intent extras from the intent received by the edit activity * @param extrasFromHost intent extras from the intent received by the edit activity
* @see #setVariableReplaceKeys(Bundle, String[]) * @see #setVariableReplaceKeys(Bundle, String[])
*/ */
public static boolean hostSupportsOnFireVariableReplacement(Bundle extrasFromHost) { static boolean hostSupportsOnFireVariableReplacement(Bundle extrasFromHost) {
return hostSupports(extrasFromHost, EXTRA_HOST_CAPABILITY_SETTING_FIRE_VARIABLE_REPLACEMENT); return hostSupports(extrasFromHost, EXTRA_HOST_CAPABILITY_SETTING_FIRE_VARIABLE_REPLACEMENT);
} }

@ -15,7 +15,7 @@ import org.tasks.injection.NativeDialogFragmentComponent;
public class RemoteListNativePicker extends InjectingNativeDialogFragment { public class RemoteListNativePicker extends InjectingNativeDialogFragment {
public static final String EXTRA_SELECTED = "extra_selected"; private static final String EXTRA_SELECTED = "extra_selected";
@Inject DialogBuilder dialogBuilder; @Inject DialogBuilder dialogBuilder;
@Inject FilterAdapter filterAdapter; @Inject FilterAdapter filterAdapter;
private RemoteListSelectionHandler handler; private RemoteListSelectionHandler handler;

@ -46,7 +46,7 @@ public class TagSettingsActivity extends ThemedInjectingAppCompatActivity implem
public static final String TOKEN_AUTOPOPULATE_NAME = "autopopulateName"; //$NON-NLS-1$ public static final String TOKEN_AUTOPOPULATE_NAME = "autopopulateName"; //$NON-NLS-1$
public static final String EXTRA_TAG_DATA = "tagData"; //$NON-NLS-1$ public static final String EXTRA_TAG_DATA = "tagData"; //$NON-NLS-1$
public static final String EXTRA_TAG_UUID = "uuid"; //$NON-NLS-1$ private static final String EXTRA_TAG_UUID = "uuid"; //$NON-NLS-1$
public static final String ACTION_RELOAD = "tagRenamed"; public static final String ACTION_RELOAD = "tagRenamed";
public static final String ACTION_DELETED = "tagDeleted"; public static final String ACTION_DELETED = "tagDeleted";
private static final String EXTRA_SELECTED_THEME = "extra_selected_theme"; private static final String EXTRA_SELECTED_THEME = "extra_selected_theme";

@ -17,7 +17,6 @@ public class Tracking {
GTASK_ENABLED(R.string.tracking_category_google_tasks, R.string.tracking_action_on), GTASK_ENABLED(R.string.tracking_category_google_tasks, R.string.tracking_action_on),
GTASK_DISABLED(R.string.tracking_category_google_tasks, R.string.tracking_action_off), GTASK_DISABLED(R.string.tracking_category_google_tasks, R.string.tracking_action_off),
GTASK_LOGOUT(R.string.tracking_category_google_tasks, R.string.tracking_action_clear), GTASK_LOGOUT(R.string.tracking_category_google_tasks, R.string.tracking_action_clear),
GTASK_MOVE(R.string.tracking_category_google_tasks, R.string.tracking_action_move),
GTASK_NEW_LIST(R.string.tracking_category_google_tasks, R.string.tracking_action_new_list), GTASK_NEW_LIST(R.string.tracking_category_google_tasks, R.string.tracking_action_new_list),
GTASK_RENAME_LIST(R.string.tracking_category_google_tasks, GTASK_RENAME_LIST(R.string.tracking_category_google_tasks,
R.string.tracking_action_rename_list), R.string.tracking_action_rename_list),

@ -16,13 +16,13 @@ import org.tasks.data.TagData;
import org.tasks.data.TaskAttachment; import org.tasks.data.TaskAttachment;
import org.tasks.data.UserActivity; import org.tasks.data.UserActivity;
public class BackupContainer { class BackupContainer {
List<TaskBackup> tasks; final List<TaskBackup> tasks;
List<TagData> tags; final List<TagData> tags;
List<Filter> filters; final List<Filter> filters;
List<GoogleTaskList> googleTaskLists; final List<GoogleTaskList> googleTaskLists;
List<CaldavAccount> caldavAccounts; final List<CaldavAccount> caldavAccounts;
BackupContainer(List<TaskBackup> tasks, List<TagData> tags, List<Filter> filters, BackupContainer(List<TaskBackup> tasks, List<TagData> tags, List<Filter> filters,
List<GoogleTaskList> googleTaskLists, List<CaldavAccount> caldavAccounts) { List<GoogleTaskList> googleTaskLists, List<CaldavAccount> caldavAccounts) {
@ -35,14 +35,14 @@ public class BackupContainer {
static class TaskBackup { static class TaskBackup {
Task task; final Task task;
List<Alarm> alarms; final List<Alarm> alarms;
List<Location> locations; final List<Location> locations;
List<Tag> tags; final List<Tag> tags;
List<GoogleTask> google; final List<GoogleTask> google;
List<UserActivity> comments; final List<UserActivity> comments;
private List<TaskAttachment> attachments; private final List<TaskAttachment> attachments;
private List<CaldavTask> caldavTasks; private final List<CaldavTask> caldavTasks;
TaskBackup(Task task, List<Alarm> alarms, List<Location> locations, List<Tag> tags, TaskBackup(Task task, List<Alarm> alarms, List<Location> locations, List<Tag> tags,
List<GoogleTask> google, List<UserActivity> comments, List<TaskAttachment> attachments, List<GoogleTask> google, List<UserActivity> comments, List<TaskAttachment> attachments,

@ -38,7 +38,6 @@ import org.tasks.data.TaskAttachmentDao;
import org.tasks.data.UserActivity; import org.tasks.data.UserActivity;
import org.tasks.data.UserActivityDao; import org.tasks.data.UserActivityDao;
import org.tasks.dialogs.DialogBuilder; import org.tasks.dialogs.DialogBuilder;
import org.xmlpull.v1.XmlPullParserException;
import timber.log.Timber; import timber.log.Timber;
public class TasksJsonImporter { public class TasksJsonImporter {
@ -62,7 +61,6 @@ public class TasksJsonImporter {
private int taskCount; private int taskCount;
private int importCount = 0; private int importCount = 0;
private int skipCount = 0; private int skipCount = 0;
private int errorCount = 0;
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
private String input; private String input;
@ -101,13 +99,13 @@ public class TasksJsonImporter {
new Thread(() -> { new Thread(() -> {
try { try {
performImport(); performImport();
} catch (IOException | XmlPullParserException e) { } catch (IOException e) {
Timber.e(e, e.getMessage()); Timber.e(e, e.getMessage());
} }
}).start(); }).start();
} }
private void performImport() throws IOException, XmlPullParserException { private void performImport() throws IOException {
FileReader fileReader = new FileReader(input); FileReader fileReader = new FileReader(input);
String string = CharStreams.toString(fileReader); String string = CharStreams.toString(fileReader);
fileReader.close(); fileReader.close();
@ -199,7 +197,7 @@ public class TasksJsonImporter {
r.getQuantityString(R.plurals.Ntasks, taskCount, taskCount), r.getQuantityString(R.plurals.Ntasks, taskCount, taskCount),
r.getQuantityString(R.plurals.Ntasks, importCount, importCount), r.getQuantityString(R.plurals.Ntasks, importCount, importCount),
r.getQuantityString(R.plurals.Ntasks, skipCount, skipCount), r.getQuantityString(R.plurals.Ntasks, skipCount, skipCount),
r.getQuantityString(R.plurals.Ntasks, errorCount, errorCount))) r.getQuantityString(R.plurals.Ntasks, 0, 0)))
.setPositiveButton(android.R.string.ok, (dialog, id) -> dialog.dismiss()) .setPositiveButton(android.R.string.ok, (dialog, id) -> dialog.dismiss())
.show(); .show();
} }

@ -9,8 +9,8 @@ public class Account {
private static final String AUTHORITY = "org.tasks"; private static final String AUTHORITY = "org.tasks";
private AccountManager accountManager; private final AccountManager accountManager;
private android.accounts.Account account; private final android.accounts.Account account;
public Account(AccountManager accountManager, android.accounts.Account account) { public Account(AccountManager accountManager, android.accounts.Account account) {
this.accountManager = accountManager; this.accountManager = accountManager;

@ -4,12 +4,11 @@ import android.accounts.AbstractAccountAuthenticator;
import android.accounts.Account; import android.accounts.Account;
import android.accounts.AccountAuthenticatorResponse; import android.accounts.AccountAuthenticatorResponse;
import android.accounts.AccountManager; import android.accounts.AccountManager;
import android.accounts.NetworkErrorException;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
public class CalDAVAccountAuthenticator extends AbstractAccountAuthenticator { class CalDAVAccountAuthenticator extends AbstractAccountAuthenticator {
private final Context context; private final Context context;
@ -25,8 +24,7 @@ public class CalDAVAccountAuthenticator extends AbstractAccountAuthenticator {
@Override @Override
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, public Bundle addAccount(AccountAuthenticatorResponse response, String accountType,
String authTokenType, String[] requiredFeatures, Bundle options) String authTokenType, String[] requiredFeatures, Bundle options) {
throws NetworkErrorException {
Intent intent = new Intent(context, CalDAVSettingsActivity.class); Intent intent = new Intent(context, CalDAVSettingsActivity.class);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@ -36,13 +34,13 @@ public class CalDAVAccountAuthenticator extends AbstractAccountAuthenticator {
@Override @Override
public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account,
Bundle options) throws NetworkErrorException { Bundle options) {
return null; return null;
} }
@Override @Override
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account,
String authTokenType, Bundle options) throws NetworkErrorException { String authTokenType, Bundle options) {
return null; return null;
} }
@ -53,13 +51,13 @@ public class CalDAVAccountAuthenticator extends AbstractAccountAuthenticator {
@Override @Override
public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account,
String authTokenType, Bundle options) throws NetworkErrorException { String authTokenType, Bundle options) {
return null; return null;
} }
@Override @Override
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account,
String[] features) throws NetworkErrorException { String[] features) {
return null; return null;
} }
} }

@ -13,7 +13,7 @@ import org.tasks.sync.SyncAdapters;
public class CalDAVFilterExposer { public class CalDAVFilterExposer {
private final SyncAdapters syncAdapters; private final SyncAdapters syncAdapters;
private CaldavDao caldavDao; private final CaldavDao caldavDao;
@Inject @Inject
public CalDAVFilterExposer(CaldavDao caldavDao, SyncAdapters syncAdapters) { public CalDAVFilterExposer(CaldavDao caldavDao, SyncAdapters syncAdapters) {

@ -52,7 +52,7 @@ public class CalDAVSettingsActivity extends ThemedInjectingAppCompatActivity
implements Toolbar.OnMenuItemClickListener, DeleteAccountDialog.DeleteAccountDialogCallback { implements Toolbar.OnMenuItemClickListener, DeleteAccountDialog.DeleteAccountDialogCallback {
public static final String EXTRA_CALDAV_DATA = "caldavData"; //$NON-NLS-1$ public static final String EXTRA_CALDAV_DATA = "caldavData"; //$NON-NLS-1$
public static final String EXTRA_CALDAV_UUID = "uuid"; //$NON-NLS-1$ private static final String EXTRA_CALDAV_UUID = "uuid"; //$NON-NLS-1$
public static final String ACTION_RELOAD = "accountRenamed"; public static final String ACTION_RELOAD = "accountRenamed";
public static final String ACTION_DELETED = "accountDeleted"; public static final String ACTION_DELETED = "accountDeleted";
private static final String EXTRA_SELECTED_THEME = "extra_selected_theme"; private static final String EXTRA_SELECTED_THEME = "extra_selected_theme";

@ -24,7 +24,6 @@ import at.bitfire.dav4android.property.CalendarData;
import at.bitfire.dav4android.property.DisplayName; import at.bitfire.dav4android.property.DisplayName;
import at.bitfire.dav4android.property.GetCTag; import at.bitfire.dav4android.property.GetCTag;
import at.bitfire.dav4android.property.GetETag; import at.bitfire.dav4android.property.GetETag;
import at.bitfire.ical4android.CalendarStorageException;
import at.bitfire.ical4android.InvalidCalendarException; import at.bitfire.ical4android.InvalidCalendarException;
import at.bitfire.ical4android.iCalendar; import at.bitfire.ical4android.iCalendar;
import com.google.common.base.Strings; import com.google.common.base.Strings;
@ -208,7 +207,7 @@ public class CalDAVSyncAdapter extends InjectingAbstractThreadedSyncAdapter {
caldavAccount.setCtag(remoteCtag); caldavAccount.setCtag(remoteCtag);
Timber.d("UPDATE %s", caldavAccount); Timber.d("UPDATE %s", caldavAccount);
caldavDao.update(caldavAccount); caldavDao.update(caldavAccount);
} catch (IOException | HttpException | DavException | CalendarStorageException e) { } catch (IOException | HttpException | DavException e) {
Timber.e(e, e.getMessage()); Timber.e(e, e.getMessage());
} catch (Exception e) { } catch (Exception e) {
Timber.e(e, e.getMessage()); Timber.e(e, e.getMessage());
@ -313,7 +312,7 @@ public class CalDAVSyncAdapter extends InjectingAbstractThreadedSyncAdapter {
} }
private void processVTodo(String fileName, CaldavAccount caldavAccount, String eTag, String vtodo) private void processVTodo(String fileName, CaldavAccount caldavAccount, String eTag, String vtodo)
throws IOException, CalendarStorageException { throws IOException {
List<at.bitfire.ical4android.Task> tasks; List<at.bitfire.ical4android.Task> tasks;
try { try {
tasks = at.bitfire.ical4android.Task.fromReader(new StringReader(vtodo)); tasks = at.bitfire.ical4android.Task.fromReader(new StringReader(vtodo));

@ -59,7 +59,7 @@ public class CaldavAccountManager {
return null; return null;
} }
public List<Account> getAccounts() { private List<Account> getAccounts() {
if (!permissionChecker.canAccessAccounts()) { if (!permissionChecker.canAccessAccounts()) {
return Collections.emptyList(); return Collections.emptyList();
} }

@ -11,17 +11,12 @@ import java.util.concurrent.Callable;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import org.tasks.R; import org.tasks.R;
import org.tasks.data.CaldavAccount;
import org.tasks.ui.DisplayableException; import org.tasks.ui.DisplayableException;
public class CaldavClient { class CaldavClient {
private final DavCalendar davCalendar; private final DavCalendar davCalendar;
public CaldavClient(CaldavAccount caldavAccount, Account localAccount) {
this(caldavAccount.getUrl(), caldavAccount.getUsername(), localAccount.getPassword());
}
public CaldavClient(String url, String username, String password) { public CaldavClient(String url, String username, String password) {
BasicDigestAuthHandler basicDigestAuthHandler = new BasicDigestAuthHandler(null, username, BasicDigestAuthHandler basicDigestAuthHandler = new BasicDigestAuthHandler(null, username,
password); password);

@ -19,7 +19,7 @@ public class CaldavListFragment extends TaskListFragment {
private static final String EXTRA_CALDAV_ACCOUNT = "extra_caldav_account"; private static final String EXTRA_CALDAV_ACCOUNT = "extra_caldav_account";
private static final int REQUEST_ACCOUNT_SETTINGS = 10101; private static final int REQUEST_ACCOUNT_SETTINGS = 10101;
protected CaldavAccount account; private CaldavAccount account;
public static TaskListFragment newCaldavListFragment(CaldavFilter filter, CaldavAccount account) { public static TaskListFragment newCaldavListFragment(CaldavFilter filter, CaldavAccount account) {
CaldavListFragment fragment = new CaldavListFragment(); CaldavListFragment fragment = new CaldavListFragment();

@ -22,14 +22,14 @@ import org.apache.commons.collections4.map.MultiKeyMap;
* Primitive cookie store that stores cookies in a (volatile) hash map. * Primitive cookie store that stores cookies in a (volatile) hash map.
* Will be sufficient for session cookies. * Will be sufficient for session cookies.
*/ */
public class MemoryCookieStore implements CookieJar { class MemoryCookieStore implements CookieJar {
/** /**
* Stored cookies. The multi-key consists of three parts: name, domain, and path. * Stored cookies. The multi-key consists of three parts: name, domain, and path.
* This ensures that cookies can be overwritten. [RFC 6265 5.3 Storage Model] * This ensures that cookies can be overwritten. [RFC 6265 5.3 Storage Model]
* Not thread-safe! * Not thread-safe!
*/ */
protected final MultiKeyMap<String, Cookie> storage = MultiKeyMap private final MultiKeyMap<String, Cookie> storage = MultiKeyMap
.multiKeyMap(new HashedMap<MultiKey<? extends String>, Cookie>()); .multiKeyMap(new HashedMap<MultiKey<? extends String>, Cookie>());
@Override @Override

@ -22,9 +22,9 @@ import net.fortuna.ical4j.model.property.RRule;
import org.tasks.data.CaldavTask; import org.tasks.data.CaldavTask;
import timber.log.Timber; import timber.log.Timber;
public class TaskConverter { class TaskConverter {
private static DateFormat DUE_DATE_FORMAT = new SimpleDateFormat("yyyyMMdd", Locale.US); private static final DateFormat DUE_DATE_FORMAT = new SimpleDateFormat("yyyyMMdd", Locale.US);
public static void apply(Task local, at.bitfire.ical4android.Task remote) { public static void apply(Task local, at.bitfire.ical4android.Task remote) {
if (remote.getCompletedAt() != null) { if (remote.getCompletedAt() != null) {
@ -58,7 +58,7 @@ public class TaskConverter {
} }
} }
static int fromRemote(int remotePriority) { private static int fromRemote(int remotePriority) {
switch (remotePriority) { switch (remotePriority) {
case 0: case 0:
return Task.IMPORTANCE_NONE; return Task.IMPORTANCE_NONE;
@ -71,7 +71,7 @@ public class TaskConverter {
} }
} }
static int toRemote(int remotePriority, int localPriority) { private static int toRemote(int remotePriority, int localPriority) {
switch (localPriority) { switch (localPriority) {
case Task.IMPORTANCE_DO_OR_DIE: case Task.IMPORTANCE_DO_OR_DIE:
return 1; return 1;

@ -59,18 +59,22 @@ public class CalendarEventProvider {
} }
} }
public boolean deleteEvent(Task task) { public void deleteEvent(Task task) {
String uri = task.getCalendarURI(); String uri = task.getCalendarURI();
task.setCalendarUri(""); task.setCalendarUri("");
return deleteEvent(uri); deleteEvent(uri);
} }
private boolean deleteEvent(String eventUri) { private void deleteEvent(String eventUri) {
return !TextUtils.isEmpty(eventUri) && deleteEvent(Uri.parse(eventUri)); if (!TextUtils.isEmpty(eventUri)) {
deleteEvent(Uri.parse(eventUri));
}
} }
private boolean deleteEvent(Uri eventUri) { private void deleteEvent(Uri eventUri) {
return getEvent(eventUri) != null && contentResolver.delete(eventUri, null, null) > 0; if (getEvent(eventUri) != null) {
contentResolver.delete(eventUri, null, null);
}
} }
public List<AndroidCalendarEvent> getEventsBetween(long start, long end) { public List<AndroidCalendarEvent> getEventsBetween(long start, long end) {

@ -24,7 +24,7 @@ public class LimitOffsetDataSource extends PositionalDataSource<Task> {
} }
@WorkerThread @WorkerThread
public int countItems() { private int countItems() {
Cursor cursor = mDb.query(mCountQuery, null); Cursor cursor = mDb.query(mCountQuery, null);
try { try {
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {
@ -47,7 +47,7 @@ public class LimitOffsetDataSource extends PositionalDataSource<Task> {
@Nullable @Nullable
@WorkerThread @WorkerThread
public List<Task> loadRange(int startPosition, int loadCount) { private List<Task> loadRange(int startPosition, int loadCount) {
Cursor cursor = mDb.query(mLimitOffsetQuery, new Object[]{loadCount, startPosition}); Cursor cursor = mDb.query(mLimitOffsetQuery, new Object[]{loadCount, startPosition});
//noinspection TryFinallyCanBeTryWithResources //noinspection TryFinallyCanBeTryWithResources
try { try {

@ -163,10 +163,12 @@ public class Location implements Serializable, Parcelable {
'}'; '}';
} }
@Override
public int describeContents() { public int describeContents() {
return 0; return 0;
} }
@Override
public void writeToParcel(Parcel out, int flags) { public void writeToParcel(Parcel out, int flags) {
out.writeLong(id); out.writeLong(id);
out.writeLong(task); out.writeLong(task);

@ -12,7 +12,7 @@ public abstract class TaskListMetadataDao {
public abstract TaskListMetadata fetchByTagOrFilter(String tagUuid); public abstract TaskListMetadata fetchByTagOrFilter(String tagUuid);
@Update @Update
public abstract int update(TaskListMetadata taskListMetadata); public abstract void update(TaskListMetadata taskListMetadata);
@Insert @Insert
abstract long insert(TaskListMetadata taskListMetadata); abstract long insert(TaskListMetadata taskListMetadata);

@ -185,7 +185,7 @@ public class Migrations {
database.execSQL("ALTER TABLE `caldav_tasks` ADD COLUMN `vtodo` TEXT"); database.execSQL("ALTER TABLE `caldav_tasks` ADD COLUMN `vtodo` TEXT");
} }
}; };
public static Migration[] MIGRATIONS = new Migration[]{ public static final Migration[] MIGRATIONS = new Migration[]{
MIGRATION_35_36, MIGRATION_35_36,
MIGRATION_36_37, MIGRATION_36_37,
MIGRATION_37_38, MIGRATION_37_38,

@ -43,9 +43,7 @@ public class AddAttachmentDialog extends InjectingDialogFragment {
entries.add(getString(R.string.pick_from_storage)); entries.add(getString(R.string.pick_from_storage));
actions.add(() -> callback.pickFromStorage()); actions.add(() -> callback.pickFromStorage());
return dialogBuilder.newDialog() return dialogBuilder.newDialog()
.setItems(entries, (dialog, which) -> { .setItems(entries, (dialog, which) -> actions.get(which).run())
actions.get(which).run();
})
.show(); .show();
} }

@ -19,7 +19,7 @@ public class AlertDialogBuilder {
private final Theme theme; private final Theme theme;
private final Locale locale; private final Locale locale;
public AlertDialogBuilder(Context context, Theme theme, Locale locale) { AlertDialogBuilder(Context context, Theme theme, Locale locale) {
this.context = context; this.context = context;
this.theme = theme; this.theme = theme;
this.locale = locale; this.locale = locale;
@ -80,12 +80,6 @@ public class AlertDialogBuilder {
return this; return this;
} }
public AlertDialogBuilder setAdapter(ListAdapter adapter,
DialogInterface.OnClickListener listener) {
builder.setAdapter(adapter, listener);
return this;
}
public AlertDialogBuilder setSingleChoiceItems(List<String> strings, int selectedIndex, public AlertDialogBuilder setSingleChoiceItems(List<String> strings, int selectedIndex,
DialogInterface.OnClickListener onClickListener) { DialogInterface.OnClickListener onClickListener) {
builder.setSingleChoiceItems(addDirectionality(strings.toArray(new String[strings.size()])), builder.setSingleChoiceItems(addDirectionality(strings.toArray(new String[strings.size()])),

@ -16,7 +16,6 @@ public class ExportTasksDialog extends InjectingNativeDialogFragment {
@Inject DialogBuilder dialogBuilder; @Inject DialogBuilder dialogBuilder;
@Inject TasksJsonExporter tasksJsonExporter; @Inject TasksJsonExporter tasksJsonExporter;
@Inject Tracker tracker; @Inject Tracker tracker;
private ProgressDialog progressDialog;
public static ExportTasksDialog newExportTasksDialog() { public static ExportTasksDialog newExportTasksDialog() {
return new ExportTasksDialog(); return new ExportTasksDialog();
@ -25,7 +24,7 @@ public class ExportTasksDialog extends InjectingNativeDialogFragment {
@NonNull @NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
progressDialog = dialogBuilder.newProgressDialog(); ProgressDialog progressDialog = dialogBuilder.newProgressDialog();
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setProgress(0); progressDialog.setProgress(0);
progressDialog.setCancelable(false); progressDialog.setCancelable(false);

@ -7,6 +7,7 @@ public class MyDatePickerDialog extends DatePickerDialog {
private DialogInterface.OnCancelListener listener; private DialogInterface.OnCancelListener listener;
@Override
public void setOnCancelListener(DialogInterface.OnCancelListener listener) { public void setOnCancelListener(DialogInterface.OnCancelListener listener) {
this.listener = listener; this.listener = listener;
} }

@ -7,6 +7,7 @@ public class MyTimePickerDialog extends TimePickerDialog {
private DialogInterface.OnDismissListener listener; private DialogInterface.OnDismissListener listener;
@Override
public void setOnDismissListener(DialogInterface.OnDismissListener listener) { public void setOnDismissListener(DialogInterface.OnDismissListener listener) {
this.listener = listener; this.listener = listener;
} }

@ -272,7 +272,7 @@ public class CommentBarFragment extends TaskEditControlFragment {
void addComment(String message, String picture); void addComment(String message, String picture);
} }
public interface ClearImageCallback { interface ClearImageCallback {
void clearImage(); void clearImage();
} }

@ -6,6 +6,6 @@ import javax.inject.Scope;
@Scope @Scope
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface ActivityScope { @interface ActivityScope {
} }

@ -3,7 +3,6 @@ package org.tasks.injection;
import com.todoroo.astrid.calls.PhoneStateChangedReceiver; import com.todoroo.astrid.calls.PhoneStateChangedReceiver;
import com.todoroo.astrid.gcal.CalendarAlarmReceiver; import com.todoroo.astrid.gcal.CalendarAlarmReceiver;
import dagger.Subcomponent; import dagger.Subcomponent;
import org.tasks.locale.receiver.FireReceiver;
import org.tasks.notifications.NotificationClearedReceiver; import org.tasks.notifications.NotificationClearedReceiver;
import org.tasks.receivers.BootCompletedReceiver; import org.tasks.receivers.BootCompletedReceiver;
import org.tasks.receivers.CompleteTaskReceiver; import org.tasks.receivers.CompleteTaskReceiver;
@ -13,8 +12,6 @@ import org.tasks.widget.TasksWidget;
@Subcomponent(modules = BroadcastModule.class) @Subcomponent(modules = BroadcastModule.class)
public interface BroadcastComponent { public interface BroadcastComponent {
void inject(FireReceiver fireReceiver);
void inject(PhoneStateChangedReceiver phoneStateChangedReceiver); void inject(PhoneStateChangedReceiver phoneStateChangedReceiver);
void inject(CalendarAlarmReceiver calendarAlarmReceiver); void inject(CalendarAlarmReceiver calendarAlarmReceiver);

@ -9,7 +9,7 @@ class Dagger {
private static final Object lock = new Object(); private static final Object lock = new Object();
private static Dagger instance; private static Dagger instance;
private ApplicationComponent applicationComponent; private final ApplicationComponent applicationComponent;
private Dagger(Context context) { private Dagger(Context context) {
Context localeContext = context.getApplicationContext(); Context localeContext = context.getApplicationContext();

@ -27,8 +27,8 @@ public class JobManager {
static final int JOB_ID_NOTIFICATION = 3; static final int JOB_ID_NOTIFICATION = 3;
static final int JOB_ID_MIDNIGHT_REFRESH = 6; static final int JOB_ID_MIDNIGHT_REFRESH = 6;
static final int JOB_ID_BACKUP = 7; static final int JOB_ID_BACKUP = 7;
private Context context; private final Context context;
private AlarmManager alarmManager; private final AlarmManager alarmManager;
@Inject @Inject
public JobManager(@ForApplication Context context, AlarmManager alarmManager) { public JobManager(@ForApplication Context context, AlarmManager alarmManager) {

@ -11,7 +11,7 @@ public class TaskCreationBundle {
public static final String EXTRA_DUE_TIME = "org.tasks.locale.create.STRING_DUE_TIME"; public static final String EXTRA_DUE_TIME = "org.tasks.locale.create.STRING_DUE_TIME";
public static final String EXTRA_PRIORITY = "org.tasks.locale.create.STRING_PRIORITY"; public static final String EXTRA_PRIORITY = "org.tasks.locale.create.STRING_PRIORITY";
public static final String EXTRA_DESCRIPTION = "org.tasks.locale.create.STRING_DESCRIPTION"; public static final String EXTRA_DESCRIPTION = "org.tasks.locale.create.STRING_DESCRIPTION";
public static final String EXTRA_VERSION_CODE = "org.tasks.locale.create.INT_VERSION_CODE"; private static final String EXTRA_VERSION_CODE = "org.tasks.locale.create.INT_VERSION_CODE";
private final Bundle bundle; private final Bundle bundle;

@ -95,7 +95,7 @@ public class GeofenceService {
return locationDao.getActiveGeofences(taskId); return locationDao.getActiveGeofences(taskId);
} }
public interface SynchronizeGeofenceCallback { interface SynchronizeGeofenceCallback {
void beforeDelete(Location location); void beforeDelete(Location location);
} }

@ -55,7 +55,7 @@ public class NotificationManager {
public static final String NOTIFICATION_CHANNEL_TASKER = "notifications_tasker"; public static final String NOTIFICATION_CHANNEL_TASKER = "notifications_tasker";
public static final String NOTIFICATION_CHANNEL_CALLS = "notifications_calls"; public static final String NOTIFICATION_CHANNEL_CALLS = "notifications_calls";
public static final String NOTIFICATION_CHANNEL_TIMERS = "notifications_timers"; public static final String NOTIFICATION_CHANNEL_TIMERS = "notifications_timers";
public static final String GROUP_KEY = "tasks"; private static final String GROUP_KEY = "tasks";
static final String EXTRA_NOTIFICATION_ID = "extra_notification_id"; static final String EXTRA_NOTIFICATION_ID = "extra_notification_id";
private static final int SUMMARY_NOTIFICATION_ID = 0; private static final int SUMMARY_NOTIFICATION_ID = 0;
private final NotificationManagerCompat notificationManagerCompat; private final NotificationManagerCompat notificationManagerCompat;

@ -15,6 +15,7 @@ public class ActivityPermissionRequestor extends PermissionRequestor {
this.activity = activity; this.activity = activity;
} }
@Override
protected void requestPermissions(String[] permissions, int rc) { protected void requestPermissions(String[] permissions, int rc) {
ActivityCompat.requestPermissions(activity, permissions, rc); ActivityCompat.requestPermissions(activity, permissions, rc);
} }

@ -106,6 +106,7 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
getDelegate().onDestroy(); getDelegate().onDestroy();
} }
@Override
public void invalidateOptionsMenu() { public void invalidateOptionsMenu() {
getDelegate().invalidateOptionsMenu(); getDelegate().invalidateOptionsMenu();
} }

@ -22,7 +22,7 @@ public class AppearancePreferences extends InjectingPreferenceActivity implement
SeekBarDialog.SeekBarCallback { SeekBarDialog.SeekBarCallback {
public static final String EXTRA_RESTART = "extra_restart"; public static final String EXTRA_RESTART = "extra_restart";
public static final String EXTRA_FILTERS_CHANGED = "extra_filters_changed"; private static final String EXTRA_FILTERS_CHANGED = "extra_filters_changed";
private static final int REQUEST_CUSTOMIZE = 1004; private static final int REQUEST_CUSTOMIZE = 1004;
private static final int REQUEST_DEFAULT_LIST = 1005; private static final int REQUEST_DEFAULT_LIST = 1005;
private static final int REQUEST_ROW_PADDING = 1006; private static final int REQUEST_ROW_PADDING = 1006;

@ -48,7 +48,7 @@ public class DateTimePreferences extends InjectingPreferenceActivity implements
updateStartOfWeek(preferences.getStringValue(R.string.p_start_of_week)); updateStartOfWeek(preferences.getStringValue(R.string.p_start_of_week));
} }
String[] getWeekdayEntries() { private String[] getWeekdayEntries() {
return new String[]{ return new String[]{
getString(R.string.use_locale_default), getString(R.string.use_locale_default),
getWeekdayDisplayName(DayOfWeek.SUNDAY), getWeekdayDisplayName(DayOfWeek.SUNDAY),

@ -95,7 +95,7 @@ public class Preferences {
return time; return time;
} }
public boolean quietHoursEnabled() { private boolean quietHoursEnabled() {
return getBoolean(R.string.p_rmd_enable_quiet, false); return getBoolean(R.string.p_rmd_enable_quiet, false);
} }
@ -103,11 +103,11 @@ public class Preferences {
return getInt(R.string.p_rmd_time, (int) TimeUnit.HOURS.toMillis(18)); return getInt(R.string.p_rmd_time, (int) TimeUnit.HOURS.toMillis(18));
} }
public int getQuietHoursStart() { private int getQuietHoursStart() {
return getMillisPerDayPref(R.string.p_rmd_quietStart, R.integer.default_quiet_hours_start); return getMillisPerDayPref(R.string.p_rmd_quietStart, R.integer.default_quiet_hours_start);
} }
public int getQuietHoursEnd() { private int getQuietHoursEnd() {
return getMillisPerDayPref(R.string.p_rmd_quietEnd, R.integer.default_quiet_hours_end); return getMillisPerDayPref(R.string.p_rmd_quietEnd, R.integer.default_quiet_hours_end);
} }
@ -159,10 +159,6 @@ public class Preferences {
return getStringValue(R.string.gcal_p_default); return getStringValue(R.string.gcal_p_default);
} }
public String getDefaultRemoteList() {
return getStringValue(R.string.p_default_remote_list);
}
public int getFirstDayOfWeek() { public int getFirstDayOfWeek() {
int firstDayOfWeek = getIntegerFromString(R.string.p_start_of_week, 0); int firstDayOfWeek = getIntegerFromString(R.string.p_start_of_week, 0);
return firstDayOfWeek < 1 || firstDayOfWeek > 7 ? 0 : firstDayOfWeek; return firstDayOfWeek < 1 || firstDayOfWeek > 7 ? 0 : firstDayOfWeek;

@ -23,7 +23,7 @@ public class Badger {
private boolean enabled; private boolean enabled;
private BroadcastReceiver receiver = new BroadcastReceiver() { private final BroadcastReceiver receiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
publishCount(); publishCount();

@ -29,7 +29,7 @@ public class SnoozeActivity extends InjectingAppCompatActivity implements Snooze
@Inject TaskDao taskDao; @Inject TaskDao taskDao;
@Inject ReminderService reminderService; @Inject ReminderService reminderService;
private List<Long> taskIds = new ArrayList<>(); private final List<Long> taskIds = new ArrayList<>();
private boolean pickingDateTime; private boolean pickingDateTime;
@Override @Override

@ -15,7 +15,7 @@ import timber.log.Timber;
public class NotificationSchedulerIntentService extends InjectingJobIntentService { public class NotificationSchedulerIntentService extends InjectingJobIntentService {
public static final String EXTRA_CANCEL_EXISTING_NOTIFICATIONS = "extra_cancel_existing_notifications"; private static final String EXTRA_CANCEL_EXISTING_NOTIFICATIONS = "extra_cancel_existing_notifications";
@Inject AlarmService alarmService; @Inject AlarmService alarmService;
@Inject ReminderService reminderService; @Inject ReminderService reminderService;
@Inject JobQueue jobQueue; @Inject JobQueue jobQueue;

@ -5,7 +5,7 @@ import android.support.v7.util.DiffUtil.ItemCallback;
import com.todoroo.astrid.adapter.TaskAdapter; import com.todoroo.astrid.adapter.TaskAdapter;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
public class DiffCallback extends ItemCallback<Task> { class DiffCallback extends ItemCallback<Task> {
private final TaskAdapter adapter; private final TaskAdapter adapter;

@ -49,7 +49,7 @@ public class TaskListRecyclerAdapter extends RecyclerView.Adapter<ViewHolder>
private ActionMode mode = null; private ActionMode mode = null;
private boolean dragging; private boolean dragging;
private boolean animate; private boolean animate;
private ActionMode.Callback actionModeCallback = new ActionMode.Callback() { private final ActionMode.Callback actionModeCallback = new ActionMode.Callback() {
@Override @Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) { public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
MenuInflater inflater = actionMode.getMenuInflater(); MenuInflater inflater = actionMode.getMenuInflater();

@ -124,10 +124,6 @@ class ViewHolder extends RecyclerView.ViewHolder {
} }
} }
public boolean isSelected() {
return selected;
}
public void setSelected(boolean selected) { public void setSelected(boolean selected) {
this.selected = selected; this.selected = selected;
updateBackground(); updateBackground();

@ -164,7 +164,7 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
return actionBarTint; return actionBarTint;
} }
public int getColorPrimaryDark() { private int getColorPrimaryDark() {
return colorPrimaryDark; return colorPrimaryDark;
} }

@ -26,7 +26,7 @@ public class DateTimeUtils {
return nextMidnight(currentTimeMillis()); return nextMidnight(currentTimeMillis());
} }
public static long nextMidnight(long timestamp) { private static long nextMidnight(long timestamp) {
return newDateTime(timestamp).startOfDay().plusDays(1).getMillis(); return newDateTime(timestamp).startOfDay().plusDays(1).getMillis();
} }

@ -55,7 +55,7 @@ public class DeadlineControlSet extends TaskEditControlFragment {
@BindView(R.id.due_date) Spinner dueDateSpinner; @BindView(R.id.due_date) Spinner dueDateSpinner;
@BindView(R.id.due_time) Spinner dueTimeSpinner; @BindView(R.id.due_time) Spinner dueTimeSpinner;
@BindView(R.id.clear) View clearButton; @BindView(R.id.clear) View clearButton;
DueDateChangeListener callback; private DueDateChangeListener callback;
private List<String> dueDateOptions = new ArrayList<>(); private List<String> dueDateOptions = new ArrayList<>();
private List<String> dueTimeOptions = new ArrayList<>(); private List<String> dueTimeOptions = new ArrayList<>();
private List<String> dueTimeHint = new ArrayList<>(); private List<String> dueTimeHint = new ArrayList<>();

@ -9,7 +9,7 @@ import org.tasks.injection.ForApplication;
public class AppWidgetManager { public class AppWidgetManager {
private final android.appwidget.AppWidgetManager appWidgetManager; private final android.appwidget.AppWidgetManager appWidgetManager;
private Context context; private final Context context;
@Inject @Inject
public AppWidgetManager(@ForApplication Context context) { public AppWidgetManager(@ForApplication Context context) {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save