Add support annotations

pull/437/head
Alex Baker 8 years ago
parent b0b67908d9
commit 4d251cf2c1

@ -122,6 +122,7 @@ dependencies {
compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:multidex:1.0.1'
compile 'com.nononsenseapps:filepicker:2.5.2' compile 'com.nononsenseapps:filepicker:2.5.2'
compile "com.android.support:design:${SUPPORT_VERSION}" compile "com.android.support:design:${SUPPORT_VERSION}"
compile "com.android.support:support-annotations:${SUPPORT_VERSION}"
compile 'com.jakewharton.timber:timber:4.1.2' compile 'com.jakewharton.timber:timber:4.1.2'
compile 'com.google.guava:guava:19.0' compile 'com.google.guava:guava:19.0'
compile 'com.jakewharton:process-phoenix:1.0.2' compile 'com.jakewharton:process-phoenix:1.0.2'

@ -9,6 +9,7 @@ import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.support.annotation.NonNull;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.dao.MetadataDao; import com.todoroo.astrid.dao.MetadataDao;
@ -118,7 +119,7 @@ public class GtasksPreferences extends InjectingPreferenceActivity implements Go
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == PermissionRequestor.REQUEST_ACCOUNTS) { if (requestCode == PermissionRequestor.REQUEST_ACCOUNTS) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
requestLogin(); requestLogin();

@ -3,6 +3,7 @@ package org.tasks.activities;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import com.todoroo.astrid.gtasks.GtasksList; import com.todoroo.astrid.gtasks.GtasksList;
@ -26,6 +27,7 @@ public class SupportGoogleTaskListPicker extends InjectingDialogFragment {
private GoogleTaskListSelectionHandler handler; private GoogleTaskListSelectionHandler handler;
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
return createDialog(dialogBuilder, gtasksListService, list -> handler.selectedList(list)); return createDialog(dialogBuilder, gtasksListService, list -> handler.selectedList(list));

@ -8,6 +8,7 @@ package com.todoroo.astrid.activity;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.MenuItem; import android.view.MenuItem;
@ -70,8 +71,9 @@ public class BeastModePreferences extends ThemedInjectingAppCompatActivity imple
items = constructOrderedControlList(preferences, this); items = constructOrderedControlList(preferences, this);
adapter = new ArrayAdapter<String>(this, R.layout.preference_draggable_row, R.id.text, items) { adapter = new ArrayAdapter<String>(this, R.layout.preference_draggable_row, R.id.text, items) {
@NonNull
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, @NonNull ViewGroup parent) {
View v = super.getView(position, convertView, parent); View v = super.getView(position, convertView, parent);
TextView display = (TextView) v.findViewById(R.id.text); TextView display = (TextView) v.findViewById(R.id.text);
display.setText(prefsToDescriptions.get(getItem(position))); display.setText(prefsToDescriptions.get(getItem(position)));

@ -10,6 +10,7 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.support.annotation.NonNull;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -135,8 +136,9 @@ public class FilterAdapter extends ArrayAdapter<FilterListItem> {
public View view; public View view;
} }
@NonNull
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, @NonNull ViewGroup parent) {
FilterListItem item = getItem(position); FilterListItem item = getItem(position);
convertView = newView(convertView, parent, item.getItemType()); convertView = newView(convertView, parent, item.getItemType());
@ -180,7 +182,7 @@ public class FilterAdapter extends ArrayAdapter<FilterListItem> {
} }
@Override @Override
public View getDropDownView(int position, View convertView, ViewGroup parent) { public View getDropDownView(int position, View convertView, @NonNull ViewGroup parent) {
return getView(position, convertView, parent); return getView(position, convertView, parent);
} }
/* ====================================================================== /* ======================================================================

@ -6,6 +6,7 @@
package com.todoroo.astrid.core; package com.todoroo.astrid.core;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.support.annotation.NonNull;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -141,8 +142,9 @@ class CustomFilterAdapter extends ArrayAdapter<CriterionInstance> {
// --- view construction // --- view construction
@NonNull
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, @NonNull ViewGroup parent) {
if(convertView == null) { if(convertView == null) {
convertView = inflater.inflate(R.layout.custom_filter_row, parent, false); convertView = inflater.inflate(R.layout.custom_filter_row, parent, false);
ViewHolder viewHolder = new ViewHolder(); ViewHolder viewHolder = new ViewHolder();

@ -9,6 +9,7 @@ import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.preference.Preference; import android.preference.Preference;
import android.support.annotation.NonNull;
import org.tasks.R; import org.tasks.R;
import org.tasks.activities.CalendarSelectionActivity; import org.tasks.activities.CalendarSelectionActivity;
@ -67,7 +68,7 @@ public class DefaultsPreferences extends InjectingPreferenceActivity {
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == PermissionRequestor.REQUEST_CALENDAR) { if (requestCode == PermissionRequestor.REQUEST_CALENDAR) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startCalendarSelectionActivity(); startCalendarSelectionActivity();

@ -8,6 +8,7 @@ package com.todoroo.astrid.files;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.widget.Chronometer; import android.widget.Chronometer;
import com.todoroo.astrid.voice.AACRecorder; import com.todoroo.astrid.voice.AACRecorder;
@ -99,7 +100,7 @@ public class AACRecordingActivity extends InjectingAppCompatActivity implements
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == PermissionRequestor.REQUEST_MIC) { if (requestCode == PermissionRequestor.REQUEST_MIC) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startRecording(); startRecording();

@ -11,6 +11,7 @@ import android.content.UriMatcher;
import android.database.Cursor; import android.database.Cursor;
import android.database.MatrixCursor; import android.database.MatrixCursor;
import android.net.Uri; import android.net.Uri;
import android.support.annotation.NonNull;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.data.TodorooCursor;
@ -91,17 +92,17 @@ public class Astrid2TaskProvider extends InjectingContentProvider {
} }
@Override @Override
public int delete(Uri uri, String selection, String[] selectionArgs) { public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) {
return 0; return 0;
} }
@Override @Override
public String getType(Uri uri) { public String getType(@NonNull Uri uri) {
return null; return null;
} }
@Override @Override
public Uri insert(Uri uri, ContentValues values) { public Uri insert(@NonNull Uri uri, ContentValues values) {
return null; return null;
} }
@ -202,7 +203,7 @@ public class Astrid2TaskProvider extends InjectingContentProvider {
} }
@Override @Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
Cursor cursor; Cursor cursor;
switch (URI_MATCHER.match(uri)) { switch (URI_MATCHER.match(uri)) {
@ -222,7 +223,7 @@ public class Astrid2TaskProvider extends InjectingContentProvider {
} }
@Override @Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { public int update(@NonNull Uri uri, ContentValues values, String selection, String[] selectionArgs) {
switch (URI_MATCHER.match(uri)) { switch (URI_MATCHER.match(uri)) {
case URI_TASKS: case URI_TASKS:

@ -15,6 +15,7 @@ import android.database.Cursor;
import android.database.SQLException; import android.database.SQLException;
import android.database.sqlite.SQLiteQueryBuilder; import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri; import android.net.Uri;
import android.support.annotation.NonNull;
import android.text.TextUtils; import android.text.TextUtils;
import com.todoroo.andlib.data.AbstractModel; import com.todoroo.andlib.data.AbstractModel;
@ -109,7 +110,7 @@ public class Astrid3ContentProvider extends InjectingContentProvider {
} }
@Override @Override
public String getType(Uri uri) { public String getType(@NonNull Uri uri) {
switch (uriMatcher.match(uri)) { switch (uriMatcher.match(uri)) {
case URI_DIR: case URI_DIR:
case URI_GROUP: case URI_GROUP:
@ -201,7 +202,7 @@ public class Astrid3ContentProvider extends InjectingContentProvider {
* @return number of rows deleted * @return number of rows deleted
*/ */
@Override @Override
public int delete(Uri uri, String selection, String[] selectionArgs) { public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) {
UriHelper<?> helper = generateHelper(uri, false); UriHelper<?> helper = generateHelper(uri, false);
switch (uriMatcher.match(uri)) { switch (uriMatcher.match(uri)) {
@ -242,7 +243,7 @@ public class Astrid3ContentProvider extends InjectingContentProvider {
* Insert key/value pairs into given table * Insert key/value pairs into given table
*/ */
@Override @Override
public Uri insert(Uri uri, ContentValues values) { public Uri insert(@NonNull Uri uri, ContentValues values) {
UriHelper<?> helper = generateHelper(uri, true); UriHelper<?> helper = generateHelper(uri, true);
switch (uriMatcher.match(uri)) { switch (uriMatcher.match(uri)) {
@ -277,8 +278,8 @@ public class Astrid3ContentProvider extends InjectingContentProvider {
* ====================================================================== */ * ====================================================================== */
@Override @Override
public int update(Uri uri, ContentValues values, String selection, public int update(@NonNull Uri uri, ContentValues values, String selection,
String[] selectionArgs) { String[] selectionArgs) {
UriHelper<?> helper = generateHelper(uri, true); UriHelper<?> helper = generateHelper(uri, true);
switch (uriMatcher.match(uri)) { switch (uriMatcher.match(uri)) {
@ -361,8 +362,8 @@ public class Astrid3ContentProvider extends InjectingContentProvider {
* name of a column * name of a column
*/ */
@Override @Override
public Cursor query(Uri uri, String[] projection, String selection, public Cursor query(@NonNull Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) { String[] selectionArgs, String sortOrder) {
String groupBy = null; String groupBy = null;

@ -9,6 +9,7 @@ import android.content.ContentValues;
import android.content.UriMatcher; import android.content.UriMatcher;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.support.annotation.NonNull;
import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.Database; import com.todoroo.astrid.dao.Database;
@ -53,7 +54,7 @@ public class SqlContentProvider extends InjectingContentProvider {
} }
@Override @Override
public String getType(Uri uri) { public String getType(@NonNull Uri uri) {
switch (uriMatcher.match(uri)) { switch (uriMatcher.match(uri)) {
case 0: case 0:
return "vnd.android.cursor.dir/vnd.astrid"; return "vnd.android.cursor.dir/vnd.astrid";
@ -71,7 +72,7 @@ public class SqlContentProvider extends InjectingContentProvider {
* @return number of rows deleted * @return number of rows deleted
*/ */
@Override @Override
public int delete(Uri uri, String selection, String[] selectionArgs) { public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) {
throw new UnsupportedOperationException("unimplemented"); throw new UnsupportedOperationException("unimplemented");
} }
@ -83,7 +84,7 @@ public class SqlContentProvider extends InjectingContentProvider {
* Insert key/value pairs into given table * Insert key/value pairs into given table
*/ */
@Override @Override
public Uri insert(Uri uri, ContentValues values) { public Uri insert(@NonNull Uri uri, ContentValues values) {
throw new UnsupportedOperationException("unimplemented"); throw new UnsupportedOperationException("unimplemented");
} }
@ -92,7 +93,7 @@ public class SqlContentProvider extends InjectingContentProvider {
* ====================================================================== */ * ====================================================================== */
@Override @Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { public int update(@NonNull Uri uri, ContentValues values, String selection, String[] selectionArgs) {
throw new UnsupportedOperationException("unimplemented"); throw new UnsupportedOperationException("unimplemented");
} }
@ -108,8 +109,8 @@ public class SqlContentProvider extends InjectingContentProvider {
* name of a column * name of a column
*/ */
@Override @Override
public Cursor query(Uri uri, String[] projection, String selection, public Cursor query(@NonNull Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) { String[] selectionArgs, String sortOrder) {
return getDatabase().rawQuery(selection); return getDatabase().rawQuery(selection);
} }

@ -14,6 +14,7 @@ import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import org.tasks.R; import org.tasks.R;
import org.tasks.activities.ColorPickerActivity; import org.tasks.activities.ColorPickerActivity;
@ -113,7 +114,7 @@ public class ReminderPreferences extends InjectingPreferenceActivity {
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == PermissionRequestor.REQUEST_CONTACTS) { if (requestCode == PermissionRequestor.REQUEST_CONTACTS) {
for (int grantResult : grantResults) { for (int grantResult : grantResults) {
if (grantResult != PackageManager.PERMISSION_GRANTED) { if (grantResult != PackageManager.PERMISSION_GRANTED) {

@ -8,6 +8,7 @@ package com.todoroo.astrid.tags;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat; import android.support.v4.graphics.drawable.DrawableCompat;
@ -153,9 +154,10 @@ public final class TagsControlSet extends TaskEditControlFragment {
newTagLayout = (LinearLayout) dialogView.findViewById(R.id.newTags); newTagLayout = (LinearLayout) dialogView.findViewById(R.id.newTags);
tagListView = (ListView) dialogView.findViewById(R.id.existingTags); tagListView = (ListView) dialogView.findViewById(R.id.existingTags);
tagListView.setAdapter(new ArrayAdapter<TagData>(getActivity(), R.layout.simple_list_item_multiple_choice_themed, allTags) { tagListView.setAdapter(new ArrayAdapter<TagData>(getActivity(), R.layout.simple_list_item_multiple_choice_themed, allTags) {
@NonNull
@SuppressLint("NewApi") @SuppressLint("NewApi")
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, @NonNull ViewGroup parent) {
CheckedTextView view = (CheckedTextView) super.getView(position, convertView, parent); CheckedTextView view = (CheckedTextView) super.getView(position, convertView, parent);
TagData tagData = allTags.get(position); TagData tagData = allTags.get(position);
ThemeColor themeColor = themeCache.getThemeColor(tagData.getColor() >= 0 ? tagData.getColor() : 19); ThemeColor themeColor = themeCache.getThemeColor(tagData.getColor() >= 0 ? tagData.getColor() : 19);

@ -9,6 +9,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -91,8 +92,9 @@ public class HideUntilControlSet extends TaskEditControlFragment implements OnIt
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState); View view = super.onCreateView(inflater, container, savedInstanceState);
adapter = new HiddenTopArrayAdapter<HideUntilValue>(context, android.R.layout.simple_spinner_item, spinnerItems) { adapter = new HiddenTopArrayAdapter<HideUntilValue>(context, android.R.layout.simple_spinner_item, spinnerItems) {
@NonNull
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, @NonNull ViewGroup parent) {
int selectedItemPosition = position; int selectedItemPosition = position;
if (parent instanceof AdapterView) { if (parent instanceof AdapterView) {
selectedItemPosition = ((AdapterView) parent).getSelectedItemPosition(); selectedItemPosition = ((AdapterView) parent).getSelectedItemPosition();

@ -11,6 +11,7 @@ import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.os.Parcelable; import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -266,7 +267,7 @@ public class ReminderControlSet extends TaskEditControlFragment {
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == PermissionRequestor.REQUEST_LOCATION) { if (requestCode == PermissionRequestor.REQUEST_LOCATION) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
pickLocation(); pickLocation();

@ -1,5 +1,7 @@
package org.tasks; package org.tasks;
import android.support.annotation.NonNull;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.tasks.analytics.Tracker; import org.tasks.analytics.Tracker;
@ -23,7 +25,7 @@ public class ErrorReportingSingleThreadExecutor implements Executor, Thread.Unca
} }
@Override @Override
public void execute(Runnable runnable) { public void execute(@NonNull Runnable runnable) {
try { try {
executorService.execute(runnable); executorService.execute(runnable);
} catch (Exception e) { } catch (Exception e) {

@ -3,6 +3,7 @@ package org.tasks.dialogs;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import org.tasks.R; import org.tasks.R;
import org.tasks.injection.DialogFragmentComponent; import org.tasks.injection.DialogFragmentComponent;
@ -38,6 +39,7 @@ public class AddAttachmentDialog extends InjectingDialogFragment {
private AddAttachmentCallback callback; private AddAttachmentCallback callback;
private DialogInterface.OnCancelListener onCancelListener; private DialogInterface.OnCancelListener onCancelListener;
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
List<String> entries = newArrayList(); List<String> entries = newArrayList();

@ -7,6 +7,7 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat; import android.support.v4.graphics.drawable.DrawableCompat;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -57,6 +58,7 @@ public class ColorPickerDialog extends InjectingDialogFragment {
private ThemePickerCallback callback; private ThemePickerCallback callback;
private ArrayAdapter<String> adapter; private ArrayAdapter<String> adapter;
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
if (savedInstanceState != null) { if (savedInstanceState != null) {
@ -70,9 +72,10 @@ public class ColorPickerDialog extends InjectingDialogFragment {
final LayoutInflater inflater = theme.getLayoutInflater(context); final LayoutInflater inflater = theme.getLayoutInflater(context);
adapter = new ArrayAdapter<String>(context, R.layout.color_selection_row, themes) { adapter = new ArrayAdapter<String>(context, R.layout.color_selection_row, themes) {
@NonNull
@SuppressLint("NewApi") @SuppressLint("NewApi")
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, @NonNull ViewGroup parent) {
TextView textView = (TextView) (convertView == null TextView textView = (TextView) (convertView == null
? inflater.inflate(R.layout.color_selection_row, parent, false) ? inflater.inflate(R.layout.color_selection_row, parent, false)
: convertView); : convertView);

@ -4,6 +4,7 @@ import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
@ -47,6 +48,7 @@ public class SortDialog extends InjectingDialogFragment {
private AlertDialog alertDialog; private AlertDialog alertDialog;
private SortDialogCallback callback; private SortDialogCallback callback;
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

@ -6,6 +6,7 @@ import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.support.annotation.NonNull;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.nononsenseapps.filepicker.FilePickerActivity; import com.nononsenseapps.filepicker.FilePickerActivity;
@ -76,7 +77,7 @@ public class FileExplore extends InjectingAppCompatActivity {
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == PermissionRequestor.REQUEST_FILE_WRITE) { if (requestCode == PermissionRequestor.REQUEST_FILE_WRITE) {
if (grantResults.length > 0) { if (grantResults.length > 0) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {

@ -20,6 +20,7 @@ import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.support.annotation.LayoutRes; import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatDelegate; import android.support.v7.app.AppCompatDelegate;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.View; import android.view.View;
@ -48,6 +49,7 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
getDelegate().onPostCreate(savedInstanceState); getDelegate().onPostCreate(savedInstanceState);
} }
@NonNull
@Override @Override
public MenuInflater getMenuInflater() { public MenuInflater getMenuInflater() {
return getDelegate().getMenuInflater(); return getDelegate().getMenuInflater();

@ -5,6 +5,7 @@ import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeech;
import android.support.annotation.NonNull;
import com.todoroo.astrid.voice.VoiceOutputAssistant; import com.todoroo.astrid.voice.VoiceOutputAssistant;
@ -141,7 +142,7 @@ public class MiscellaneousPreferences extends InjectingPreferenceActivity {
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == PermissionRequestor.REQUEST_CALENDAR) { if (requestCode == PermissionRequestor.REQUEST_CALENDAR) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
calendarReminderPreference.setChecked(true); calendarReminderPreference.setChecked(true);

@ -10,6 +10,7 @@ import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.CalendarContract; import android.provider.CalendarContract;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -284,7 +285,7 @@ public class CalendarControlSet extends TaskEditControlFragment {
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == REQUEST_CODE_OPEN_EVENT) { if (requestCode == REQUEST_CODE_OPEN_EVENT) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
openCalendarEvent(); openCalendarEvent();

@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat; import android.support.v4.graphics.drawable.DrawableCompat;
@ -132,8 +133,9 @@ public class DeadlineControlSet extends TaskEditControlFragment {
} }
final int overdueColor = getColor(context, R.color.overdue); final int overdueColor = getColor(context, R.color.overdue);
dueDateAdapter = new HiddenTopArrayAdapter<String>(context, android.R.layout.simple_spinner_item, dueDateOptions) { dueDateAdapter = new HiddenTopArrayAdapter<String>(context, android.R.layout.simple_spinner_item, dueDateOptions) {
@NonNull
@Override @Override
public View getView(final int position, final View convertView, final ViewGroup parent) { public View getView(final int position, final View convertView, @NonNull final ViewGroup parent) {
int selectedItemPosition = position; int selectedItemPosition = position;
if (parent instanceof AdapterView) { if (parent instanceof AdapterView) {
selectedItemPosition = ((AdapterView) parent).getSelectedItemPosition(); selectedItemPosition = ((AdapterView) parent).getSelectedItemPosition();
@ -157,8 +159,9 @@ public class DeadlineControlSet extends TaskEditControlFragment {
dueDateSpinner.setAdapter(dueDateAdapter); dueDateSpinner.setAdapter(dueDateAdapter);
dueTimeAdapter = new HiddenTopArrayAdapter<String>(context, android.R.layout.simple_spinner_item, dueTimeOptions, dueTimeHint) { dueTimeAdapter = new HiddenTopArrayAdapter<String>(context, android.R.layout.simple_spinner_item, dueTimeOptions, dueTimeHint) {
@NonNull
@Override @Override
public View getView(final int position, final View convertView, final ViewGroup parent) { public View getView(final int position, final View convertView, @NonNull final ViewGroup parent) {
int selectedItemPosition = position; int selectedItemPosition = position;
if (parent instanceof AdapterView) { if (parent instanceof AdapterView) {
selectedItemPosition = ((AdapterView) parent).getSelectedItemPosition(); selectedItemPosition = ((AdapterView) parent).getSelectedItemPosition();

@ -1,6 +1,7 @@
package org.tasks.ui; package org.tasks.ui;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -26,7 +27,7 @@ public class HiddenTopArrayAdapter<T> extends ArrayAdapter<T> {
} }
@Override @Override
public View getDropDownView(final int position, final View convertView, final ViewGroup parent) { public View getDropDownView(final int position, final View convertView, @NonNull final ViewGroup parent) {
View v; View v;
if (position == 0) { if (position == 0) {

Loading…
Cancel
Save