Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-notes.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithExcerpt.java')
-rw-r--r--app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithExcerpt.java44
1 files changed, 44 insertions, 0 deletions
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
new file mode 100644
index 00000000..032e868f
--- /dev/null
+++ b/app/src/main/java/it/niedermann/owncloud/notes/model/NoteViewHolderWithExcerpt.java
@@ -0,0 +1,44 @@
+package it.niedermann.owncloud.notes.model;
+
+import android.content.Context;
+import android.text.TextUtils;
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import it.niedermann.owncloud.notes.R;
+import it.niedermann.owncloud.notes.databinding.ItemNotesListNoteItemWithExcerptBinding;
+
+public class NoteViewHolderWithExcerpt extends NoteViewHolder {
+ @NonNull
+ private final ItemNotesListNoteItemWithExcerptBinding binding;
+
+ public NoteViewHolderWithExcerpt(@NonNull ItemNotesListNoteItemWithExcerptBinding binding, @NonNull NoteClickListener noteClickListener) {
+ super(binding.getRoot(), noteClickListener);
+ this.binding = binding;
+ }
+
+ public void showSwipe(boolean left) {
+ binding.noteFavoriteLeft.setVisibility(left ? View.VISIBLE : View.INVISIBLE);
+ binding.noteDeleteRight.setVisibility(left ? View.INVISIBLE : View.VISIBLE);
+ binding.noteSwipeFrame.setBackgroundResource(left ? R.color.bg_warning : R.color.bg_attention);
+ }
+
+ 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.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);
+ bindFavorite(binding.noteFavorite, note.isFavorite());
+
+ bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor);
+ bindSearchableContent(context, binding.noteExcerpt, searchQuery, note.getExcerpt(), mainColor);
+ }
+
+ @NonNull
+ public View getNoteSwipeable() {
+ return binding.noteSwipeable;
+ }
+} \ No newline at end of file