From 58484d5790cd8410368f989e1ce3390a666a4346 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Fri, 13 Oct 2023 17:31:09 +0200 Subject: Add 'Search online' button if local search has no results (#6681) --- .../adapter/HorizontalFeedListAdapter.java | 27 ++++++++++++++++++++-- .../danoeh/antennapod/fragment/SearchFragment.java | 19 +++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/de/danoeh') diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/HorizontalFeedListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/HorizontalFeedListAdapter.java index 9a578da6a..304bf9f64 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/HorizontalFeedListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/HorizontalFeedListAdapter.java @@ -2,7 +2,10 @@ package de.danoeh.antennapod.adapter; import android.view.View; import android.view.ViewGroup; +import android.widget.Button; import androidx.annotation.NonNull; +import androidx.annotation.StringRes; +import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; @@ -26,7 +29,8 @@ public class HorizontalFeedListAdapter extends RecyclerView.Adapter data = new ArrayList<>(); private int dummyViews = 0; private Feed longPressedItem; - + private @StringRes int endButtonText = 0; + private Runnable endButtonAction = null; public HorizontalFeedListAdapter(MainActivity mainActivity) { this.mainActivityRef = new WeakReference<>(mainActivity); @@ -51,6 +55,15 @@ public class HorizontalFeedListAdapter extends RecyclerView.Adapter endButtonAction.run()); + return; + } + holder.cardView.setVisibility(View.VISIBLE); + holder.actionButton.setVisibility(View.GONE); if (position >= data.size()) { holder.itemView.setAlpha(0.1f); Glide.with(mainActivityRef.get()).clear(holder.imageView); @@ -95,7 +108,7 @@ public class HorizontalFeedListAdapter extends RecyclerView.Adapter