Respect remaining time setting in widget
This commit is contained in:
parent
46ba314e4d
commit
dd4997db27
|
@ -20,6 +20,7 @@ import com.bumptech.glide.request.RequestOptions;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import de.danoeh.antennapod.core.R;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.model.playback.MediaType;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.receiver.MediaButtonReceiver;
|
||||
|
@ -218,14 +219,16 @@ public abstract class WidgetUpdater {
|
|||
}
|
||||
|
||||
private static String getProgressString(int position, int duration, float speed) {
|
||||
if (position >= 0 && duration > 0) {
|
||||
TimeSpeedConverter converter = new TimeSpeedConverter(speed);
|
||||
position = converter.convert(position);
|
||||
duration = converter.convert(duration);
|
||||
return Converter.getDurationStringLong(position) + " / "
|
||||
+ Converter.getDurationStringLong(duration);
|
||||
} else {
|
||||
if (position < 0 || duration <= 0) {
|
||||
return null;
|
||||
}
|
||||
TimeSpeedConverter converter = new TimeSpeedConverter(speed);
|
||||
if (UserPreferences.shouldShowRemainingTime()) {
|
||||
return Converter.getDurationStringLong(converter.convert(position)) + " / -"
|
||||
+ Converter.getDurationStringLong(converter.convert(Math.max(0, duration - position)));
|
||||
} else {
|
||||
return Converter.getDurationStringLong(converter.convert(position)) + " / "
|
||||
+ Converter.getDurationStringLong(converter.convert(duration));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue