From 87d0055cf746febe4c98214980c91fac4ab4cd59 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sat, 30 Jul 2022 16:53:22 +0200 Subject: [PATCH] Show details dialog on download stats page as well --- .../downloads/DownloadStatisticsFragment.java | 2 +- .../downloads/DownloadStatisticsListAdapter.java | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsFragment.java b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsFragment.java index 295094beb..f1f6a0785 100644 --- a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsFragment.java +++ b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsFragment.java @@ -41,7 +41,7 @@ public class DownloadStatisticsFragment extends Fragment { View root = inflater.inflate(R.layout.statistics_fragment, container, false); downloadStatisticsList = root.findViewById(R.id.statistics_list); progressBar = root.findViewById(R.id.progressBar); - listAdapter = new DownloadStatisticsListAdapter(getContext()); + listAdapter = new DownloadStatisticsListAdapter(getContext(), this); downloadStatisticsList.setLayoutManager(new LinearLayoutManager(getContext())); downloadStatisticsList.setAdapter(listAdapter); return root; diff --git a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsListAdapter.java b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsListAdapter.java index edd3e322f..4839aa891 100644 --- a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsListAdapter.java +++ b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsListAdapter.java @@ -2,10 +2,12 @@ package de.danoeh.antennapod.ui.statistics.downloads; import android.content.Context; import android.text.format.Formatter; +import androidx.fragment.app.Fragment; import de.danoeh.antennapod.core.storage.StatisticsItem; import de.danoeh.antennapod.ui.statistics.PieChartView; import de.danoeh.antennapod.ui.statistics.R; import de.danoeh.antennapod.ui.statistics.StatisticsListAdapter; +import de.danoeh.antennapod.ui.statistics.feed.FeedStatisticsDialogFragment; import java.util.List; import java.util.Locale; @@ -14,9 +16,11 @@ import java.util.Locale; * Adapter for the download statistics list. */ public class DownloadStatisticsListAdapter extends StatisticsListAdapter { + private final Fragment fragment; - public DownloadStatisticsListAdapter(Context context) { + public DownloadStatisticsListAdapter(Context context, Fragment fragment) { super(context); + this.fragment = fragment; } @Override @@ -45,6 +49,12 @@ public class DownloadStatisticsListAdapter extends StatisticsListAdapter { + " • " + String.format(Locale.getDefault(), "%d%s", item.episodesDownloadCount, context.getString(R.string.episodes_suffix))); + + holder.itemView.setOnClickListener(v -> { + FeedStatisticsDialogFragment yourDialogFragment = FeedStatisticsDialogFragment.newInstance( + item.feed.getId(), item.feed.getTitle()); + yourDialogFragment.show(fragment.getChildFragmentManager().beginTransaction(), "DialogFragment"); + }); } }