Show the number of downloaded episodes in stats screen (#7435)
This commit is contained in:
parent
4990d95f33
commit
a671be2d79
|
@ -77,7 +77,10 @@
|
|||
<string name="section_shown">Shown</string>
|
||||
|
||||
<!-- Download Statistics fragment -->
|
||||
<string name="total_size_downloaded_podcasts">Total size of episodes on the device</string>
|
||||
<plurals name="total_size_downloaded_podcasts">
|
||||
<item quantity="one">Total size of %d episode on the device</item>
|
||||
<item quantity="other">Total size of %d episodes on the device</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Main activity -->
|
||||
<string name="drawer_open">Open menu</string>
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||
*/
|
||||
public class DownloadStatisticsListAdapter extends StatisticsListAdapter {
|
||||
private final Fragment fragment;
|
||||
private int cacheEpisodes;
|
||||
|
||||
public DownloadStatisticsListAdapter(Context context, Fragment fragment) {
|
||||
super(context);
|
||||
|
@ -24,7 +25,8 @@ public class DownloadStatisticsListAdapter extends StatisticsListAdapter {
|
|||
|
||||
@Override
|
||||
protected String getHeaderCaption() {
|
||||
return context.getString(R.string.total_size_downloaded_podcasts);
|
||||
return context.getResources().getQuantityString(
|
||||
R.plurals.total_size_downloaded_podcasts, cacheEpisodes, cacheEpisodes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,9 +37,11 @@ public class DownloadStatisticsListAdapter extends StatisticsListAdapter {
|
|||
@Override
|
||||
protected PieChartView.PieChartData generateChartData(List<StatisticsItem> statisticsData) {
|
||||
float[] dataValues = new float[statisticsData.size()];
|
||||
cacheEpisodes = 0;
|
||||
for (int i = 0; i < statisticsData.size(); i++) {
|
||||
StatisticsItem item = statisticsData.get(i);
|
||||
dataValues[i] = item.totalDownloadSize;
|
||||
cacheEpisodes += item.episodesDownloadCount;
|
||||
}
|
||||
return new PieChartView.PieChartData(dataValues);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue