From 6da8a01b4dc3faa31187d89887a2eb66484b481d Mon Sep 17 00:00:00 2001 From: Stefan Niedermann Date: Thu, 11 Jun 2020 11:14:57 +0200 Subject: [PATCH] Added some IDE hint annotations --- .../java/it/niedermann/owncloud/notes/model/ItemAdapter.java | 2 +- .../it/niedermann/owncloud/notes/model/NoteViewGridHolder.java | 3 ++- .../it/niedermann/owncloud/notes/model/NoteViewHolder.java | 1 + .../owncloud/notes/model/NoteViewHolderWithExcerpt.java | 1 + .../owncloud/notes/model/NoteViewHolderWithoutExcerpt.java | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java b/app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java index 92635564..4a2a1d9a 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java @@ -139,7 +139,7 @@ public class ItemAdapter extends RecyclerView.Adapter i return !selected.contains(position) && selected.add(position); } - public void clearSelection(RecyclerView recyclerView) { + public void clearSelection(@NonNull RecyclerView recyclerView) { for (Integer i : getSelected()) { RecyclerView.ViewHolder viewHolder = recyclerView.findViewHolderForAdapterPosition(i); if (viewHolder != null) { diff --git a/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewGridHolder.java b/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewGridHolder.java index 13cf735a..6675eb59 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewGridHolder.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewGridHolder.java @@ -37,7 +37,8 @@ public class NoteViewGridHolder extends NoteViewHolder { binding.noteExcerpt.setVisibility(TextUtils.isEmpty(note.getExcerpt()) ? GONE : VISIBLE); } + @Nullable public View getNoteSwipeable() { - throw new UnsupportedOperationException(NoteViewGridHolder.class.getSimpleName() + " does not support swiping"); + return null; } } \ No newline at end of file diff --git a/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolder.java b/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolder.java index db211b85..b40f8c17 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolder.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolder.java @@ -114,5 +114,6 @@ public abstract class NoteViewHolder extends RecyclerView.ViewHolder { public abstract void showSwipe(boolean left); + @Nullable public abstract View getNoteSwipeable(); } \ No newline at end of file diff --git a/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithExcerpt.java b/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithExcerpt.java index ac87768c..032e868f 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithExcerpt.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithExcerpt.java @@ -37,6 +37,7 @@ public class NoteViewHolderWithExcerpt extends NoteViewHolder { bindSearchableContent(context, binding.noteExcerpt, searchQuery, note.getExcerpt(), mainColor); } + @NonNull public View getNoteSwipeable() { return binding.noteSwipeable; } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithoutExcerpt.java b/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithoutExcerpt.java index c7c61bd6..acdb4fb6 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithoutExcerpt.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithoutExcerpt.java @@ -34,6 +34,7 @@ public class NoteViewHolderWithoutExcerpt extends NoteViewHolder { bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor); } + @NonNull public View getNoteSwipeable() { return binding.noteSwipeable; }