SimpleExoPlayerView/DefaultTimebar fixes

- Restore making the playback controls visible on any key press.
- Turn anti-aliasing on for drawing the scrubber circle. It looks
  really ugly on some devices if you don't do this.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160413777
This commit is contained in:
olly 2017-06-28 08:57:57 -07:00 committed by Oliver Woodman
parent c6e5b67626
commit a543436b96
3 changed files with 7 additions and 9 deletions

View File

@ -205,8 +205,8 @@ public class PlayerActivity extends Activity implements OnClickListener, ExoPlay
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// If the event was not handled then see if the player view can handle it as a media key event.
return super.dispatchKeyEvent(event) || simpleExoPlayerView.dispatchMediaKeyEvent(event);
// If the event was not handled then see if the player view can handle it.
return super.dispatchKeyEvent(event) || simpleExoPlayerView.dispatchKeyEvent(event);
}
// OnClickListener methods

View File

@ -73,10 +73,10 @@ public class DefaultTimeBar extends View implements TimeBar {
private final Rect bufferedBar;
private final Rect scrubberBar;
private final Paint playedPaint;
private final Paint scrubberPaint;
private final Paint bufferedPaint;
private final Paint unplayedPaint;
private final Paint adMarkerPaint;
private final Paint scrubberPaint;
private final int barHeight;
private final int touchTargetHeight;
private final int adMarkerWidth;
@ -115,10 +115,11 @@ public class DefaultTimeBar extends View implements TimeBar {
bufferedBar = new Rect();
scrubberBar = new Rect();
playedPaint = new Paint();
scrubberPaint = new Paint();
bufferedPaint = new Paint();
unplayedPaint = new Paint();
adMarkerPaint = new Paint();
scrubberPaint = new Paint();
scrubberPaint.setAntiAlias(true);
// Calculate the dimensions and paints for drawn elements.
Resources res = context.getResources();

View File

@ -495,6 +495,7 @@ public final class SimpleExoPlayerView extends FrameLayout {
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
maybeShowController(true);
return dispatchMediaKeyEvent(event) || super.dispatchKeyEvent(event);
}
@ -506,11 +507,7 @@ public final class SimpleExoPlayerView extends FrameLayout {
* @return Whether the key event was handled.
*/
public boolean dispatchMediaKeyEvent(KeyEvent event) {
boolean handled = useController && controller.dispatchMediaKeyEvent(event);
if (handled) {
maybeShowController(true);
}
return handled;
return useController && controller.dispatchMediaKeyEvent(event);
}
/**