Issue #2680: Display time left in queue info bar

This commit is contained in:
amhokies 2018-05-10 21:25:36 -04:00
parent 36ac93e031
commit 5fe060506a
1 changed files with 4 additions and 3 deletions

View File

@ -534,14 +534,15 @@ public class QueueFragment extends Fragment {
private void refreshInfoBar() {
String info = queue.size() + getString(R.string.episodes_suffix);
if(queue.size() > 0) {
long duration = 0;
long timeLeft = 0;
for(FeedItem item : queue) {
if(item.getMedia() != null) {
duration += item.getMedia().getDuration();
timeLeft += item.getMedia().getDuration() - item.getMedia().getPosition();
}
}
info += " \u2022 ";
info += Converter.getDurationStringLocalized(getActivity(), duration);
info += getString(R.string.time_left_label);
info += Converter.getDurationStringLocalized(getActivity(), timeLeft);
}
infoBar.setText(info);
}