From 76393e1e7c029ff5837b2210a9ef891b897df1b8 Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Sun, 19 Jul 2015 10:35:28 +0200 Subject: [PATCH] Info text has smaller font, conversion moved utility class --- .../antennapod/fragment/QueueFragment.java | 12 ++++-------- app/src/main/res/layout/queue_fragment.xml | 1 + .../antennapod/core/util/Converter.java | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index 3a5e66cfe..ba4ababf5 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -47,6 +47,7 @@ import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.LongList; import de.danoeh.antennapod.core.util.QueueSorter; import de.danoeh.antennapod.core.util.gui.FeedItemUndoToken; @@ -475,19 +476,14 @@ public class QueueFragment extends Fragment { // refresh information bar String info = queue.size() + getString(R.string.episodes_suffix); if(queue.size() > 0) { - int durationSec = 0; + int duration = 0; for(FeedItem item : queue) { if(item.getMedia() != null) { - durationSec += item.getMedia().getDuration() / 1000; + duration += item.getMedia().getDuration(); } } - int hours = durationSec / 3600; - int minutes = (durationSec % 3600) / 60; info += " \u2022 "; - if (hours > 0) { - info += hours + " " + getString(R.string.time_unit_hours) + " "; - } - info += minutes + " " + getString(R.string.time_unit_minutes); + info += Converter.getDurationStringLocalized(getActivity(), duration); } infoBar.setText(info); } diff --git a/app/src/main/res/layout/queue_fragment.xml b/app/src/main/res/layout/queue_fragment.xml index 2068fc04c..339369971 100644 --- a/app/src/main/res/layout/queue_fragment.xml +++ b/app/src/main/res/layout/queue_fragment.xml @@ -11,6 +11,7 @@ android:layout_height="wrap_content" android:layout_alignParentTop="true" android:gravity="center" + android:textSize="12sp" android:text="42 episodes \u2022 5 hours 17 minutes"/> 0) { + String hours = context.getString(R.string.time_unit_hours); + result += h + " " + hours + " "; + } + String minutes = context.getString(R.string.time_unit_minutes); + result += m + " " + minutes; + return result; + } }