Code analysis - address @NotNull/@Nullable issues.

This commit is contained in:
Alan Evans 2019-05-22 13:51:56 -03:00 committed by GitHub
parent 7db1588578
commit 9445555d66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
113 changed files with 238 additions and 232 deletions

View File

@ -1,6 +1,7 @@
package org.thoughtcrime.securesms;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
@ -41,7 +42,7 @@ public class BasicIntroFragment extends Fragment {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.color_fragment, container, false);

View File

@ -85,19 +85,19 @@ public class BlockedContactsActivity extends PassphraseRequiredActionBarActivity
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
public @NonNull Loader<Cursor> onCreateLoader(int id, Bundle args) {
return new BlockedContactsLoader(getActivity());
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor data) {
if (getListAdapter() != null) {
((CursorAdapter) getListAdapter()).changeCursor(data);
}
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
public void onLoaderReset(@NonNull Loader<Cursor> loader) {
if (getListAdapter() != null) {
((CursorAdapter) getListAdapter()).changeCursor(null);
}

View File

@ -122,7 +122,7 @@ public class ContactSelectionListFragment extends Fragment
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.contact_selection_list_fragment, container, false);
emptyText = ViewUtil.findById(view, android.R.id.empty);
@ -214,14 +214,14 @@ public class ContactSelectionListFragment extends Fragment
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
public @NonNull Loader<Cursor> onCreateLoader(int id, Bundle args) {
return new ContactsCursorLoader(getActivity(),
getActivity().getIntent().getIntExtra(DISPLAY_MODE, DisplayMode.FLAG_ALL),
cursorFilter, getActivity().getIntent().getBooleanExtra(RECENTS, false));
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor data) {
swipeRefresh.setVisibility(View.VISIBLE);
showContactsLayout.setVisibility(View.GONE);
@ -236,7 +236,7 @@ public class ContactSelectionListFragment extends Fragment
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
public void onLoaderReset(@NonNull Loader<Cursor> loader) {
((CursorRecyclerViewAdapter) recyclerView.getAdapter()).changeCursor(null);
fastScroller.setVisibility(View.GONE);
}

View File

@ -352,12 +352,12 @@ public class ConversationListFragment extends Fragment
}
@Override
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
public @NonNull Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
return new ConversationListLoader(getActivity(), queryFilter, archive);
}
@Override
public void onLoadFinished(Loader<Cursor> arg0, Cursor cursor) {
public void onLoadFinished(@NonNull Loader<Cursor> arg0, Cursor cursor) {
if ((cursor == null || cursor.getCount() <= 0) && TextUtils.isEmpty(queryFilter) && !archive) {
list.setVisibility(View.INVISIBLE);
emptyState.setVisibility(View.VISIBLE);
@ -380,7 +380,7 @@ public class ConversationListFragment extends Fragment
}
@Override
public void onLoaderReset(Loader<Cursor> arg0) {
public void onLoaderReset(@NonNull Loader<Cursor> arg0) {
getListAdapter().changeCursor(null);
}
@ -481,15 +481,15 @@ public class ConversationListFragment extends Fragment
}
@Override
public boolean onMove(RecyclerView recyclerView,
RecyclerView.ViewHolder viewHolder,
RecyclerView.ViewHolder target)
public boolean onMove(@NonNull RecyclerView recyclerView,
@NonNull RecyclerView.ViewHolder viewHolder,
@NonNull RecyclerView.ViewHolder target)
{
return false;
}
@Override
public int getSwipeDirs(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
public int getSwipeDirs(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
if (viewHolder.itemView instanceof ConversationListItemAction) {
return 0;
}
@ -503,7 +503,7 @@ public class ConversationListFragment extends Fragment
@SuppressLint("StaticFieldLeak")
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
if (viewHolder.itemView instanceof ConversationListItemInboxZero) return;
final long threadId = ((ConversationListItem)viewHolder.itemView).getThreadId();
final int unreadCount = ((ConversationListItem)viewHolder.itemView).getUnreadCount();
@ -557,8 +557,8 @@ public class ConversationListFragment extends Fragment
}
@Override
public void onChildDraw(Canvas c, RecyclerView recyclerView,
RecyclerView.ViewHolder viewHolder,
public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView,
@NonNull RecyclerView.ViewHolder viewHolder,
float dX, float dY, int actionState,
boolean isCurrentlyActive)
{

View File

@ -2,6 +2,7 @@ package org.thoughtcrime.securesms;
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ListFragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
@ -54,12 +55,12 @@ public class CountrySelectionFragment extends ListFragment implements LoaderMana
}
@Override
public Loader<ArrayList<Map<String, String>>> onCreateLoader(int arg0, Bundle arg1) {
public @NonNull Loader<ArrayList<Map<String, String>>> onCreateLoader(int arg0, Bundle arg1) {
return new CountryListLoader(getActivity());
}
@Override
public void onLoadFinished(Loader<ArrayList<Map<String, String>>> loader,
public void onLoadFinished(@NonNull Loader<ArrayList<Map<String, String>>> loader,
ArrayList<Map<String, String>> results)
{
String[] from = {"country_name", "country_code"};
@ -72,7 +73,7 @@ public class CountrySelectionFragment extends ListFragment implements LoaderMana
}
@Override
public void onLoaderReset(Loader<ArrayList<Map<String, String>>> arg0) {
public void onLoaderReset(@NonNull Loader<ArrayList<Map<String, String>>> arg0) {
this.setListAdapter(null);
}

View File

@ -5,6 +5,7 @@ import android.annotation.TargetApi;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
@ -29,7 +30,7 @@ public class DeviceAddFragment extends Fragment {
private ScanListener scanListener;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
this.container = ViewUtil.inflate(inflater, viewGroup, R.layout.device_add_fragment);
this.overlay = ViewUtil.findById(this.container, R.id.overlay);
this.scannerView = ViewUtil.findById(this.container, R.id.scanner);

View File

@ -5,6 +5,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ListFragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
@ -89,7 +90,7 @@ public class DeviceListFragment extends ListFragment
}
@Override
public Loader<List<Device>> onCreateLoader(int id, Bundle args) {
public @NonNull Loader<List<Device>> onCreateLoader(int id, Bundle args) {
empty.setVisibility(View.GONE);
progressContainer.setVisibility(View.VISIBLE);
@ -97,7 +98,7 @@ public class DeviceListFragment extends ListFragment
}
@Override
public void onLoadFinished(Loader<List<Device>> loader, List<Device> data) {
public void onLoadFinished(@NonNull Loader<List<Device>> loader, List<Device> data) {
progressContainer.setVisibility(View.GONE);
if (data == null) {
@ -116,7 +117,7 @@ public class DeviceListFragment extends ListFragment
}
@Override
public void onLoaderReset(Loader<List<Device>> loader) {
public void onLoaderReset(@NonNull Loader<List<Device>> loader) {
setListAdapter(null);
}
@ -210,7 +211,7 @@ public class DeviceListFragment extends ListFragment
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
public @NonNull View getView(int position, View convertView, @NonNull ViewGroup parent) {
if (convertView == null) {
convertView = ((Activity)getContext()).getLayoutInflater().inflate(resource, parent, false);
}

View File

@ -3,6 +3,7 @@ package org.thoughtcrime.securesms;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
@ -41,7 +42,7 @@ public class LinkPreviewsIntroFragment extends Fragment {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.experience_upgrade_link_previews_fragment, container, false);
view.findViewById(R.id.experience_ok_button).setOnClickListener(v -> {

View File

@ -257,12 +257,12 @@ public class MediaOverviewActivity extends PassphraseRequiredActionBarActivity {
}
@Override
public Loader<BucketedThreadMedia> onCreateLoader(int i, Bundle bundle) {
public @NonNull Loader<BucketedThreadMedia> onCreateLoader(int i, Bundle bundle) {
return new BucketedThreadMediaLoader(getContext(), recipient.getAddress());
}
@Override
public void onLoadFinished(Loader<BucketedThreadMedia> loader, BucketedThreadMedia bucketedThreadMedia) {
public void onLoadFinished(@NonNull Loader<BucketedThreadMedia> loader, BucketedThreadMedia bucketedThreadMedia) {
((MediaGalleryAdapter) recyclerView.getAdapter()).setMedia(bucketedThreadMedia);
((MediaGalleryAdapter) recyclerView.getAdapter()).notifyAllSectionsDataSetChanged();
@ -271,7 +271,7 @@ public class MediaOverviewActivity extends PassphraseRequiredActionBarActivity {
}
@Override
public void onLoaderReset(Loader<BucketedThreadMedia> cursorLoader) {
public void onLoaderReset(@NonNull Loader<BucketedThreadMedia> cursorLoader) {
((MediaGalleryAdapter) recyclerView.getAdapter()).setMedia(new BucketedThreadMedia(getContext()));
}
@ -496,12 +496,12 @@ public class MediaOverviewActivity extends PassphraseRequiredActionBarActivity {
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
public @NonNull Loader<Cursor> onCreateLoader(int id, Bundle args) {
return new ThreadMediaLoader(getContext(), recipient.getAddress(), false);
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor data) {
((CursorRecyclerViewAdapter)this.recyclerView.getAdapter()).changeCursor(data);
getActivity().invalidateOptionsMenu();
@ -509,7 +509,7 @@ public class MediaOverviewActivity extends PassphraseRequiredActionBarActivity {
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
public void onLoaderReset(@NonNull Loader<Cursor> loader) {
((CursorRecyclerViewAdapter)this.recyclerView.getAdapter()).changeCursor(null);
getActivity().invalidateOptionsMenu();
}

View File

@ -441,12 +441,12 @@ public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity im
}
@Override
public Loader<Pair<Cursor, Integer>> onCreateLoader(int id, Bundle args) {
public @NonNull Loader<Pair<Cursor, Integer>> onCreateLoader(int id, Bundle args) {
return new PagingMediaLoader(this, conversationRecipient, initialMediaUri, leftIsRecent);
}
@Override
public void onLoadFinished(Loader<Pair<Cursor, Integer>> loader, @Nullable Pair<Cursor, Integer> data) {
public void onLoadFinished(@NonNull Loader<Pair<Cursor, Integer>> loader, @Nullable Pair<Cursor, Integer> data) {
if (data != null) {
@SuppressWarnings("ConstantConditions")
CursorPagerAdapter adapter = new CursorPagerAdapter(this, GlideApp.with(this), getWindow(), data.first, data.second, leftIsRecent);
@ -465,7 +465,7 @@ public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity im
}
@Override
public void onLoaderReset(Loader<Pair<Cursor, Integer>> loader) {
public void onLoaderReset(@NonNull Loader<Pair<Cursor, Integer>> loader) {
}

View File

@ -22,6 +22,7 @@ import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
@ -31,12 +32,12 @@ import com.google.android.gms.common.GooglePlayServicesUtil;
public class PlayServicesProblemFragment extends DialogFragment {
@Override
public @NonNull Dialog onCreateDialog(@NonNull Bundle bundle) {
public @NonNull Dialog onCreateDialog(@Nullable Bundle bundle) {
int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getActivity());
Dialog dialog = GoogleApiAvailability.getInstance().getErrorDialog(getActivity(), code, 9111);
if (dialog == null) {
return new AlertDialog.Builder(getActivity())
return new AlertDialog.Builder(requireActivity())
.setNegativeButton(android.R.string.ok, null)
.setMessage(R.string.PlayServicesProblemFragment_the_version_of_google_play_services_you_have_installed_is_not_functioning)
.create();

View File

@ -2,6 +2,7 @@ package org.thoughtcrime.securesms;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v7.widget.SwitchCompat;
import android.view.LayoutInflater;
@ -29,7 +30,7 @@ public class ReadReceiptsIntroFragment extends Fragment {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.experience_upgrade_preference_fragment, container, false);
SwitchCompat preference = ViewUtil.findById(v, R.id.preference);

View File

@ -231,12 +231,12 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
public @NonNull Loader<Cursor> onCreateLoader(int id, Bundle args) {
return new ThreadMediaLoader(this, address, true);
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor data) {
if (data != null && data.getCount() > 0) {
this.threadPhotoRailLabel.setVisibility(View.VISIBLE);
this.threadPhotoRailView.setVisibility(View.VISIBLE);
@ -253,7 +253,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
public void onLoaderReset(@NonNull Loader<Cursor> loader) {
this.threadPhotoRailView.setCursor(glideRequests, null);
}

View File

@ -3,6 +3,7 @@ package org.thoughtcrime.securesms;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
@ -42,7 +43,7 @@ public class TypingIndicatorIntroFragment extends Fragment {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.experience_upgrade_typing_indicators_fragment, container, false);
View yesButton = view.findViewById(R.id.experience_yes_button);
View noButton = view.findViewById(R.id.experience_no_button);

View File

@ -230,7 +230,7 @@ public class VerifyIdentityActivity extends PassphraseRequiredActionBarActivity
private boolean animateFailureOnDraw = false;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
this.container = ViewUtil.inflate(inflater, viewGroup, R.layout.verify_display_fragment);
this.numbersContainer = ViewUtil.findById(container, R.id.number_table);
this.qrCode = ViewUtil.findById(container, R.id.qr_code);
@ -623,7 +623,7 @@ public class VerifyIdentityActivity extends PassphraseRequiredActionBarActivity
private ScanningThread scanningThread;
private ScanListener scanListener;
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
this.container = ViewUtil.inflate(inflater, viewGroup, R.layout.verify_scan_fragment);
this.cameraView = ViewUtil.findById(container, R.id.scanner);

View File

@ -1,5 +1,7 @@
package org.thoughtcrime.securesms.attachments;
import android.support.annotation.NonNull;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.thoughtcrime.securesms.util.Util;
@ -29,7 +31,7 @@ public class AttachmentId {
return new String[] {String.valueOf(rowId), String.valueOf(uniqueId)};
}
public String toString() {
public @NonNull String toString() {
return "(row id: " + rowId + ", unique ID: " + uniqueId + ")";
}

View File

@ -140,7 +140,7 @@ public class CustomDefaultPreference extends DialogPreference {
@Override
public Dialog onCreateDialog(Bundle instanceState) {
public @NonNull Dialog onCreateDialog(Bundle instanceState) {
Dialog dialog = super.onCreateDialog(instanceState);
CustomDefaultPreference preference = (CustomDefaultPreference)getPreference();

View File

@ -64,17 +64,17 @@ public class RecentPhotoViewRail extends FrameLayout implements LoaderManager.Lo
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
public @NonNull Loader<Cursor> onCreateLoader(int id, Bundle args) {
return new RecentPhotosLoader(getContext());
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor data) {
this.recyclerView.setAdapter(new RecentPhotoAdapter(getContext(), data, RecentPhotosLoader.BASE_URL, listener));
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
public void onLoaderReset(@NonNull Loader<Cursor> loader) {
((CursorRecyclerViewAdapter)this.recyclerView.getAdapter()).changeCursor(null);
}

View File

@ -52,7 +52,7 @@ public class RecyclerViewFastScroller extends LinearLayout {
private final RecyclerView.OnScrollListener onScrollListener = new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(final RecyclerView recyclerView, final int dx, final int dy) {
public void onScrolled(@NonNull final RecyclerView recyclerView, final int dx, final int dy) {
if (handle.isSelected()) return;
final int offset = recyclerView.computeVerticalScrollOffset();
final int range = recyclerView.computeVerticalScrollRange();

View File

@ -165,19 +165,19 @@ public class EmojiDrawer extends LinearLayout implements InputView, EmojiSelecti
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
container.removeView((View)object);
}
@Override
public void setPrimaryItem(ViewGroup container, int position, Object object) {
public void setPrimaryItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
EmojiPageView current = (EmojiPageView) object;
current.onSelected();
super.setPrimaryItem(container, position, object);
}
@Override
public boolean isViewFromObject(View view, Object object) {
public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
return view == object;
}

View File

@ -25,7 +25,7 @@ public class EmojiSpan extends AnimatingImageSpan {
}
@Override
public int getSize(Paint paint, CharSequence text, int start, int end, FontMetricsInt fm) {
public int getSize(@NonNull Paint paint, CharSequence text, int start, int end, FontMetricsInt fm) {
if (fm != null && this.fm != null) {
fm.ascent = this.fm.ascent;
fm.descent = this.fm.descent;
@ -39,7 +39,7 @@ public class EmojiSpan extends AnimatingImageSpan {
}
@Override
public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) {
public void draw(@NonNull Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, @NonNull Paint paint) {
int height = bottom - top;
int centeringMargin = (height - size) / 2;
int adjustedMargin = (int) (centeringMargin * SHIFT_FACTOR);

View File

@ -22,7 +22,7 @@ public class EmojiDrawInfo {
}
@Override
public String toString() {
public @NonNull String toString() {
return "DrawInfo{" +
"page=" + page +
", index=" + index +

View File

@ -104,7 +104,7 @@ public class EmojiPageBitmap {
}
@Override
public String toString() {
public @NonNull String toString() {
return model.getSprite();
}
}

View File

@ -124,7 +124,7 @@ public class EmojiParser {
}
@Override
public Iterator<Candidate> iterator() {
public @NonNull Iterator<Candidate> iterator() {
return list.iterator();
}
}

View File

@ -50,7 +50,7 @@ public class GroupRecordContactPhoto implements ContactPhoto {
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
messageDigest.update(address.serialize().getBytes());
messageDigest.update(Conversions.longToByteArray(avatarId));
}

View File

@ -40,7 +40,7 @@ public class ProfileContactPhoto implements ContactPhoto {
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
messageDigest.update(address.serialize().getBytes());
messageDigest.update(avatarObject.getBytes());
}

View File

@ -30,9 +30,8 @@ public class SystemContactPhoto implements ContactPhoto {
return context.getContentResolver().openInputStream(contactPhotoUri);
}
@Nullable
@Override
public Uri getUri(@NonNull Context context) {
public @Nullable Uri getUri(@NonNull Context context) {
return contactPhotoUri;
}
@ -42,7 +41,7 @@ public class SystemContactPhoto implements ContactPhoto {
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
messageDigest.update(address.serialize().getBytes());
messageDigest.update(contactPhotoUri.toString().getBytes());
messageDigest.update(Conversions.longToByteArray(lastModifiedTime));

View File

@ -540,7 +540,7 @@ public class Contact implements Parcelable {
};
@Override
public String toString() {
public @NonNull String toString() {
StringBuilder builder = new StringBuilder();
if (!TextUtils.isEmpty(street)) {

View File

@ -39,17 +39,17 @@ class ContactFieldAdapter extends RecyclerView.Adapter<ContactFieldAdapter.Conta
}
@Override
public ContactFieldViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
public @NonNull ContactFieldViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ContactFieldViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_selectable_contact_field, parent, false));
}
@Override
public void onBindViewHolder(ContactFieldViewHolder holder, int position) {
public void onBindViewHolder(@NonNull ContactFieldViewHolder holder, int position) {
holder.bind(fields.get(position), glideRequests, selectable);
}
@Override
public void onViewRecycled(ContactFieldViewHolder holder) {
public void onViewRecycled(@NonNull ContactFieldViewHolder holder) {
holder.recycle();
}

View File

@ -37,14 +37,14 @@ public class ContactShareEditAdapter extends RecyclerView.Adapter<ContactShareEd
}
@Override
public ContactEditViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
public @NonNull ContactEditViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ContactEditViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_editable_contact, parent, false),
locale,
glideRequests);
}
@Override
public void onBindViewHolder(ContactEditViewHolder holder, int position) {
public void onBindViewHolder(@NonNull ContactEditViewHolder holder, int position) {
holder.bind(position, contacts.get(position), eventListener);
}

View File

@ -615,7 +615,7 @@ public class ConversationFragment extends Fragment
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
public @NonNull Loader<Cursor> onCreateLoader(int id, Bundle args) {
Log.i(TAG, "onCreateLoader");
loaderStartTime = System.currentTimeMillis();
@ -630,7 +630,7 @@ public class ConversationFragment extends Fragment
}
@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
public void onLoadFinished(@NonNull Loader<Cursor> cursorLoader, Cursor cursor) {
long loadTime = System.currentTimeMillis() - loaderStartTime;
int count = cursor.getCount();
Log.i(TAG, "onLoadFinished - took " + loadTime + " ms to load a cursor of size " + count);
@ -705,7 +705,7 @@ public class ConversationFragment extends Fragment
}
@Override
public void onLoaderReset(Loader<Cursor> arg0) {
public void onLoaderReset(@NonNull Loader<Cursor> arg0) {
if (list.getAdapter() != null) {
getListAdapter().changeCursor(null);
}
@ -828,7 +828,7 @@ public class ConversationFragment extends Fragment
}
@Override
public void onScrolled(final RecyclerView rv, final int dx, final int dy) {
public void onScrolled(@NonNull final RecyclerView rv, final int dx, final int dy) {
boolean currentlyAtBottom = isAtBottom();
boolean currentlyAtZoomScrollHeight = isAtZoomScrollHeight();
int positionId = getHeaderPositionId();
@ -854,7 +854,7 @@ public class ConversationFragment extends Fragment
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
conversationDateHeader.show();
} else if (newState == RecyclerView.SCROLL_STATE_IDLE) {

View File

@ -149,12 +149,12 @@ public class ConversationItem extends LinearLayout
private ViewGroup container;
private @NonNull Set<MessageRecord> batchSelected = new HashSet<>();
private @NonNull Recipient conversationRecipient;
private @NonNull Stub<ConversationItemThumbnail> mediaThumbnailStub;
private @NonNull Stub<AudioView> audioViewStub;
private @NonNull Stub<DocumentView> documentViewStub;
private @NonNull Stub<SharedContactView> sharedContactStub;
private @NonNull Stub<LinkPreviewView> linkPreviewStub;
private Recipient conversationRecipient;
private Stub<ConversationItemThumbnail> mediaThumbnailStub;
private Stub<AudioView> audioViewStub;
private Stub<DocumentView> documentViewStub;
private Stub<SharedContactView> sharedContactStub;
private Stub<LinkPreviewView> linkPreviewStub;
private @Nullable EventListener eventListener;
private int defaultBubbleColor;

View File

@ -145,7 +145,7 @@ public class Address implements Parcelable, Comparable<Address> {
}
@Override
public String toString() {
public @NonNull String toString() {
return address;
}

View File

@ -5,6 +5,7 @@ import android.database.Cursor;
import android.database.DataSetObserver;
import android.database.MatrixCursor;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.io.Closeable;
import java.util.Collection;
@ -58,9 +59,8 @@ public class CursorList<T> implements List<T>, Closeable {
throw new UnsupportedOperationException();
}
@NonNull
@Override
public Iterator<T> iterator() {
public @NonNull Iterator<T> iterator() {
return new Iterator<T>() {
int index = 0;
@ -77,9 +77,8 @@ public class CursorList<T> implements List<T>, Closeable {
};
}
@NonNull
@Override
public Object[] toArray() {
public @NonNull Object[] toArray() {
Object[] out = new Object[size()];
for (int i = 0; i < cursor.getCount(); i++) {
cursor.moveToPosition(i);
@ -145,19 +144,17 @@ public class CursorList<T> implements List<T>, Closeable {
}
@Override
public ListIterator<T> listIterator() {
public @NonNull ListIterator<T> listIterator() {
throw new UnsupportedOperationException();
}
@NonNull
@Override
public ListIterator<T> listIterator(int i) {
public @NonNull ListIterator<T> listIterator(int i) {
throw new UnsupportedOperationException();
}
@NonNull
@Override
public List<T> subList(int i, int i1) {
public @NonNull List<T> subList(int i, int i1) {
throw new UnsupportedOperationException();
}
@ -176,9 +173,8 @@ public class CursorList<T> implements List<T>, Closeable {
throw new UnsupportedOperationException();
}
@NonNull
@Override
public T[] toArray(@NonNull Object[] objects) {
public @NonNull T[] toArray(@Nullable Object[] objects) {
throw new UnsupportedOperationException();
}

View File

@ -130,7 +130,7 @@ public abstract class CursorRecyclerViewAdapter<VH extends RecyclerView.ViewHold
@SuppressWarnings("unchecked")
@Override
public final void onViewRecycled(ViewHolder holder) {
public final void onViewRecycled(@NonNull ViewHolder holder) {
if (!(holder instanceof HeaderFooterViewHolder)) {
onItemViewRecycled((VH)holder);
}
@ -139,7 +139,7 @@ public abstract class CursorRecyclerViewAdapter<VH extends RecyclerView.ViewHold
public void onItemViewRecycled(VH holder) {}
@Override
public final ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
public @NonNull final ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
switch (viewType) {
case HEADER_TYPE: return new HeaderFooterViewHolder(header);
case FOOTER_TYPE: return new HeaderFooterViewHolder(footer);
@ -151,7 +151,7 @@ public abstract class CursorRecyclerViewAdapter<VH extends RecyclerView.ViewHold
@SuppressWarnings("unchecked")
@Override
public final void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
public final void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
if (!isHeaderPosition(position) && !isFooterPosition(position)) {
if (isFastAccessPosition(position)) onBindFastAccessItemViewHolder((VH)viewHolder, position);
else onBindItemViewHolder((VH)viewHolder, getCursorAtPositionOrThrow(position));

View File

@ -210,7 +210,7 @@ public class IdentityDatabase extends Database {
}
@Override
public String toString() {
public @NonNull String toString() {
return "{address: " + address + ", identityKey: " + identitykey + ", verifiedStatus: " + verifiedStatus + ", firstUse: " + firstUse + "}";
}

View File

@ -117,7 +117,7 @@ public class WebRtcViewModel {
return remoteRenderer;
}
public String toString() {
public @NonNull String toString() {
return "[State: " + state + ", recipient: " + recipient.getAddress() + ", identity: " + identityKey + ", remoteVideo: " + remoteVideoEnabled + ", localVideo: " + localCameraState.isEnabled() + "]";
}
}

View File

@ -34,7 +34,7 @@ public class ChunkedImageUrl implements Key {
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
messageDigest.update(url.getBytes());
messageDigest.update(Conversions.longToByteArray(size));
}

View File

@ -132,7 +132,7 @@ class GiphyAdapter extends RecyclerView.Adapter<GiphyAdapter.GiphyViewHolder> {
}
@Override
public GiphyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
public @NonNull GiphyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.giphy_thumbnail, parent, false);
@ -140,7 +140,7 @@ class GiphyAdapter extends RecyclerView.Adapter<GiphyAdapter.GiphyViewHolder> {
}
@Override
public void onBindViewHolder(GiphyViewHolder holder, int position) {
public void onBindViewHolder(@NonNull GiphyViewHolder holder, int position) {
GiphyImage image = images.get(position);
holder.modelReady = false;
@ -173,7 +173,7 @@ class GiphyAdapter extends RecyclerView.Adapter<GiphyAdapter.GiphyViewHolder> {
}
@Override
public void onViewRecycled(GiphyViewHolder holder) {
public void onViewRecycled(@NonNull GiphyViewHolder holder) {
super.onViewRecycled(holder);
glideRequests.clear(holder.thumbnail);
}

View File

@ -41,7 +41,7 @@ public abstract class GiphyFragment extends Fragment implements LoaderManager.Lo
protected String searchString;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
ViewGroup container = ViewUtil.inflate(inflater, viewGroup, R.layout.giphy_fragment);
this.recyclerView = ViewUtil.findById(container, R.id.giphy_list);
this.loadingProgress = ViewUtil.findById(container, R.id.loading_progress);
@ -66,7 +66,7 @@ public abstract class GiphyFragment extends Fragment implements LoaderManager.Lo
}
@Override
public void onLoadFinished(Loader<List<GiphyImage>> loader, @NonNull List<GiphyImage> data) {
public void onLoadFinished(@NonNull Loader<List<GiphyImage>> loader, @NonNull List<GiphyImage> data) {
this.loadingProgress.setVisibility(View.GONE);
if (data.isEmpty()) noResultsView.setVisibility(View.VISIBLE);
@ -76,7 +76,7 @@ public abstract class GiphyFragment extends Fragment implements LoaderManager.Lo
}
@Override
public void onLoaderReset(Loader<List<GiphyImage>> loader) {
public void onLoaderReset(@NonNull Loader<List<GiphyImage>> loader) {
noResultsView.setVisibility(View.GONE);
this.giphyAdapter.setImages(new LinkedList<GiphyImage>());
}

View File

@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.giph.ui;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.Loader;
import org.thoughtcrime.securesms.giph.model.GiphyImage;
@ -12,7 +13,7 @@ import java.util.List;
public class GiphyGifFragment extends GiphyFragment {
@Override
public Loader<List<GiphyImage>> onCreateLoader(int id, Bundle args) {
public @NonNull Loader<List<GiphyImage>> onCreateLoader(int id, Bundle args) {
return new GiphyGifLoader(getActivity(), searchString);
}

View File

@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.giph.ui;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.Loader;
import org.thoughtcrime.securesms.giph.model.GiphyImage;
@ -11,7 +12,7 @@ import java.util.List;
public class GiphyStickerFragment extends GiphyFragment {
@Override
public Loader<List<GiphyImage>> onCreateLoader(int id, Bundle args) {
public @NonNull Loader<List<GiphyImage>> onCreateLoader(int id, Bundle args) {
return new GiphyStickerLoader(getActivity(), searchString);
}
}

View File

@ -2,6 +2,7 @@
package org.thoughtcrime.securesms.giph.util;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
public abstract class InfiniteScrollListener extends RecyclerView.OnScrollListener {
@ -17,7 +18,7 @@ public abstract class InfiniteScrollListener extends RecyclerView.OnScrollListen
private int currentPage = 1;
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
RecyclerViewPositionHelper recyclerViewPositionHelper = RecyclerViewPositionHelper.createHelper(recyclerView);

View File

@ -1,5 +1,6 @@
package org.thoughtcrime.securesms.glide;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.bumptech.glide.load.Options;
@ -23,14 +24,13 @@ public class ChunkedImageUrlLoader implements ModelLoader<ChunkedImageUrl, Input
this.client = client;
}
@Nullable
@Override
public LoadData<InputStream> buildLoadData(ChunkedImageUrl url, int width, int height, Options options) {
public @Nullable LoadData<InputStream> buildLoadData(@NonNull ChunkedImageUrl url, int width, int height, @NonNull Options options) {
return new LoadData<>(url, new ChunkedImageUrlFetcher(client, url));
}
@Override
public boolean handles(ChunkedImageUrl url) {
public boolean handles(@NonNull ChunkedImageUrl url) {
return true;
}
@ -48,7 +48,7 @@ public class ChunkedImageUrlLoader implements ModelLoader<ChunkedImageUrl, Input
}
@Override
public ModelLoader<ChunkedImageUrl, InputStream> build(MultiModelLoaderFactory multiFactory) {
public @NonNull ModelLoader<ChunkedImageUrl, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) {
return new ChunkedImageUrlLoader(client);
}

View File

@ -26,7 +26,7 @@ class ContactPhotoFetcher implements DataFetcher<InputStream> {
}
@Override
public void loadData(Priority priority, DataCallback<? super InputStream> callback) {
public void loadData(@NonNull Priority priority, @NonNull DataCallback<? super InputStream> callback) {
try {
inputStream = contactPhoto.openInputStream(context);
callback.onDataReady(inputStream);
@ -47,15 +47,13 @@ class ContactPhotoFetcher implements DataFetcher<InputStream> {
}
@NonNull
@Override
public Class<InputStream> getDataClass() {
public @NonNull Class<InputStream> getDataClass() {
return InputStream.class;
}
@NonNull
@Override
public DataSource getDataSource() {
public @NonNull DataSource getDataSource() {
return DataSource.LOCAL;
}
}

View File

@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.glide;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.bumptech.glide.load.Options;
@ -20,14 +21,13 @@ public class ContactPhotoLoader implements ModelLoader<ContactPhoto, InputStream
this.context = context;
}
@Nullable
@Override
public LoadData<InputStream> buildLoadData(ContactPhoto contactPhoto, int width, int height, Options options) {
public @Nullable LoadData<InputStream> buildLoadData(@NonNull ContactPhoto contactPhoto, int width, int height, @NonNull Options options) {
return new LoadData<>(contactPhoto, new ContactPhotoFetcher(context, contactPhoto));
}
@Override
public boolean handles(ContactPhoto contactPhoto) {
public boolean handles(@NonNull ContactPhoto contactPhoto) {
return true;
}
@ -40,7 +40,7 @@ public class ContactPhotoLoader implements ModelLoader<ContactPhoto, InputStream
}
@Override
public ModelLoader<ContactPhoto, InputStream> build(MultiModelLoaderFactory multiFactory) {
public @NonNull ModelLoader<ContactPhoto, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) {
return new ContactPhotoLoader(context);
}

View File

@ -35,7 +35,7 @@ class OkHttpStreamFetcher implements DataFetcher<InputStream> {
}
@Override
public void loadData(Priority priority, DataCallback<? super InputStream> callback) {
public void loadData(@NonNull Priority priority, @NonNull DataCallback<? super InputStream> callback) {
try {
Request.Builder requestBuilder = new Request.Builder()
.url(url.toStringUrl());
@ -82,15 +82,13 @@ class OkHttpStreamFetcher implements DataFetcher<InputStream> {
// TODO: call cancel on the client when this method is called on a background thread. See #257
}
@NonNull
@Override
public Class<InputStream> getDataClass() {
public @NonNull Class<InputStream> getDataClass() {
return InputStream.class;
}
@NonNull
@Override
public DataSource getDataSource() {
public @NonNull DataSource getDataSource() {
return DataSource.REMOTE;
}
}

View File

@ -1,5 +1,6 @@
package org.thoughtcrime.securesms.glide;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.bumptech.glide.load.Options;
@ -25,14 +26,13 @@ public class OkHttpUrlLoader implements ModelLoader<GlideUrl, InputStream> {
this.client = client;
}
@Nullable
@Override
public LoadData<InputStream> buildLoadData(GlideUrl glideUrl, int width, int height, Options options) {
public @Nullable LoadData<InputStream> buildLoadData(@NonNull GlideUrl glideUrl, int width, int height, @NonNull Options options) {
return new LoadData<>(glideUrl, new OkHttpStreamFetcher(client, glideUrl));
}
@Override
public boolean handles(GlideUrl glideUrl) {
public boolean handles(@NonNull GlideUrl glideUrl) {
return true;
}
@ -62,7 +62,7 @@ public class OkHttpUrlLoader implements ModelLoader<GlideUrl, InputStream> {
}
@Override
public ModelLoader<GlideUrl, InputStream> build(MultiModelLoaderFactory multiFactory) {
public @NonNull ModelLoader<GlideUrl, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) {
return new OkHttpUrlLoader(client);
}

View File

@ -20,7 +20,7 @@ public class PaddedHeadersInterceptor implements Interceptor {
private static final int MAX_RANDOM_BYTES = 64;
@Override
public Response intercept(@NonNull Chain chain) throws IOException {
public @NonNull Response intercept(@NonNull Chain chain) throws IOException {
Request padded = chain.request().newBuilder()
.headers(getPaddedHeaders(chain.request().headers()))
.build();

View File

@ -34,12 +34,12 @@ class DrawingSession extends ElementEditSession {
}
@Override
public EditSession newPoint(Matrix newInverse, PointF point, int p) {
public EditSession newPoint(@NonNull Matrix newInverse, @NonNull PointF point, int p) {
return this;
}
@Override
public EditSession removePoint(Matrix newInverse, int p) {
public EditSession removePoint(@NonNull Matrix newInverse, int p) {
return this;
}
}

View File

@ -31,7 +31,7 @@ final class ElementDragEditSession extends ElementEditSession {
}
@Override
public EditSession newPoint(@NonNull Matrix newInverse, PointF point, int p) {
public EditSession newPoint(@NonNull Matrix newInverse, @NonNull PointF point, int p) {
return ElementScaleEditSession.startScale(this, newInverse, point, p);
}

View File

@ -145,7 +145,7 @@ public class AttachmentDownloadJob extends BaseJob implements InjectableType {
}
@Override
protected boolean onShouldRetry(Exception exception) {
protected boolean onShouldRetry(@NonNull Exception exception) {
return (exception instanceof PushNetworkException);
}

View File

@ -95,7 +95,7 @@ public class AttachmentUploadJob extends BaseJob implements InjectableType {
public void onCanceled() { }
@Override
protected boolean onShouldRetry(Exception exception) {
protected boolean onShouldRetry(@NonNull Exception exception) {
return exception instanceof PushNetworkException ||
exception instanceof SSLException ||
exception instanceof ConnectException;

View File

@ -111,7 +111,7 @@ public class AvatarDownloadJob extends BaseJob implements InjectableType {
public void onCanceled() {}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
if (exception instanceof IOException) return true;
return false;
}

View File

@ -97,7 +97,7 @@ public class CleanPreKeysJob extends BaseJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception throwable) {
public boolean onShouldRetry(@NonNull Exception throwable) {
if (throwable instanceof NonSuccessfulResponseCodeException) return false;
if (throwable instanceof PushNetworkException) return true;
return false;

View File

@ -74,7 +74,7 @@ public class CreateSignedPreKeyJob extends BaseJob implements InjectableType {
public void onCanceled() {}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
if (exception instanceof PushNetworkException) return true;
return false;
}

View File

@ -75,7 +75,7 @@ public class DirectoryRefreshJob extends BaseJob {
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
if (exception instanceof PushNetworkException) return true;
return false;
}

View File

@ -119,7 +119,7 @@ public class FcmRefreshJob extends BaseJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception throwable) {
public boolean onShouldRetry(@NonNull Exception throwable) {
if (throwable instanceof NonSuccessfulResponseCodeException) return false;
return true;
}

View File

@ -102,7 +102,7 @@ public class LocalBackupJob extends BaseJob {
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
return false;
}

View File

@ -183,7 +183,7 @@ public class MmsDownloadJob extends BaseJob {
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
return false;
}

View File

@ -95,7 +95,7 @@ public class MmsReceiveJob extends BaseJob {
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
return false;
}

View File

@ -121,7 +121,7 @@ public class MmsSendJob extends SendJob {
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
return false;
}

View File

@ -90,7 +90,7 @@ public class MultiDeviceBlockedUpdateJob extends BaseJob implements InjectableTy
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
if (exception instanceof PushNetworkException) return true;
return false;
}

View File

@ -99,7 +99,7 @@ public class MultiDeviceConfigurationUpdateJob extends BaseJob implements Inject
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
return e instanceof PushNetworkException;
}

View File

@ -217,7 +217,7 @@ public class MultiDeviceContactUpdateJob extends BaseJob implements InjectableTy
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
if (exception instanceof PushNetworkException) return true;
return false;
}

View File

@ -119,7 +119,7 @@ public class MultiDeviceGroupUpdateJob extends BaseJob implements InjectableType
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
if (exception instanceof PushNetworkException) return true;
return false;
}

View File

@ -93,7 +93,7 @@ public class MultiDeviceProfileKeyUpdateJob extends BaseJob implements Injectabl
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
if (exception instanceof PushNetworkException) return true;
return false;
}

View File

@ -98,7 +98,7 @@ public class MultiDeviceReadUpdateJob extends BaseJob implements InjectableType
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
return exception instanceof PushNetworkException;
}

View File

@ -125,7 +125,7 @@ public class MultiDeviceVerifiedUpdateJob extends BaseJob implements InjectableT
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
return exception instanceof PushNetworkException;
}

View File

@ -36,7 +36,7 @@ public class PushContentReceiveJob extends PushReceivedJob {
public void onCanceled() { }
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
return false;
}

View File

@ -180,7 +180,7 @@ public class PushDecryptJob extends BaseJob {
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
return false;
}

View File

@ -212,7 +212,7 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
if (exception instanceof IOException) return true;
if (exception instanceof RetryLaterException) return true;
return false;

View File

@ -124,7 +124,7 @@ public class PushGroupUpdateJob extends BaseJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
Log.w(TAG, e);
return e instanceof PushNetworkException;
}

View File

@ -178,7 +178,7 @@ public class PushMediaSendJob extends PushSendJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
if (exception instanceof RetryLaterException) return true;
return false;
}

View File

@ -64,7 +64,7 @@ public class PushNotificationReceiveJob extends PushReceivedJob implements Injec
}
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
Log.w(TAG, e);
return e instanceof PushNetworkException;
}

View File

@ -60,9 +60,8 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
return new Data.Builder().putLong(KEY_MESSAGE_ID, messageId).build();
}
@NonNull
@Override
public String getFactoryKey() {
public @NonNull String getFactoryKey() {
return KEY;
}
@ -134,7 +133,7 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
if (exception instanceof RetryLaterException) return true;
return false;

View File

@ -65,7 +65,7 @@ public class RefreshAttributesJob extends BaseJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
return e instanceof NetworkFailureException;
}

View File

@ -83,7 +83,7 @@ public class RefreshPreKeysJob extends BaseJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
if (exception instanceof NonSuccessfulResponseCodeException) return false;
if (exception instanceof PushNetworkException) return true;

View File

@ -68,7 +68,7 @@ public class RefreshUnidentifiedDeliveryAbilityJob extends BaseJob implements In
}
@Override
protected boolean onShouldRetry(Exception exception) {
protected boolean onShouldRetry(@NonNull Exception exception) {
return exception instanceof PushNetworkException;
}

View File

@ -85,7 +85,7 @@ public class RequestGroupInfoJob extends BaseJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
return e instanceof PushNetworkException;
}

View File

@ -112,7 +112,7 @@ public class RetrieveProfileAvatarJob extends BaseJob implements InjectableType
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
if (e instanceof PushNetworkException) return true;
return false;
}

View File

@ -86,7 +86,7 @@ public class RetrieveProfileJob extends BaseJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
return false;
}

View File

@ -47,7 +47,7 @@ public class RotateCertificateJob extends BaseJob implements InjectableType {
}
@Override
public String getFactoryKey() {
public @NonNull String getFactoryKey() {
return KEY;
}
@ -63,7 +63,7 @@ public class RotateCertificateJob extends BaseJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
return e instanceof PushNetworkException;
}

View File

@ -69,7 +69,7 @@ public class RotateProfileKeyJob extends BaseJob implements InjectableType {
}
@Override
protected boolean onShouldRetry(Exception exception) {
protected boolean onShouldRetry(@NonNull Exception exception) {
return exception instanceof PushNetworkException;
}

View File

@ -67,7 +67,7 @@ public class RotateSignedPreKeyJob extends BaseJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
return exception instanceof PushNetworkException;
}

View File

@ -89,7 +89,7 @@ public class SendDeliveryReceiptJob extends BaseJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
if (e instanceof PushNetworkException) return true;
return false;
}

View File

@ -95,7 +95,7 @@ public class SendReadReceiptJob extends BaseJob implements InjectableType {
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
if (e instanceof PushNetworkException) return true;
return false;
}

View File

@ -81,7 +81,7 @@ public class ServiceOutageDetectionJob extends BaseJob {
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
return e instanceof RetryLaterException;
}

View File

@ -94,7 +94,7 @@ public class SmsReceiveJob extends BaseJob {
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
return exception instanceof MigrationPendingException;
}

View File

@ -93,7 +93,7 @@ public class SmsSendJob extends SendJob {
}
@Override
public boolean onShouldRetry(Exception throwable) {
public boolean onShouldRetry(@NonNull Exception throwable) {
return false;
}

View File

@ -78,7 +78,7 @@ public class SmsSentJob extends BaseJob {
}
@Override
public boolean onShouldRetry(Exception throwable) {
public boolean onShouldRetry(@NonNull Exception throwable) {
return false;
}

View File

@ -65,7 +65,7 @@ public class TrimThreadJob extends BaseJob {
}
@Override
public boolean onShouldRetry(Exception exception) {
public boolean onShouldRetry(@NonNull Exception exception) {
return false;
}

View File

@ -104,7 +104,7 @@ public class TypingSendJob extends BaseJob implements InjectableType {
}
@Override
protected boolean onShouldRetry(Exception exception) {
protected boolean onShouldRetry(@NonNull Exception exception) {
return false;
}

View File

@ -97,7 +97,7 @@ public class UpdateApkJob extends BaseJob {
}
@Override
public boolean onShouldRetry(Exception e) {
public boolean onShouldRetry(@NonNull Exception e) {
return e instanceof IOException;
}
@ -229,7 +229,7 @@ public class UpdateApkJob extends BaseJob {
return url;
}
public String toString() {
public @NonNull String toString() {
return "[" + versionCode + ", " + versionName + ", " + url + "]";
}

View File

@ -95,13 +95,13 @@ public class LinkPreviewRepository {
call.enqueue(new okhttp3.Callback() {
@Override
public void onFailure(Call call, IOException e) {
public void onFailure(@NonNull Call call, @NonNull IOException e) {
Log.w(TAG, "Request failed.", e);
callback.onComplete(Metadata.empty());
}
@Override
public void onResponse(Call call, Response response) throws IOException {
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
if (!response.isSuccessful()) {
Log.w(TAG, "Non-successful response. Code: " + response.code());
callback.onComplete(Metadata.empty());

View File

@ -72,7 +72,7 @@ public class RegistrationLockDialog {
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(View widget) {
public void onClick(@NonNull View widget) {
dialog.dismiss();
new AlertDialog.Builder(context).setTitle(R.string.RegistrationLockDialog_forgotten_pin)
.setMessage(R.string.RegistrationLockDialog_registration_lock_helps_protect_your_phone_number_from_unauthorized_registration_attempts)

View File

@ -23,6 +23,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.ResolveInfo;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -49,7 +50,7 @@ public class ShareIntentListAdapter extends ArrayAdapter<ResolveInfo> {
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
public @NonNull View getView(int position, View convertView, @NonNull ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.share_intent_row, parent, false);
ImageView intentImage = (ImageView) rowView.findViewById(R.id.share_intent_image);

View File

@ -139,14 +139,14 @@ public class SubmitLogFragment extends Fragment {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_submit_log, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initializeResources();
}
@ -199,7 +199,7 @@ public class SubmitLogFragment extends Fragment {
logPreview.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
if (((LinearLayoutManager) recyclerView.getLayoutManager()).findLastVisibleItemPosition() < logPreviewAdapter.getItemCount() - 10) {
scrollButton.setVisibility(View.VISIBLE);
} else {

View File

@ -243,7 +243,7 @@ class Camera1Controller {
}
@Override
public String toString() {
public @NonNull String toString() {
return "cameraCount: " + cameraCount + " previewWidth: " + previewWidth + " previewHeight: " + previewHeight;
}
}

View File

@ -34,7 +34,7 @@ class AttachmentStreamLocalUriFetcher implements DataFetcher<InputStream> {
}
@Override
public void loadData(Priority priority, DataCallback<? super InputStream> callback) {
public void loadData(@NonNull Priority priority, @NonNull DataCallback<? super InputStream> callback) {
try {
if (!digest.isPresent()) throw new InvalidMessageException("No attachment digest!");
is = AttachmentCipherInputStream.createFor(attachment, plaintextLength, key, digest.get());
@ -57,15 +57,13 @@ class AttachmentStreamLocalUriFetcher implements DataFetcher<InputStream> {
@Override
public void cancel() {}
@NonNull
@Override
public Class<InputStream> getDataClass() {
public @NonNull Class<InputStream> getDataClass() {
return InputStream.class;
}
@NonNull
@Override
public DataSource getDataSource() {
public @NonNull DataSource getDataSource() {
return DataSource.LOCAL;
}

Some files were not shown because too many files have changed in this diff Show More