Search in sources :

Example 1 with StatisticsItem

use of de.danoeh.antennapod.core.storage.StatisticsItem in project AntennaPod by AntennaPod.

the class DownloadStatisticsListAdapter method generateChartData.

@Override
PieChartView.PieChartData generateChartData(List<StatisticsItem> statisticsData) {
    float[] dataValues = new float[statisticsData.size()];
    for (int i = 0; i < statisticsData.size(); i++) {
        StatisticsItem item = statisticsData.get(i);
        dataValues[i] = item.totalDownloadSize;
    }
    return new PieChartView.PieChartData(dataValues);
}
Also used : StatisticsItem(de.danoeh.antennapod.core.storage.StatisticsItem)

Example 2 with StatisticsItem

use of de.danoeh.antennapod.core.storage.StatisticsItem in project AntennaPod by AntennaPod.

the class PlaybackStatisticsListAdapter method generateChartData.

@Override
PieChartView.PieChartData generateChartData(List<StatisticsItem> statisticsData) {
    float[] dataValues = new float[statisticsData.size()];
    for (int i = 0; i < statisticsData.size(); i++) {
        StatisticsItem item = statisticsData.get(i);
        dataValues[i] = countAll ? item.timePlayedCountAll : item.timePlayed;
    }
    return new PieChartView.PieChartData(dataValues);
}
Also used : StatisticsItem(de.danoeh.antennapod.core.storage.StatisticsItem)

Example 3 with StatisticsItem

use of de.danoeh.antennapod.core.storage.StatisticsItem in project AntennaPod by AntennaPod.

the class StatisticsListAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder h, int position) {
    if (getItemViewType(position) == TYPE_HEADER) {
        HeaderHolder holder = (HeaderHolder) h;
        holder.pieChart.setData(pieChartData);
        holder.totalTime.setText(getHeaderValue());
    } else {
        StatisticsHolder holder = (StatisticsHolder) h;
        StatisticsItem statsItem = statisticsData.get(position - 1);
        Glide.with(context).load(statsItem.feed.getImageUrl()).apply(new RequestOptions().placeholder(R.color.light_gray).error(R.color.light_gray).diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).fitCenter().dontAnimate()).into(holder.image);
        holder.title.setText(statsItem.feed.getTitle());
        holder.chip.setTextColor(pieChartData.getColorOfItem(position - 1));
        onBindFeedViewHolder(holder, statsItem);
    }
}
Also used : StatisticsItem(de.danoeh.antennapod.core.storage.StatisticsItem) RequestOptions(com.bumptech.glide.request.RequestOptions)

Aggregations

StatisticsItem (de.danoeh.antennapod.core.storage.StatisticsItem)3 RequestOptions (com.bumptech.glide.request.RequestOptions)1