From 6b03dce78beacf1a61deb4357b6254ca758bcb2e Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Thu, 3 Oct 2019 12:30:34 +0200 Subject: [PATCH] Added pie chart to statistics page --- .../adapter/StatisticsListAdapter.java | 9 ++ .../danoeh/antennapod/view/PieChartView.java | 120 ++++++++++++++++++ .../layout/statistics_listitem_total_time.xml | 62 ++++----- 3 files changed, 161 insertions(+), 30 deletions(-) create mode 100644 app/src/main/java/de/danoeh/antennapod/view/PieChartView.java diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/StatisticsListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/StatisticsListAdapter.java index 0bc32dd07..fb49f04d7 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/StatisticsListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/StatisticsListAdapter.java @@ -15,6 +15,7 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.glide.ApGlideSettings; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.util.Converter; +import de.danoeh.antennapod.view.PieChartView; /** * Adapter for the statistics list @@ -67,6 +68,12 @@ public class StatisticsListAdapter extends RecyclerView.Adapter PADDING_DEGREES) { + canvas.drawArc(arc_bounds, startAngle + PADDING_DEGREES, sweepAngle - PADDING_DEGREES, false, linePaint); + } + } + + @Override + public int getOpacity() { + return PixelFormat.TRANSLUCENT; + } + + @Override + public void setAlpha(int alpha) { + } + + @Override + public void setColorFilter(ColorFilter cf) { + } + } +} diff --git a/app/src/main/res/layout/statistics_listitem_total_time.xml b/app/src/main/res/layout/statistics_listitem_total_time.xml index 2db42ac74..2e0ae54d6 100644 --- a/app/src/main/res/layout/statistics_listitem_total_time.xml +++ b/app/src/main/res/layout/statistics_listitem_total_time.xml @@ -1,40 +1,42 @@ - + - + + + android:id="@+id/total_time_description" + android:textSize="14sp" + android:text="@string/total_time_listened_to_podcasts" + android:gravity="center_horizontal" + android:layout_above="@+id/total_time"/> - - - - - + + android:layout_marginTop="16dp" + android:background="?android:attr/dividerVertical" + android:layout_below="@+id/pie_chart"/> - \ No newline at end of file + \ No newline at end of file