Commit 84875bbe by andrewlewis Committed by Oliver Woodman

Constrain DefaultTimeBar maximum positions

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156113616
parent b31ec337
...@@ -465,12 +465,10 @@ public class DefaultTimeBar extends View implements TimeBar { ...@@ -465,12 +465,10 @@ public class DefaultTimeBar extends View implements TimeBar {
scrubberBar.set(progressBar); scrubberBar.set(progressBar);
long newScrubberTime = scrubbing ? scrubPosition : position; long newScrubberTime = scrubbing ? scrubPosition : position;
if (duration > 0) { if (duration > 0) {
int bufferedPixelWidth = int bufferedPixelWidth = (int) ((progressBar.width() * bufferedPosition) / duration);
(int) ((progressBar.width() * bufferedPosition) / duration); bufferedBar.right = Math.min(progressBar.left + bufferedPixelWidth, progressBar.right);
bufferedBar.right = progressBar.left + bufferedPixelWidth; int scrubberPixelPosition = (int) ((progressBar.width() * newScrubberTime) / duration);
int scrubberPixelPosition = scrubberBar.right = Math.min(progressBar.left + scrubberPixelPosition, progressBar.right);
(int) ((progressBar.width() * newScrubberTime) / duration);
scrubberBar.right = progressBar.left + scrubberPixelPosition;
} else { } else {
bufferedBar.right = progressBar.left; bufferedBar.right = progressBar.left;
scrubberBar.right = progressBar.left; scrubberBar.right = progressBar.left;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment