Skip to content

Commit 87c1a6b

Browse files
committed
Add highlight support for list query adapter
1 parent 5957262 commit 87c1a6b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

dynamic-support/src/main/java/com/pranavpandey/android/dynamic/support/recyclerview/adapter/factory/DynamicListQueryAdapter.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,20 @@ protected DynamicListQueryAdapter(@NonNull AsyncDifferConfig<T> config) {
8383
initHighlightColor();
8484
}
8585

86+
@Override
87+
public void onBindViewHolder(@NonNull VH holder, int position) {
88+
onHighlightQuery(holder, position, getQuery());
89+
}
90+
91+
/**
92+
* This method will be called to highlight the query text.
93+
*
94+
* @param holder The view holder for the recycler view.
95+
* @param position The position to bind the view holder.
96+
* @param query The string to be highlighted.
97+
*/
98+
public abstract void onHighlightQuery(@NonNull VH holder, int position, @Nullable Q query);
99+
86100
/**
87101
* Get the raw data used by this list adapter.
88102
*

0 commit comments

Comments
 (0)