Remove @ForApplication annotation

pull/1020/head
Alex Baker 4 years ago
parent 85367a6022
commit 999e5aab7a

@ -14,19 +14,19 @@ import org.tasks.preferences.Preferences
class TestModule {
@Provides
@ApplicationScope
fun getDatabase(@ForApplication context: Context): Database {
fun getDatabase(context: Application): Database {
return Room.inMemoryDatabaseBuilder(context, Database::class.java)
.fallbackToDestructiveMigration()
.build()
}
@Provides
fun getPermissionChecker(@ForApplication context: Context): PermissionChecker {
fun getPermissionChecker(context: Application): PermissionChecker {
return PermissivePermissionChecker(context)
}
@Provides
fun getPreferences(@ForApplication context: Context): Preferences {
fun getPreferences(context: Application): Preferences {
return TestUtilities.newPreferences(context)
}
}

@ -1,9 +1,8 @@
package org.tasks.preferences
import android.content.Context
import org.tasks.injection.ForApplication
class PermissivePermissionChecker(@ForApplication context: Context) : PermissionChecker(context) {
class PermissivePermissionChecker(context: Application) : PermissionChecker(context) {
override fun canAccessCalendars() = true
override fun canAccessAccounts() = true

@ -1,5 +1,6 @@
package org.tasks
import android.app.Application
import android.content.Context
import android.os.StrictMode
import android.os.StrictMode.VmPolicy
@ -12,13 +13,12 @@ import com.facebook.flipper.plugins.network.NetworkFlipperPlugin
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin
import com.facebook.soloader.SoLoader
import leakcanary.AppWatcher
import org.tasks.injection.ForApplication
import org.tasks.preferences.Preferences
import timber.log.Timber
import timber.log.Timber.DebugTree
import javax.inject.Inject
class BuildSetup @Inject constructor(@param:ForApplication private val context: Context, private val preferences: Preferences) {
class BuildSetup @Inject constructor(private val context: Application, private val preferences: Preferences) {
fun setup() {
Timber.plant(DebugTree())
SoLoader.init(context, false)

@ -1,5 +1,6 @@
package org.tasks
import android.app.Application
import android.content.Context
import com.facebook.flipper.android.AndroidFlipperClient
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor
@ -7,11 +8,10 @@ import com.facebook.flipper.plugins.network.NetworkFlipperPlugin
import com.google.api.client.http.HttpRequest
import com.google.api.client.http.HttpResponse
import okhttp3.OkHttpClient
import org.tasks.injection.ForApplication
import java.io.IOException
import javax.inject.Inject
class DebugNetworkInterceptor @Inject constructor(@param:ForApplication private val context: Context) {
class DebugNetworkInterceptor @Inject constructor(private val context: Application) {
fun add(builder: OkHttpClient.Builder) {
builder.addNetworkInterceptor(FlipperOkhttpInterceptor(getNetworkPlugin(context)))
}

@ -1,6 +1,6 @@
package org.tasks.injection
import android.content.Context
import android.app.Application
import dagger.Module
import dagger.Provides
import org.tasks.location.MapFragment
@ -12,13 +12,13 @@ import org.tasks.location.PlaceSearchProvider
class LocationModule {
@Provides
@ActivityScope
fun getPlaceSearchProvider(@ForApplication context: Context): PlaceSearchProvider {
fun getPlaceSearchProvider(context: Application): PlaceSearchProvider {
return MapboxSearchProvider(context)
}
@Provides
@ActivityScope
fun getMapFragment(@ForApplication context: Context): MapFragment {
fun getMapFragment(context: Application): MapFragment {
return MapboxMapFragment(context)
}
}

@ -1,5 +1,6 @@
package org.tasks.analytics
import android.app.Application
import android.content.Context
import android.os.Bundle
import androidx.annotation.StringRes
@ -12,7 +13,6 @@ import io.fabric.sdk.android.Fabric
import org.tasks.R
import org.tasks.billing.BillingClientImpl
import org.tasks.injection.ApplicationScope
import org.tasks.injection.ForApplication
import org.tasks.jobs.WorkManager
import org.tasks.preferences.Preferences
import timber.log.Timber
@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit
import javax.inject.Inject
@ApplicationScope
class Firebase @Inject constructor(@param:ForApplication val context: Context, preferences: Preferences) {
class Firebase @Inject constructor(val context: Application, preferences: Preferences) {
private var enabled: Boolean = preferences.isTrackingEnabled
private var analytics: FirebaseAnalytics? = null

@ -4,7 +4,7 @@ import static com.google.common.collect.Lists.newArrayList;
import static com.todoroo.andlib.utility.AndroidUtilities.assertMainThread;
import android.app.Activity;
import android.content.Context;
import android.app.Application;
import androidx.annotation.Nullable;
import com.android.billingclient.api.BillingClient.BillingResponse;
import com.android.billingclient.api.BillingClient.FeatureType;
@ -22,7 +22,6 @@ import io.reactivex.schedulers.Schedulers;
import java.util.List;
import org.tasks.BuildConfig;
import org.tasks.analytics.Firebase;
import org.tasks.injection.ForApplication;
import timber.log.Timber;
@SuppressWarnings("all")
@ -36,7 +35,7 @@ public class BillingClientImpl implements BillingClient, PurchasesUpdatedListene
private boolean connected;
private OnPurchasesUpdated onPurchasesUpdated;
public BillingClientImpl(@ForApplication Context context, Inventory inventory, Firebase firebase) {
public BillingClientImpl(Application context, Inventory inventory, Firebase firebase) {
this.inventory = inventory;
this.firebase = firebase;
billingClient =

@ -1,13 +1,13 @@
package org.tasks.billing
import android.app.Application
import android.content.Context
import org.tasks.R
import org.tasks.injection.ForApplication
import timber.log.Timber
import java.io.IOException
import javax.inject.Inject
internal class SignatureVerifier @Inject constructor(@ForApplication context: Context) {
internal class SignatureVerifier @Inject constructor(context: Application) {
private val billingKey: String = context.getString(R.string.gp_key)
fun verifySignature(purchase: Purchase): Boolean {

@ -1,6 +1,7 @@
package org.tasks.gtasks
import android.app.Activity
import android.app.Application
import android.content.Context
import android.widget.Toast
import com.google.android.gms.common.ConnectionResult
@ -13,13 +14,12 @@ import io.reactivex.schedulers.Schedulers
import org.tasks.R
import org.tasks.data.GoogleTaskListDao
import org.tasks.data.LocationDao
import org.tasks.injection.ForApplication
import org.tasks.preferences.Preferences
import timber.log.Timber
import javax.inject.Inject
class PlayServices @Inject constructor(
@param:ForApplication private val context: Context,
private val context: Application,
private val preferences: Preferences,
private val googleTaskListDao: GoogleTaskListDao,
private val locationDao: LocationDao) {

@ -1,6 +1,6 @@
package org.tasks.injection
import android.content.Context
import android.app.Application
import dagger.Module
import dagger.Provides
import org.tasks.billing.Inventory
@ -13,7 +13,7 @@ internal class LocationModule {
@Provides
@ActivityScope
fun getPlaceSearchProvider(
@ForApplication context: Context,
context: Application,
preferences: Preferences,
playServices: PlayServices,
inventory: Inventory): PlaceSearchProvider {
@ -28,7 +28,7 @@ internal class LocationModule {
@Provides
@ActivityScope
fun getMapFragment(@ForApplication context: Context, preferences: Preferences): MapFragment {
fun getMapFragment(context: Application, preferences: Preferences): MapFragment {
return if (preferences.useGoogleMaps()) {
GoogleMapFragment(context)
} else {

@ -1,6 +1,7 @@
package org.tasks.location
import android.annotation.SuppressLint
import android.app.Application
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
@ -10,13 +11,12 @@ import com.google.android.gms.location.LocationServices
import org.tasks.data.LocationDao
import org.tasks.data.MergedGeofence
import org.tasks.data.Place
import org.tasks.injection.ForApplication
import org.tasks.preferences.PermissionChecker
import timber.log.Timber
import javax.inject.Inject
class GeofenceApi @Inject constructor(
@param:ForApplication private val context: Context,
private val context: Application,
private val permissionChecker: PermissionChecker,
private val locationDao: LocationDao) {

@ -8,6 +8,7 @@ import static org.tasks.files.FileHelper.copyToUri;
import static org.tasks.files.FileHelper.getFilename;
import static org.tasks.intents.TaskIntents.getTaskListIntent;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@ -21,7 +22,6 @@ import javax.inject.Inject;
import org.tasks.data.TaskAttachment;
import org.tasks.files.FileHelper;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.ForApplication;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.Preferences;
import timber.log.Timber;
@ -32,7 +32,7 @@ import timber.log.Timber;
*/
public final class ShareLinkActivity extends InjectingAppCompatActivity {
@Inject @ForApplication Context context;
@Inject Application context;
@Inject TaskCreator taskCreator;
@Inject Preferences preferences;

@ -1,5 +1,6 @@
package com.todoroo.astrid.adapter
import android.app.Application
import android.content.Context
import com.todoroo.astrid.api.CaldavFilter
import com.todoroo.astrid.api.Filter
@ -16,12 +17,11 @@ import org.tasks.data.CaldavDao
import org.tasks.data.GoogleTaskDao
import org.tasks.data.TaskListMetadata
import org.tasks.data.TaskListMetadataDao
import org.tasks.injection.ForApplication
import org.tasks.preferences.Preferences
import javax.inject.Inject
class TaskAdapterProvider @Inject constructor(
@param:ForApplication private val context: Context,
private val context: Application,
private val preferences: Preferences,
private val taskListMetadataDao: TaskListMetadataDao,
private val taskDao: TaskDao,

@ -6,6 +6,7 @@
package com.todoroo.astrid.core;
import android.app.Application;
import android.content.Context;
import android.content.res.Resources;
import com.todoroo.andlib.sql.Criterion;
@ -25,7 +26,6 @@ import javax.inject.Inject;
import org.tasks.R;
import org.tasks.filters.RecentlyModifiedFilter;
import org.tasks.filters.SortableFilter;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.Preferences;
import org.tasks.themes.CustomIcons;
@ -42,7 +42,7 @@ public final class BuiltInFilterExposer {
@Inject
public BuiltInFilterExposer(
@ForApplication Context context, Preferences preferences, TaskDao taskDao) {
Application context, Preferences preferences, TaskDao taskDao) {
this.context = context;
this.preferences = preferences;
this.taskDao = taskDao;

@ -8,9 +8,9 @@ package com.todoroo.astrid.gcal;
import static org.tasks.Strings.isNullOrEmpty;
import android.app.Application;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.provider.CalendarContract;
import android.text.format.Time;
@ -22,7 +22,6 @@ import javax.inject.Inject;
import org.tasks.R;
import org.tasks.calendars.AndroidCalendarEvent;
import org.tasks.calendars.CalendarEventProvider;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.PermissionChecker;
import org.tasks.preferences.Preferences;
import timber.log.Timber;
@ -40,7 +39,7 @@ public class GCalHelper {
@Inject
public GCalHelper(
@ForApplication Context context,
Application context,
TaskDao taskDao,
Preferences preferences,
PermissionChecker permissionChecker,

@ -1,5 +1,6 @@
package com.todoroo.astrid.gtasks.api;
import android.app.Application;
import android.content.Context;
import androidx.annotation.Nullable;
import com.google.api.client.http.HttpRequest;
@ -18,7 +19,6 @@ import javax.inject.Inject;
import org.tasks.BuildConfig;
import org.tasks.DebugNetworkInterceptor;
import org.tasks.gtasks.GoogleAccountManager;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.Preferences;
import timber.log.Timber;
@ -40,7 +40,7 @@ public class GtasksInvoker {
@Inject
public GtasksInvoker(
@ForApplication Context context,
Application context,
GoogleAccountManager googleAccountManager,
Preferences preferences,
DebugNetworkInterceptor interceptor) {

@ -1,5 +1,6 @@
package com.todoroo.astrid.service
import android.app.Application
import android.content.Context
import com.todoroo.andlib.utility.DateUtilities
import com.todoroo.astrid.api.CaldavFilter
@ -11,13 +12,12 @@ import org.tasks.BuildConfig
import org.tasks.LocalBroadcastManager
import org.tasks.data.*
import org.tasks.db.DbUtils.dbchunk
import org.tasks.injection.ForApplication
import org.tasks.preferences.Preferences
import java.util.*
import javax.inject.Inject
class TaskMover @Inject constructor(
@param:ForApplication private val context: Context,
private val context: Application,
private val taskDao: TaskDao,
private val caldavDao: CaldavDao,
private val googleTaskDao: GoogleTaskDao,

@ -1,5 +1,6 @@
package com.todoroo.astrid.service
import android.app.Application
import android.content.Context
import androidx.annotation.ColorRes
import com.google.common.collect.ImmutableListMultimap
@ -14,7 +15,6 @@ import org.tasks.caldav.iCalendar.Companion.fromVtodo
import org.tasks.caldav.iCalendar.Companion.getParent
import org.tasks.caldav.iCalendar.Companion.order
import org.tasks.data.*
import org.tasks.injection.ForApplication
import org.tasks.preferences.DefaultFilterProvider
import org.tasks.preferences.Preferences
import org.tasks.widget.AppWidgetManager
@ -24,7 +24,7 @@ import java.util.*
import javax.inject.Inject
class Upgrader @Inject constructor(
@param:ForApplication private val context: Context,
private val context: Application,
private val preferences: Preferences,
private val tagDataDao: TagDataDao,
private val tagDao: TagDao,

@ -3,6 +3,7 @@ package com.todoroo.astrid.subtasks;
import static org.tasks.Strings.isNullOrEmpty;
import static org.tasks.db.QueryUtils.showHiddenAndCompleted;
import android.app.Application;
import android.content.Context;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.core.BuiltInFilterExposer;
@ -18,7 +19,6 @@ import org.tasks.data.TagData;
import org.tasks.data.TagDataDao;
import org.tasks.data.TaskListMetadata;
import org.tasks.data.TaskListMetadataDao;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.Preferences;
import timber.log.Timber;
@ -32,7 +32,7 @@ public class SubtasksHelper {
@Inject
public SubtasksHelper(
@ForApplication Context context,
Application context,
Preferences preferences,
TaskDao taskDao,
TagDataDao tagDataDao,

@ -8,6 +8,7 @@ package com.todoroo.astrid.timers;
import static org.tasks.time.DateTimeUtils.currentTimeMillis;
import android.app.Application;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
@ -24,7 +25,6 @@ import io.reactivex.Completable;
import io.reactivex.schedulers.Schedulers;
import javax.inject.Inject;
import org.tasks.R;
import org.tasks.injection.ForApplication;
import org.tasks.intents.TaskIntents;
import org.tasks.notifications.NotificationManager;
@ -36,7 +36,7 @@ public class TimerPlugin {
@Inject
public TimerPlugin(
@ForApplication Context context,
Application context,
NotificationManager notificationManager,
TaskDao taskDao) {
this.context = context;

@ -1,5 +1,6 @@
package com.todoroo.astrid.voice;
import android.app.Application;
import android.content.Context;
import android.media.AudioManager;
import android.speech.tts.TextToSpeech;
@ -8,7 +9,6 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.UUID;
import javax.inject.Inject;
import org.tasks.injection.ForApplication;
import timber.log.Timber;
/** @author Arne Jans */
@ -21,7 +21,7 @@ public class VoiceOutputAssistant implements OnInitListener {
private String lastTextToSpeak;
@Inject
public VoiceOutputAssistant(@ForApplication Context context) {
public VoiceOutputAssistant(Application context) {
this.context = context;
}

@ -1,12 +1,11 @@
package org.tasks;
import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import com.todoroo.astrid.api.AstridApiConstants;
import javax.inject.Inject;
import org.tasks.injection.ForApplication;
import org.tasks.widget.AppWidgetManager;
public class LocalBroadcastManager {
@ -20,7 +19,7 @@ public class LocalBroadcastManager {
private final AppWidgetManager appWidgetManager;
@Inject
public LocalBroadcastManager(@ForApplication Context context, AppWidgetManager appWidgetManager) {
public LocalBroadcastManager(Application context, AppWidgetManager appWidgetManager) {
this.appWidgetManager = appWidgetManager;
localBroadcastManager =
androidx.localbroadcastmanager.content.LocalBroadcastManager.getInstance(context);

@ -1,5 +1,6 @@
package org.tasks
import android.app.Application
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
@ -10,7 +11,6 @@ import com.todoroo.astrid.api.Filter
import com.todoroo.astrid.dao.TaskDao
import com.todoroo.astrid.reminders.ReminderService
import com.todoroo.astrid.voice.VoiceOutputAssistant
import org.tasks.injection.ForApplication
import org.tasks.notifications.AudioManager
import org.tasks.notifications.Notification
import org.tasks.notifications.NotificationManager
@ -24,7 +24,7 @@ import javax.inject.Inject
import kotlin.math.min
class Notifier @Inject constructor(
@param:ForApplication private val context: Context,
private val context: Application,
private val taskDao: TaskDao,
private val notificationManager: NotificationManager,
private val telephonyManager: TelephonyManager,

@ -1,14 +1,13 @@
package org.tasks
import android.content.Context
import android.app.Application
import android.content.pm.ShortcutManager
import com.todoroo.andlib.utility.AndroidUtilities
import org.tasks.injection.ApplicationScope
import org.tasks.injection.ForApplication
import javax.inject.Inject
@ApplicationScope
class ShortcutManager @Inject constructor(@ForApplication context: Context) {
class ShortcutManager @Inject constructor(context: Application) {
private val shortcutManager: ShortcutManager? = if (AndroidUtilities.atLeastNougatMR1()) {
context.getSystemService(ShortcutManager::class.java)
} else {

@ -1,5 +1,6 @@
package org.tasks
import android.app.Application
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
@ -14,7 +15,6 @@ import org.tasks.billing.BillingClient
import org.tasks.billing.Inventory
import org.tasks.files.FileHelper
import org.tasks.injection.ApplicationComponent
import org.tasks.injection.ForApplication
import org.tasks.injection.InjectingApplication
import org.tasks.injection.InjectingJobIntentService
import org.tasks.jobs.WorkManager
@ -30,7 +30,6 @@ import timber.log.Timber
import javax.inject.Inject
class Tasks : InjectingApplication(), Configuration.Provider {
@Inject @ForApplication lateinit var context: Context
@Inject lateinit var preferences: Preferences
@Inject lateinit var buildSetup: BuildSetup
@Inject lateinit var inventory: Inventory
@ -65,15 +64,15 @@ class Tasks : InjectingApplication(), Configuration.Provider {
}
private fun doInBackground() {
NotificationSchedulerIntentService.enqueueWork(context, false)
CalendarNotificationIntentService.enqueueWork(context)
NotificationSchedulerIntentService.enqueueWork(this, false)
CalendarNotificationIntentService.enqueueWork(this)
refreshScheduler.get().scheduleAll()
workManager.get().updateBackgroundSync()
workManager.get().scheduleMidnightRefresh()
workManager.get().scheduleBackup()
workManager.get().scheduleConfigRefresh()
geofenceApi.get().registerAll()
FileHelper.delete(context, preferences.cacheDirectory)
FileHelper.delete(this, preferences.cacheDirectory)
billingClient.get().queryPurchases()
appWidgetManager.get().reconfigureWidgets()
}

@ -1,5 +1,6 @@
package org.tasks.activities;
import android.app.Application;
import android.appwidget.AppWidgetManager;
import android.content.BroadcastReceiver;
import android.content.Context;
@ -17,7 +18,6 @@ import org.tasks.LocalBroadcastManager;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.filters.FilterProvider;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.ForApplication;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.DefaultFilterProvider;
import org.tasks.preferences.Preferences;
@ -31,7 +31,7 @@ public class FilterSelectionActivity extends InjectingAppCompatActivity {
private static final String EXTRA_FILTER_SQL = "extra_filter_query";
private static final String EXTRA_FILTER_VALUES = "extra_filter_values";
@Inject @ForApplication Context context;
@Inject Application context;
@Inject DialogBuilder dialogBuilder;
@Inject FilterAdapter filterAdapter;
@Inject FilterProvider filterProvider;

@ -2,6 +2,7 @@ package org.tasks.activities;
import static org.tasks.Strings.isNullOrEmpty;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@ -25,14 +26,13 @@ import org.tasks.data.GoogleTaskAccount;
import org.tasks.data.GoogleTaskList;
import org.tasks.data.GoogleTaskListDao;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.ForApplication;
import timber.log.Timber;
public class GoogleTaskListSettingsActivity extends BaseListSettingsActivity {
public static final String EXTRA_ACCOUNT = "extra_account";
public static final String EXTRA_STORE_DATA = "extra_store_data";
@Inject @ForApplication Context context;
@Inject Application context;
@Inject GoogleTaskListDao googleTaskListDao;
@Inject GtasksListService gtasksListService;
@Inject TaskDeleter taskDeleter;

@ -5,6 +5,7 @@ import static at.bitfire.dav4jvm.XmlUtils.NS_CARDDAV;
import static at.bitfire.dav4jvm.XmlUtils.NS_WEBDAV;
import static org.tasks.Strings.isNullOrEmpty;
import android.app.Application;
import android.content.Context;
import at.bitfire.cert4android.CustomCertManager;
import at.bitfire.cert4android.CustomCertManager.CustomHostnameVerifier;
@ -43,7 +44,6 @@ import org.tasks.DebugNetworkInterceptor;
import org.tasks.R;
import org.tasks.data.CaldavAccount;
import org.tasks.data.CaldavCalendar;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.Preferences;
import org.tasks.security.KeyStoreEncryption;
import org.tasks.ui.DisplayableException;
@ -65,7 +65,7 @@ public class CaldavClient {
@Inject
CaldavClient(
@ForApplication Context context,
Application context,
KeyStoreEncryption encryption,
Preferences preferences,
DebugNetworkInterceptor interceptor) {

@ -9,6 +9,7 @@ import static com.google.common.collect.Sets.newHashSet;
import static org.tasks.Strings.isNullOrEmpty;
import static org.tasks.time.DateTimeUtils.currentTimeMillis;
import android.app.Application;
import android.content.Context;
import androidx.annotation.Nullable;
import at.bitfire.dav4jvm.DavCalendar;
@ -55,7 +56,6 @@ import org.tasks.data.CaldavAccount;
import org.tasks.data.CaldavCalendar;
import org.tasks.data.CaldavDao;
import org.tasks.data.CaldavTask;
import org.tasks.injection.ForApplication;
import timber.log.Timber;
public class CaldavSynchronizer {
@ -77,7 +77,7 @@ public class CaldavSynchronizer {
@Inject
public CaldavSynchronizer(
@ForApplication Context context,
Application context,
CaldavDao caldavDao,
TaskDao taskDao,
LocalBroadcastManager localBroadcastManager,

@ -1,14 +1,13 @@
package org.tasks.calendars;
import android.app.Application;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.provider.CalendarContract;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.PermissionChecker;
import timber.log.Timber;
@ -23,7 +22,7 @@ class CalendarEventAttendeeProvider {
@Inject
public CalendarEventAttendeeProvider(
@ForApplication Context context, PermissionChecker permissionChecker) {
Application context, PermissionChecker permissionChecker) {
this.permissionChecker = permissionChecker;
contentResolver = context.getContentResolver();
}

@ -3,8 +3,8 @@ package org.tasks.calendars;
import static android.provider.BaseColumns._ID;
import static org.tasks.Strings.isNullOrEmpty;
import android.app.Application;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.CalendarContract;
@ -14,7 +14,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.PermissionChecker;
import timber.log.Timber;
@ -34,7 +33,7 @@ public class CalendarEventProvider {
@Inject
public CalendarEventProvider(
@ForApplication Context context,
Application context,
PermissionChecker permissionChecker,
CalendarEventAttendeeProvider calendarEventAttendeeProvider) {
this.permissionChecker = permissionChecker;

@ -3,8 +3,8 @@ package org.tasks.calendars;
import static android.provider.BaseColumns._ID;
import static org.tasks.Strings.isNullOrEmpty;
import android.app.Application;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.CalendarContract;
@ -13,7 +13,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.PermissionChecker;
import timber.log.Timber;
@ -32,7 +31,7 @@ public class CalendarProvider {
private final ContentResolver contentResolver;
@Inject
public CalendarProvider(@ForApplication Context context, PermissionChecker permissionChecker) {
public CalendarProvider(Application context, PermissionChecker permissionChecker) {
this.permissionChecker = permissionChecker;
contentResolver = context.getContentResolver();
}

@ -2,6 +2,7 @@ package org.tasks.drive;
import static com.todoroo.andlib.utility.DateUtilities.now;
import android.app.Application;
import android.content.Context;
import android.net.Uri;
import com.google.api.client.http.HttpResponse;
@ -23,7 +24,6 @@ import org.tasks.BuildConfig;
import org.tasks.DebugNetworkInterceptor;
import org.tasks.R;
import org.tasks.files.FileHelper;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.Preferences;
import timber.log.Timber;
@ -39,7 +39,7 @@ public class DriveInvoker {
@Inject
public DriveInvoker(
@ForApplication Context context,
Application context,
Preferences preferences,
HttpCredentialsAdapter credentialsAdapter,
DebugNetworkInterceptor interceptor) {

@ -3,6 +3,7 @@ package org.tasks.etesync;
import static com.google.common.collect.Lists.partition;
import static com.google.common.collect.Lists.transform;
import android.app.Application;
import android.content.Context;
import androidx.annotation.Nullable;
import androidx.core.util.Pair;
@ -44,7 +45,6 @@ import org.tasks.DebugNetworkInterceptor;
import org.tasks.caldav.MemoryCookieStore;
import org.tasks.data.CaldavAccount;
import org.tasks.data.CaldavCalendar;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.Preferences;
import org.tasks.security.KeyStoreEncryption;
import timber.log.Timber;
@ -69,7 +69,7 @@ public class EteSyncClient {
@Inject
public EteSyncClient(
@ForApplication Context context,
Application context,
KeyStoreEncryption encryption,
Preferences preferences,
DebugNetworkInterceptor interceptor) {

@ -6,6 +6,7 @@ import static com.google.common.collect.Sets.newHashSet;
import static java.util.Collections.emptySet;
import static org.tasks.Strings.isNullOrEmpty;
import android.app.Application;
import android.content.Context;
import androidx.core.util.Pair;
import at.bitfire.ical4android.ICalendar;
@ -42,7 +43,6 @@ import org.tasks.data.CaldavCalendar;
import org.tasks.data.CaldavDao;
import org.tasks.data.CaldavTask;
import org.tasks.data.CaldavTaskContainer;
import org.tasks.injection.ForApplication;
import timber.log.Timber;
public class EteSynchronizer {
@ -62,7 +62,7 @@ public class EteSynchronizer {
@Inject
public EteSynchronizer(
@ForApplication Context context,
Application context,
CaldavDao caldavDao,
LocalBroadcastManager localBroadcastManager,
TaskDeleter taskDeleter,

@ -3,6 +3,7 @@ package org.tasks.filters;
import static com.google.common.collect.Iterables.transform;
import static com.google.common.collect.Sets.newLinkedHashSet;
import android.app.Application;
import android.content.Context;
import android.content.res.Resources;
import com.todoroo.andlib.sql.Criterion;
@ -31,7 +32,6 @@ import org.tasks.data.GoogleTaskListDao;
import org.tasks.data.Tag;
import org.tasks.data.TagData;
import org.tasks.data.TagDataDao;
import org.tasks.injection.ForApplication;
public class FilterCriteriaProvider {
@ -52,7 +52,7 @@ public class FilterCriteriaProvider {
@Inject
public FilterCriteriaProvider(
@ForApplication Context context,
Application context,
TagDataDao tagDataDao,
GoogleTaskListDao googleTaskListDao,
CaldavDao caldavDao) {

@ -1,5 +1,6 @@
package org.tasks.filters
import android.app.Application
import android.content.Context
import android.content.Intent
import com.todoroo.andlib.utility.AndroidUtilities.assertNotMainThread
@ -18,7 +19,6 @@ import org.tasks.caldav.BaseCaldavCalendarSettingsActivity
import org.tasks.data.*
import org.tasks.data.CaldavAccount.Companion.TYPE_LOCAL
import org.tasks.filters.NavigationDrawerSubheader.SubheaderType
import org.tasks.injection.ForApplication
import org.tasks.location.LocationPickerActivity
import org.tasks.preferences.HelpAndFeedback
import org.tasks.preferences.MainPreferences
@ -27,7 +27,7 @@ import org.tasks.ui.NavigationDrawerFragment
import javax.inject.Inject
class FilterProvider @Inject constructor(
@param:ForApplication private val context: Context,
private val context: Application,
private val inventory: Inventory,
private val builtInFilterExposer: BuiltInFilterExposer,
private val filterDao: FilterDao,

@ -12,7 +12,7 @@ import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.app.Application;
import android.content.Intent;
import android.os.Bundle;
import com.google.api.services.drive.DriveScopes;
@ -25,7 +25,6 @@ import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
import org.tasks.R;
import org.tasks.injection.ForApplication;
import org.tasks.play.AuthResultHandler;
import org.tasks.preferences.PermissionChecker;
import org.tasks.preferences.Preferences;
@ -39,7 +38,7 @@ public class GoogleAccountManager {
@Inject
public GoogleAccountManager(
@ForApplication Context context, PermissionChecker permissionChecker, Preferences preferences) {
Application context, PermissionChecker permissionChecker, Preferences preferences) {
this.permissionChecker = permissionChecker;
accountManager = android.accounts.AccountManager.get(context);
this.preferences = preferences;

@ -4,6 +4,7 @@ import static com.google.common.collect.Lists.transform;
import static org.tasks.Strings.isNullOrEmpty;
import static org.tasks.date.DateTimeUtils.newDateTime;
import android.app.Application;
import android.content.Context;
import androidx.annotation.Nullable;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
@ -42,7 +43,6 @@ import org.tasks.data.GoogleTaskAccount;
import org.tasks.data.GoogleTaskDao;
import org.tasks.data.GoogleTaskList;
import org.tasks.data.GoogleTaskListDao;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.DefaultFilterProvider;
import org.tasks.preferences.PermissionChecker;
import org.tasks.preferences.Preferences;
@ -82,7 +82,7 @@ public class GoogleTaskSynchronizer {
@Inject
public GoogleTaskSynchronizer(
@ForApplication Context context,
Application context,
GoogleTaskListDao googleTaskListDao,
GtasksListService gtasksListService,
Preferences preferences,

@ -1,6 +1,6 @@
package org.tasks.injection
import android.content.Context
import android.app.Application
import com.todoroo.astrid.dao.Database
import com.todoroo.astrid.dao.TaskDao
import dagger.Module
@ -17,7 +17,7 @@ import org.tasks.location.MapboxGeocoder
import org.tasks.notifications.NotificationDao
@Module
class ApplicationModule(@get:Provides @get:ForApplication val context: Context) {
class ApplicationModule(@get:Provides val context: Application) {
@get:Provides
val locale: Locale

@ -1,19 +1,23 @@
package org.tasks.injection
import android.content.Context
import android.app.Application
import org.tasks.locale.Locale
import timber.log.Timber
internal class Dagger private constructor(context: Context) {
val applicationComponent: ApplicationComponent
internal class Dagger private constructor(context: Application) {
val applicationComponent: ApplicationComponent =
DaggerApplicationComponent.builder()
.applicationModule(ApplicationModule(context))
.productionModule(ProductionModule())
.build()
companion object {
private val lock = Any()
private var instance: Dagger? = null
operator fun get(context: Context): Dagger {
operator fun get(context: Application): Dagger {
if (instance == null) {
synchronized(lock) {
if (instance == null) {
Locale.getInstance(context)
instance = Dagger(context)
}
}
@ -21,17 +25,4 @@ internal class Dagger private constructor(context: Context) {
return instance!!
}
}
init {
var localeContext = context.applicationContext
try {
localeContext = Locale.getInstance(localeContext).createConfigurationContext(localeContext)
} catch (e: Exception) {
Timber.e(e)
}
applicationComponent = DaggerApplicationComponent.builder()
.applicationModule(ApplicationModule(localeContext))
.productionModule(ProductionModule())
.build()
}
}

@ -1,9 +0,0 @@
package org.tasks.injection
import javax.inject.Qualifier
@Qualifier
@Target(AnnotationTarget.FIELD, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
@MustBeDocumented
@Retention(AnnotationRetention.RUNTIME)
annotation class ForApplication

@ -1,15 +1,13 @@
package org.tasks.injection
import android.app.Application
import org.tasks.locale.Locale
abstract class InjectingApplication : Application() {
lateinit var component: ApplicationComponent
override fun onCreate() {
super.onCreate()
val context = Locale.getInstance(this).createConfigurationContext(applicationContext)
component = Dagger.Companion[context].applicationComponent
component = Dagger.Companion[this].applicationComponent
inject(component)
}

@ -1,12 +1,13 @@
package org.tasks.injection
import android.app.Application
import android.content.ContentProvider
abstract class InjectingContentProvider : ContentProvider() {
override fun onCreate(): Boolean {
inject(
DaggerContentProviderComponent.builder()
.applicationModule(ApplicationModule(context!!.applicationContext))
.applicationModule(ApplicationModule(context!!.applicationContext as Application))
.productionModule(ProductionModule())
.contentProviderModule(ContentProviderModule())
.build())

@ -1,6 +1,6 @@
package org.tasks.injection
import android.content.Context
import android.app.Application
import androidx.room.Room
import com.todoroo.astrid.dao.Database
import dagger.Module
@ -12,7 +12,7 @@ import org.tasks.preferences.Preferences
internal class ProductionModule {
@Provides
@ApplicationScope
fun getAppDatabase(@ForApplication context: Context): Database {
fun getAppDatabase(context: Application): Database {
return Room.databaseBuilder(context, Database::class.java, Database.NAME)
.allowMainThreadQueries() // TODO: remove me
.addMigrations(*Migrations.MIGRATIONS)
@ -20,7 +20,7 @@ internal class ProductionModule {
}
@Provides
fun getPreferences(@ForApplication context: Context): Preferences {
fun getPreferences(context: Application): Preferences {
return Preferences(context)
}
}

@ -3,6 +3,7 @@ package org.tasks.jobs;
import static com.todoroo.astrid.dao.TaskDao.TRANS_SUPPRESS_REFRESH;
import static org.tasks.Strings.isNullOrEmpty;
import android.app.Application;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
@ -24,7 +25,6 @@ import org.tasks.LocalBroadcastManager;
import org.tasks.R;
import org.tasks.data.CaldavAccount;
import org.tasks.data.CaldavDao;
import org.tasks.injection.ForApplication;
import org.tasks.injection.InjectingWorker;
import org.tasks.injection.JobComponent;
import org.tasks.location.GeofenceApi;
@ -43,7 +43,7 @@ public class AfterSaveWork extends InjectingWorker {
private static final String EXTRA_SUPPRESS_REFRESH = "extra_suppress_refresh";
@Inject RepeatTaskHelper repeatTaskHelper;
@Inject @ForApplication Context context;
@Inject Application context;
@Inject NotificationManager notificationManager;
@Inject GeofenceApi geofenceApi;
@Inject TimerPlugin timerPlugin;

@ -6,6 +6,7 @@ import static com.google.common.collect.Lists.newArrayList;
import static com.todoroo.andlib.utility.DateUtilities.now;
import static java.util.Collections.emptyList;
import android.app.Application;
import android.content.ContentResolver;
import android.content.Context;
import android.net.Uri;
@ -22,7 +23,6 @@ import java.util.List;
import javax.inject.Inject;
import org.tasks.R;
import org.tasks.backup.TasksJsonExporter;
import org.tasks.injection.ForApplication;
import org.tasks.injection.JobComponent;
import org.tasks.preferences.Preferences;
import timber.log.Timber;
@ -37,7 +37,7 @@ public class BackupWork extends RepeatingWorker {
(f1, f2) -> Long.compare(f2.lastModified(), f1.lastModified());
private static final Comparator<DocumentFile> DOCUMENT_FILE_COMPARATOR =
(d1, d2) -> Long.compare(d2.lastModified(), d1.lastModified());
@Inject @ForApplication Context context;
@Inject Application context;
@Inject TasksJsonExporter tasksJsonExporter;
@Inject Preferences preferences;
@Inject WorkManager workManager;

@ -4,6 +4,7 @@ import static com.google.common.collect.Iterables.skip;
import static com.google.common.collect.Lists.newArrayList;
import static org.tasks.Strings.isNullOrEmpty;
import android.app.Application;
import android.content.Context;
import android.net.Uri;
import androidx.annotation.NonNull;
@ -22,7 +23,6 @@ import javax.inject.Inject;
import javax.net.ssl.SSLException;
import org.tasks.R;
import org.tasks.drive.DriveInvoker;
import org.tasks.injection.ForApplication;
import org.tasks.injection.InjectingWorker;
import org.tasks.injection.JobComponent;
import org.tasks.preferences.Preferences;
@ -36,7 +36,7 @@ public class DriveUploader extends InjectingWorker {
private static final Comparator<File> DRIVE_FILE_COMPARATOR =
(f1, f2) -> Long.compare(f2.getModifiedTime().getValue(), f1.getModifiedTime().getValue());
@Inject @ForApplication Context context;
@Inject Application context;
@Inject DriveInvoker drive;
@Inject Preferences preferences;

@ -2,6 +2,7 @@ package org.tasks.jobs
import android.annotation.SuppressLint
import android.app.AlarmManager
import android.app.Application
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
@ -23,7 +24,6 @@ import org.tasks.data.Place
import org.tasks.date.DateTimeUtils.midnight
import org.tasks.date.DateTimeUtils.newDateTime
import org.tasks.injection.ApplicationScope
import org.tasks.injection.ForApplication
import org.tasks.preferences.Preferences
import org.tasks.time.DateTimeUtils
import timber.log.Timber
@ -34,7 +34,7 @@ import kotlin.math.max
@ApplicationScope
class WorkManager @Inject constructor(
@param:ForApplication private val context: Context,
private val context: Application,
private val preferences: Preferences,
private val googleTaskListDao: GoogleTaskListDao,
private val caldavDao: CaldavDao) {

@ -1,13 +1,12 @@
package org.tasks.locale.receiver;
import android.content.Context;
import android.app.Application;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.todoroo.astrid.api.Filter;
import javax.inject.Inject;
import org.tasks.Notifier;
import org.tasks.injection.ForApplication;
import org.tasks.injection.InjectingJobIntentService;
import org.tasks.injection.ServiceComponent;
import org.tasks.locale.bundle.ListNotificationBundle;
@ -17,7 +16,7 @@ import timber.log.Timber;
public class TaskerIntentService extends InjectingJobIntentService {
@Inject @ForApplication Context context;
@Inject Application context;
@Inject Notifier notifier;
@Inject DefaultFilterProvider defaultFilterProvider;
@Inject TaskerTaskCreator taskerTaskCreator;

@ -1,15 +1,15 @@
package org.tasks.notifications;
import android.app.Application;
import android.content.Context;
import javax.inject.Inject;
import org.tasks.injection.ForApplication;
public class AudioManager {
private final android.media.AudioManager audioManager;
@Inject
public AudioManager(@ForApplication Context context) {
public AudioManager(Application context) {
audioManager = (android.media.AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
}

@ -17,6 +17,7 @@ import static java.util.Collections.singletonList;
import static org.tasks.Strings.isNullOrEmpty;
import android.annotation.SuppressLint;
import android.app.Application;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
@ -43,7 +44,6 @@ import org.tasks.R;
import org.tasks.data.LocationDao;
import org.tasks.data.Place;
import org.tasks.injection.ApplicationScope;
import org.tasks.injection.ForApplication;
import org.tasks.intents.TaskIntents;
import org.tasks.preferences.Preferences;
import org.tasks.receivers.CompleteTaskReceiver;
@ -80,7 +80,7 @@ public class NotificationManager {
@Inject
public NotificationManager(
@ForApplication Context context,
Application context,
Preferences preferences,
NotificationDao notificationDao,
TaskDao taskDao,

@ -1,15 +1,15 @@
package org.tasks.notifications;
import android.app.Application;
import android.content.Context;
import javax.inject.Inject;
import org.tasks.injection.ForApplication;
public class TelephonyManager {
private final android.telephony.TelephonyManager telephonyManager;
@Inject
public TelephonyManager(@ForApplication Context context) {
public TelephonyManager(Application context) {
telephonyManager =
(android.telephony.TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
}

@ -1,5 +1,6 @@
package org.tasks.preferences
import android.app.Application
import android.content.Context
import com.todoroo.astrid.api.*
import com.todoroo.astrid.api.Filter
@ -9,12 +10,11 @@ import org.tasks.R
import org.tasks.Strings.isNullOrEmpty
import org.tasks.data.*
import org.tasks.filters.PlaceFilter
import org.tasks.injection.ForApplication
import timber.log.Timber
import javax.inject.Inject
class DefaultFilterProvider @Inject constructor(
@param:ForApplication private val context: Context,
private val context: Application,
private val preferences: Preferences,
private val filterDao: FilterDao,
private val tagDataDao: TagDataDao,

@ -2,6 +2,7 @@ package org.tasks.preferences;
import static java.util.Arrays.asList;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@ -14,7 +15,6 @@ import java.util.List;
import javax.inject.Inject;
import org.tasks.BuildConfig;
import org.tasks.R;
import org.tasks.injection.ForApplication;
import org.tasks.locale.Locale;
import timber.log.Timber;
@ -24,7 +24,7 @@ public class Device {
private final Locale locale;
@Inject
public Device(@ForApplication Context context, Locale locale) {
public Device(Application context, Locale locale) {
this.context = context;
this.locale = locale;
}

@ -4,10 +4,10 @@ import static com.todoroo.andlib.utility.AndroidUtilities.atLeastOreo;
import static com.todoroo.andlib.utility.AndroidUtilities.atLeastQ;
import android.Manifest.permission;
import android.app.Application;
import android.content.Context;
import android.content.pm.PackageManager;
import javax.inject.Inject;
import org.tasks.injection.ForApplication;
import timber.log.Timber;
public class PermissionChecker {
@ -15,7 +15,7 @@ public class PermissionChecker {
private final Context context;
@Inject
PermissionChecker(@ForApplication Context context) {
PermissionChecker(Application context) {
this.context = context;
}

@ -1,6 +1,6 @@
package org.tasks.receivers;
import android.content.Context;
import android.app.Application;
import android.content.Intent;
import androidx.annotation.NonNull;
import com.todoroo.astrid.api.Filter;
@ -8,7 +8,6 @@ import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.provider.Astrid2TaskProvider;
import javax.inject.Inject;
import org.tasks.R;
import org.tasks.injection.ForApplication;
import org.tasks.injection.InjectingJobIntentService;
import org.tasks.injection.ServiceComponent;
import org.tasks.preferences.DefaultFilterProvider;
@ -16,7 +15,7 @@ import org.tasks.preferences.Preferences;
public class RefreshReceiver extends InjectingJobIntentService {
@Inject @ForApplication Context context;
@Inject Application context;
@Inject DefaultFilterProvider defaultFilterProvider;
@Inject TaskDao taskDao;
@Inject Preferences preferences;

@ -2,8 +2,8 @@ package org.tasks.reminders;
import static com.todoroo.andlib.utility.DateUtilities.getTimeString;
import android.app.Application;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import androidx.annotation.NonNull;
@ -13,7 +13,6 @@ import javax.inject.Inject;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.DialogFragmentComponent;
import org.tasks.injection.ForApplication;
import org.tasks.injection.InjectingDialogFragment;
import org.tasks.preferences.Preferences;
import org.tasks.time.DateTime;
@ -22,7 +21,7 @@ public class SnoozeDialog extends InjectingDialogFragment {
private final List<String> items = new ArrayList<>();
@Inject Preferences preferences;
@Inject @ForApplication Context context;
@Inject Application context;
@Inject DialogBuilder dialogBuilder;
private SnoozeCallback snoozeCallback;
private DialogInterface.OnCancelListener onCancelListener;

@ -3,6 +3,7 @@ package org.tasks.repeats;
import static com.google.ical.values.Frequency.MONTHLY;
import static com.google.ical.values.Frequency.WEEKLY;
import android.app.Application;
import android.content.Context;
import com.google.common.base.Joiner;
import com.google.ical.values.Frequency;
@ -17,7 +18,6 @@ import java.util.Calendar;
import java.util.List;
import javax.inject.Inject;
import org.tasks.R;
import org.tasks.injection.ForApplication;
import org.tasks.locale.Locale;
import org.tasks.time.DateTime;
@ -28,7 +28,7 @@ public class RepeatRuleToString {
private final List<Weekday> weekdays = Arrays.asList(Weekday.values());
@Inject
public RepeatRuleToString(@ForApplication Context context, Locale locale) {
public RepeatRuleToString(Application context, Locale locale) {
this.context = context;
this.locale = locale;
}

@ -1,17 +1,17 @@
package org.tasks.scheduling;
import android.annotation.SuppressLint;
import android.app.Application;
import android.app.PendingIntent;
import android.content.Context;
import javax.inject.Inject;
import org.tasks.injection.ForApplication;
public class AlarmManager {
private final android.app.AlarmManager alarmManager;
@Inject
public AlarmManager(@ForApplication Context context) {
public AlarmManager(Application context) {
alarmManager = (android.app.AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
}

@ -1,5 +1,6 @@
package org.tasks.scheduling;
import android.app.Application;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
@ -13,7 +14,6 @@ import javax.inject.Inject;
import org.tasks.R;
import org.tasks.calendars.AndroidCalendarEvent;
import org.tasks.calendars.CalendarEventProvider;
import org.tasks.injection.ForApplication;
import org.tasks.injection.InjectingJobIntentService;
import org.tasks.injection.ServiceComponent;
import org.tasks.preferences.Preferences;
@ -26,7 +26,7 @@ public class CalendarNotificationIntentService extends RecurringIntervalIntentSe
private static final String URI_PREFIX = "cal-reminder";
@Inject Preferences preferences;
@Inject CalendarEventProvider calendarEventProvider;
@Inject @ForApplication Context context;
@Inject Application context;
@Inject AlarmManager alarmManager;
public static void enqueueWork(Context context) {

@ -7,6 +7,7 @@ import static org.tasks.notifications.NotificationManager.NOTIFICATION_CHANNEL_T
import static org.tasks.notifications.NotificationManager.NOTIFICATION_CHANNEL_TIMERS;
import android.annotation.TargetApi;
import android.app.Application;
import android.app.NotificationChannel;
import android.content.Context;
import android.content.Intent;
@ -16,7 +17,6 @@ import com.todoroo.astrid.alarms.AlarmService;
import com.todoroo.astrid.reminders.ReminderService;
import javax.inject.Inject;
import org.tasks.R;
import org.tasks.injection.ForApplication;
import org.tasks.injection.InjectingJobIntentService;
import org.tasks.injection.ServiceComponent;
import org.tasks.jobs.NotificationQueue;
@ -27,7 +27,7 @@ public class NotificationSchedulerIntentService extends InjectingJobIntentServic
private static final String EXTRA_CANCEL_EXISTING_NOTIFICATIONS =
"extra_cancel_existing_notifications";
@Inject @ForApplication Context context;
@Inject Application context;
@Inject AlarmService alarmService;
@Inject ReminderService reminderService;
@Inject NotificationQueue notificationQueue;

@ -2,7 +2,7 @@ package org.tasks.voice;
import static org.tasks.Strings.isNullOrEmpty;
import android.content.Context;
import android.app.Application;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
@ -10,13 +10,12 @@ import com.todoroo.astrid.service.TaskCreator;
import javax.inject.Inject;
import org.tasks.R;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.ForApplication;
import org.tasks.injection.InjectingAppCompatActivity;
public class VoiceCommandActivity extends InjectingAppCompatActivity {
@Inject TaskCreator taskCreator;
@Inject @ForApplication Context context;
@Inject Application context;
@Override
protected void onCreate(Bundle savedInstanceState) {

@ -1,11 +1,11 @@
package org.tasks.widget;
import android.app.Application;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import javax.inject.Inject;
import org.tasks.R;
import org.tasks.injection.ForApplication;
public class AppWidgetManager {
@ -13,7 +13,7 @@ public class AppWidgetManager {
private final Context context;
@Inject
public AppWidgetManager(@ForApplication Context context) {
public AppWidgetManager(Application context) {
this.context = context;
appWidgetManager = android.appwidget.AppWidgetManager.getInstance(context);
}

@ -4,6 +4,7 @@ import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import android.app.Application;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.content.Context;
@ -19,7 +20,6 @@ import javax.inject.Inject;
import org.tasks.R;
import org.tasks.activities.FilterSelectionActivity;
import org.tasks.injection.BroadcastComponent;
import org.tasks.injection.ForApplication;
import org.tasks.injection.InjectingAppWidgetProvider;
import org.tasks.intents.TaskIntents;
import org.tasks.locale.Locale;
@ -35,7 +35,7 @@ public class TasksWidget extends InjectingAppWidgetProvider {
@Inject DefaultFilterProvider defaultFilterProvider;
@Inject Locale locale;
@Inject TaskDao taskDao;
@Inject @ForApplication Context context;
@Inject Application context;
@Override
protected void inject(BroadcastComponent component) {

Loading…
Cancel
Save