Skip to content

Commit

Permalink
Use default search icon for empty binder
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavpandey committed Oct 10, 2022
1 parent b04693e commit 3060917
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
return;
}

holder.getEmptyView().setIcon(getDrawable());
holder.getEmptyView().setIcon(getDrawable() != null ? getDrawable() : holder.getIcon());
holder.getEmptyView().setTitle(getData());

DynamicResourceUtils.highlightQueryTextColor(getQuery(),
Expand Down Expand Up @@ -135,5 +135,14 @@ public ViewHolder(@NonNull View view) {
public @NonNull DynamicEmptyView getEmptyView() {
return emptyView;
}

/**
* Get the icon drawable used by the empty view.
*
* @return The icon drawable used by the empty view.
*/
public @Nullable Drawable getIcon() {
return emptyView != null ? emptyView.getIcon() : null;
}
}
}
5 changes: 1 addition & 4 deletions dynamic-support/src/main/res/layout/ads_empty_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="?attr/ads_widgetContentCard"
android:id="@+id/ads_item_view"
android:orientation="horizontal">

<com.pranavpandey.android.dynamic.support.widget.DynamicImageView
style="?attr/ads_widgetImagePreference"
android:id="@+id/ads_item_view_icon"
android:visibility="visible"
app:srcCompat="@drawable/ads_ic_search" />
android:id="@+id/ads_item_view_icon" />

<com.pranavpandey.android.dynamic.support.widget.DynamicTextView
style="?attr/ads_textAppearanceHeadline5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

<com.pranavpandey.android.dynamic.support.view.DynamicEmptyView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ads_empty_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
app:ads_icon="@drawable/ads_ic_search" />

0 comments on commit 3060917

Please sign in to comment.