aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-08-15 00:10:02 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-08-15 00:10:02 +0000
commitc29aae3b9703aae75d3c31bef01741251b979a6c (patch)
tree831ee44a34696d553ba8ab3ae88351421fdc1762 /app/src/main/java/ml
parent25ac920fe5e5fa60ede9e4e0c50bb66dda7acfe0 (diff)
downloadinfinity-for-reddit-c29aae3b9703aae75d3c31bef01741251b979a6c.tar
infinity-for-reddit-c29aae3b9703aae75d3c31bef01741251b979a6c.tar.gz
infinity-for-reddit-c29aae3b9703aae75d3c31bef01741251b979a6c.tar.bz2
infinity-for-reddit-c29aae3b9703aae75d3c31bef01741251b979a6c.tar.lz
infinity-for-reddit-c29aae3b9703aae75d3c31bef01741251b979a6c.tar.xz
infinity-for-reddit-c29aae3b9703aae75d3c31bef01741251b979a6c.tar.zst
infinity-for-reddit-c29aae3b9703aae75d3c31bef01741251b979a6c.zip
Show 'Search in' in recent searches in SearchActivity.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java
index 058b5a05..60d6c634 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java
@@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.adapters;
import android.content.res.ColorStateList;
import android.view.LayoutInflater;
+import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
@@ -46,7 +47,13 @@ public class SearchActivityRecyclerViewAdapter extends RecyclerView.Adapter<Recy
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder instanceof RecentSearchQueryViewHolder) {
if (recentSearchQueries != null && !recentSearchQueries.isEmpty() && position < recentSearchQueries.size()) {
- ((RecentSearchQueryViewHolder) holder).binding.recentSearchQueryTextViewItemRecentSearchQuery.setText(recentSearchQueries.get(position).getSearchQuery());
+ RecentSearchQuery recentSearchQuery = recentSearchQueries.get(position);
+ ((RecentSearchQueryViewHolder) holder).binding.recentSearchQueryTextViewItemRecentSearchQuery.setText(recentSearchQuery.getSearchQuery());
+ if (recentSearchQuery.getSearchInSubredditOrUserName() != null && !recentSearchQuery.getSearchInSubredditOrUserName().isEmpty()) {
+ ((RecentSearchQueryViewHolder) holder).binding.recentSearchQueryWhereTextViewItemRecentSearchQuery.setVisibility(View.VISIBLE);
+ ((RecentSearchQueryViewHolder) holder).binding.recentSearchQueryWhereTextViewItemRecentSearchQuery
+ .setText((recentSearchQuery.isSearchInIsUser() ? "u/" : "r/") + recentSearchQuery.getSearchQuery());
+ }
holder.itemView.postDelayed(() -> {
((RecentSearchQueryViewHolder) holder).binding.recentSearchQueryTextViewItemRecentSearchQuery.setSelected(true);
((RecentSearchQueryViewHolder) holder).binding.recentSearchQueryWhereTextViewItemRecentSearchQuery.setSelected(true);
@@ -64,6 +71,7 @@ public class SearchActivityRecyclerViewAdapter extends RecyclerView.Adapter<Recy
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
super.onViewRecycled(holder);
if (holder instanceof RecentSearchQueryViewHolder) {
+ ((RecentSearchQueryViewHolder) holder).binding.recentSearchQueryWhereTextViewItemRecentSearchQuery.setVisibility(View.GONE);
((RecentSearchQueryViewHolder) holder).binding.recentSearchQueryTextViewItemRecentSearchQuery.setSelected(false);
((RecentSearchQueryViewHolder) holder).binding.recentSearchQueryWhereTextViewItemRecentSearchQuery.setSelected(false);
}