Add final modifier

pull/437/head
Alex Baker 8 years ago
parent 61360e114b
commit b0b67908d9

@ -14,7 +14,7 @@ import javax.inject.Inject;
import timber.log.Timber;
public class BuildSetup {
private Context context;
private final Context context;
@Inject
public BuildSetup(@ForApplication Context context) {

@ -51,10 +51,10 @@ public class OrderedMetadataListFragmentHelper<LIST> implements OrderedListFragm
private final DisplayMetrics metrics = new DisplayMetrics();
private final OrderedMetadataListUpdater<LIST> updater;
private DialogBuilder dialogBuilder;
private CheckBoxes checkBoxes;
private final DialogBuilder dialogBuilder;
private final CheckBoxes checkBoxes;
private final TagService tagService;
private ThemeCache themeCache;
private final ThemeCache themeCache;
private final TaskListFragment fragment;
private final Preferences preferences;

@ -19,7 +19,7 @@ import java.util.concurrent.atomic.AtomicReference;
abstract public class OrderedMetadataListUpdater<LIST> {
private MetadataDao metadataDao;
private final MetadataDao metadataDao;
public interface OrderedListIterator {
void processTask(long taskId, Metadata metadata);

@ -19,7 +19,7 @@ import timber.log.Timber;
public class MoveRequest {
private final GtasksInvoker service;
private String taskId;
private final String taskId;
private final String destinationList;
private String parentId;
private String priorSiblingId;

@ -65,7 +65,7 @@ public class GtasksSyncService {
}
private class MoveOp implements SyncOnSaveOperation {
Metadata metadata;
final Metadata metadata;
public MoveOp(Metadata metadata) {
this.metadata = metadata;

@ -16,8 +16,8 @@ import java.util.ArrayList;
public class GtasksTaskContainer {
public Task task;
public ArrayList<Metadata> metadata;
public final Task task;
public final ArrayList<Metadata> metadata;
public Metadata gtaskMetadata;
private final long updateTime;

@ -38,7 +38,7 @@ public class PurchaseHelper implements IabHelper.OnIabSetupFinishedListener {
private final Tracker tracker;
private final Broadcaster broadcaster;
private final InventoryHelper inventory;
private Executor executor;
private final Executor executor;
private PurchaseHelperCallback activityResultCallback;
private IabHelper iabHelper;

@ -29,9 +29,9 @@ import static java.util.Collections.singletonList;
public class GeofenceApi {
private Context context;
private Preferences preferences;
private PermissionChecker permissionChecker;
private final Context context;
private final Preferences preferences;
private final PermissionChecker permissionChecker;
@Inject
public GeofenceApi(@ForApplication Context context, Preferences preferences, PermissionChecker permissionChecker) {

@ -15,7 +15,7 @@ import timber.log.Timber;
public class GoogleApi implements GoogleApiClient.ConnectionCallbacks {
private GoogleApiClient.Builder builder;
private final GoogleApiClient.Builder builder;
private GoogleApiClient googleApiClient;
private GoogleApiClientConnectionHandler googleApiClientConnectionHandler;

@ -19,7 +19,7 @@ public abstract class Criterion {
this.operator = operator;
}
public static Criterion all = new Criterion(Operator.exists) {
public static final Criterion all = new Criterion(Operator.exists) {
@Override
protected void populate(StringBuilder sb) {
sb.append(1);

@ -149,7 +149,7 @@ public class TaskListFragment extends InjectingListFragment implements
@BindView(R.id.task_list_coordinator) CoordinatorLayout coordinatorLayout;
private TaskAdapter taskAdapter = null;
private RefreshReceiver refreshReceiver = new RefreshReceiver();
private final RefreshReceiver refreshReceiver = new RefreshReceiver();
private TaskListFragmentCallbackHandler callbacks;
protected final AtomicReference<String> sqlQueryTemplate = new AtomicReference<>();

@ -53,7 +53,7 @@ public class FilterAdapter extends ArrayAdapter<FilterListItem> {
private final FilterProvider filterProvider;
private final FilterCounter filterCounter;
private final Activity activity;
private boolean navigationDrawer;
private final boolean navigationDrawer;
private final Locale locale;
private final FilterListUpdateReceiver filterListUpdateReceiver = new FilterListUpdateReceiver();
@ -187,7 +187,7 @@ public class FilterAdapter extends ArrayAdapter<FilterListItem> {
* ============================================================ selection
* ====================================================================== */
private FilterListItem selection = null;
private final FilterListItem selection = null;
/* ======================================================================
* ============================================================= receiver

@ -122,9 +122,9 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
private final Context context;
private final TaskListFragment fragment;
private DialogBuilder dialogBuilder;
private final DialogBuilder dialogBuilder;
private final TagService tagService;
private ThemeCache themeCache;
private final ThemeCache themeCache;
private final Resources resources;
private OnCompletedTaskListener onCompletedTaskListener = null;
private final LayoutInflater inflater;

@ -148,9 +148,9 @@ public class TasksXmlImporter {
private class Format2TaskImporter {
XmlPullParser xpp;
Task currentTask = new Task();
Metadata metadata = new Metadata();
TagData tagdata = new TagData();
final Task currentTask = new Task();
final Metadata metadata = new Metadata();
final TagData tagdata = new TagData();
public Format2TaskImporter() { }
public Format2TaskImporter(XmlPullParser xpp) throws XmlPullParserException, IOException {

@ -37,7 +37,7 @@ import java.util.List;
class CustomFilterAdapter extends ArrayAdapter<CriterionInstance> {
private final CustomFilterActivity activity;
private DialogBuilder dialogBuilder;
private final DialogBuilder dialogBuilder;
private final LayoutInflater inflater;
private final Locale locale;
@ -52,7 +52,7 @@ class CustomFilterAdapter extends ArrayAdapter<CriterionInstance> {
// --- view event handling
private View.OnClickListener filterClickListener = new View.OnClickListener() {
private final View.OnClickListener filterClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
ViewHolder viewHolder = (ViewHolder) v.getTag();

@ -25,7 +25,7 @@ public class StoreObjectDao {
private final DatabaseDao<StoreObject> dao;
private static Criterion isSavedFilter = StoreObject.TYPE.eq(SavedFilter.TYPE);
private static final Criterion isSavedFilter = StoreObject.TYPE.eq(SavedFilter.TYPE);
@Inject
public StoreObjectDao(Database database) {

@ -44,7 +44,7 @@ public class CommentsController {
private final UserActivityDao userActivityDao;
private final ArrayList<NoteOrUpdate> items = new ArrayList<>();
private final Activity activity;
private Preferences preferences;
private final Preferences preferences;
private int commentItems = 10;
private Task task;

@ -71,10 +71,10 @@ public class Astrid2TaskProvider extends InjectingContentProvider {
private final static String TAGS_ID = "tags_id";
private static String[] TASK_FIELD_LIST = new String[] { NAME, IMPORTANCE_COLOR, PREFERRED_DUE_DATE, DEFINITE_DUE_DATE,
private static final String[] TASK_FIELD_LIST = new String[] { NAME, IMPORTANCE_COLOR, PREFERRED_DUE_DATE, DEFINITE_DUE_DATE,
IMPORTANCE, IDENTIFIER, TAGS_ID };
private static String[] TAGS_FIELD_LIST = new String[] { ID, NAME };
private static final String[] TAGS_FIELD_LIST = new String[] { ID, NAME };
private static final int URI_TASKS = 0;
private static final int URI_TAGS = 1;

@ -35,7 +35,7 @@ public class SqlContentProvider extends InjectingContentProvider {
// --- instance variables
private static UriMatcher uriMatcher;
private static final UriMatcher uriMatcher;
static {
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);

@ -77,8 +77,8 @@ public final class ReminderService {
private AlarmScheduler scheduler;
private long now = -1; // For tracking when reminders might be scheduled all at once
private Context context;
private Preferences preferences;
private final Context context;
private final Preferences preferences;
@Inject
ReminderService(@ForApplication Context context, Preferences preferences, AlarmManager alarmManager) {

@ -169,7 +169,7 @@ public class RepeatTaskCompleteListener extends InjectingBroadcastReceiver {
}
}
private static Comparator<WeekdayNum> weekdayCompare = (object1, object2) -> object1.wday.javaDayNum - object2.wday.javaDayNum;
private static final Comparator<WeekdayNum> weekdayCompare = (object1, object2) -> object1.wday.javaDayNum - object2.wday.javaDayNum;
private static WeekdayNum findNextWeekday(List<WeekdayNum> byDay, DateTime date) {
WeekdayNum next = byDay.get(0);

@ -16,7 +16,7 @@ public class TaskCreator {
private final TaskService taskService;
private final GCalHelper gcalHelper;
private Preferences preferences;
private final Preferences preferences;
@Inject
public TaskCreator(TaskService taskService, GCalHelper gcalHelper, Preferences preferences) {

@ -46,8 +46,8 @@ public class AstridOrderedListFragmentHelper<LIST> implements OrderedListFragmen
private final DisplayMetrics metrics = new DisplayMetrics();
private final AstridOrderedListUpdater<LIST> updater;
private DialogBuilder dialogBuilder;
private CheckBoxes checkBoxes;
private final DialogBuilder dialogBuilder;
private final CheckBoxes checkBoxes;
private final TagService tagService;
private final TaskListFragment fragment;
private final Preferences preferences;

@ -11,7 +11,7 @@ import javax.inject.Inject;
public class SubtasksFilterUpdater extends SubtasksUpdater<TaskListMetadata> {
private TaskListMetadataDao taskListMetadataDao;
private final TaskListMetadataDao taskListMetadataDao;
@Inject
public SubtasksFilterUpdater(TaskListMetadataDao taskListMetadataDao, TaskService taskService) {

@ -55,8 +55,8 @@ public class HideUntilControlSet extends TaskEditControlFragment implements OnIt
public static final int TAG = R.string.TEA_ctrl_hide_until_pref;
private static String EXTRA_CUSTOM = "extra_custom";
private static String EXTRA_SELECTION = "extra_selection";
private static final String EXTRA_CUSTOM = "extra_custom";
private static final String EXTRA_SELECTION = "extra_selection";
private static final int SPECIFIC_DATE = -1;
private static final int EXISTING_TIME_UNSET = -2;
@ -222,9 +222,9 @@ public class HideUntilControlSet extends TaskEditControlFragment implements OnIt
*
*/
private class HideUntilValue {
public String label;
public int setting;
public long date;
public final String label;
public final int setting;
public final long date;
public HideUntilValue(String label, int setting) {
this(label, setting, 0);

@ -97,10 +97,10 @@ public class ReminderControlSet extends TaskEditControlFragment {
private RandomReminderControlSet randomControlSet;
private boolean whenDue;
private boolean whenOverdue;
private List<String> spinnerOptions = new ArrayList<>();
private final List<String> spinnerOptions = new ArrayList<>();
private ArrayAdapter<String> remindAdapter;
private Set<Long> alarms = new LinkedHashSet<>();
private Set<Geofence> geofences = new LinkedHashSet<>();
private final Set<Long> alarms = new LinkedHashSet<>();
private final Set<Geofence> geofences = new LinkedHashSet<>();
@OnItemSelected(R.id.reminder_alarm)
void ringModeSelected(int position) {

@ -57,7 +57,7 @@ public class VoiceInputAssistant {
* Use the mightier constructor to specify your own requestCode in this case for every additional use on an fragment.
* If you only use one microphone-button on an fragment, you can leave it to its default, VOICE_RECOGNITION_REQUEST_CODE.
*/
private Fragment fragment;
private final Fragment fragment;
/**
* This constructor can be called from a widget with a voice-button calling a dummy-activity.

@ -45,11 +45,11 @@ public class FilterCriteriaProvider {
private static final String IDENTIFIER_TAG_IS = "tag_is"; //$NON-NLS-1$
private static final String IDENTIFIER_TAG_CONTAINS = "tag_contains"; //$NON-NLS-1$
private Context context;
private TagService tagService;
private GtasksListService gtasksListService;
private GtasksMetadata gtasksMetadata;
private Resources r;
private final Context context;
private final TagService tagService;
private final GtasksListService gtasksListService;
private final GtasksMetadata gtasksMetadata;
private final Resources r;
private final SyncAdapterHelper syncAdapterHelper;
@Inject

@ -21,7 +21,7 @@ import static org.tasks.ui.WidgetCheckBoxes.newWidgetCheckBoxes;
@Module
public class ApplicationModule {
private Context context;
private final Context context;
public ApplicationModule(Context context) {
this.context = context;

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

@ -8,7 +8,7 @@ import dagger.Provides;
@Module
public class NativeDialogFragmentModule {
private DialogFragment dialogFragment;
private final DialogFragment dialogFragment;
public NativeDialogFragmentModule(DialogFragment dialogFragment) {
this.dialogFragment = dialogFragment;

@ -23,7 +23,7 @@ import static com.todoroo.andlib.utility.AndroidUtilities.atLeastJellybeanMR1;
public class Locale {
private static Locale DEFAULT = new Locale(java.util.Locale.getDefault(), null, -1);
private static final Locale DEFAULT = new Locale(java.util.Locale.getDefault(), null, -1);
private static Locale INSTANCE;
public static Locale getInstance(Context context) {

@ -22,8 +22,8 @@ public class AppearancePreferences extends InjectingPreferenceActivity {
private static final int REQUEST_DEFAULT_LIST = 1005;
private static final String EXTRA_BUNDLE = "extra_bundle";
public static String EXTRA_RESTART = "extra_restart";
public static String EXTRA_FILTERS_CHANGED = "extra_filters_changed";
public static final String EXTRA_RESTART = "extra_restart";
public static final String EXTRA_FILTERS_CHANGED = "extra_filters_changed";
@Inject Preferences preferences;
@Inject DefaultFilterProvider defaultFilterProvider;

@ -19,7 +19,7 @@ import static java.util.Arrays.asList;
public class Device {
private Context context;
private final Context context;
@Inject
public Device(@ForApplication Context context) {

@ -5,7 +5,7 @@ import android.support.v4.app.Fragment;
import javax.inject.Inject;
public class FragmentPermissionRequestor extends PermissionRequestor {
private Fragment fragment;
private final Fragment fragment;
@Inject
public FragmentPermissionRequestor(Fragment fragment, PermissionChecker permissionChecker) {

@ -18,7 +18,7 @@ import timber.log.Timber;
public class ListNotificationReceiver extends InjectingBroadcastReceiver {
private static ExecutorService executorService = Executors.newSingleThreadExecutor();
private static final ExecutorService executorService = Executors.newSingleThreadExecutor();
private static final String EXTRA_FILTER_TITLE = "extra_filter_title";
private static final String EXTRA_FILTER_QUERY = "extra_filter_query";

@ -33,7 +33,7 @@ public class RepeatConfirmationReceiver extends BroadcastReceiver {
private final TaskService taskService;
private final Activity activity;
private Tracker tracker;
private final Tracker tracker;
@Inject
public RepeatConfirmationReceiver(TaskService taskService, Activity activity, Tracker tracker) {

@ -14,7 +14,7 @@ import javax.inject.Inject;
public class TaskNotificationReceiver extends InjectingBroadcastReceiver {
private static ExecutorService executorService = Executors.newSingleThreadExecutor();
private static final ExecutorService executorService = Executors.newSingleThreadExecutor();
public static final String ID_KEY = "id"; //$NON-NLS-1$
public static final String EXTRAS_TYPE = "type"; //$NON-NLS-1$

@ -29,7 +29,7 @@ public class SnoozeDialog extends InjectingDialogFragment {
private SnoozeCallback snoozeCallback;
private DialogInterface.OnCancelListener onCancelListener;
private List<String> items = new ArrayList<>();
private final List<String> items = new ArrayList<>();
@NonNull
@Override

@ -8,7 +8,7 @@ import org.tasks.injection.ForApplication;
import javax.inject.Inject;
public class BackgroundScheduler {
private Context context;
private final Context context;
@Inject
public BackgroundScheduler(@ForApplication Context context) {

@ -7,8 +7,8 @@ import org.tasks.Broadcaster;
public class RecordSyncStatusCallback implements SyncResultCallback {
private GtasksPreferenceService gtasksPreferenceService;
private Broadcaster broadcaster;
private final GtasksPreferenceService gtasksPreferenceService;
private final Broadcaster broadcaster;
public RecordSyncStatusCallback(GtasksPreferenceService gtasksPreferenceService, Broadcaster broadcaster) {
this.gtasksPreferenceService = gtasksPreferenceService;

@ -2,7 +2,7 @@ package org.tasks.time;
public class FixedMillisProvider implements MillisProvider {
private long millis;
private final long millis;
public FixedMillisProvider(long millis) {
this.millis = millis;

@ -22,11 +22,11 @@ public class CheckBoxes {
private static final int MAX_IMPORTANCE_INDEX = 3;
private List<Drawable> checkboxes;
private List<Drawable> repeatingCheckboxes;
private List<Drawable> completedCheckboxes;
private List<Integer> priorityColors;
private int[] priorityColorsArray;
private final List<Drawable> checkboxes;
private final List<Drawable> repeatingCheckboxes;
private final List<Drawable> completedCheckboxes;
private final List<Integer> priorityColors;
private final int[] priorityColorsArray;
private CheckBoxes(Context context) {
checkboxes = wrapDrawable(context, R.drawable.ic_check_box_outline_blank_24dp);

@ -14,7 +14,7 @@ import java.util.List;
public class HiddenTopArrayAdapter<T> extends ArrayAdapter<T> {
private List<String> hints;
private final List<String> hints;
public HiddenTopArrayAdapter(Context context, int resources, List<T> objects) {
this(context, resources, objects, new ArrayList<>());

@ -13,8 +13,8 @@ import timber.log.Timber;
public abstract class ProgressDialogAsyncTask extends AsyncTask<Void, Void, Integer> {
private ProgressDialog progressDialog;
private Activity activity;
private DialogBuilder dialogBuilder;
private final Activity activity;
private final DialogBuilder dialogBuilder;
public ProgressDialogAsyncTask(Activity activity, DialogBuilder dialogBuilder) {
this.activity = activity;

@ -35,7 +35,7 @@ public class ScrimInsetsFrameLayout extends FrameLayout {
private Drawable mInsetForeground;
private Rect mInsets;
private Rect mTempRect = new Rect();
private final Rect mTempRect = new Rect();
private OnInsetsCallback mOnInsetsCallback;
public ScrimInsetsFrameLayout(Context context) {

@ -15,7 +15,7 @@ import org.tasks.time.DateTime;
public class TimePreference extends Preference {
private int millisOfDay;
private String summary;
private final String summary;
public TimePreference(Context context, AttributeSet attrs) {
super(context, attrs);

@ -18,9 +18,9 @@ public class WidgetCheckBoxes {
return new WidgetCheckBoxes(checkBoxes);
}
private List<Bitmap> checkboxes;
private List<Bitmap> repeatingCheckboxes;
private List<Bitmap> completedCheckboxes;
private final List<Bitmap> checkboxes;
private final List<Bitmap> repeatingCheckboxes;
private final List<Bitmap> completedCheckboxes;
private WidgetCheckBoxes(CheckBoxes checkBoxes) {
Timber.d("Initializing widget checkboxes");

@ -39,7 +39,7 @@ import static org.tasks.intents.TaskIntents.getEditTaskIntent;
public class TasksWidget extends InjectingAppWidgetProvider {
private static int flags = FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TOP;
private static final int flags = FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TOP;
@Inject Broadcaster broadcaster;
@Inject Preferences preferences;

Loading…
Cancel
Save