Remove @ForActivity annotation

pull/1020/head
Alex Baker 4 years ago
parent 999e5aab7a
commit 6d9b949e37

@ -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;

@ -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

@ -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<String> = 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

@ -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 <tim></tim>@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

@ -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<HideUntilValue> = 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

@ -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<Long> = 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

@ -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

@ -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;

@ -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;

@ -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;

@ -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) {

@ -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;
}

@ -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);

@ -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

@ -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

@ -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;

@ -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<String> repeatUntilOptions = new ArrayList<>();
@Inject @ForActivity Context context;
@Inject Activity context;
@Inject DialogBuilder dialogBuilder;
@Inject Locale locale;

@ -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,

@ -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

@ -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

@ -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)

@ -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

@ -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;
}

Loading…
Cancel
Save