Merge pull request #5988 from ByteHamster/download-stats-click

Show details dialog on download stats page as well
This commit is contained in:
ByteHamster 2022-07-30 17:20:06 +02:00 committed by GitHub
commit c8c883f3fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -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;

View File

@ -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");
});
}
}