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:
parent
c6e5b67626
commit
a543436b96
@ -205,8 +205,8 @@ public class PlayerActivity extends Activity implements OnClickListener, ExoPlay
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
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.
|
// If the event was not handled then see if the player view can handle it.
|
||||||
return super.dispatchKeyEvent(event) || simpleExoPlayerView.dispatchMediaKeyEvent(event);
|
return super.dispatchKeyEvent(event) || simpleExoPlayerView.dispatchKeyEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnClickListener methods
|
// OnClickListener methods
|
||||||
|
@ -73,10 +73,10 @@ public class DefaultTimeBar extends View implements TimeBar {
|
|||||||
private final Rect bufferedBar;
|
private final Rect bufferedBar;
|
||||||
private final Rect scrubberBar;
|
private final Rect scrubberBar;
|
||||||
private final Paint playedPaint;
|
private final Paint playedPaint;
|
||||||
private final Paint scrubberPaint;
|
|
||||||
private final Paint bufferedPaint;
|
private final Paint bufferedPaint;
|
||||||
private final Paint unplayedPaint;
|
private final Paint unplayedPaint;
|
||||||
private final Paint adMarkerPaint;
|
private final Paint adMarkerPaint;
|
||||||
|
private final Paint scrubberPaint;
|
||||||
private final int barHeight;
|
private final int barHeight;
|
||||||
private final int touchTargetHeight;
|
private final int touchTargetHeight;
|
||||||
private final int adMarkerWidth;
|
private final int adMarkerWidth;
|
||||||
@ -115,10 +115,11 @@ public class DefaultTimeBar extends View implements TimeBar {
|
|||||||
bufferedBar = new Rect();
|
bufferedBar = new Rect();
|
||||||
scrubberBar = new Rect();
|
scrubberBar = new Rect();
|
||||||
playedPaint = new Paint();
|
playedPaint = new Paint();
|
||||||
scrubberPaint = new Paint();
|
|
||||||
bufferedPaint = new Paint();
|
bufferedPaint = new Paint();
|
||||||
unplayedPaint = new Paint();
|
unplayedPaint = new Paint();
|
||||||
adMarkerPaint = new Paint();
|
adMarkerPaint = new Paint();
|
||||||
|
scrubberPaint = new Paint();
|
||||||
|
scrubberPaint.setAntiAlias(true);
|
||||||
|
|
||||||
// Calculate the dimensions and paints for drawn elements.
|
// Calculate the dimensions and paints for drawn elements.
|
||||||
Resources res = context.getResources();
|
Resources res = context.getResources();
|
||||||
|
@ -495,6 +495,7 @@ public final class SimpleExoPlayerView extends FrameLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||||
|
maybeShowController(true);
|
||||||
return dispatchMediaKeyEvent(event) || super.dispatchKeyEvent(event);
|
return dispatchMediaKeyEvent(event) || super.dispatchKeyEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,11 +507,7 @@ public final class SimpleExoPlayerView extends FrameLayout {
|
|||||||
* @return Whether the key event was handled.
|
* @return Whether the key event was handled.
|
||||||
*/
|
*/
|
||||||
public boolean dispatchMediaKeyEvent(KeyEvent event) {
|
public boolean dispatchMediaKeyEvent(KeyEvent event) {
|
||||||
boolean handled = useController && controller.dispatchMediaKeyEvent(event);
|
return useController && controller.dispatchMediaKeyEvent(event);
|
||||||
if (handled) {
|
|
||||||
maybeShowController(true);
|
|
||||||
}
|
|
||||||
return handled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user