This commit is contained in:
Stefan Niedermann 2020-06-09 22:48:35 +02:00
parent 561010a4fa
commit 3d0a1fdc12
3 changed files with 5 additions and 5 deletions

View file

@ -52,7 +52,7 @@ public abstract class NoteViewHolder extends RecyclerView.ViewHolder implements
return noteClickListener.onNoteLongClick(getAdapterPosition(), v);
}
protected void bindCategory(Context context, TextView noteCategory, boolean showCategory, String category, int mainColor) {
protected void bindCategory(@NonNull Context context, @NonNull TextView noteCategory, boolean showCategory, @NonNull String category, int mainColor) {
final boolean isDarkThemeActive = Notes.isDarkThemeActive(context);
noteCategory.setVisibility(showCategory && !category.isEmpty() ? View.VISIBLE : View.GONE);
noteCategory.setText(category);
@ -92,12 +92,12 @@ public abstract class NoteViewHolder extends RecyclerView.ViewHolder implements
noteCategory.setTextColor(categoryForeground);
}
protected void bindFavorite(ImageView noteFavorite, boolean isFavorite) {
protected void bindFavorite(@NonNull ImageView noteFavorite, boolean isFavorite) {
noteFavorite.setImageResource(isFavorite ? R.drawable.ic_star_yellow_24dp : R.drawable.ic_star_grey_ccc_24dp);
noteFavorite.setOnClickListener(view -> noteClickListener.onNoteFavoriteClick(getAdapterPosition(), view));
}
protected void bindTitleAndExcerpt(Context context, TextView noteTitle, @Nullable TextView noteExcerpt, CharSequence searchQuery, DBNote note, int mainColor) {
protected void bindTitleAndExcerpt(@NonNull Context context, @NonNull TextView noteTitle, @Nullable TextView noteExcerpt, @Nullable CharSequence searchQuery, @NonNull DBNote note, int mainColor) {
if (!TextUtils.isEmpty(searchQuery)) {
@ColorInt final int searchBackground = context.getResources().getColor(R.color.bg_highlighted);
@ColorInt final int searchForeground = BrandingUtil.getSecondaryForegroundColorDependingOnTheme(context, mainColor);

View file

@ -26,7 +26,7 @@ public class NoteViewHolderWithExcerpt extends NoteViewHolder {
binding.noteSwipeFrame.setBackgroundResource(left ? R.color.bg_warning : R.color.bg_attention);
}
public void bind(DBNote note, boolean showCategory, int mainColor, int textColor, @Nullable CharSequence searchQuery) {
public void bind(@NonNull DBNote note, boolean showCategory, int mainColor, int textColor, @Nullable CharSequence searchQuery) {
@NonNull final Context context = itemView.getContext();
binding.noteSwipeable.setAlpha(DBStatus.LOCAL_DELETED.equals(note.getStatus()) ? 0.5f : 1.0f);
bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), mainColor);

View file

@ -27,7 +27,7 @@ public class NoteViewHolderWithoutExcerpt extends NoteViewHolder {
binding.noteSwipeFrame.setBackgroundResource(left ? R.color.bg_warning : R.color.bg_attention);
}
public void bind(DBNote note, boolean showCategory, int mainColor, int textColor, @Nullable CharSequence searchQuery) {
public void bind(@NonNull DBNote note, boolean showCategory, int mainColor, int textColor, @Nullable CharSequence searchQuery) {
@NonNull final Context context = itemView.getContext();
binding.noteSwipeable.setAlpha(DBStatus.LOCAL_DELETED.equals(note.getStatus()) ? 0.5f : 1.0f);
bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), mainColor);