1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00

Merge pull request #6528 from TacoTheDank/annotate-methods

Annotate some overridden methods and parameters as NonNull
This commit is contained in:
bopol 2021-06-20 09:26:05 +02:00 committed by GitHub
commit 6c575511be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 43 additions and 25 deletions

View File

@ -63,8 +63,9 @@ public final class FlingBehavior extends AppBarLayout.Behavior {
return consumed == dy; return consumed == dy;
} }
public boolean onInterceptTouchEvent(final CoordinatorLayout parent, final AppBarLayout child, public boolean onInterceptTouchEvent(@NonNull final CoordinatorLayout parent,
final MotionEvent ev) { @NonNull final AppBarLayout child,
@NonNull final MotionEvent ev) {
for (final Integer element : skipInterceptionOfElements) { for (final Integer element : skipInterceptionOfElements) {
final View view = child.findViewById(element); final View view = child.findViewById(element);
if (view != null) { if (view != null) {

View File

@ -389,7 +389,8 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I>
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu,
@NonNull final MenuInflater inflater) {
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "onCreateOptionsMenu() called with: " Log.d(TAG, "onCreateOptionsMenu() called with: "
+ "menu = [" + menu + "], inflater = [" + inflater + "]"); + "menu = [" + menu + "], inflater = [" + inflater + "]");

View File

@ -164,7 +164,8 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu,
@NonNull final MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
final ActionBar supportActionBar = activity.getSupportActionBar(); final ActionBar supportActionBar = activity.getSupportActionBar();
if (useAsFrontPage && supportActionBar != null) { if (useAsFrontPage && supportActionBar != null) {

View File

@ -85,7 +85,8 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
public void setTitle(final String title) { } public void setTitle(final String title) { }
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { } public void onCreateOptionsMenu(@NonNull final Menu menu,
@NonNull final MenuInflater inflater) { }
@Override @Override
protected boolean isGridLayout() { protected boolean isGridLayout() {

View File

@ -131,7 +131,8 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu,
@NonNull final MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
final ActionBar supportActionBar = activity.getSupportActionBar(); final ActionBar supportActionBar = activity.getSupportActionBar();
if (supportActionBar != null && useAsFrontPage) { if (supportActionBar != null && useAsFrontPage) {

View File

@ -181,7 +181,8 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
} }
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu,
@NonNull final MenuInflater inflater) {
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "onCreateOptionsMenu() called with: " Log.d(TAG, "onCreateOptionsMenu() called with: "
+ "menu = [" + menu + "], inflater = [" + inflater + "]"); + "menu = [" + menu + "], inflater = [" + inflater + "]");

View File

@ -413,7 +413,8 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu,
@NonNull final MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
final ActionBar supportActionBar = activity.getSupportActionBar(); final ActionBar supportActionBar = activity.getSupportActionBar();

View File

@ -140,7 +140,8 @@ public class RelatedItemsFragment extends BaseListInfoFragment<RelatedItemInfo>
} }
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu,
@NonNull final MenuInflater inflater) {
} }
private void setInitialData(final StreamInfo info) { private void setInitialData(final StreamInfo info) {

View File

@ -9,6 +9,7 @@ import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
@ -145,7 +146,8 @@ public abstract class BaseLocalListFragment<I, N> extends BaseStateFragment<I>
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu,
@NonNull final MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "onCreateOptionsMenu() called with: " Log.d(TAG, "onCreateOptionsMenu() called with: "

View File

@ -111,7 +111,8 @@ public class StatisticsPlaylistFragment
} }
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu,
@NonNull final MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.menu_history, menu); inflater.inflate(R.menu.menu_history, menu);
} }

View File

@ -248,7 +248,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
} }
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu,
@NonNull final MenuInflater inflater) {
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "onCreateOptionsMenu() called with: " Log.d(TAG, "onCreateOptionsMenu() called with: "
+ "menu = [" + menu + "], inflater = [" + inflater + "]"); + "menu = [" + menu + "], inflater = [" + inflater + "]");

View File

