Tighten access restrictions

pull/996/head
Alex Baker 6 years ago
parent aed4614eb1
commit 688baad5a6

@ -202,7 +202,7 @@ public class TranslationTests {
/** the original string */ /** the original string */
final String string; final String string;
public FormatStringData(String string) { FormatStringData(String string) {
this.string = string; this.string = string;
int pos = -1; int pos = -1;

@ -18,13 +18,13 @@ import org.tasks.injection.ForApplication;
import org.tasks.preferences.Preferences; import org.tasks.preferences.Preferences;
import timber.log.Timber; import timber.log.Timber;
public class BuildSetup { class BuildSetup {
private final Context context; private final Context context;
private final Preferences preferences; private final Preferences preferences;
@Inject @Inject
public BuildSetup(@ForApplication Context context, Preferences preferences) { BuildSetup(@ForApplication Context context, Preferences preferences) {
this.context = context; this.context = context;
this.preferences = preferences; this.preferences = preferences;
} }

@ -21,7 +21,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import timber.log.Timber; import timber.log.Timber;
public class FlipperHttpInterceptor<T> implements HttpExecuteInterceptor, HttpResponseInterceptor { class FlipperHttpInterceptor<T> implements HttpExecuteInterceptor, HttpResponseInterceptor {
private final Class<T> responseClass; private final Class<T> responseClass;
private final String requestId = UUIDHelper.newUUID(); private final String requestId = UUIDHelper.newUUID();
@ -43,7 +43,7 @@ public class FlipperHttpInterceptor<T> implements HttpExecuteInterceptor, HttpRe
plugin.reportResponse(toResponseInfo(response, now())); plugin.reportResponse(toResponseInfo(response, now()));
} }
public void report(HttpResponse response, long start, long end) throws IOException { void report(HttpResponse response, long start, long end) throws IOException {
plugin.reportRequest(toRequestInfo(response.getRequest(), start)); plugin.reportRequest(toRequestInfo(response.getRequest(), start));
plugin.reportResponse(toResponseInfo(response, end)); plugin.reportResponse(toResponseInfo(response, end));
} }

@ -33,7 +33,7 @@ import java.security.spec.X509EncodedKeySpec;
* Security-related methods. For a secure implementation, all of this code should be implemented on * Security-related methods. For a secure implementation, all of this code should be implemented on
* a server that communicates with the application on the device. * a server that communicates with the application on the device.
*/ */
public class Security { class Security {
private static final String TAG = "IABUtil/Security"; private static final String TAG = "IABUtil/Security";
private static final String KEY_FACTORY_ALGORITHM = "RSA"; private static final String KEY_FACTORY_ALGORITHM = "RSA";
@ -47,7 +47,7 @@ public class Security {
* @param signature the signature for the data, signed with the private key * @param signature the signature for the data, signed with the private key
* @throws IOException if encoding algorithm is not supported or key specification is invalid * @throws IOException if encoding algorithm is not supported or key specification is invalid
*/ */
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) static boolean verifyPurchase(String base64PublicKey, String signedData, String signature)
throws IOException { throws IOException {
if (TextUtils.isEmpty(signedData) if (TextUtils.isEmpty(signedData)
|| TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(base64PublicKey)
@ -66,7 +66,7 @@ public class Security {
* @param encodedPublicKey Base64-encoded public key * @param encodedPublicKey Base64-encoded public key
* @throws IOException if encoding algorithm is not supported or key specification is invalid * @throws IOException if encoding algorithm is not supported or key specification is invalid
*/ */
public static PublicKey generatePublicKey(String encodedPublicKey) throws IOException { private static PublicKey generatePublicKey(String encodedPublicKey) throws IOException {
try { try {
byte[] decodedKey = Base64.decode(encodedPublicKey, Base64.DEFAULT); byte[] decodedKey = Base64.decode(encodedPublicKey, Base64.DEFAULT);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM); KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM);
@ -90,7 +90,7 @@ public class Security {
* @param signature server signature * @param signature server signature
* @return true if the data and signature match * @return true if the data and signature match
*/ */
public static boolean verify(PublicKey publicKey, String signedData, String signature) { private static boolean verify(PublicKey publicKey, String signedData, String signature) {
byte[] signatureBytes; byte[] signatureBytes;
try { try {
signatureBytes = Base64.decode(signature, Base64.DEFAULT); signatureBytes = Base64.decode(signature, Base64.DEFAULT);

@ -7,16 +7,16 @@ import org.tasks.R;
import org.tasks.injection.ForApplication; import org.tasks.injection.ForApplication;
import timber.log.Timber; import timber.log.Timber;
public class SignatureVerifier { class SignatureVerifier {
private final String billingKey; private final String billingKey;
@Inject @Inject
public SignatureVerifier(@ForApplication Context context) { SignatureVerifier(@ForApplication Context context) {
billingKey = context.getString(R.string.gp_key); billingKey = context.getString(R.string.gp_key);
} }
public boolean verifySignature(Purchase purchase) { boolean verifySignature(Purchase purchase) {
try { try {
return Security.verifyPurchase( return Security.verifyPurchase(
billingKey, purchase.getOriginalJson(), purchase.getSignature()); billingKey, purchase.getOriginalJson(), purchase.getSignature());

@ -90,7 +90,7 @@ public class PlayServices {
} }
} }
public String getStatus() { private String getStatus() {
return GoogleApiAvailability.getInstance().getErrorString(getResult()); return GoogleApiAvailability.getInstance().getErrorString(getResult());
} }

@ -14,11 +14,11 @@ import org.tasks.location.PlaceSearchProvider;
import org.tasks.preferences.Preferences; import org.tasks.preferences.Preferences;
@Module @Module
public class LocationModule { class LocationModule {
@Provides @Provides
@ActivityScope @ActivityScope
public PlaceSearchProvider getPlaceSearchProvider( PlaceSearchProvider getPlaceSearchProvider(
@ForApplication Context context, @ForApplication Context context,
Preferences preferences, Preferences preferences,
PlayServices playServices, PlayServices playServices,
@ -32,7 +32,7 @@ public class LocationModule {
@Provides @Provides
@ActivityScope @ActivityScope
public MapFragment getMapFragment(@ForApplication Context context, Preferences preferences) { MapFragment getMapFragment(@ForApplication Context context, Preferences preferences) {
return preferences.useGoogleMaps() return preferences.useGoogleMaps()
? new GoogleMapFragment(context) ? new GoogleMapFragment(context)
: new MapboxMapFragment(context); : new MapboxMapFragment(context);

@ -104,7 +104,7 @@ public class MainActivity extends InjectingAppCompatActivity
private Filter filter; private Filter filter;
private ActionMode actionMode = null; private ActionMode actionMode = null;
TaskListActivityBinding binding; private TaskListActivityBinding binding;
/** @see android.app.Activity#onCreate(Bundle) */ /** @see android.app.Activity#onCreate(Bundle) */
@Override @Override

@ -144,7 +144,7 @@ public final class TaskListFragment extends InjectingFragment
private static final int SEARCH_DEBOUNCE_TIMEOUT = 300; private static final int SEARCH_DEBOUNCE_TIMEOUT = 300;
private final RefreshReceiver refreshReceiver = new RefreshReceiver(); private final RefreshReceiver refreshReceiver = new RefreshReceiver();
protected CompositeDisposable disposables; private CompositeDisposable disposables;
@Inject SyncAdapters syncAdapters; @Inject SyncAdapters syncAdapters;
@Inject TaskDeleter taskDeleter; @Inject TaskDeleter taskDeleter;
@Inject @ForActivity Context context; @Inject @ForActivity Context context;
@ -536,7 +536,7 @@ public final class TaskListFragment extends InjectingFragment
return makeSnackbar(getString(res, args)); return makeSnackbar(getString(res, args));
} }
public Snackbar makeSnackbar(String text) { private Snackbar makeSnackbar(String text) {
Snackbar snackbar = Snackbar snackbar =
Snackbar.make(coordinatorLayout, text, 8000) Snackbar.make(coordinatorLayout, text, 8000)
.setTextColor(getColor(context, R.color.snackbar_text_color)) .setTextColor(getColor(context, R.color.snackbar_text_color))

@ -141,7 +141,7 @@ public class FilterAdapter extends BaseAdapter {
return convertView; return convertView;
} }
public ArrayList<FilterListItem> getItems() { private ArrayList<FilterListItem> getItems() {
assertMainThread(); assertMainThread();
return newArrayList(items); return newArrayList(items);
} }

@ -9,8 +9,8 @@ import org.tasks.tasklist.ViewHolder;
public class GoogleTaskManualSortAdapter extends TaskAdapter { public class GoogleTaskManualSortAdapter extends TaskAdapter {
protected final TaskDao taskDao; final TaskDao taskDao;
protected final GoogleTaskDao googleTaskDao; final GoogleTaskDao googleTaskDao;
GoogleTaskManualSortAdapter(TaskDao taskDao, GoogleTaskDao googleTaskDao) { GoogleTaskManualSortAdapter(TaskDao taskDao, GoogleTaskDao googleTaskDao) {
this.taskDao = taskDao; this.taskDao = taskDao;

@ -19,7 +19,7 @@ import org.tasks.preferences.Preferences;
import org.tasks.preferences.SyncPreferences; import org.tasks.preferences.SyncPreferences;
import org.tasks.themes.DrawableUtil; import org.tasks.themes.DrawableUtil;
public class SubheaderViewHolder extends RecyclerView.ViewHolder { class SubheaderViewHolder extends RecyclerView.ViewHolder {
private final Preferences preferences; private final Preferences preferences;
private final GoogleTaskDao googleTaskDao; private final GoogleTaskDao googleTaskDao;

@ -28,7 +28,7 @@ public class TaskAdapter {
private final Set<Long> selected = new HashSet<>(); private final Set<Long> selected = new HashSet<>();
private TaskListRecyclerAdapter helper; private TaskListRecyclerAdapter helper;
public int getCount() { int getCount() {
return helper.getItemCount(); return helper.getItemCount();
} }
@ -96,7 +96,7 @@ public class TaskAdapter {
public void moved(int from, int to, int indent) {} public void moved(int from, int to, int indent) {}
public TaskContainer getTask(int position) { TaskContainer getTask(int position) {
return helper.getItem(position); return helper.getItem(position);
} }

@ -69,7 +69,7 @@ public class CustomFilterActivity extends ThemedInjectingAppCompatActivity
@Inject FilterCriteriaProvider filterCriteriaProvider; @Inject FilterCriteriaProvider filterCriteriaProvider;
@Inject Locale locale; @Inject Locale locale;
CustomFilterActivityBinding binding; private CustomFilterActivityBinding binding;
private ListView listView; private ListView listView;
private CustomFilterAdapter adapter; private CustomFilterAdapter adapter;

@ -61,7 +61,7 @@ class CustomFilterAdapter extends ArrayAdapter<CriterionInstance> {
// --- view event handling // --- view event handling
public CustomFilterAdapter( CustomFilterAdapter(
CustomFilterActivity activity, CustomFilterActivity activity,
DialogBuilder dialogBuilder, DialogBuilder dialogBuilder,
List<CriterionInstance> objects, List<CriterionInstance> objects,
@ -73,7 +73,7 @@ class CustomFilterAdapter extends ArrayAdapter<CriterionInstance> {
inflater = activity.getLayoutInflater(); inflater = activity.getLayoutInflater();
} }
public void onCreateContextMenu(ContextMenu menu, View v) { void onCreateContextMenu(ContextMenu menu, View v) {
// view holder // view holder
ViewHolder viewHolder = (ViewHolder) v.getTag(); ViewHolder viewHolder = (ViewHolder) v.getTag();
if (viewHolder == null || viewHolder.item.type == CriterionInstance.TYPE_UNIVERSE) { if (viewHolder == null || viewHolder.item.type == CriterionInstance.TYPE_UNIVERSE) {
@ -115,7 +115,7 @@ class CustomFilterAdapter extends ArrayAdapter<CriterionInstance> {
} }
/** Show options menu for the given criterioninstance */ /** Show options menu for the given criterioninstance */
public void showOptionsFor(final CriterionInstance item, final Runnable onComplete) { void showOptionsFor(final CriterionInstance item, final Runnable onComplete) {
AlertDialogBuilder dialog = dialogBuilder.newDialog(item.criterion.name); AlertDialogBuilder dialog = dialogBuilder.newDialog(item.criterion.name);
if (item.criterion instanceof MultipleSelectCriterion) { if (item.criterion instanceof MultipleSelectCriterion) {

@ -5,7 +5,7 @@ import java.io.IOException;
public class HttpNotFoundException extends IOException { public class HttpNotFoundException extends IOException {
public HttpNotFoundException(HttpResponseException e) { HttpNotFoundException(HttpResponseException e) {
super(e.getMessage()); super(e.getMessage());
} }
} }

@ -138,7 +138,7 @@ public class ReminderControlSet extends TaskEditControlFragment {
} }
} }
void addAlarm(String selected) { private void addAlarm(String selected) {
if (selected.equals(getString(R.string.when_due))) { if (selected.equals(getString(R.string.when_due))) {
addDue(); addDue();
} else if (selected.equals(getString(R.string.when_overdue))) { } else if (selected.equals(getString(R.string.when_overdue))) {

@ -11,6 +11,7 @@ import org.tasks.preferences.Preferences;
import org.tasks.time.DateTime; import org.tasks.time.DateTime;
import timber.log.Timber; import timber.log.Timber;
@SuppressWarnings({"WeakerAccess", "RedundantSuppression"})
public class AACRecorder extends ViewModel { public class AACRecorder extends ViewModel {
private MediaRecorder mediaRecorder; private MediaRecorder mediaRecorder;

@ -185,7 +185,7 @@ public abstract class BaseCaldavAccountSettingsActivity extends ThemedInjectingA
return binding.user.getText().toString().trim(); return binding.user.getText().toString().trim();
} }
protected boolean passwordChanged() { boolean passwordChanged() {
return caldavAccount == null || !PASSWORD_MASK.equals(binding.password.getText().toString().trim()); return caldavAccount == null || !PASSWORD_MASK.equals(binding.password.getText().toString().trim());
} }

@ -57,7 +57,7 @@ public class CaldavAccountSettingsActivity extends BaseCaldavAccountSettingsActi
finish(); finish();
} }
protected void updateAccount(String principal) { private void updateAccount(String principal) {
hideProgressIndicator(); hideProgressIndicator();
caldavAccount.setName(getNewName()); caldavAccount.setName(getNewName());

@ -6,16 +6,16 @@ import java.util.ArrayList;
import kotlin.Unit; import kotlin.Unit;
import kotlin.jvm.functions.Function2; import kotlin.jvm.functions.Function2;
public class ResponseList extends ArrayList<Response> class ResponseList extends ArrayList<Response>
implements Function2<Response, HrefRelation, Unit> { implements Function2<Response, HrefRelation, Unit> {
private final HrefRelation filter; private final HrefRelation filter;
public ResponseList() { ResponseList() {
this(null); this(null);
} }
public ResponseList(HrefRelation filter) { ResponseList(HrefRelation filter) {
this.filter = filter; this.filter = filter;
} }

@ -12,7 +12,7 @@ import org.tasks.injection.ForApplication;
import org.tasks.preferences.PermissionChecker; import org.tasks.preferences.PermissionChecker;
import timber.log.Timber; import timber.log.Timber;
public class CalendarEventAttendeeProvider { class CalendarEventAttendeeProvider {
private static final String[] COLUMNS = { private static final String[] COLUMNS = {
CalendarContract.Attendees.ATTENDEE_NAME, CalendarContract.Attendees.ATTENDEE_EMAIL, CalendarContract.Attendees.ATTENDEE_NAME, CalendarContract.Attendees.ATTENDEE_EMAIL,

@ -14,7 +14,7 @@ import org.tasks.security.Encryption;
@Entity(tableName = "caldav_accounts") @Entity(tableName = "caldav_accounts")
public class CaldavAccount implements Parcelable { public class CaldavAccount implements Parcelable {
public static final int TYPE_CALDAV = 0; private static final int TYPE_CALDAV = 0;
public static final int TYPE_ETESYNC = 1; public static final int TYPE_ETESYNC = 1;
public static final Parcelable.Creator<CaldavAccount> CREATOR = public static final Parcelable.Creator<CaldavAccount> CREATOR =
new Parcelable.Creator<CaldavAccount>() { new Parcelable.Creator<CaldavAccount>() {

@ -19,11 +19,11 @@ import org.tasks.preferences.Preferences;
@Entity(tableName = TABLE_NAME, indices = @Index(name = "geo_task", value = "task")) @Entity(tableName = TABLE_NAME, indices = @Index(name = "geo_task", value = "task"))
public class Geofence implements Serializable, Parcelable { public class Geofence implements Serializable, Parcelable {
public static final String TABLE_NAME = "geofences"; static final String TABLE_NAME = "geofences";
public static final Table TABLE = new Table(TABLE_NAME); public static final Table TABLE = new Table(TABLE_NAME);
public static final LongProperty TASK = new LongProperty(TABLE, "task"); public static final LongProperty TASK = new LongProperty(TABLE, "task");
public static final StringProperty PLACE = new StringProperty(TABLE, "place"); static final StringProperty PLACE = new StringProperty(TABLE, "place");
public static final Parcelable.Creator<Geofence> CREATOR = public static final Parcelable.Creator<Geofence> CREATOR =
new Parcelable.Creator<Geofence>() { new Parcelable.Creator<Geofence>() {

@ -76,7 +76,7 @@ public abstract class GoogleTaskDao {
@Update @Update
public abstract void update(GoogleTask googleTask); public abstract void update(GoogleTask googleTask);
public void update(SubsetGoogleTask googleTask) { private void update(SubsetGoogleTask googleTask) {
update(googleTask.getId(), googleTask.getParent(), googleTask.getOrder()); update(googleTask.getId(), googleTask.getParent(), googleTask.getOrder());
} }

@ -35,7 +35,7 @@ public class Location implements Serializable, Parcelable {
} }
@Ignore @Ignore
protected Location(Parcel in) { private Location(Parcel in) {
geofence = in.readParcelable(Geofence.class.getClassLoader()); geofence = in.readParcelable(Geofence.class.getClassLoader());
place = in.readParcelable(Place.class.getClassLoader()); place = in.readParcelable(Place.class.getClassLoader());
} }

@ -36,7 +36,7 @@ import org.tasks.themes.CustomIcons;
public class Place implements Serializable, Parcelable { public class Place implements Serializable, Parcelable {
public static final String KEY = "place"; public static final String KEY = "place";
public static final String TABLE_NAME = "places"; static final String TABLE_NAME = "places";
public static final Table TABLE = new Table(TABLE_NAME); public static final Table TABLE = new Table(TABLE_NAME);
public static final StringProperty UID = new StringProperty(TABLE, "uid"); public static final StringProperty UID = new StringProperty(TABLE, "uid");

@ -31,7 +31,7 @@ public class DbUtils {
batch(items, MAX_SQLITE_ARGS, callback); batch(items, MAX_SQLITE_ARGS, callback);
} }
public static <T> void batch(List<T> items, int size, Callback<List<T>> callback) { private static <T> void batch(List<T> items, int size, Callback<List<T>> callback) {
if (items.isEmpty()) { if (items.isEmpty()) {
return; return;
} }

@ -73,7 +73,7 @@ class ColorPalettePicker : InjectingDialogFragment() {
@BindView(R.id.icons) lateinit var recyclerView: RecyclerView @BindView(R.id.icons) lateinit var recyclerView: RecyclerView
private lateinit var colors: List<Pickable> private lateinit var colors: List<Pickable>
lateinit var palette: Palette private lateinit var palette: Palette
var callback: ColorPickedCallback? = null var callback: ColorPickedCallback? = null
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {

@ -14,14 +14,14 @@ import org.tasks.R;
import org.tasks.billing.Inventory; import org.tasks.billing.Inventory;
import org.tasks.themes.CustomIcons; import org.tasks.themes.CustomIcons;
public class IconPickerAdapter extends ListAdapter<Integer, IconPickerHolder> { class IconPickerAdapter extends ListAdapter<Integer, IconPickerHolder> {
private final Activity activity; private final Activity activity;
private final Inventory inventory; private final Inventory inventory;
private final int current; private final int current;
private final Callback<Integer> onSelected; private final Callback<Integer> onSelected;
public IconPickerAdapter( IconPickerAdapter(
Activity activity, Inventory inventory, int current, Callback<Integer> onSelected) { Activity activity, Inventory inventory, int current, Callback<Integer> onSelected) {
super(new DiffCallback()); super(new DiffCallback());
this.activity = activity; this.activity = activity;

@ -27,7 +27,7 @@ import org.tasks.preferences.Preferences;
*/ */
public class DriveLoginActivity extends InjectingAppCompatActivity { public class DriveLoginActivity extends InjectingAppCompatActivity {
public static final String EXTRA_ERROR = "extra_error"; private static final String EXTRA_ERROR = "extra_error";
private static final int RC_CHOOSE_ACCOUNT = 10988; private static final int RC_CHOOSE_ACCOUNT = 10988;
@Inject DialogBuilder dialogBuilder; @Inject DialogBuilder dialogBuilder;
@Inject GoogleAccountManager googleAccountManager; @Inject GoogleAccountManager googleAccountManager;

@ -3,6 +3,7 @@ package org.tasks.etesync;
import org.tasks.data.CaldavAccount; import org.tasks.data.CaldavAccount;
import org.tasks.ui.CompletableViewModel; import org.tasks.ui.CompletableViewModel;
@SuppressWarnings("WeakerAccess")
public class CreateUserInfoViewModel extends CompletableViewModel<String> { public class CreateUserInfoViewModel extends CompletableViewModel<String> {
void createUserInfo(EteSyncClient client, CaldavAccount caldavAccount, String derivedKey) { void createUserInfo(EteSyncClient client, CaldavAccount caldavAccount, String derivedKey) {

@ -42,10 +42,10 @@ public class EncryptionSettingsActivity extends ThemedInjectingAppCompatActivity
@Inject EteSyncClient client; @Inject EteSyncClient client;
@Inject Encryption encryption; @Inject Encryption encryption;
ActivityEtesyncEncryptionSettingsBinding binding; private ActivityEtesyncEncryptionSettingsBinding binding;
private UserInfo userInfo; private UserInfo userInfo;
private CaldavAccount caldavAccount; private CaldavAccount caldavAccount;
CreateUserInfoViewModel createUserInfoViewModel; private CreateUserInfoViewModel createUserInfoViewModel;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {

@ -8,7 +8,7 @@ public class CaldavFilters {
@Embedded public CaldavCalendar caldavCalendar; @Embedded public CaldavCalendar caldavCalendar;
public int count; public int count;
public CaldavFilter toCaldavFilter() { CaldavFilter toCaldavFilter() {
CaldavFilter filter = new CaldavFilter(caldavCalendar); CaldavFilter filter = new CaldavFilter(caldavCalendar);
filter.count = count; filter.count = count;
return filter; return filter;

@ -8,7 +8,7 @@ public class GoogleTaskFilters {
@Embedded public GoogleTaskList googleTaskList; @Embedded public GoogleTaskList googleTaskList;
public int count; public int count;
public GtasksFilter toGtasksFilter() { GtasksFilter toGtasksFilter() {
GtasksFilter filter = new GtasksFilter(googleTaskList); GtasksFilter filter = new GtasksFilter(googleTaskList);
filter.count = count; filter.count = count;
return filter; return filter;

@ -7,7 +7,7 @@ public class LocationFilters {
@Embedded public Place place; @Embedded public Place place;
public int count; public int count;
public PlaceFilter toLocationFilter() { PlaceFilter toLocationFilter() {
PlaceFilter filter = new PlaceFilter(place); PlaceFilter filter = new PlaceFilter(place);
filter.count = count; filter.count = count;
return filter; return filter;

@ -8,7 +8,7 @@ public class TagFilters {
@Embedded public TagData tagData; @Embedded public TagData tagData;
public int count; public int count;
public TagFilter toTagFilter() { TagFilter toTagFilter() {
TagFilter filter = new TagFilter(tagData); TagFilter filter = new TagFilter(tagData);
filter.count = count; filter.count = count;
return filter; return filter;

@ -13,7 +13,7 @@ import org.tasks.themes.ThemeBase;
import org.tasks.themes.ThemeColor; import org.tasks.themes.ThemeColor;
@Module @Module
public class ActivityModule { class ActivityModule {
private final Activity activity; private final Activity activity;
@ -28,13 +28,13 @@ public class ActivityModule {
@Provides @Provides
@ForActivity @ForActivity
public Context getActivityContext() { Context getActivityContext() {
return activity; return activity;
} }
@Provides @Provides
@ActivityScope @ActivityScope
public ThemeBase getThemeBase(Preferences preferences, Inventory inventory) { ThemeBase getThemeBase(Preferences preferences, Inventory inventory) {
return ThemeBase.getThemeBase(preferences, inventory, activity.getIntent()); return ThemeBase.getThemeBase(preferences, inventory, activity.getIntent());
} }
@ -46,7 +46,7 @@ public class ActivityModule {
@Provides @Provides
@ActivityScope @ActivityScope
public ThemeAccent getThemeAccent(ColorProvider colorProvider, Preferences preferences) { ThemeAccent getThemeAccent(ColorProvider colorProvider, Preferences preferences) {
return colorProvider.getThemeAccent(preferences.getInt(R.string.p_theme_accent, 1)); return colorProvider.getThemeAccent(preferences.getInt(R.string.p_theme_accent, 1));
} }
} }

@ -33,7 +33,7 @@ import org.tasks.security.KeyStoreEncryption;
import org.tasks.security.NoEncryption; import org.tasks.security.NoEncryption;
@Module @Module
public class ApplicationModule { class ApplicationModule {
private final Context context; private final Context context;
@ -54,79 +54,79 @@ public class ApplicationModule {
@Provides @Provides
@ApplicationScope @ApplicationScope
public NotificationDao getNotificationDao(Database database) { NotificationDao getNotificationDao(Database database) {
return database.notificationDao(); return database.notificationDao();
} }
@Provides @Provides
@ApplicationScope @ApplicationScope
public TagDataDao getTagDataDao(Database database) { TagDataDao getTagDataDao(Database database) {
return database.getTagDataDao(); return database.getTagDataDao();
} }
@Provides @Provides
@ApplicationScope @ApplicationScope
public UserActivityDao getUserActivityDao(Database database) { UserActivityDao getUserActivityDao(Database database) {
return database.getUserActivityDao(); return database.getUserActivityDao();
} }
@Provides @Provides
@ApplicationScope @ApplicationScope
public TaskAttachmentDao getTaskAttachmentDao(Database database) { TaskAttachmentDao getTaskAttachmentDao(Database database) {
return database.getTaskAttachmentDao(); return database.getTaskAttachmentDao();
} }
@Provides @Provides
@ApplicationScope @ApplicationScope
public TaskListMetadataDao getTaskListMetadataDao(Database database) { TaskListMetadataDao getTaskListMetadataDao(Database database) {
return database.getTaskListMetadataDao(); return database.getTaskListMetadataDao();
} }
@Provides @Provides
@ApplicationScope @ApplicationScope
public GoogleTaskDao getGoogleTaskDao(Database database) { GoogleTaskDao getGoogleTaskDao(Database database) {
return database.getGoogleTaskDao(); return database.getGoogleTaskDao();
} }
@Provides @Provides
@ApplicationScope @ApplicationScope
public AlarmDao getAlarmDao(Database database) { AlarmDao getAlarmDao(Database database) {
return database.getAlarmDao(); return database.getAlarmDao();
} }
@Provides @Provides
@ApplicationScope @ApplicationScope
public LocationDao getGeofenceDao(Database database) { LocationDao getGeofenceDao(Database database) {
return database.getLocationDao(); return database.getLocationDao();
} }
@Provides @Provides
@ApplicationScope @ApplicationScope
public TagDao getTagDao(Database database) { TagDao getTagDao(Database database) {
return database.getTagDao(); return database.getTagDao();
} }
@Provides @Provides
@ApplicationScope @ApplicationScope
public FilterDao getFilterDao(Database database) { FilterDao getFilterDao(Database database) {
return database.getFilterDao(); return database.getFilterDao();
} }
@Provides @Provides
@ApplicationScope @ApplicationScope
public GoogleTaskListDao getGoogleTaskListDao(Database database) { GoogleTaskListDao getGoogleTaskListDao(Database database) {
return database.getGoogleTaskListDao(); return database.getGoogleTaskListDao();
} }
@Provides @Provides
@ApplicationScope @ApplicationScope
public CaldavDao getCaldavDao(Database database) { CaldavDao getCaldavDao(Database database) {
return database.getCaldavDao(); return database.getCaldavDao();
} }
@Provides @Provides
@ApplicationScope @ApplicationScope
public TaskDao getTaskDao(Database database, WorkManager workManager) { TaskDao getTaskDao(Database database, WorkManager workManager) {
TaskDao taskDao = database.getTaskDao(); TaskDao taskDao = database.getTaskDao();
taskDao.initialize(workManager); taskDao.initialize(workManager);
return taskDao; return taskDao;
@ -134,7 +134,7 @@ public class ApplicationModule {
@Provides @Provides
@ApplicationScope @ApplicationScope
public DeletionDao getDeletionDao(Database database) { DeletionDao getDeletionDao(Database database) {
return database.getDeletionDao(); return database.getDeletionDao();
} }
@ -145,12 +145,12 @@ public class ApplicationModule {
} }
@Provides @Provides
public BillingClient getBillingClient(Inventory inventory, Tracker tracker) { BillingClient getBillingClient(Inventory inventory, Tracker tracker) {
return new BillingClientImpl(context, inventory, tracker); return new BillingClientImpl(context, inventory, tracker);
} }
@Provides @Provides
public Geocoder getGeocoder(@ForApplication Context context) { Geocoder getGeocoder(@ForApplication Context context) {
return new MapboxGeocoder(context); return new MapboxGeocoder(context);
} }
} }

@ -3,4 +3,4 @@ package org.tasks.injection;
import dagger.Module; import dagger.Module;
@Module @Module
public class BroadcastModule {} class BroadcastModule {}

@ -3,4 +3,4 @@ package org.tasks.injection;
import dagger.Module; import dagger.Module;
@Module(includes = ProductionModule.class) @Module(includes = ProductionModule.class)
public class ContentProviderModule {} class ContentProviderModule {}

@ -6,11 +6,11 @@ import dagger.Module;
import dagger.Provides; import dagger.Provides;
@Module @Module
public class DialogFragmentModule { class DialogFragmentModule {
private final DialogFragment dialogFragment; private final DialogFragment dialogFragment;
public DialogFragmentModule(DialogFragment dialogFragment) { DialogFragmentModule(DialogFragment dialogFragment) {
this.dialogFragment = dialogFragment; this.dialogFragment = dialogFragment;
} }

@ -9,10 +9,10 @@ import org.tasks.db.Migrations;
import org.tasks.preferences.Preferences; import org.tasks.preferences.Preferences;
@Module(includes = ApplicationModule.class) @Module(includes = ApplicationModule.class)
public class ProductionModule { class ProductionModule {
@Provides @Provides
@ApplicationScope @ApplicationScope
public Database getAppDatabase(@ForApplication Context context) { Database getAppDatabase(@ForApplication Context context) {
return Room.databaseBuilder(context, Database.class, Database.NAME) return Room.databaseBuilder(context, Database.class, Database.NAME)
.allowMainThreadQueries() // TODO: remove me .allowMainThreadQueries() // TODO: remove me
.addMigrations(Migrations.MIGRATIONS) .addMigrations(Migrations.MIGRATIONS)
@ -20,7 +20,7 @@ public class ProductionModule {
} }
@Provides @Provides
public Preferences getPreferences(@ForApplication Context context) { Preferences getPreferences(@ForApplication Context context) {
return new Preferences(context); return new Preferences(context);
} }
} }

@ -3,4 +3,4 @@ package org.tasks.injection;
import dagger.Module; import dagger.Module;
@Module @Module
public class ServiceModule {} class ServiceModule {}

@ -3,4 +3,4 @@ package org.tasks.injection;
import dagger.Module; import dagger.Module;
@Module @Module
public class WorkModule {} class WorkModule {}

@ -30,9 +30,9 @@ import timber.log.Timber;
public class BackupWork extends RepeatingWorker { public class BackupWork extends RepeatingWorker {
public static final int DAYS_TO_KEEP_BACKUP = 7; static final int DAYS_TO_KEEP_BACKUP = 7;
static final String BACKUP_FILE_NAME_REGEX = "auto\\.[-\\d]+\\.json"; static final String BACKUP_FILE_NAME_REGEX = "auto\\.[-\\d]+\\.json";
static final Predicate<String> FILENAME_FILTER = f -> f.matches(BACKUP_FILE_NAME_REGEX); private static final Predicate<String> FILENAME_FILTER = f -> f.matches(BACKUP_FILE_NAME_REGEX);
static final FileFilter FILE_FILTER = f -> FILENAME_FILTER.apply(f.getName()); static final FileFilter FILE_FILTER = f -> FILENAME_FILTER.apply(f.getName());
private static final Comparator<File> BY_LAST_MODIFIED = private static final Comparator<File> BY_LAST_MODIFIED =
(f1, f2) -> Long.compare(f2.lastModified(), f1.lastModified()); (f1, f2) -> Long.compare(f2.lastModified(), f1.lastModified());
@ -86,7 +86,7 @@ public class BackupWork extends RepeatingWorker {
component.inject(this); component.inject(this);
} }
void startBackup(Context context) { private void startBackup(Context context) {
try { try {
deleteOldLocalBackups(); deleteOldLocalBackups();
} catch (Exception e) { } catch (Exception e) {

@ -2,7 +2,7 @@ package org.tasks.jobs;
import org.tasks.notifications.Notification; import org.tasks.notifications.Notification;
public interface NotificationQueueEntry { interface NotificationQueueEntry {
long getId(); long getId();

@ -7,7 +7,7 @@ import org.tasks.injection.InjectingWorker;
public abstract class RepeatingWorker extends InjectingWorker { public abstract class RepeatingWorker extends InjectingWorker {
public RepeatingWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { RepeatingWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
super(context, workerParams); super(context, workerParams);
} }

@ -15,7 +15,7 @@ import org.threeten.bp.LocalTime;
import org.threeten.bp.format.DateTimeFormatter; import org.threeten.bp.format.DateTimeFormatter;
import timber.log.Timber; import timber.log.Timber;
public class TaskerTaskCreator { class TaskerTaskCreator {
private static final DateTimeFormatter dateFormatter = DateTimeFormatter.ISO_LOCAL_DATE; private static final DateTimeFormatter dateFormatter = DateTimeFormatter.ISO_LOCAL_DATE;
private static final DateTimeFormatter timeFormatter = DateTimeFormatter.ISO_LOCAL_TIME; private static final DateTimeFormatter timeFormatter = DateTimeFormatter.ISO_LOCAL_TIME;
@ -24,7 +24,7 @@ public class TaskerTaskCreator {
private final TaskDao taskDao; private final TaskDao taskDao;
@Inject @Inject
public TaskerTaskCreator(TaskCreator taskCreator, TaskDao taskDao) { TaskerTaskCreator(TaskCreator taskCreator, TaskDao taskDao) {
this.taskCreator = taskCreator; this.taskCreator = taskCreator;
this.taskDao = taskDao; this.taskDao = taskDao;
} }

@ -22,7 +22,7 @@ public final class TaskerCreateTaskActivity extends AbstractFragmentPluginAppCom
@Inject Inventory inventory; @Inject Inventory inventory;
@Inject LocalBroadcastManager localBroadcastManager; @Inject LocalBroadcastManager localBroadcastManager;
ActivityTaskerCreateBinding binding; private ActivityTaskerCreateBinding binding;
private Bundle previousBundle; private Bundle previousBundle;

@ -106,7 +106,7 @@ public class LocationPickerAdapter extends ListAdapter<PlaceUsage, PlaceViewHold
.setOnClickListener(v -> onLocationPicked.settings(place)); .setOnClickListener(v -> onLocationPicked.settings(place));
} }
public void bind(PlaceUsage placeUsage, int color, int icon) { void bind(PlaceUsage placeUsage, int color, int icon) {
place = placeUsage.place; place = placeUsage.place;
String name = place.getDisplayName(); String name = place.getDisplayName();
String address = place.getDisplayAddress(); String address = place.getDisplayAddress();
@ -124,7 +124,7 @@ public class LocationPickerAdapter extends ListAdapter<PlaceUsage, PlaceViewHold
} }
} }
public static class DiffCallback extends ItemCallback<PlaceUsage> { static class DiffCallback extends ItemCallback<PlaceUsage> {
@Override @Override
public boolean areItemsTheSame(@NonNull PlaceUsage oldItem, @NonNull PlaceUsage newItem) { public boolean areItemsTheSame(@NonNull PlaceUsage oldItem, @NonNull PlaceUsage newItem) {

@ -18,7 +18,7 @@ import com.google.common.base.Strings;
import java.util.List; import java.util.List;
import org.tasks.R; import org.tasks.R;
public class LocationSearchAdapter extends RecyclerView.Adapter<ViewHolder> class LocationSearchAdapter extends RecyclerView.Adapter<ViewHolder>
implements ListUpdateCallback { implements ListUpdateCallback {
private final int attributionRes; private final int attributionRes;
@ -98,7 +98,7 @@ public class LocationSearchAdapter extends RecyclerView.Adapter<ViewHolder>
void picked(PlaceSearchResult prediction); void picked(PlaceSearchResult prediction);
} }
public static class SearchViewHolder extends RecyclerView.ViewHolder { static class SearchViewHolder extends RecyclerView.ViewHolder {
private final TextView name; private final TextView name;
private final TextView address; private final TextView address;
private PlaceSearchResult prediction; private PlaceSearchResult prediction;
@ -111,7 +111,7 @@ public class LocationSearchAdapter extends RecyclerView.Adapter<ViewHolder>
itemView.findViewById(R.id.place_icon).setVisibility(View.INVISIBLE); itemView.findViewById(R.id.place_icon).setVisibility(View.INVISIBLE);
} }
public void bind(PlaceSearchResult prediction) { void bind(PlaceSearchResult prediction) {
this.prediction = prediction; this.prediction = prediction;
CharSequence name = prediction.getName(); CharSequence name = prediction.getName();
CharSequence address = prediction.getAddress(); CharSequence address = prediction.getAddress();
@ -127,7 +127,7 @@ public class LocationSearchAdapter extends RecyclerView.Adapter<ViewHolder>
} }
} }
public static class FooterViewHolder extends RecyclerView.ViewHolder { static class FooterViewHolder extends RecyclerView.ViewHolder {
final View divider; final View divider;
@ -143,7 +143,7 @@ public class LocationSearchAdapter extends RecyclerView.Adapter<ViewHolder>
} }
} }
public static class DiffCallback extends ItemCallback<PlaceSearchResult> { static class DiffCallback extends ItemCallback<PlaceSearchResult> {
@Override @Override
public boolean areItemsTheSame( public boolean areItemsTheSame(

@ -31,7 +31,7 @@ public class MapPosition implements Parcelable {
this.zoom = zoom; this.zoom = zoom;
} }
protected MapPosition(Parcel in) { private MapPosition(Parcel in) {
latitude = in.readDouble(); latitude = in.readDouble();
longitude = in.readDouble(); longitude = in.readDouble();
zoom = in.readFloat(); zoom = in.readFloat();
@ -45,7 +45,7 @@ public class MapPosition implements Parcelable {
return longitude; return longitude;
} }
public float getZoom() { float getZoom() {
return zoom; return zoom;
} }

@ -2,14 +2,13 @@ package org.tasks.location;
import org.tasks.data.Place; import org.tasks.data.Place;
public class PlaceSearchResult { class PlaceSearchResult {
private final String id; private final String id;
private final String name; private final String name;
private final String address; private final String address;
private final Place place; private final Place place;
@SuppressWarnings("unused")
PlaceSearchResult(String id, String name, String address) { PlaceSearchResult(String id, String name, String address) {
this(id, name, address, null); this(id, name, address, null);
} }

@ -14,6 +14,7 @@ import java.util.List;
import org.tasks.Event; import org.tasks.Event;
import org.tasks.data.Place; import org.tasks.data.Place;
@SuppressWarnings({"WeakerAccess", "RedundantSuppression"})
public class PlaceSearchViewModel extends ViewModel { public class PlaceSearchViewModel extends ViewModel {
private PlaceSearchProvider searchProvider; private PlaceSearchProvider searchProvider;

@ -12,7 +12,7 @@ import com.todoroo.andlib.data.Table;
indices = {@Index(value = "task", unique = true)}) indices = {@Index(value = "task", unique = true)})
public class Notification { public class Notification {
public static final String TABLE_NAME = "notification"; static final String TABLE_NAME = "notification";
public static final Table TABLE = new Table(TABLE_NAME); public static final Table TABLE = new Table(TABLE_NAME);
public static final LongProperty TASK = new LongProperty(TABLE, "task"); public static final LongProperty TASK = new LongProperty(TABLE, "task");

@ -80,7 +80,7 @@ public class AttributionActivity extends ThemedInjectingAppCompatActivity {
component.inject(this); component.inject(this);
} }
public static class AttributionList { static class AttributionList {
List<LibraryAttribution> libraries; List<LibraryAttribution> libraries;
} }
@ -103,6 +103,7 @@ public class AttributionActivity extends ThemedInjectingAppCompatActivity {
} }
} }
@SuppressWarnings({"WeakerAccess", "RedundantSuppression"})
public static class ViewModel extends androidx.lifecycle.ViewModel { public static class ViewModel extends androidx.lifecycle.ViewModel {
private final MutableLiveData<List<LibraryAttribution>> attributions = new MutableLiveData<>(); private final MutableLiveData<List<LibraryAttribution>> attributions = new MutableLiveData<>();
private final CompositeDisposable disposables = new CompositeDisposable(); private final CompositeDisposable disposables = new CompositeDisposable();

@ -23,7 +23,7 @@ import java.util.Map.Entry;
import org.tasks.R; import org.tasks.R;
import org.tasks.preferences.AttributionActivity.LibraryAttribution; import org.tasks.preferences.AttributionActivity.LibraryAttribution;
public class AttributionSection extends StatelessSection { class AttributionSection extends StatelessSection {
private final String license; private final String license;
private final List<Entry<String, String>> attributions; private final List<Entry<String, String>> attributions;
@ -102,7 +102,7 @@ public class AttributionSection extends StatelessSection {
ButterKnife.bind(this, itemView); ButterKnife.bind(this, itemView);
} }
public void bind(String copyrightHolder, String libraries) { void bind(String copyrightHolder, String libraries) {
this.copyrightHolder.setText(copyrightHolder); this.copyrightHolder.setText(copyrightHolder);
this.libraries.setText(libraries); this.libraries.setText(libraries);
} }

@ -16,7 +16,7 @@ public class PermissionChecker {
private final Context context; private final Context context;
@Inject @Inject
public PermissionChecker(@ForApplication Context context) { PermissionChecker(@ForApplication Context context) {
this.context = context; this.context = context;
} }

@ -5,7 +5,7 @@ import androidx.recyclerview.widget.DiffUtil;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import org.tasks.data.TagData; import org.tasks.data.TagData;
public class TagDiffCallback extends DiffUtil.ItemCallback<TagData> { class TagDiffCallback extends DiffUtil.ItemCallback<TagData> {
@Override @Override
public boolean areItemsTheSame(@NonNull TagData oldItem, @NonNull TagData newItem) { public boolean areItemsTheSame(@NonNull TagData oldItem, @NonNull TagData newItem) {

@ -22,6 +22,7 @@ import org.tasks.data.TagData;
import org.tasks.data.TagDataDao; import org.tasks.data.TagDataDao;
import org.tasks.tags.CheckBoxTriStates.State; import org.tasks.tags.CheckBoxTriStates.State;
@SuppressWarnings({"WeakerAccess", "RedundantSuppression"})
public class TagPickerViewModel extends ViewModel { public class TagPickerViewModel extends ViewModel {
private final MutableLiveData<List<TagData>> tags = new MutableLiveData<>(); private final MutableLiveData<List<TagData>> tags = new MutableLiveData<>();
@ -48,7 +49,7 @@ public class TagPickerViewModel extends ViewModel {
return newArrayList(selected); return newArrayList(selected);
} }
public ArrayList<TagData> getPartiallySelected() { ArrayList<TagData> getPartiallySelected() {
return newArrayList(partiallySelected); return newArrayList(partiallySelected);
} }
@ -84,7 +85,7 @@ public class TagPickerViewModel extends ViewModel {
return selected.contains(tagData); return selected.contains(tagData);
} }
public State getState(TagData tagData) { State getState(TagData tagData) {
if (partiallySelected.contains(tagData)) { if (partiallySelected.contains(tagData)) {
return State.PARTIALLY_CHECKED; return State.PARTIALLY_CHECKED;
} }

@ -19,7 +19,7 @@ import org.tasks.themes.ColorProvider;
import org.tasks.themes.CustomIcons; import org.tasks.themes.CustomIcons;
import org.tasks.themes.ThemeColor; import org.tasks.themes.ThemeColor;
public class TagRecyclerAdapter extends RecyclerView.Adapter<TagPickerViewHolder> { class TagRecyclerAdapter extends RecyclerView.Adapter<TagPickerViewHolder> {
private final AsyncListDiffer<TagData> differ; private final AsyncListDiffer<TagData> differ;
private final Context context; private final Context context;

@ -4,7 +4,7 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DiffUtil; import androidx.recyclerview.widget.DiffUtil;
import org.tasks.data.TaskContainer; import org.tasks.data.TaskContainer;
public class ItemCallback extends DiffUtil.ItemCallback<TaskContainer> { class ItemCallback extends DiffUtil.ItemCallback<TaskContainer> {
@Override @Override
public boolean areItemsTheSame(@NonNull TaskContainer oldItem, @NonNull TaskContainer newItem) { public boolean areItemsTheSame(@NonNull TaskContainer oldItem, @NonNull TaskContainer newItem) {

@ -29,7 +29,7 @@ public class SubtaskViewHolder extends RecyclerView.ViewHolder {
private final ChipProvider chipProvider; private final ChipProvider chipProvider;
private final CheckBoxProvider checkBoxProvider; private final CheckBoxProvider checkBoxProvider;
public TaskContainer task; private TaskContainer task;
@BindView(R.id.rowBody) @BindView(R.id.rowBody)
ViewGroup rowBody; ViewGroup rowBody;
@ -128,8 +128,7 @@ public class SubtaskViewHolder extends RecyclerView.ViewHolder {
return indent; return indent;
} }
@SuppressLint("NewApi") private void setIndent(int indent) {
public void setIndent(int indent) {
this.indent = indent; this.indent = indent;
int indentSize = getIndentSize(indent); int indentSize = getIndentSize(indent);
if (atLeastLollipop()) { if (atLeastLollipop()) {

@ -54,17 +54,13 @@ public class SubtasksRecyclerAdapter extends RecyclerView.Adapter<SubtaskViewHol
@Override @Override
public void onBindViewHolder(@NonNull SubtaskViewHolder holder, int position) { public void onBindViewHolder(@NonNull SubtaskViewHolder holder, int position) {
TaskContainer task = getItem(position); TaskContainer task = differ.getCurrentList().get(position);
if (task != null) { if (task != null) {
task.setIndent(multiLevelSubtasks ? task.indent : 0); task.setIndent(multiLevelSubtasks ? task.indent : 0);
holder.bindView(task); holder.bindView(task);
} }
} }
public TaskContainer getItem(int position) {
return differ.getCurrentList().get(position);
}
public void submitList(List<TaskContainer> list) { public void submitList(List<TaskContainer> list) {
differ.submitList(list); differ.submitList(list);
} }

@ -2,7 +2,7 @@ package org.tasks.themes;
import android.graphics.Color; import android.graphics.Color;
public class ColorUtil { class ColorUtil {
/** /**
* https://stackoverflow.com/a/40964456 * https://stackoverflow.com/a/40964456

@ -60,7 +60,7 @@ public class Theme {
themeAccent.applyStyle(theme); themeAccent.applyStyle(theme);
} }
public Context wrap(Context context) { private Context wrap(Context context) {
ContextThemeWrapper wrapper = themeBase.wrap(context); ContextThemeWrapper wrapper = themeBase.wrap(context);
applyToContext(wrapper); applyToContext(wrapper);
return wrapper; return wrapper;

@ -270,7 +270,7 @@ public class DateTime {
return isAfter(dateTime.getMillis()); return isAfter(dateTime.getMillis());
} }
public boolean isAfter(long timestamp) { private boolean isAfter(long timestamp) {
return this.timestamp > timestamp; return this.timestamp > timestamp;
} }

@ -12,6 +12,7 @@ import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.functions.Action; import io.reactivex.functions.Action;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
@SuppressWarnings({"WeakerAccess", "RedundantSuppression"})
public class ActionViewModel extends ViewModel { public class ActionViewModel extends ViewModel {
private final MutableLiveData<Boolean> completed = new MutableLiveData<>(); private final MutableLiveData<Boolean> completed = new MutableLiveData<>();
private final MutableLiveData<Throwable> error = new MutableLiveData<>(); private final MutableLiveData<Throwable> error = new MutableLiveData<>();

@ -18,7 +18,7 @@ import org.tasks.data.TagDataDao;
import org.tasks.injection.ApplicationScope; import org.tasks.injection.ApplicationScope;
@ApplicationScope @ApplicationScope
public class ChipListCache { class ChipListCache {
private final Map<String, GtasksFilter> googleTaskLists = new HashMap<>(); private final Map<String, GtasksFilter> googleTaskLists = new HashMap<>();
private final Map<String, CaldavFilter> caldavCalendars = new HashMap<>(); private final Map<String, CaldavFilter> caldavCalendars = new HashMap<>();
@ -26,7 +26,7 @@ public class ChipListCache {
private final LocalBroadcastManager localBroadcastManager; private final LocalBroadcastManager localBroadcastManager;
@Inject @Inject
public ChipListCache( ChipListCache(
GoogleTaskListDao googleTaskListDao, GoogleTaskListDao googleTaskListDao,
CaldavDao caldavDao, CaldavDao caldavDao,
TagDataDao tagDataDao, TagDataDao tagDataDao,

@ -7,21 +7,13 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.tasks.R; import org.tasks.R;
public class HiddenTopArrayAdapter<T> extends ArrayAdapter<T> { public class HiddenTopArrayAdapter<T> extends ArrayAdapter<T> {
private final List<String> hints; protected HiddenTopArrayAdapter(Context context, int resources, List<T> objects) {
super(context, resources, objects);
public HiddenTopArrayAdapter(Context context, int resources, List<T> objects) {
this(context, resources, objects, new ArrayList<>());
}
public HiddenTopArrayAdapter(Context context, int resource, List<T> objects, List<String> hints) {
super(context, resource, objects);
this.hints = hints;
} }
@Override @Override
@ -40,9 +32,6 @@ public class HiddenTopArrayAdapter<T> extends ArrayAdapter<T> {
LayoutInflater.from(getContext()) LayoutInflater.from(getContext())
.inflate(R.layout.simple_spinner_dropdown_item, parent, false); .inflate(R.layout.simple_spinner_dropdown_item, parent, false);
((TextView) vg.findViewById(R.id.text1)).setText(getItem(position).toString()); ((TextView) vg.findViewById(R.id.text1)).setText(getItem(position).toString());
if (position < hints.size()) {
((TextView) vg.findViewById(R.id.text2)).setText(hints.get(position));
}
v = vg; v = vg;
} }

@ -30,6 +30,7 @@ import org.tasks.data.TaskContainer;
import org.tasks.preferences.Preferences; import org.tasks.preferences.Preferences;
import timber.log.Timber; import timber.log.Timber;
@SuppressWarnings({"WeakerAccess", "RedundantSuppression"})
public class TaskListViewModel extends ViewModel implements Observer<PagedList<TaskContainer>> { public class TaskListViewModel extends ViewModel implements Observer<PagedList<TaskContainer>> {
private static final PagedList.Config PAGED_LIST_CONFIG = private static final PagedList.Config PAGED_LIST_CONFIG =

Loading…
Cancel
Save