Merge pull request #2684 from amhokies/info-bar-time-left

Display time left in queue info bar
This commit is contained in:
Martin Fietz 2018-05-12 11:01:13 +02:00 committed by GitHub
commit 04929cee4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
}