@ -139,7 +139,8 @@ public class PeertubeInstanceListFragment extends Fragment {
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu,
@NonNull final MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
final MenuItem restoreItem = menu final MenuItem restoreItem = menu
@ -279,7 +280,7 @@ public class PeertubeInstanceListFragment extends Fragment {
return new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN, return new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN,
ItemTouchHelper.START | ItemTouchHelper.END) { ItemTouchHelper.START | ItemTouchHelper.END) {
@Override @Override
public int interpolateOutOfBoundsScroll(final RecyclerView recyclerView, public int interpolateOutOfBoundsScroll(@NonNull final RecyclerView recyclerView,
final int viewSize, final int viewSize,
final int viewSizeOutOfBounds, final int viewSizeOutOfBounds,
final int totalSize, final int totalSize,
@ -292,9 +293,9 @@ public class PeertubeInstanceListFragment extends Fragment {
} }
@Override @Override
public boolean onMove(final RecyclerView recyclerView, public boolean onMove(@NonNull final RecyclerView recyclerView,
final RecyclerView.ViewHolder source, @NonNull final RecyclerView.ViewHolder source,
final RecyclerView.ViewHolder target) { @NonNull final RecyclerView.ViewHolder target) {
if (source.getItemViewType() != target.getItemViewType() if (source.getItemViewType() != target.getItemViewType()
|| instanceListAdapter == null) { || instanceListAdapter == null) {
return false; return false;
@ -317,7 +318,8 @@ public class PeertubeInstanceListFragment extends Fragment {
} }
@Override @Override
public void onSwiped(final RecyclerView.ViewHolder viewHolder, final int swipeDir) { public void onSwiped(@NonNull final RecyclerView.ViewHolder viewHolder,
final int swipeDir) {
final int position = viewHolder.getAdapterPosition(); final int position = viewHolder.getAdapterPosition();
// do not allow swiping the selected instance // do not allow swiping the selected instance
if (instanceList.get(position).getUrl().equals(selectedInstance.getUrl())) { if (instanceList.get(position).getUrl().equals(selectedInstance.getUrl())) {

View File

@ -8,6 +8,7 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.content.res.AppCompatResources;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
@ -92,7 +93,7 @@ public class SelectKioskFragment extends DialogFragment {
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
@Override @Override
public void onCancel(final DialogInterface dialogInterface) { public void onCancel(@NonNull final DialogInterface dialogInterface) {
super.onCancel(dialogInterface); super.onCancel(dialogInterface);
if (onCancelListener != null) { if (onCancelListener != null) {
onCancelListener.onCancel(); onCancelListener.onCancel();
@ -138,6 +139,7 @@ public class SelectKioskFragment extends DialogFragment {
return kioskList.size(); return kioskList.size();
} }
@NonNull
public SelectKioskItemHolder onCreateViewHolder(final ViewGroup parent, final int type) { public SelectKioskItemHolder onCreateViewHolder(final ViewGroup parent, final int type) {
final View item = LayoutInflater.from(parent.getContext()) final View item = LayoutInflater.from(parent.getContext())
.inflate(R.layout.select_kiosk_item, parent, false); .inflate(R.layout.select_kiosk_item, parent, false);

View File

@ -106,7 +106,8 @@ public class ChooseTabsFragment extends Fragment {
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu,
@NonNull final MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
final MenuItem restoreItem = menu.add(Menu.NONE, MENU_ITEM_RESTORE_ID, Menu.NONE, final MenuItem restoreItem = menu.add(Menu.NONE, MENU_ITEM_RESTORE_ID, Menu.NONE,
@ -277,7 +278,7 @@ public class ChooseTabsFragment extends Fragment {
return new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN, return new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN,
ItemTouchHelper.START | ItemTouchHelper.END) { ItemTouchHelper.START | ItemTouchHelper.END) {
@Override @Override
public int interpolateOutOfBoundsScroll(final RecyclerView recyclerView, public int interpolateOutOfBoundsScroll(@NonNull final RecyclerView recyclerView,
final int viewSize, final int viewSize,
final int viewSizeOutOfBounds, final int viewSizeOutOfBounds,
final int totalSize, final int totalSize,
@ -290,9 +291,9 @@ public class ChooseTabsFragment extends Fragment {
} }
@Override @Override
public boolean onMove(final RecyclerView recyclerView, public boolean onMove(@NonNull final RecyclerView recyclerView,
final RecyclerView.ViewHolder source, @NonNull final RecyclerView.ViewHolder source,
final RecyclerView.ViewHolder target) { @NonNull final RecyclerView.ViewHolder target) {
if (source.getItemViewType() != target.getItemViewType() if (source.getItemViewType() != target.getItemViewType()
|| selectedTabsAdapter == null) { || selectedTabsAdapter == null) {
return false; return false;
@ -315,7 +316,8 @@ public class ChooseTabsFragment extends Fragment {
} }
@Override @Override
public void onSwiped(final RecyclerView.ViewHolder viewHolder, final int swipeDir) { public void onSwiped(@NonNull final RecyclerView.ViewHolder viewHolder,
final int swipeDir) {
final int position = viewHolder.getAdapterPosition(); final int position = viewHolder.getAdapterPosition();
tabList.remove(position); tabList.remove(position);
selectedTabsAdapter.notifyItemRemoved(position); selectedTabsAdapter.notifyItemRemoved(position);