Loading app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewGridHolder.java +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ public class NoteViewGridHolder extends NoteViewHolder { super.bind(note, showCategory, mainColor, textColor, searchQuery); @NonNull final Context context = itemView.getContext(); bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), mainColor); binding.noteStatus.setVisibility(DBStatus.VOID.equals(note.getStatus()) ? INVISIBLE : VISIBLE); bindStatus(binding.noteStatus, note.getStatus(), mainColor); bindFavorite(binding.noteFavorite, note.isFavorite()); bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor); bindSearchableContent(context, binding.noteExcerpt, searchQuery, note.getExcerpt().replace(EXCERPT_LINE_SEPARATOR, "\n"), mainColor); Loading app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewGridHolderOnlyTitle.java +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ public class NoteViewGridHolderOnlyTitle extends NoteViewHolder { public void bind(@NonNull DBNote note, boolean showCategory, int mainColor, int textColor, @Nullable CharSequence searchQuery) { super.bind(note, showCategory, mainColor, textColor, searchQuery); @NonNull final Context context = itemView.getContext(); binding.noteStatus.setVisibility(DBStatus.VOID.equals(note.getStatus()) ? INVISIBLE : VISIBLE); bindStatus(binding.noteStatus, note.getStatus(), mainColor); bindFavorite(binding.noteFavorite, note.isFavorite()); bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor); } Loading app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolder.java +8 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ import androidx.annotation.CallSuper; import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.AppCompatImageView; import androidx.core.graphics.drawable.DrawableCompat; import androidx.recyclerview.widget.RecyclerView; Loading @@ -29,6 +30,8 @@ import it.niedermann.owncloud.notes.R; import it.niedermann.owncloud.notes.branding.BrandingUtil; import it.niedermann.owncloud.notes.util.Notes; import static android.view.View.INVISIBLE; import static android.view.View.VISIBLE; import static it.niedermann.owncloud.notes.util.ColorUtil.contrastRatioIsSufficient; import static it.niedermann.owncloud.notes.util.ColorUtil.isColorDark; Loading @@ -47,6 +50,11 @@ public abstract class NoteViewHolder extends RecyclerView.ViewHolder { itemView.setOnLongClickListener((view) -> noteClickListener.onNoteLongClick(getAdapterPosition(), view)); } protected void bindStatus(AppCompatImageView noteStatus, DBStatus status, int mainColor) { noteStatus.setVisibility(DBStatus.VOID.equals(status) ? INVISIBLE : VISIBLE); DrawableCompat.setTint(noteStatus.getDrawable(), BrandingUtil.getSecondaryForegroundColorDependingOnTheme(noteStatus.getContext(), 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); Loading app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithExcerpt.java +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ public class NoteViewHolderWithExcerpt extends NoteViewHolder { @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); binding.noteStatus.setVisibility(DBStatus.VOID.equals(note.getStatus()) ? View.INVISIBLE : View.VISIBLE); bindStatus(binding.noteStatus, note.getStatus(), mainColor); bindFavorite(binding.noteFavorite, note.isFavorite()); bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor); Loading app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithoutExcerpt.java +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ public class NoteViewHolderWithoutExcerpt extends NoteViewHolder { @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); binding.noteStatus.setVisibility(DBStatus.VOID.equals(note.getStatus()) ? View.INVISIBLE : View.VISIBLE); bindStatus(binding.noteStatus, note.getStatus(), mainColor); bindFavorite(binding.noteFavorite, note.isFavorite()); bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor); } Loading Loading
app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewGridHolder.java +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ public class NoteViewGridHolder extends NoteViewHolder { super.bind(note, showCategory, mainColor, textColor, searchQuery); @NonNull final Context context = itemView.getContext(); bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), mainColor); binding.noteStatus.setVisibility(DBStatus.VOID.equals(note.getStatus()) ? INVISIBLE : VISIBLE); bindStatus(binding.noteStatus, note.getStatus(), mainColor); bindFavorite(binding.noteFavorite, note.isFavorite()); bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor); bindSearchableContent(context, binding.noteExcerpt, searchQuery, note.getExcerpt().replace(EXCERPT_LINE_SEPARATOR, "\n"), mainColor); Loading
app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewGridHolderOnlyTitle.java +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ public class NoteViewGridHolderOnlyTitle extends NoteViewHolder { public void bind(@NonNull DBNote note, boolean showCategory, int mainColor, int textColor, @Nullable CharSequence searchQuery) { super.bind(note, showCategory, mainColor, textColor, searchQuery); @NonNull final Context context = itemView.getContext(); binding.noteStatus.setVisibility(DBStatus.VOID.equals(note.getStatus()) ? INVISIBLE : VISIBLE); bindStatus(binding.noteStatus, note.getStatus(), mainColor); bindFavorite(binding.noteFavorite, note.isFavorite()); bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor); } Loading
app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolder.java +8 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ import androidx.annotation.CallSuper; import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.AppCompatImageView; import androidx.core.graphics.drawable.DrawableCompat; import androidx.recyclerview.widget.RecyclerView; Loading @@ -29,6 +30,8 @@ import it.niedermann.owncloud.notes.R; import it.niedermann.owncloud.notes.branding.BrandingUtil; import it.niedermann.owncloud.notes.util.Notes; import static android.view.View.INVISIBLE; import static android.view.View.VISIBLE; import static it.niedermann.owncloud.notes.util.ColorUtil.contrastRatioIsSufficient; import static it.niedermann.owncloud.notes.util.ColorUtil.isColorDark; Loading @@ -47,6 +50,11 @@ public abstract class NoteViewHolder extends RecyclerView.ViewHolder { itemView.setOnLongClickListener((view) -> noteClickListener.onNoteLongClick(getAdapterPosition(), view)); } protected void bindStatus(AppCompatImageView noteStatus, DBStatus status, int mainColor) { noteStatus.setVisibility(DBStatus.VOID.equals(status) ? INVISIBLE : VISIBLE); DrawableCompat.setTint(noteStatus.getDrawable(), BrandingUtil.getSecondaryForegroundColorDependingOnTheme(noteStatus.getContext(), 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); Loading
app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithExcerpt.java +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ public class NoteViewHolderWithExcerpt extends NoteViewHolder { @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); binding.noteStatus.setVisibility(DBStatus.VOID.equals(note.getStatus()) ? View.INVISIBLE : View.VISIBLE); bindStatus(binding.noteStatus, note.getStatus(), mainColor); bindFavorite(binding.noteFavorite, note.isFavorite()); bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor); Loading
app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithoutExcerpt.java +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ public class NoteViewHolderWithoutExcerpt extends NoteViewHolder { @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); binding.noteStatus.setVisibility(DBStatus.VOID.equals(note.getStatus()) ? View.INVISIBLE : View.VISIBLE); bindStatus(binding.noteStatus, note.getStatus(), mainColor); bindFavorite(binding.noteFavorite, note.isFavorite()); bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor); } Loading