Reformat code

pull/795/head
Alex Baker 7 years ago
parent 011d47024d
commit 35525a4957

@ -1,15 +1,10 @@
package org.tasks.gtasks; package org.tasks.gtasks;
import android.app.Activity; import android.app.Activity;
import javax.inject.Inject;
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity;
import org.tasks.drive.DriveLoginActivity; import org.tasks.drive.DriveLoginActivity;
import org.tasks.play.AuthResultHandler; import org.tasks.play.AuthResultHandler;
import javax.inject.Inject;
public class PlayServices { public class PlayServices {
@Inject @Inject

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.test; package com.todoroo.andlib.test;
import static androidx.test.InstrumentationRegistry.getTargetContext; import static androidx.test.InstrumentationRegistry.getTargetContext;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.utility; package com.todoroo.andlib.utility;
import static androidx.test.InstrumentationRegistry.getTargetContext; import static androidx.test.InstrumentationRegistry.getTargetContext;
@ -19,8 +20,8 @@ import static org.tasks.date.DateTimeUtils.newDate;
import static org.tasks.date.DateTimeUtils.newDateTime; import static org.tasks.date.DateTimeUtils.newDateTime;
import android.content.res.Configuration; import android.content.res.Configuration;
import androidx.test.runner.AndroidJUnit4;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import androidx.test.runner.AndroidJUnit4;
import java.util.Locale; import java.util.Locale;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.dao; package com.todoroo.astrid.dao;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;

@ -1,29 +1,5 @@
package com.todoroo.astrid.reminders; package com.todoroo.astrid.reminders;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.tasks.R;
import org.tasks.Snippet;
import org.tasks.injection.InjectingTestCase;
import org.tasks.injection.TestComponent;
import org.tasks.jobs.NotificationQueue;
import org.tasks.jobs.ReminderEntry;
import org.tasks.jobs.WorkManager;
import org.tasks.preferences.Preferences;
import org.tasks.reminders.Random;
import org.tasks.time.DateTime;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import androidx.test.runner.AndroidJUnit4;
import static com.natpryce.makeiteasy.MakeItEasy.with; import static com.natpryce.makeiteasy.MakeItEasy.with;
import static com.todoroo.andlib.utility.DateUtilities.ONE_HOUR; import static com.todoroo.andlib.utility.DateUtilities.ONE_HOUR;
import static com.todoroo.andlib.utility.DateUtilities.ONE_WEEK; import static com.todoroo.andlib.utility.DateUtilities.ONE_WEEK;
@ -48,6 +24,26 @@ import static org.tasks.makers.TaskMaker.REMINDER_LAST;
import static org.tasks.makers.TaskMaker.SNOOZE_TIME; import static org.tasks.makers.TaskMaker.SNOOZE_TIME;
import static org.tasks.makers.TaskMaker.newTask; import static org.tasks.makers.TaskMaker.newTask;
import androidx.test.runner.AndroidJUnit4;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.tasks.R;
import org.tasks.Snippet;
import org.tasks.injection.InjectingTestCase;
import org.tasks.injection.TestComponent;
import org.tasks.jobs.NotificationQueue;
import org.tasks.jobs.ReminderEntry;
import org.tasks.jobs.WorkManager;
import org.tasks.preferences.Preferences;
import org.tasks.reminders.Random;
import org.tasks.time.DateTime;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class ReminderServiceTest extends InjectingTestCase { public class ReminderServiceTest extends InjectingTestCase {

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.repeats; package com.todoroo.astrid.repeats;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.service; package com.todoroo.astrid.service;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.service; package com.todoroo.astrid.service;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;

@ -1,17 +1,15 @@
package org.tasks.caldav; package org.tasks.caldav;
import static junit.framework.Assert.assertTrue;
import static org.tasks.TestUtilities.vtodo;
import androidx.test.runner.AndroidJUnit4;
import java.util.TimeZone;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import java.util.TimeZone;
import androidx.test.runner.AndroidJUnit4;
import static junit.framework.Assert.assertTrue;
import static org.tasks.TestUtilities.vtodo;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class SynologyTests { public class SynologyTests {

@ -1,12 +1,11 @@
package org.tasks.injection; package org.tasks.injection;
import org.junit.Before;
import timber.log.Timber;
import static androidx.test.InstrumentationRegistry.getTargetContext; import static androidx.test.InstrumentationRegistry.getTargetContext;
import static org.tasks.TestUtilities.initializeMockito; import static org.tasks.TestUtilities.initializeMockito;
import org.junit.Before;
import timber.log.Timber;
public abstract class InjectingTestCase { public abstract class InjectingTestCase {
@Before @Before

@ -1,7 +1,7 @@
package org.tasks.injection; package org.tasks.injection;
import androidx.room.Room;
import android.content.Context; import android.content.Context;
import androidx.room.Room;
import com.todoroo.astrid.dao.Database; import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.dao.TaskDao;
import dagger.Module; import dagger.Module;

@ -3,14 +3,14 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package org.tasks.jobs;
import android.net.Uri; package org.tasks.jobs;
import static androidx.test.InstrumentationRegistry.getTargetContext; import static androidx.test.InstrumentationRegistry.getTargetContext;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue; import static junit.framework.Assert.assertTrue;
import android.net.Uri;
import androidx.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;

@ -1,20 +1,17 @@
package org.tasks.preferences; package org.tasks.preferences;
import android.annotation.SuppressLint; import static androidx.test.InstrumentationRegistry.getTargetContext;
import static junit.framework.Assert.assertEquals;
import android.annotation.SuppressLint;
import androidx.test.runner.AndroidJUnit4;
import java.util.concurrent.TimeUnit;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.tasks.R; import org.tasks.R;
import org.tasks.time.DateTime; import org.tasks.time.DateTime;
import java.util.concurrent.TimeUnit;
import androidx.test.runner.AndroidJUnit4;
import static androidx.test.InstrumentationRegistry.getTargetContext;
import static junit.framework.Assert.assertEquals;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class PreferenceTests { public class PreferenceTests {

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks; package com.todoroo.astrid.gtasks;
import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNotNull;

@ -1,9 +1,23 @@
package com.todoroo.astrid.gtasks; package com.todoroo.astrid.gtasks;
import static com.natpryce.makeiteasy.MakeItEasy.with;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;
import static org.tasks.makers.GtaskListMaker.ID;
import static org.tasks.makers.GtaskListMaker.LAST_SYNC;
import static org.tasks.makers.GtaskListMaker.NAME;
import static org.tasks.makers.GtaskListMaker.REMOTE_ID;
import static org.tasks.makers.GtaskListMaker.newGtaskList;
import static org.tasks.makers.RemoteGtaskListMaker.newRemoteList;
import static org.tasks.time.DateTimeUtils.currentTimeMillis;
import androidx.test.runner.AndroidJUnit4;
import com.google.api.client.util.DateTime; import com.google.api.client.util.DateTime;
import com.google.api.services.tasks.model.TaskList; import com.google.api.services.tasks.model.TaskList;
import com.todoroo.astrid.service.TaskDeleter; import com.todoroo.astrid.service.TaskDeleter;
import javax.inject.Inject;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.tasks.LocalBroadcastManager; import org.tasks.LocalBroadcastManager;
@ -15,23 +29,6 @@ import org.tasks.injection.TestComponent;
import org.tasks.jobs.WorkManager; import org.tasks.jobs.WorkManager;
import org.tasks.makers.RemoteGtaskListMaker; import org.tasks.makers.RemoteGtaskListMaker;
import javax.inject.Inject;
import androidx.test.runner.AndroidJUnit4;
import static com.natpryce.makeiteasy.MakeItEasy.with;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;
import static org.tasks.makers.GtaskListMaker.ID;
import static org.tasks.makers.GtaskListMaker.LAST_SYNC;
import static org.tasks.makers.GtaskListMaker.NAME;
import static org.tasks.makers.GtaskListMaker.REMOTE_ID;
import static org.tasks.makers.GtaskListMaker.newGtaskList;
import static org.tasks.makers.RemoteGtaskListMaker.newRemoteList;
import static org.tasks.time.DateTimeUtils.currentTimeMillis;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class GtasksListServiceTest extends InjectingTestCase { public class GtasksListServiceTest extends InjectingTestCase {
@ -47,8 +44,7 @@ public class GtasksListServiceTest extends InjectingTestCase {
super.setUp(); super.setUp();
workManager.init(); workManager.init();
gtasksListService = gtasksListService =
new GtasksListService( new GtasksListService(googleTaskListDao, taskDeleter, localBroadcastManager);
googleTaskListDao, taskDeleter, localBroadcastManager);
} }
@Override @Override

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks; package com.todoroo.astrid.gtasks;
import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNotNull;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks; package com.todoroo.astrid.gtasks;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks; package com.todoroo.astrid.gtasks;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;

@ -1,14 +1,11 @@
package org.tasks.gtasks; package org.tasks.gtasks;
import android.app.Activity; import android.app.Activity;
import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity; import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity;
import javax.inject.Inject;
import org.tasks.drive.DriveLoginActivity; import org.tasks.drive.DriveLoginActivity;
import org.tasks.play.AuthResultHandler; import org.tasks.play.AuthResultHandler;
import javax.inject.Inject;
public class PlayServices { public class PlayServices {
@Inject @Inject

@ -4,7 +4,6 @@ import android.accounts.Account;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.gms.auth.GoogleAuthException; import com.google.android.gms.auth.GoogleAuthException;
import com.google.android.gms.auth.GoogleAuthUtil; import com.google.android.gms.auth.GoogleAuthUtil;
import com.google.android.gms.auth.UserRecoverableAuthException; import com.google.android.gms.auth.UserRecoverableAuthException;
@ -13,16 +12,12 @@ import com.google.android.gms.common.GoogleApiAvailability;
import com.google.api.services.drive.DriveScopes; import com.google.api.services.drive.DriveScopes;
import com.google.api.services.tasks.TasksScopes; import com.google.api.services.tasks.TasksScopes;
import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity; import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity;
import java.io.IOException;
import javax.inject.Inject;
import org.tasks.R; import org.tasks.R;
import org.tasks.injection.ForApplication; import org.tasks.injection.ForApplication;
import org.tasks.play.AuthResultHandler; import org.tasks.play.AuthResultHandler;
import org.tasks.preferences.Preferences; import org.tasks.preferences.Preferences;
import java.io.IOException;
import javax.inject.Inject;
import timber.log.Timber; import timber.log.Timber;
public class PlayServices { public class PlayServices {
@ -92,7 +87,8 @@ public class PlayServices {
getToken(DriveScopes.DRIVE_FILE, activity, accountName, handler); getToken(DriveScopes.DRIVE_FILE, activity, accountName, handler);
} }
private void getToken(String scope, Activity activity, String accountName, AuthResultHandler handler) { private void getToken(
String scope, Activity activity, String accountName, AuthResultHandler handler) {
final Account account = accountManager.getAccount(accountName); final Account account = accountManager.getAccount(accountName);
if (account == null) { if (account == null) {
handler.authenticationFailed( handler.authenticationFailed(

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.mdimension.jchronic; package com.mdimension.jchronic;
import com.mdimension.jchronic.handlers.Handler; import com.mdimension.jchronic.handlers.Handler;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.data; package com.todoroo.andlib.data;
import android.text.TextUtils; import android.text.TextUtils;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.data; package com.todoroo.andlib.data;
import com.todoroo.andlib.sql.SqlTable; import com.todoroo.andlib.sql.SqlTable;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
import static com.todoroo.andlib.sql.SqlConstants.AND; import static com.todoroo.andlib.sql.SqlConstants.AND;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
import static com.todoroo.andlib.sql.SqlConstants.AS; import static com.todoroo.andlib.sql.SqlConstants.AS;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
import static com.todoroo.andlib.sql.SqlConstants.COMMA; import static com.todoroo.andlib.sql.SqlConstants.COMMA;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
public final class Functions { public final class Functions {

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
import static com.todoroo.andlib.sql.SqlConstants.AND; import static com.todoroo.andlib.sql.SqlConstants.AND;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
public enum JoinType { public enum JoinType {

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
public final class Operator { public final class Operator {

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
import static com.todoroo.andlib.sql.SqlConstants.SPACE; import static com.todoroo.andlib.sql.SqlConstants.SPACE;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
public enum OrderType { public enum OrderType {

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
import static com.todoroo.andlib.sql.SqlConstants.ALL; import static com.todoroo.andlib.sql.SqlConstants.ALL;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
import static com.todoroo.andlib.sql.SqlConstants.COMMA; import static com.todoroo.andlib.sql.SqlConstants.COMMA;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
final class SqlConstants { final class SqlConstants {

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
public class SqlTable extends DBObject<SqlTable> { public class SqlTable extends DBObject<SqlTable> {

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
import static com.todoroo.andlib.sql.SqlConstants.SPACE; import static com.todoroo.andlib.sql.SqlConstants.SPACE;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.utility; package com.todoroo.andlib.utility;
import android.app.Activity; import android.app.Activity;
@ -15,11 +16,9 @@ import android.util.DisplayMetrics;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.TextView; import android.widget.TextView;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import timber.log.Timber; import timber.log.Timber;
/** /**

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.utility; package com.todoroo.andlib.utility;
import static org.tasks.date.DateTimeUtils.newDateTime; import static org.tasks.date.DateTimeUtils.newDateTime;
@ -196,8 +197,7 @@ public class DateUtilities {
return context.getString(abbreviated ? R.string.yest : R.string.yesterday); return context.getString(abbreviated ? R.string.yest : R.string.yesterday);
} }
if (today + abbreviationLimit >= input if (today + abbreviationLimit >= input && today - abbreviationLimit <= input) {
&& today - abbreviationLimit <= input) {
return abbreviated return abbreviated
? DateUtilities.getWeekdayShort(newDateTime(date)) ? DateUtilities.getWeekdayShort(newDateTime(date))
: DateUtilities.getWeekday(newDateTime(date)); : DateUtilities.getWeekday(newDateTime(date));

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.andlib.utility; package com.todoroo.andlib.utility;
import android.app.Activity; import android.app.Activity;

@ -3,17 +3,18 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.activity; package com.todoroo.astrid.activity;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import com.google.common.base.Strings; import com.google.common.base.Strings;
@ -90,7 +91,8 @@ public class BeastModePreferences extends ThemedInjectingAppCompatActivity
setContentView(R.layout.beast_mode_pref_activity); setContentView(R.layout.beast_mode_pref_activity);
ButterKnife.bind(this); ButterKnife.bind(this);
toolbar.setNavigationIcon(ContextCompat.getDrawable(this, R.drawable.ic_outline_arrow_back_24px)); toolbar.setNavigationIcon(
ContextCompat.getDrawable(this, R.drawable.ic_outline_arrow_back_24px));
toolbar.setNavigationOnClickListener(v -> finish()); toolbar.setNavigationOnClickListener(v -> finish());
toolbar.inflateMenu(R.menu.beast_mode); toolbar.inflateMenu(R.menu.beast_mode);
toolbar.setOnMenuItemClickListener(this); toolbar.setOnMenuItemClickListener(this);

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.activity; package com.todoroo.astrid.activity;
import static com.todoroo.andlib.utility.AndroidUtilities.atLeastLollipop; import static com.todoroo.andlib.utility.AndroidUtilities.atLeastLollipop;
@ -11,18 +12,18 @@ import static org.tasks.tasklist.ActionUtils.applySupportActionModeColor;
import static org.tasks.ui.NavigationDrawerFragment.OnFilterItemClickedListener; import static org.tasks.ui.NavigationDrawerFragment.OnFilterItemClickedListener;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import androidx.lifecycle.ViewModelProviders;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentManager;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.view.ActionMode;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.appcompat.view.ActionMode;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.ViewModelProviders;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import com.todoroo.astrid.api.CaldavFilter; import com.todoroo.astrid.api.CaldavFilter;

@ -1,26 +1,21 @@
package com.todoroo.astrid.activity; package com.todoroo.astrid.activity;
import static com.google.common.collect.Lists.newArrayList;
import static com.todoroo.andlib.utility.AndroidUtilities.atLeastMarshmallow;
import static org.tasks.intents.TaskIntents.getEditTaskStack;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskCreator; import com.todoroo.astrid.service.TaskCreator;
import java.util.ArrayList;
import javax.inject.Inject;
import org.tasks.data.TaskAttachment; import org.tasks.data.TaskAttachment;
import org.tasks.injection.ActivityComponent; import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity; import org.tasks.injection.InjectingAppCompatActivity;
import java.util.ArrayList;
import javax.inject.Inject;
import timber.log.Timber; import timber.log.Timber;
import static com.google.common.collect.Lists.newArrayList;
import static com.todoroo.andlib.utility.AndroidUtilities.atLeastMarshmallow;
import static org.tasks.intents.TaskIntents.getEditTaskStack;
/** /**
* @author joshuagross * @author joshuagross
* <p>Create a new task based on incoming links from the "share" menu * <p>Create a new task based on incoming links from the "share" menu

@ -3,8 +3,12 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.activity; package com.todoroo.astrid.activity;
import static org.tasks.date.DateTimeUtils.newDateTime;
import static org.tasks.files.FileHelper.copyToUri;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.net.Uri; import android.net.Uri;
@ -15,7 +19,12 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.dao.TaskDao;
@ -26,7 +35,8 @@ import com.todoroo.astrid.service.TaskDeleter;
import com.todoroo.astrid.timers.TimerPlugin; import com.todoroo.astrid.timers.TimerPlugin;
import com.todoroo.astrid.ui.EditTitleControlSet; import com.todoroo.astrid.ui.EditTitleControlSet;
import com.todoroo.astrid.utility.Flags; import com.todoroo.astrid.utility.Flags;
import java.util.List;
import javax.inject.Inject;
import org.tasks.LocalBroadcastManager; import org.tasks.LocalBroadcastManager;
import org.tasks.R; import org.tasks.R;
import org.tasks.analytics.Tracker; import org.tasks.analytics.Tracker;
@ -42,20 +52,6 @@ import org.tasks.preferences.Preferences;
import org.tasks.ui.MenuColorizer; import org.tasks.ui.MenuColorizer;
import org.tasks.ui.TaskEditControlFragment; import org.tasks.ui.TaskEditControlFragment;
import java.util.List;
import javax.inject.Inject;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import butterknife.BindView;
import butterknife.ButterKnife;
import static org.tasks.date.DateTimeUtils.newDateTime;
import static org.tasks.files.FileHelper.copyToUri;
public final class TaskEditFragment extends InjectingFragment public final class TaskEditFragment extends InjectingFragment
implements Toolbar.OnMenuItemClickListener { implements Toolbar.OnMenuItemClickListener {
@ -118,7 +114,10 @@ public final class TaskEditFragment extends InjectingFragment
final boolean backButtonSavesTask = preferences.backButtonSavesTask(); final boolean backButtonSavesTask = preferences.backButtonSavesTask();
toolbar.setNavigationIcon( toolbar.setNavigationIcon(
ContextCompat.getDrawable( ContextCompat.getDrawable(
context, backButtonSavesTask ? R.drawable.ic_outline_clear_24px : R.drawable.ic_outline_save_24px)); context,
backButtonSavesTask
? R.drawable.ic_outline_clear_24px
: R.drawable.ic_outline_save_24px));
toolbar.setNavigationOnClickListener( toolbar.setNavigationOnClickListener(
v -> { v -> {
if (backButtonSavesTask) { if (backButtonSavesTask) {

@ -3,36 +3,37 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.activity; package com.todoroo.astrid.activity;
import static android.app.Activity.RESULT_OK; import static android.app.Activity.RESULT_OK;
import static androidx.core.content.ContextCompat.getColor; import static androidx.core.content.ContextCompat.getColor;
import android.app.Activity; import android.app.Activity;
import androidx.lifecycle.ViewModelProviders;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.speech.RecognizerIntent; import android.speech.RecognizerIntent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.snackbar.Snackbar;
import androidx.core.view.MenuItemCompat; import androidx.core.view.MenuItemCompat;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.SearchView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import com.google.android.material.snackbar.Snackbar;
import com.todoroo.andlib.data.Property; import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.QueryTemplate; import com.todoroo.andlib.sql.QueryTemplate;
@ -49,8 +50,8 @@ import com.todoroo.astrid.service.TaskMover;
import com.todoroo.astrid.timers.TimerPlugin; import com.todoroo.astrid.timers.TimerPlugin;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.reactivex.subjects.PublishSubject; import io.reactivex.subjects.PublishSubject;
import java.util.concurrent.TimeUnit;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject; import javax.inject.Inject;
import org.tasks.LocalBroadcastManager; import org.tasks.LocalBroadcastManager;
import org.tasks.R; import org.tasks.R;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.adapter; package com.todoroo.astrid.adapter;
import static androidx.core.content.ContextCompat.getColor; import static androidx.core.content.ContextCompat.getColor;
@ -17,11 +18,6 @@ import android.content.Intent;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.util.Pair;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -29,6 +25,11 @@ import android.widget.ArrayAdapter;
import android.widget.CheckedTextView; import android.widget.CheckedTextView;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.util.Pair;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterListItem; import com.todoroo.astrid.api.FilterListItem;
import com.todoroo.astrid.core.CustomFilterActivity; import com.todoroo.astrid.core.CustomFilterActivity;
@ -151,7 +152,8 @@ public class FilterAdapter extends ArrayAdapter<FilterListItem> {
activity.getResources(), android.R.color.transparent, null), activity.getResources(), android.R.color.transparent, null),
theme.getThemeAccent().getAccentColor() theme.getThemeAccent().getAccentColor()
}); });
Drawable original = ContextCompat.getDrawable(activity, R.drawable.ic_outline_done_24px); Drawable original =
ContextCompat.getDrawable(activity, R.drawable.ic_outline_done_24px);
Drawable wrapped = DrawableCompat.wrap(original.mutate()); Drawable wrapped = DrawableCompat.wrap(original.mutate());
DrawableCompat.setTintList(wrapped, tintList); DrawableCompat.setTintList(wrapped, tintList);
viewHolder.name.setCheckMarkDrawable(wrapped); viewHolder.name.setCheckMarkDrawable(wrapped);

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.adapter; package com.todoroo.astrid.adapter;
import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Lists.newArrayList;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.alarms; package com.todoroo.astrid.alarms;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.api; package com.todoroo.astrid.api;
/** /**

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.api; package com.todoroo.astrid.api;
import android.graphics.Bitmap; import android.graphics.Bitmap;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.api; package com.todoroo.astrid.api;
import android.os.Parcel; import android.os.Parcel;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.api; package com.todoroo.astrid.api;
import android.content.Intent; import android.content.Intent;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.api; package com.todoroo.astrid.api;
import android.graphics.Bitmap; import android.graphics.Bitmap;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.api; package com.todoroo.astrid.api;
import static org.tasks.date.DateTimeUtils.newDateTime; import static org.tasks.date.DateTimeUtils.newDateTime;

@ -2,7 +2,6 @@ package com.todoroo.astrid.api;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import com.todoroo.andlib.sql.QueryTemplate; import com.todoroo.andlib.sql.QueryTemplate;
public class SearchFilter extends Filter { public class SearchFilter extends Filter {

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.api; package com.todoroo.astrid.api;
import android.graphics.Bitmap; import android.graphics.Bitmap;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.backup; package com.todoroo.astrid.backup;
/** /**

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.backup; package com.todoroo.astrid.backup;
import android.app.Activity; import android.app.Activity;
@ -11,11 +12,13 @@ import android.content.res.Resources;
import android.net.Uri; import android.net.Uri;
import android.os.Handler; import android.os.Handler;
import android.text.TextUtils; import android.text.TextUtils;
import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import javax.inject.Inject;
import org.tasks.LocalBroadcastManager; import org.tasks.LocalBroadcastManager;
import org.tasks.R; import org.tasks.R;
import org.tasks.backup.XmlReader; import org.tasks.backup.XmlReader;
@ -35,13 +38,6 @@ import org.tasks.dialogs.DialogBuilder;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory; import org.xmlpull.v1.XmlPullParserFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import javax.inject.Inject;
import timber.log.Timber; import timber.log.Timber;
public class TasksXmlImporter { public class TasksXmlImporter {

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.core; package com.todoroo.astrid.core;
import android.content.Context; import android.content.Context;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.core; package com.todoroo.astrid.core;
import static android.text.TextUtils.isEmpty; import static android.text.TextUtils.isEmpty;
@ -12,8 +13,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
import android.os.Bundle; import android.os.Bundle;
import androidx.core.content.ContextCompat;
import androidx.appcompat.widget.Toolbar;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem; import android.view.MenuItem;
@ -21,6 +20,8 @@ import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ListView; import android.widget.ListView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import com.todoroo.andlib.data.Property.CountProperty; import com.todoroo.andlib.data.Property.CountProperty;

@ -3,10 +3,10 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.core; package com.todoroo.astrid.core;
import android.content.DialogInterface; import android.content.DialogInterface;
import androidx.annotation.NonNull;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -17,6 +17,7 @@ import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import com.todoroo.astrid.api.MultipleSelectCriterion; import com.todoroo.astrid.api.MultipleSelectCriterion;
import com.todoroo.astrid.api.TextInputCriterion; import com.todoroo.astrid.api.TextInputCriterion;
import com.todoroo.astrid.core.CustomFilterActivity.CriterionInstance; import com.todoroo.astrid.core.CustomFilterActivity.CriterionInstance;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.core; package com.todoroo.astrid.core;
import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Lists.newArrayList;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.core; package com.todoroo.astrid.core;
import static org.tasks.PermissionUtil.verifyPermissions; import static org.tasks.PermissionUtil.verifyPermissions;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.core; package com.todoroo.astrid.core;
import android.os.Bundle; import android.os.Bundle;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.core; package com.todoroo.astrid.core;
import static com.todoroo.astrid.dao.TaskDao.TaskCriteria.isVisible; import static com.todoroo.astrid.dao.TaskDao.TaskCriteria.isVisible;
@ -22,16 +23,14 @@ import org.tasks.preferences.Preferences;
*/ */
public class SortHelper { public class SortHelper {
private static final String ADJUSTED_DUE_DATE =
"(CASE WHEN (dueDate / 1000) % 60 > 0 THEN dueDate ELSE (dueDate + 43140000) END)";
public static final int SORT_AUTO = 0; public static final int SORT_AUTO = 0;
public static final int SORT_ALPHA = 1; public static final int SORT_ALPHA = 1;
public static final int SORT_DUE = 2; public static final int SORT_DUE = 2;
public static final int SORT_IMPORTANCE = 3; public static final int SORT_IMPORTANCE = 3;
public static final int SORT_MODIFIED = 4; public static final int SORT_MODIFIED = 4;
public static final int SORT_WIDGET = 5; public static final int SORT_WIDGET = 5;
private static final String ADJUSTED_DUE_DATE =
"(CASE WHEN (dueDate / 1000) % 60 > 0 THEN dueDate ELSE (dueDate + 43140000) END)";
private static final Order ORDER_TITLE = Order.asc(Functions.upper(Task.TITLE)); private static final Order ORDER_TITLE = Order.asc(Functions.upper(Task.TITLE));
/** Takes a SQL query, and if there isn't already an order, creates an order. */ /** Takes a SQL query, and if there isn't already an order, creates an order. */
@ -79,7 +78,9 @@ public class SortHelper {
case SORT_DUE: case SORT_DUE:
order = order =
Order.asc( Order.asc(
"(CASE WHEN (dueDate=0) THEN (strftime('%s','now')*1000)*2 ELSE " + ADJUSTED_DUE_DATE + " END)+importance"); "(CASE WHEN (dueDate=0) THEN (strftime('%s','now')*1000)*2 ELSE "
+ ADJUSTED_DUE_DATE
+ " END)+importance");
break; break;
case SORT_IMPORTANCE: case SORT_IMPORTANCE:
order = order =

@ -3,11 +3,12 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.dao; package com.todoroo.astrid.dao;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.room.RoomDatabase;
import android.database.Cursor; import android.database.Cursor;
import androidx.room.RoomDatabase;
import androidx.sqlite.db.SupportSQLiteDatabase;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import java.io.IOException; import java.io.IOException;
import org.tasks.analytics.Tracker; import org.tasks.analytics.Tracker;

@ -3,10 +3,15 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.dao; package com.todoroo.astrid.dao;
import android.database.Cursor; import static com.todoroo.andlib.utility.DateUtilities.now;
import android.database.Cursor;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Update;
import com.todoroo.andlib.data.Property; import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Functions; import com.todoroo.andlib.sql.Functions;
@ -15,20 +20,12 @@ import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.PermaSql; import com.todoroo.astrid.api.PermaSql;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.helper.UUIDHelper; import com.todoroo.astrid.helper.UUIDHelper;
import org.tasks.BuildConfig;
import org.tasks.jobs.WorkManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.tasks.BuildConfig;
import androidx.room.Dao; import org.tasks.jobs.WorkManager;
import androidx.room.Insert;
import androidx.room.Update;
import timber.log.Timber; import timber.log.Timber;
import static com.todoroo.andlib.utility.DateUtilities.now;
@Dao @Dao
public abstract class TaskDao { public abstract class TaskDao {
@ -60,8 +57,7 @@ public abstract class TaskDao {
@androidx.room.Query("SELECT * FROM tasks WHERE _id IN (:taskIds)") @androidx.room.Query("SELECT * FROM tasks WHERE _id IN (:taskIds)")
public abstract List<Task> fetch(List<Long> taskIds); public abstract List<Task> fetch(List<Long> taskIds);
@androidx.room.Query( @androidx.room.Query("SELECT COUNT(1) FROM tasks WHERE timerStart > 0 AND deleted = 0")
"SELECT COUNT(1) FROM tasks WHERE timerStart > 0 AND deleted = 0")
public abstract int activeTimers(); public abstract int activeTimers();
@androidx.room.Query( @androidx.room.Query(
@ -74,8 +70,7 @@ public abstract class TaskDao {
@androidx.room.Query("SELECT * FROM tasks WHERE completed = 0 AND deleted = 0") @androidx.room.Query("SELECT * FROM tasks WHERE completed = 0 AND deleted = 0")
abstract List<Task> getActiveTasks(); abstract List<Task> getActiveTasks();
@androidx.room.Query( @androidx.room.Query("SELECT * FROM tasks WHERE hideUntil < (strftime('%s','now')*1000)")
"SELECT * FROM tasks WHERE hideUntil < (strftime('%s','now')*1000)")
abstract List<Task> getVisibleTasks(); abstract List<Task> getVisibleTasks();
@androidx.room.Query( @androidx.room.Query(
@ -87,8 +82,7 @@ public abstract class TaskDao {
"UPDATE tasks SET completed = :completionDate " + "WHERE remoteId = :remoteId") "UPDATE tasks SET completed = :completionDate " + "WHERE remoteId = :remoteId")
public abstract void setCompletionDate(String remoteId, long completionDate); public abstract void setCompletionDate(String remoteId, long completionDate);
@androidx.room.Query( @androidx.room.Query("UPDATE tasks SET snoozeTime = :millis WHERE _id in (:taskIds)")
"UPDATE tasks SET snoozeTime = :millis WHERE _id in (:taskIds)")
public abstract void snooze(List<Long> taskIds, long millis); public abstract void snooze(List<Long> taskIds, long millis);
@androidx.room.Query( @androidx.room.Query(

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.data; package com.todoroo.astrid.data;
public class SyncFlags { public class SyncFlags {

@ -3,22 +3,23 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.data; package com.todoroo.astrid.data;
import static java.lang.annotation.RetentionPolicy.SOURCE; import static java.lang.annotation.RetentionPolicy.SOURCE;
import static org.tasks.date.DateTimeUtils.newDateTime; import static org.tasks.date.DateTimeUtils.newDateTime;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.Index;
import androidx.room.PrimaryKey;
import android.content.ContentValues; import android.content.ContentValues;
import android.database.Cursor; import android.database.Cursor;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import androidx.annotation.IntDef;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.IntDef;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.Index;
import androidx.room.PrimaryKey;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.ical.values.RRule; import com.google.ical.values.RRule;
import com.todoroo.andlib.data.Property; import com.todoroo.andlib.data.Property;

@ -3,8 +3,18 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.files; package com.todoroo.astrid.files;
import static android.app.Activity.RESULT_OK;
import static org.tasks.data.TaskAttachment.createNewAttachment;
import static org.tasks.dialogs.AddAttachmentDialog.REQUEST_AUDIO;
import static org.tasks.dialogs.AddAttachmentDialog.REQUEST_CAMERA;
import static org.tasks.dialogs.AddAttachmentDialog.REQUEST_GALLERY;
import static org.tasks.dialogs.AddAttachmentDialog.REQUEST_STORAGE;
import static org.tasks.dialogs.AddAttachmentDialog.newAddAttachmentDialog;
import static org.tasks.files.FileHelper.copyToUri;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -15,9 +25,12 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.OnClick;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import java.util.ArrayList;
import javax.inject.Inject;
import org.tasks.R; import org.tasks.R;
import org.tasks.data.TaskAttachment; import org.tasks.data.TaskAttachment;
import org.tasks.data.TaskAttachmentDao; import org.tasks.data.TaskAttachmentDao;
@ -28,23 +41,6 @@ import org.tasks.injection.FragmentComponent;
import org.tasks.preferences.Preferences; import org.tasks.preferences.Preferences;
import org.tasks.ui.TaskEditControlFragment; import org.tasks.ui.TaskEditControlFragment;
import java.util.ArrayList;
import javax.inject.Inject;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.OnClick;
import static android.app.Activity.RESULT_OK;
import static org.tasks.data.TaskAttachment.createNewAttachment;
import static org.tasks.dialogs.AddAttachmentDialog.REQUEST_AUDIO;
import static org.tasks.dialogs.AddAttachmentDialog.REQUEST_CAMERA;
import static org.tasks.dialogs.AddAttachmentDialog.REQUEST_GALLERY;
import static org.tasks.dialogs.AddAttachmentDialog.REQUEST_STORAGE;
import static org.tasks.dialogs.AddAttachmentDialog.newAddAttachmentDialog;
import static org.tasks.files.FileHelper.copyToUri;
public class FilesControlSet extends TaskEditControlFragment { public class FilesControlSet extends TaskEditControlFragment {
public static final int TAG = R.string.TEA_ctrl_files_pref; public static final int TAG = R.string.TEA_ctrl_files_pref;
@ -90,8 +86,7 @@ public class FilesControlSet extends TaskEditControlFragment {
@OnClick(R.id.add_attachment) @OnClick(R.id.add_attachment)
void addAttachment(View view) { void addAttachment(View view) {
newAddAttachmentDialog(this) newAddAttachmentDialog(this).show(getFragmentManager(), FRAG_TAG_ADD_ATTACHMENT_DIALOG);
.show(getFragmentManager(), FRAG_TAG_ADD_ATTACHMENT_DIALOG);
} }
@Override @Override

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gcal; package com.todoroo.astrid.gcal;
import android.content.ContentResolver; import android.content.ContentResolver;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks; package com.todoroo.astrid.gtasks;
import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Lists.newArrayList;

@ -3,27 +3,24 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks; package com.todoroo.astrid.gtasks;
import static com.google.common.collect.Lists.newArrayList;
import static org.tasks.time.DateTimeUtils.printTimestamp;
import com.google.api.services.tasks.model.TaskList; import com.google.api.services.tasks.model.TaskList;
import com.todoroo.astrid.service.TaskDeleter; import com.todoroo.astrid.service.TaskDeleter;
import org.tasks.LocalBroadcastManager;
import org.tasks.data.GoogleTaskAccount;
import org.tasks.data.GoogleTaskList;
import org.tasks.data.GoogleTaskListDao;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.inject.Inject; import javax.inject.Inject;
import org.tasks.LocalBroadcastManager;
import org.tasks.data.GoogleTaskAccount;
import org.tasks.data.GoogleTaskList;
import org.tasks.data.GoogleTaskListDao;
import timber.log.Timber; import timber.log.Timber;
import static com.google.common.collect.Lists.newArrayList;
import static org.tasks.time.DateTimeUtils.printTimestamp;
public class GtasksListService { public class GtasksListService {
private final GoogleTaskListDao googleTaskListDao; private final GoogleTaskListDao googleTaskListDao;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks; package com.todoroo.astrid.gtasks;
import android.app.Activity; import android.app.Activity;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks; package com.todoroo.astrid.gtasks;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks; package com.todoroo.astrid.gtasks;
import android.text.TextUtils; import android.text.TextUtils;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks.api; package com.todoroo.astrid.gtasks.api;
import com.google.api.client.util.DateTime; import com.google.api.client.util.DateTime;

@ -1,7 +1,6 @@
package com.todoroo.astrid.gtasks.api; package com.todoroo.astrid.gtasks.api;
import android.content.Context; import android.content.Context;
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential; import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpResponse;
@ -15,12 +14,9 @@ import com.google.api.services.tasks.TasksScopes;
import com.google.api.services.tasks.model.Task; import com.google.api.services.tasks.model.Task;
import com.google.api.services.tasks.model.TaskList; import com.google.api.services.tasks.model.TaskList;
import com.google.api.services.tasks.model.TaskLists; import com.google.api.services.tasks.model.TaskLists;
import org.tasks.BuildConfig;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import org.tasks.BuildConfig;
import timber.log.Timber; import timber.log.Timber;
/** /**
@ -34,7 +30,8 @@ public class GtasksInvoker {
private final Tasks service; private final Tasks service;
public GtasksInvoker(Context context, String account) { public GtasksInvoker(Context context, String account) {
GoogleAccountCredential credential = GoogleAccountCredential.usingOAuth2(context, Collections.singletonList(TasksScopes.TASKS)) GoogleAccountCredential credential =
GoogleAccountCredential.usingOAuth2(context, Collections.singletonList(TasksScopes.TASKS))
.setBackOff(new ExponentialBackOff.Builder().build()) .setBackOff(new ExponentialBackOff.Builder().build())
.setSelectedAccountName(account); .setSelectedAccountName(account);
service = service =

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks.api; package com.todoroo.astrid.gtasks.api;
import com.google.api.services.tasks.model.Task; import com.google.api.services.tasks.model.Task;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks.auth; package com.todoroo.astrid.gtasks.auth;
import android.app.ProgressDialog; import android.app.ProgressDialog;

@ -3,11 +3,11 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks.sync; package com.todoroo.astrid.gtasks.sync;
import android.content.Context; import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;
import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.dao.TaskDao;
@ -15,7 +15,13 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.gtasks.GtasksTaskListUpdater; import com.todoroo.astrid.gtasks.GtasksTaskListUpdater;
import com.todoroo.astrid.gtasks.api.GtasksInvoker; import com.todoroo.astrid.gtasks.api.GtasksInvoker;
import com.todoroo.astrid.gtasks.api.MoveRequest; import com.todoroo.astrid.gtasks.api.MoveRequest;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import javax.inject.Inject;
import org.tasks.analytics.Tracker; import org.tasks.analytics.Tracker;
import org.tasks.data.GoogleTask; import org.tasks.data.GoogleTask;
import org.tasks.data.GoogleTaskDao; import org.tasks.data.GoogleTaskDao;
@ -25,16 +31,6 @@ import org.tasks.gtasks.GtaskSyncAdapterHelper;
import org.tasks.injection.ApplicationScope; import org.tasks.injection.ApplicationScope;
import org.tasks.injection.ForApplication; import org.tasks.injection.ForApplication;
import org.tasks.preferences.Preferences; import org.tasks.preferences.Preferences;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import javax.inject.Inject;
import timber.log.Timber; import timber.log.Timber;
@ApplicationScope @ApplicationScope

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.gtasks.sync; package com.todoroo.astrid.gtasks.sync;
import static org.tasks.gtasks.GoogleTaskSynchronizer.mergeDates; import static org.tasks.gtasks.GoogleTaskSynchronizer.mergeDates;

@ -3,8 +3,12 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.notes; package com.todoroo.astrid.notes;
import static androidx.core.content.ContextCompat.getColor;
import static org.tasks.files.ImageHelper.sampleBitmap;
import android.app.Activity; import android.app.Activity;
import android.graphics.Color; import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
@ -15,23 +19,16 @@ import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import java.util.ArrayList;
import javax.inject.Inject;
import org.tasks.R; import org.tasks.R;
import org.tasks.data.UserActivity; import org.tasks.data.UserActivity;
import org.tasks.data.UserActivityDao; import org.tasks.data.UserActivityDao;
import org.tasks.files.FileHelper; import org.tasks.files.FileHelper;
import org.tasks.preferences.Preferences; import org.tasks.preferences.Preferences;
import java.util.ArrayList;
import javax.inject.Inject;
import static androidx.core.content.ContextCompat.getColor;
import static org.tasks.files.ImageHelper.sampleBitmap;
public class CommentsController { public class CommentsController {
private final UserActivityDao userActivityDao; private final UserActivityDao userActivityDao;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.provider; package com.todoroo.astrid.provider;
import android.content.ContentValues; import android.content.ContentValues;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.reminders; package com.todoroo.astrid.reminders;
import static com.todoroo.andlib.utility.AndroidUtilities.atLeastMarshmallow; import static com.todoroo.andlib.utility.AndroidUtilities.atLeastMarshmallow;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.reminders; package com.todoroo.astrid.reminders;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.repeats; package com.todoroo.astrid.repeats;
import static androidx.core.content.ContextCompat.getColor; import static androidx.core.content.ContextCompat.getColor;
@ -14,10 +15,6 @@ import static org.tasks.time.DateTimeUtils.currentTimeMillis;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -26,6 +23,10 @@ import android.widget.AdapterView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import butterknife.OnItemSelected; import butterknife.OnItemSelected;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.repeats; package com.todoroo.astrid.repeats;
import static org.tasks.date.DateTimeUtils.newDate; import static org.tasks.date.DateTimeUtils.newDate;

@ -3,11 +3,13 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.service; package com.todoroo.astrid.service;
import static com.google.common.base.Strings.isNullOrEmpty;
import android.content.Context; import android.content.Context;
import android.os.Environment; import android.os.Environment;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableListMultimap;
@ -16,7 +18,9 @@ import com.google.common.collect.Multimaps;
import com.todoroo.astrid.api.GtasksFilter; import com.todoroo.astrid.api.GtasksFilter;
import com.todoroo.astrid.dao.Database; import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.tags.TagService; import com.todoroo.astrid.tags.TagService;
import java.io.File;
import java.util.List;
import javax.inject.Inject;
import org.tasks.BuildConfig; import org.tasks.BuildConfig;
import org.tasks.LocalBroadcastManager; import org.tasks.LocalBroadcastManager;
import org.tasks.R; import org.tasks.R;
@ -39,16 +43,8 @@ import org.tasks.injection.ForApplication;
import org.tasks.preferences.DefaultFilterProvider; import org.tasks.preferences.DefaultFilterProvider;
import org.tasks.preferences.Preferences; import org.tasks.preferences.Preferences;
import org.tasks.scheduling.BackgroundScheduler; import org.tasks.scheduling.BackgroundScheduler;
import java.io.File;
import java.util.List;
import javax.inject.Inject;
import timber.log.Timber; import timber.log.Timber;
import static com.google.common.base.Strings.isNullOrEmpty;
public class StartupService { public class StartupService {
private static final int V4_8_0 = 380; private static final int V4_8_0 = 380;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.service; package com.todoroo.astrid.service;
import com.todoroo.astrid.gtasks.sync.GtasksSyncService; import com.todoroo.astrid.gtasks.sync.GtasksSyncService;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.subtasks; package com.todoroo.astrid.subtasks;
import android.app.Activity; import android.app.Activity;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.subtasks; package com.todoroo.astrid.subtasks;
import android.app.Activity; import android.app.Activity;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.sync; package com.todoroo.astrid.sync;
public interface SyncResultCallback { public interface SyncResultCallback {

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.tags; package com.todoroo.astrid.tags;
import com.google.common.base.Strings; import com.google.common.base.Strings;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.tags; package com.todoroo.astrid.tags;
import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Lists.newArrayList;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.tags; package com.todoroo.astrid.tags;
import static com.google.common.base.Predicates.notNull; import static com.google.common.base.Predicates.notNull;
@ -72,20 +73,23 @@ public final class TagsControlSet extends TaskEditControlFragment {
private static final String EXTRA_NEW_TAGS = "extra_new_tags"; private static final String EXTRA_NEW_TAGS = "extra_new_tags";
private static final String EXTRA_ORIGINAL_TAGS = "extra_original_tags"; private static final String EXTRA_ORIGINAL_TAGS = "extra_original_tags";
private static final String EXTRA_SELECTED_TAGS = "extra_selected_tags"; private static final String EXTRA_SELECTED_TAGS = "extra_selected_tags";
private final Ordering<TagData> orderByName =
new Ordering<TagData>() {
@Override
public int compare(TagData left, TagData right) {
return left.getName().compareTo(right.getName());
}
};
@Inject TagDao tagDao; @Inject TagDao tagDao;
@Inject TagDataDao tagDataDao; @Inject TagDataDao tagDataDao;
@Inject TagService tagService; @Inject TagService tagService;
@Inject DialogBuilder dialogBuilder; @Inject DialogBuilder dialogBuilder;
@Inject ThemeCache themeCache; @Inject ThemeCache themeCache;
@Inject ChipProvider chipProvider; @Inject ChipProvider chipProvider;
@BindView(R.id.no_tags) @BindView(R.id.no_tags)
TextView tagsDisplay; TextView tagsDisplay;
@BindView(R.id.chip_group) @BindView(R.id.chip_group)
ChipGroup chipGroup; ChipGroup chipGroup;
private LinearLayout newTagLayout; private LinearLayout newTagLayout;
private ListView tagListView; private ListView tagListView;
private View dialogView; private View dialogView;
@ -93,13 +97,6 @@ public final class TagsControlSet extends TaskEditControlFragment {
private List<TagData> allTags; private List<TagData> allTags;
private ArrayList<TagData> originalTags; private ArrayList<TagData> originalTags;
private ArrayList<TagData> selectedTags; private ArrayList<TagData> selectedTags;
private final Ordering<TagData> orderByName =
new Ordering<TagData>() {
@Override
public int compare(TagData left, TagData right) {
return left.getName().compareTo(right.getName());
}
};
@Nullable @Nullable
@Override @Override
@ -136,7 +133,8 @@ public final class TagsControlSet extends TaskEditControlFragment {
ThemeColor themeColor = ThemeColor themeColor =
themeCache.getThemeColor(tagData.getColor() >= 0 ? tagData.getColor() : 19); themeCache.getThemeColor(tagData.getColor() >= 0 ? tagData.getColor() : 19);
view.setText(tagData.getName()); view.setText(tagData.getName());
Drawable original = ContextCompat.getDrawable(getContext(), R.drawable.ic_outline_label_24px); Drawable original =
ContextCompat.getDrawable(getContext(), R.drawable.ic_outline_label_24px);
Drawable wrapped = DrawableCompat.wrap(original.mutate()); Drawable wrapped = DrawableCompat.wrap(original.mutate());
DrawableCompat.setTint(wrapped, themeColor.getPrimaryColor()); DrawableCompat.setTint(wrapped, themeColor.getPrimaryColor());
if (atLeastJellybeanMR1()) { if (atLeastJellybeanMR1()) {

@ -3,14 +3,13 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.timers; package com.todoroo.astrid.timers;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemClock; import android.os.SystemClock;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.format.DateFormat; import android.text.format.DateFormat;
import android.text.format.DateUtils; import android.text.format.DateUtils;
@ -20,6 +19,8 @@ import android.view.ViewGroup;
import android.widget.Chronometer; import android.widget.Chronometer;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.timers; package com.todoroo.astrid.timers;
import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Lists.newArrayList;

@ -3,6 +3,7 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.timers; package com.todoroo.astrid.timers;
import static org.tasks.time.DateTimeUtils.currentTimeMillis; import static org.tasks.time.DateTimeUtils.currentTimeMillis;

@ -3,13 +3,14 @@
* *
* <p>See the file "LICENSE" for the full license governing this code. * <p>See the file "LICENSE" for the full license governing this code.
*/ */
package com.todoroo.astrid.ui; package com.todoroo.astrid.ui;
import android.content.Context; import android.content.Context;
import androidx.appcompat.widget.AppCompatImageView;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.ViewDebug; import android.view.ViewDebug;
import android.widget.Checkable; import android.widget.Checkable;
import androidx.appcompat.widget.AppCompatImageView;
public class CheckableImageView extends AppCompatImageView implements Checkable { public class CheckableImageView extends AppCompatImageView implements Checkable {

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

Loading…
Cancel
Save