From 6d9b949e37ce145f2472d1a4613546b95ba7cc65 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Fri, 12 Jun 2020 14:43:30 -0500 Subject: [PATCH] Remove @ForActivity annotation --- .../com/todoroo/astrid/activity/TaskEditFragment.java | 3 +-- .../java/com/todoroo/astrid/files/FilesControlSet.kt | 3 +-- .../java/com/todoroo/astrid/repeats/RepeatControlSet.kt | 4 ++-- .../java/com/todoroo/astrid/timers/TimerControlSet.kt | 3 +-- .../java/com/todoroo/astrid/ui/HideUntilControlSet.kt | 3 +-- .../java/com/todoroo/astrid/ui/ReminderControlSet.kt | 3 +-- app/src/main/java/org/tasks/Notifier.kt | 1 - .../main/java/org/tasks/dialogs/AddAttachmentDialog.java | 5 ++--- app/src/main/java/org/tasks/dialogs/GeofenceDialog.java | 5 ++--- .../main/java/org/tasks/dialogs/IconPickerDialog.java | 4 +--- .../main/java/org/tasks/dialogs/ImportTasksDialog.java | 4 +--- app/src/main/java/org/tasks/dialogs/Linkify.java | 4 ++-- .../fragments/TaskEditControlSetFragmentManager.java | 7 +++---- app/src/main/java/org/tasks/injection/ActivityModule.kt | 6 ------ app/src/main/java/org/tasks/injection/ForActivity.kt | 9 --------- .../java/org/tasks/repeats/BasicRecurrenceDialog.java | 5 ++--- .../java/org/tasks/repeats/CustomRecurrenceDialog.java | 6 ++---- .../main/java/org/tasks/tasklist/ViewHolderFactory.kt | 3 +-- app/src/main/java/org/tasks/themes/ColorProvider.kt | 6 ++++-- app/src/main/java/org/tasks/ui/CalendarControlSet.kt | 3 +-- app/src/main/java/org/tasks/ui/CheckBoxProvider.kt | 6 ++++-- app/src/main/java/org/tasks/ui/DeadlineControlSet.kt | 3 +-- app/src/main/java/org/tasks/ui/Toaster.java | 4 ++-- 23 files changed, 35 insertions(+), 65 deletions(-) delete mode 100644 app/src/main/java/org/tasks/injection/ForActivity.kt diff --git a/app/src/main/java/com/todoroo/astrid/activity/TaskEditFragment.java b/app/src/main/java/com/todoroo/astrid/activity/TaskEditFragment.java index b5d0cce3d..7777b13cd 100755 --- a/app/src/main/java/com/todoroo/astrid/activity/TaskEditFragment.java +++ b/app/src/main/java/com/todoroo/astrid/activity/TaskEditFragment.java @@ -59,7 +59,6 @@ import org.tasks.databinding.FragmentTaskEditBinding; import org.tasks.dialogs.DialogBuilder; import org.tasks.dialogs.Linkify; import org.tasks.fragments.TaskEditControlSetFragmentManager; -import org.tasks.injection.ForActivity; import org.tasks.injection.FragmentComponent; import org.tasks.injection.InjectingFragment; import org.tasks.notifications.NotificationManager; @@ -81,7 +80,7 @@ public final class TaskEditFragment extends InjectingFragment @Inject TaskDeleter taskDeleter; @Inject NotificationManager notificationManager; @Inject DialogBuilder dialogBuilder; - @Inject @ForActivity Context context; + @Inject Activity context; @Inject TaskEditControlSetFragmentManager taskEditControlSetFragmentManager; @Inject CommentsController commentsController; @Inject Preferences preferences; diff --git a/app/src/main/java/com/todoroo/astrid/files/FilesControlSet.kt b/app/src/main/java/com/todoroo/astrid/files/FilesControlSet.kt index 7e0993efd..6d9216dad 100644 --- a/app/src/main/java/com/todoroo/astrid/files/FilesControlSet.kt +++ b/app/src/main/java/com/todoroo/astrid/files/FilesControlSet.kt @@ -25,7 +25,6 @@ import org.tasks.data.TaskAttachmentDao import org.tasks.dialogs.AddAttachmentDialog import org.tasks.dialogs.DialogBuilder import org.tasks.files.FileHelper -import org.tasks.injection.ForActivity import org.tasks.injection.FragmentComponent import org.tasks.preferences.Preferences import org.tasks.ui.TaskEditControlFragment @@ -33,7 +32,7 @@ import java.util.* import javax.inject.Inject class FilesControlSet : TaskEditControlFragment() { - @Inject @ForActivity lateinit var activity: Context + @Inject lateinit var activity: Activity @Inject lateinit var taskAttachmentDao: TaskAttachmentDao @Inject lateinit var dialogBuilder: DialogBuilder @Inject lateinit var preferences: Preferences diff --git a/app/src/main/java/com/todoroo/astrid/repeats/RepeatControlSet.kt b/app/src/main/java/com/todoroo/astrid/repeats/RepeatControlSet.kt index 542b2136d..6ac04f593 100644 --- a/app/src/main/java/com/todoroo/astrid/repeats/RepeatControlSet.kt +++ b/app/src/main/java/com/todoroo/astrid/repeats/RepeatControlSet.kt @@ -5,6 +5,7 @@ */ package com.todoroo.astrid.repeats +import android.app.Activity import android.content.Context import android.os.Bundle import android.view.LayoutInflater @@ -24,7 +25,6 @@ import org.tasks.R import org.tasks.Strings.isNullOrEmpty import org.tasks.analytics.Firebase import org.tasks.dialogs.DialogBuilder -import org.tasks.injection.ForActivity import org.tasks.injection.FragmentComponent import org.tasks.repeats.BasicRecurrenceDialog import org.tasks.repeats.RepeatRuleToString @@ -45,7 +45,7 @@ import javax.inject.Inject class RepeatControlSet : TaskEditControlFragment() { private val repeatTypes: MutableList = ArrayList() - @Inject @ForActivity lateinit var activity: Context + @Inject lateinit var activity: Activity @Inject lateinit var dialogBuilder: DialogBuilder @Inject lateinit var theme: Theme @Inject lateinit var firebase: Firebase diff --git a/app/src/main/java/com/todoroo/astrid/timers/TimerControlSet.kt b/app/src/main/java/com/todoroo/astrid/timers/TimerControlSet.kt index 9a71a8aea..b90abc872 100644 --- a/app/src/main/java/com/todoroo/astrid/timers/TimerControlSet.kt +++ b/app/src/main/java/com/todoroo/astrid/timers/TimerControlSet.kt @@ -27,7 +27,6 @@ import com.todoroo.astrid.ui.TimeDurationControlSet import org.tasks.R import org.tasks.Strings.isNullOrEmpty import org.tasks.dialogs.DialogBuilder -import org.tasks.injection.ForActivity import org.tasks.injection.FragmentComponent import org.tasks.themes.Theme import org.tasks.ui.TaskEditControlFragment @@ -39,7 +38,7 @@ import javax.inject.Inject * @author Tim Su @todoroo.com> */ class TimerControlSet : TaskEditControlFragment() { - @Inject @ForActivity lateinit var activity: Context + @Inject lateinit var activity: Activity @Inject lateinit var dialogBuilder: DialogBuilder @Inject lateinit var theme: Theme diff --git a/app/src/main/java/com/todoroo/astrid/ui/HideUntilControlSet.kt b/app/src/main/java/com/todoroo/astrid/ui/HideUntilControlSet.kt index 77483fb8b..6acbbcb46 100644 --- a/app/src/main/java/com/todoroo/astrid/ui/HideUntilControlSet.kt +++ b/app/src/main/java/com/todoroo/astrid/ui/HideUntilControlSet.kt @@ -22,7 +22,6 @@ import org.tasks.R import org.tasks.activities.DateAndTimePickerActivity import org.tasks.date.DateTimeUtils import org.tasks.dialogs.MyTimePickerDialog -import org.tasks.injection.ForActivity import org.tasks.injection.FragmentComponent import org.tasks.locale.Locale import org.tasks.preferences.Preferences @@ -40,7 +39,7 @@ import javax.inject.Inject class HideUntilControlSet : TaskEditControlFragment(), OnItemSelectedListener { private val spinnerItems: MutableList = ArrayList() - @Inject @ForActivity lateinit var activity: Context + @Inject lateinit var activity: Activity @Inject lateinit var themeBase: ThemeBase @Inject lateinit var preferences: Preferences @Inject lateinit var locale: Locale diff --git a/app/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.kt b/app/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.kt index c76576125..217577826 100644 --- a/app/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.kt +++ b/app/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.kt @@ -28,7 +28,6 @@ import org.tasks.data.Alarm import org.tasks.date.DateTimeUtils import org.tasks.dialogs.DialogBuilder import org.tasks.dialogs.MyTimePickerDialog -import org.tasks.injection.ForActivity import org.tasks.injection.FragmentComponent import org.tasks.locale.Locale import org.tasks.ui.TaskEditControlFragment @@ -44,7 +43,7 @@ import javax.inject.Inject class ReminderControlSet : TaskEditControlFragment() { private val alarms: MutableSet = LinkedHashSet() - @Inject @ForActivity lateinit var activity: Context + @Inject lateinit var activity: Activity @Inject lateinit var alarmService: AlarmService @Inject lateinit var locale: Locale @Inject lateinit var dialogBuilder: DialogBuilder diff --git a/app/src/main/java/org/tasks/Notifier.kt b/app/src/main/java/org/tasks/Notifier.kt index 4664a2931..520521f4c 100644 --- a/app/src/main/java/org/tasks/Notifier.kt +++ b/app/src/main/java/org/tasks/Notifier.kt @@ -2,7 +2,6 @@ package org.tasks import android.app.Application import android.app.PendingIntent -import android.content.Context import android.content.Intent import androidx.core.app.NotificationCompat import com.todoroo.andlib.utility.AndroidUtilities diff --git a/app/src/main/java/org/tasks/dialogs/AddAttachmentDialog.java b/app/src/main/java/org/tasks/dialogs/AddAttachmentDialog.java index 7fe792ee4..4364cd2ef 100644 --- a/app/src/main/java/org/tasks/dialogs/AddAttachmentDialog.java +++ b/app/src/main/java/org/tasks/dialogs/AddAttachmentDialog.java @@ -3,8 +3,8 @@ package org.tasks.dialogs; import static org.tasks.dialogs.RecordAudioDialog.newRecordAudioDialog; import static org.tasks.files.FileHelper.newFilePickerIntent; +import android.app.Activity; import android.app.Dialog; -import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.provider.MediaStore.Images.Media; @@ -16,7 +16,6 @@ import javax.inject.Inject; import org.tasks.R; import org.tasks.activities.CameraActivity; import org.tasks.injection.DialogFragmentComponent; -import org.tasks.injection.ForActivity; import org.tasks.injection.InjectingDialogFragment; import org.tasks.preferences.Device; @@ -27,7 +26,7 @@ public class AddAttachmentDialog extends InjectingDialogFragment { public static final int REQUEST_STORAGE = 12122; public static final int REQUEST_AUDIO = 12123; private static final String FRAG_TAG_RECORD_AUDIO = "frag_tag_record_audio"; - @Inject @ForActivity Context context; + @Inject Activity context; @Inject DialogBuilder dialogBuilder; @Inject Device device; diff --git a/app/src/main/java/org/tasks/dialogs/GeofenceDialog.java b/app/src/main/java/org/tasks/dialogs/GeofenceDialog.java index 0ef6e781c..a7268bb90 100644 --- a/app/src/main/java/org/tasks/dialogs/GeofenceDialog.java +++ b/app/src/main/java/org/tasks/dialogs/GeofenceDialog.java @@ -2,8 +2,8 @@ package org.tasks.dialogs; import static android.app.Activity.RESULT_OK; +import android.app.Activity; import android.app.Dialog; -import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; @@ -21,7 +21,6 @@ import org.tasks.R; import org.tasks.data.Geofence; import org.tasks.data.Location; import org.tasks.injection.DialogFragmentComponent; -import org.tasks.injection.ForActivity; import org.tasks.injection.InjectingDialogFragment; import org.tasks.locale.Locale; import org.tasks.preferences.PermissionChecker; @@ -35,7 +34,7 @@ public class GeofenceDialog extends InjectingDialogFragment { private static final int MAX_RADIUS = 1000; @Inject DialogBuilder dialogBuilder; - @Inject @ForActivity Context context; + @Inject Activity context; @Inject Locale locale; @Inject PermissionChecker permissionChecker; @Inject Toaster toaster; diff --git a/app/src/main/java/org/tasks/dialogs/IconPickerDialog.java b/app/src/main/java/org/tasks/dialogs/IconPickerDialog.java index 2e6dea310..245a686b4 100644 --- a/app/src/main/java/org/tasks/dialogs/IconPickerDialog.java +++ b/app/src/main/java/org/tasks/dialogs/IconPickerDialog.java @@ -2,7 +2,6 @@ package org.tasks.dialogs; import android.app.Activity; import android.app.Dialog; -import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; @@ -18,7 +17,6 @@ import org.tasks.R; import org.tasks.billing.Inventory; import org.tasks.billing.PurchaseActivity; import org.tasks.injection.DialogFragmentComponent; -import org.tasks.injection.ForActivity; import org.tasks.injection.InjectingDialogFragment; import org.tasks.themes.CustomIcons; @@ -30,7 +28,7 @@ public class IconPickerDialog extends InjectingDialogFragment { RecyclerView recyclerView; @Inject DialogBuilder dialogBuilder; - @Inject @ForActivity Context context; + @Inject Activity context; @Inject Inventory inventory; private IconPickerCallback callback; diff --git a/app/src/main/java/org/tasks/dialogs/ImportTasksDialog.java b/app/src/main/java/org/tasks/dialogs/ImportTasksDialog.java index 4f275509c..7bec241e0 100644 --- a/app/src/main/java/org/tasks/dialogs/ImportTasksDialog.java +++ b/app/src/main/java/org/tasks/dialogs/ImportTasksDialog.java @@ -3,7 +3,6 @@ package org.tasks.dialogs; import android.app.Activity; import android.app.Dialog; import android.app.ProgressDialog; -import android.content.Context; import android.content.res.Resources; import android.net.Uri; import android.os.Bundle; @@ -15,7 +14,6 @@ import org.tasks.R; import org.tasks.backup.TasksJsonImporter; import org.tasks.backup.TasksJsonImporter.ImportResult; import org.tasks.injection.DialogFragmentComponent; -import org.tasks.injection.ForActivity; import org.tasks.injection.InjectingDialogFragment; import org.tasks.ui.Toaster; @@ -27,7 +25,7 @@ public class ImportTasksDialog extends InjectingDialogFragment { @Inject TasksXmlImporter xmlImporter; @Inject TasksJsonImporter jsonImporter; @Inject DialogBuilder dialogBuilder; - @Inject @ForActivity Context context; + @Inject Activity context; @Inject Toaster toaster; public static ImportTasksDialog newImportTasksDialog(Uri data, String extension) { diff --git a/app/src/main/java/org/tasks/dialogs/Linkify.java b/app/src/main/java/org/tasks/dialogs/Linkify.java index 8b3952592..8e3b36e0e 100644 --- a/app/src/main/java/org/tasks/dialogs/Linkify.java +++ b/app/src/main/java/org/tasks/dialogs/Linkify.java @@ -3,6 +3,7 @@ package org.tasks.dialogs; import static java.util.Arrays.asList; import static org.tasks.Strings.isNullOrEmpty; +import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; @@ -16,7 +17,6 @@ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.inject.Inject; import org.tasks.R; -import org.tasks.injection.ForActivity; public class Linkify { @@ -24,7 +24,7 @@ public class Linkify { private final DialogBuilder dialogBuilder; @Inject - public Linkify(@ForActivity Context context, DialogBuilder dialogBuilder) { + public Linkify(Activity context, DialogBuilder dialogBuilder) { this.context = context; this.dialogBuilder = dialogBuilder; } diff --git a/app/src/main/java/org/tasks/fragments/TaskEditControlSetFragmentManager.java b/app/src/main/java/org/tasks/fragments/TaskEditControlSetFragmentManager.java index ac26a9d91..4306be22c 100644 --- a/app/src/main/java/org/tasks/fragments/TaskEditControlSetFragmentManager.java +++ b/app/src/main/java/org/tasks/fragments/TaskEditControlSetFragmentManager.java @@ -1,6 +1,6 @@ package org.tasks.fragments; -import android.content.Context; +import android.app.Activity; import android.os.Bundle; import androidx.fragment.app.FragmentManager; import com.todoroo.astrid.activity.BeastModePreferences; @@ -19,14 +19,13 @@ import java.util.Map; import javax.inject.Inject; import org.tasks.BuildConfig; import org.tasks.R; -import org.tasks.injection.ForActivity; import org.tasks.preferences.Preferences; import org.tasks.ui.CalendarControlSet; import org.tasks.ui.DeadlineControlSet; import org.tasks.ui.DescriptionControlSet; +import org.tasks.ui.ListFragment; import org.tasks.ui.LocationControlSet; import org.tasks.ui.PriorityControlSet; -import org.tasks.ui.ListFragment; import org.tasks.ui.SubtaskControlSet; import org.tasks.ui.TaskEditControlFragment; @@ -81,7 +80,7 @@ public class TaskEditControlSetFragmentManager { private int numRows; @Inject - public TaskEditControlSetFragmentManager(@ForActivity Context context, Preferences preferences) { + public TaskEditControlSetFragmentManager(Activity context, Preferences preferences) { displayOrder = BeastModePreferences.constructOrderedControlList(preferences, context); displayOrder.add(0, context.getString(CommentBarFragment.TAG)); String hideAlwaysTrigger = context.getString(R.string.TEA_ctrl_hide_section_pref); diff --git a/app/src/main/java/org/tasks/injection/ActivityModule.kt b/app/src/main/java/org/tasks/injection/ActivityModule.kt index 926b3f247..508369856 100644 --- a/app/src/main/java/org/tasks/injection/ActivityModule.kt +++ b/app/src/main/java/org/tasks/injection/ActivityModule.kt @@ -1,7 +1,6 @@ package org.tasks.injection import android.app.Activity -import android.content.Context import dagger.Module import dagger.Provides import org.tasks.R @@ -15,11 +14,6 @@ import org.tasks.themes.ThemeColor @Module class ActivityModule(@get:Provides val activity: Activity) { - @get:ForActivity - @get:Provides - val activityContext: Context - get() = activity - @Provides @ActivityScope fun getThemeBase(preferences: Preferences, inventory: Inventory): ThemeBase diff --git a/app/src/main/java/org/tasks/injection/ForActivity.kt b/app/src/main/java/org/tasks/injection/ForActivity.kt deleted file mode 100644 index 6ce9b3f32..000000000 --- a/app/src/main/java/org/tasks/injection/ForActivity.kt +++ /dev/null @@ -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 ForActivity \ No newline at end of file diff --git a/app/src/main/java/org/tasks/repeats/BasicRecurrenceDialog.java b/app/src/main/java/org/tasks/repeats/BasicRecurrenceDialog.java index d4f96116a..f99ffd98d 100644 --- a/app/src/main/java/org/tasks/repeats/BasicRecurrenceDialog.java +++ b/app/src/main/java/org/tasks/repeats/BasicRecurrenceDialog.java @@ -11,8 +11,8 @@ import static org.tasks.Strings.isNullOrEmpty; import static org.tasks.repeats.CustomRecurrenceDialog.newCustomRecurrenceDialog; import static org.tasks.time.DateTimeUtils.currentTimeMillis; +import android.app.Activity; import android.app.Dialog; -import android.content.Context; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -24,7 +24,6 @@ import javax.inject.Inject; import org.tasks.R; import org.tasks.dialogs.DialogBuilder; import org.tasks.injection.DialogFragmentComponent; -import org.tasks.injection.ForActivity; import org.tasks.injection.InjectingDialogFragment; import org.tasks.ui.SingleCheckedArrayAdapter; import timber.log.Timber; @@ -35,7 +34,7 @@ public class BasicRecurrenceDialog extends InjectingDialogFragment { private static final String EXTRA_DATE = "extra_date"; private static final String FRAG_TAG_CUSTOM_RECURRENCE = "frag_tag_custom_recurrence"; - @Inject @ForActivity Context context; + @Inject Activity context; @Inject DialogBuilder dialogBuilder; @Inject RepeatRuleToString repeatRuleToString; diff --git a/app/src/main/java/org/tasks/repeats/CustomRecurrenceDialog.java b/app/src/main/java/org/tasks/repeats/CustomRecurrenceDialog.java index a66337296..d34632b61 100644 --- a/app/src/main/java/org/tasks/repeats/CustomRecurrenceDialog.java +++ b/app/src/main/java/org/tasks/repeats/CustomRecurrenceDialog.java @@ -14,7 +14,6 @@ import static org.tasks.time.DateTimeUtils.currentTimeMillis; import android.app.Activity; import android.app.Dialog; -import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.res.ColorStateList; @@ -50,6 +49,7 @@ import com.google.ical.values.WeekdayNum; import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.astrid.repeats.RepeatControlSet; import java.text.DateFormatSymbols; +import java.time.format.FormatStyle; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; @@ -59,12 +59,10 @@ import org.tasks.R; import org.tasks.dialogs.DialogBuilder; import org.tasks.dialogs.MyDatePickerDialog; import org.tasks.injection.DialogFragmentComponent; -import org.tasks.injection.ForActivity; import org.tasks.injection.InjectingDialogFragment; import org.tasks.locale.Locale; import org.tasks.preferences.ResourceResolver; import org.tasks.time.DateTime; -import java.time.format.FormatStyle; import timber.log.Timber; public class CustomRecurrenceDialog extends InjectingDialogFragment { @@ -76,7 +74,7 @@ public class CustomRecurrenceDialog extends InjectingDialogFragment { private static final String FRAG_TAG_DATE_PICKER = "frag_tag_date_picker"; private static final int REQUEST_PICK_DATE = 505; private final List repeatUntilOptions = new ArrayList<>(); - @Inject @ForActivity Context context; + @Inject Activity context; @Inject DialogBuilder dialogBuilder; @Inject Locale locale; diff --git a/app/src/main/java/org/tasks/tasklist/ViewHolderFactory.kt b/app/src/main/java/org/tasks/tasklist/ViewHolderFactory.kt index d30f6a4de..252d397c4 100644 --- a/app/src/main/java/org/tasks/tasklist/ViewHolderFactory.kt +++ b/app/src/main/java/org/tasks/tasklist/ViewHolderFactory.kt @@ -9,7 +9,6 @@ import com.todoroo.andlib.utility.AndroidUtilities import com.todoroo.astrid.service.TaskCompleter import org.tasks.R import org.tasks.dialogs.Linkify -import org.tasks.injection.ForActivity import org.tasks.preferences.Preferences import org.tasks.preferences.ResourceResolver import org.tasks.tasklist.TaskViewHolder.ViewHolderCallbacks @@ -19,7 +18,7 @@ import java.util.* import javax.inject.Inject class ViewHolderFactory @Inject constructor( - @param:ForActivity private val context: Context, + private val context: Activity, private val preferences: Preferences, private val chipProvider: ChipProvider, private val checkBoxProvider: CheckBoxProvider, diff --git a/app/src/main/java/org/tasks/themes/ColorProvider.kt b/app/src/main/java/org/tasks/themes/ColorProvider.kt index dee409635..158a6e748 100644 --- a/app/src/main/java/org/tasks/themes/ColorProvider.kt +++ b/app/src/main/java/org/tasks/themes/ColorProvider.kt @@ -1,13 +1,15 @@ package org.tasks.themes +import android.app.Activity import android.content.Context import androidx.annotation.ColorInt import org.tasks.R -import org.tasks.injection.ForActivity import org.tasks.preferences.Preferences import javax.inject.Inject -class ColorProvider @Inject constructor(@param:ForActivity private val context: Context, preferences: Preferences) { +class ColorProvider constructor(private val context: Context, preferences: Preferences) { + + @Inject constructor(activity: Activity, preferences: Preferences): this(activity as Context, preferences) companion object { const val BLUE_500 = -14575885 diff --git a/app/src/main/java/org/tasks/ui/CalendarControlSet.kt b/app/src/main/java/org/tasks/ui/CalendarControlSet.kt index a205e5a0e..2a077b40c 100644 --- a/app/src/main/java/org/tasks/ui/CalendarControlSet.kt +++ b/app/src/main/java/org/tasks/ui/CalendarControlSet.kt @@ -24,7 +24,6 @@ import org.tasks.calendars.CalendarEventProvider import org.tasks.calendars.CalendarPicker import org.tasks.calendars.CalendarProvider import org.tasks.dialogs.DialogBuilder -import org.tasks.injection.ForActivity import org.tasks.injection.FragmentComponent import org.tasks.preferences.FragmentPermissionRequestor import org.tasks.preferences.PermissionChecker @@ -40,7 +39,7 @@ class CalendarControlSet : TaskEditControlFragment() { @BindView(R.id.calendar_display_which) lateinit var calendar: TextView - @Inject @ForActivity lateinit var activity: Context + @Inject lateinit var activity: Activity @Inject lateinit var gcalHelper: GCalHelper @Inject lateinit var calendarProvider: CalendarProvider @Inject lateinit var preferences: Preferences diff --git a/app/src/main/java/org/tasks/ui/CheckBoxProvider.kt b/app/src/main/java/org/tasks/ui/CheckBoxProvider.kt index 6a5253ca6..e0a4d8c45 100644 --- a/app/src/main/java/org/tasks/ui/CheckBoxProvider.kt +++ b/app/src/main/java/org/tasks/ui/CheckBoxProvider.kt @@ -1,5 +1,6 @@ package org.tasks.ui +import android.app.Activity import android.content.Context import android.graphics.Bitmap import android.graphics.Canvas @@ -7,12 +8,13 @@ import android.graphics.drawable.Drawable import androidx.annotation.DrawableRes import com.todoroo.astrid.data.Task import org.tasks.R -import org.tasks.injection.ForActivity import org.tasks.themes.ColorProvider import org.tasks.themes.DrawableUtil import javax.inject.Inject -class CheckBoxProvider @Inject constructor(@param:ForActivity private val context: Context, private val colorProvider: ColorProvider) { +class CheckBoxProvider constructor(private val context: Context, private val colorProvider: ColorProvider) { + + @Inject constructor(context: Activity, colorProvider: ColorProvider): this(context as Context, colorProvider) fun getCheckBox(task: Task) = getCheckBox(task.isCompleted, task.isRecurring, task.priority) diff --git a/app/src/main/java/org/tasks/ui/DeadlineControlSet.kt b/app/src/main/java/org/tasks/ui/DeadlineControlSet.kt index 9a40ba0d7..e7bc5d29f 100644 --- a/app/src/main/java/org/tasks/ui/DeadlineControlSet.kt +++ b/app/src/main/java/org/tasks/ui/DeadlineControlSet.kt @@ -17,7 +17,6 @@ import org.tasks.R import org.tasks.date.DateTimeUtils import org.tasks.dialogs.DateTimePicker import org.tasks.dialogs.DateTimePicker.Companion.newDateTimePicker -import org.tasks.injection.ForActivity import org.tasks.injection.FragmentComponent import org.tasks.locale.Locale import org.tasks.preferences.Preferences @@ -26,7 +25,7 @@ import java.time.format.FormatStyle import javax.inject.Inject class DeadlineControlSet : TaskEditControlFragment() { - @Inject @ForActivity lateinit var activity: Context + @Inject lateinit var activity: Activity @Inject lateinit var locale: Locale @Inject lateinit var preferences: Preferences diff --git a/app/src/main/java/org/tasks/ui/Toaster.java b/app/src/main/java/org/tasks/ui/Toaster.java index fb2a0a13a..6091c0093 100644 --- a/app/src/main/java/org/tasks/ui/Toaster.java +++ b/app/src/main/java/org/tasks/ui/Toaster.java @@ -3,11 +3,11 @@ package org.tasks.ui; import static android.widget.Toast.LENGTH_LONG; import static org.tasks.Strings.isNullOrEmpty; +import android.app.Activity; import android.content.Context; import android.widget.Toast; import androidx.annotation.StringRes; import javax.inject.Inject; -import org.tasks.injection.ForActivity; import org.tasks.locale.Locale; public class Toaster { @@ -16,7 +16,7 @@ public class Toaster { private final Locale locale; @Inject - public Toaster(@ForActivity Context context, Locale locale) { + public Toaster(Activity context, Locale locale) { this.context = context; this.locale = locale; }