Merge "VV2 & MCV2: Move handling MediaControlView2 visibility logic to VV2"
This commit is contained in:
committed by
Android (Google) Code Review
commit
d11dc140bc
@@ -49,9 +49,8 @@ import java.lang.annotation.RetentionPolicy;
|
||||
* There is no separate method that handles the show/hide behavior for MediaControlView2. Instead,
|
||||
* one can directly change the visibility of this view by calling View.setVisibility(int). The
|
||||
* values supported are View.VISIBLE and View.GONE.
|
||||
* In addition, the following customizations are supported:
|
||||
* 1. Modify default timeout value of 2 seconds by calling setTimeout(long).
|
||||
* 2. Set focus to the play/pause button by calling requestPlayButtonFocus().
|
||||
* In addition, the following customization is supported:
|
||||
* Set focus to the play/pause button by calling requestPlayButtonFocus().
|
||||
*
|
||||
* <p>
|
||||
* It is also possible to add custom buttons with custom icons and actions inside MediaControlView2.
|
||||
@@ -200,23 +199,6 @@ public class MediaControlView2 extends ViewGroupHelper<MediaControlView2Provider
|
||||
mProvider.requestPlayButtonFocus_impl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new timeout value (in milliseconds) for showing MediaControlView2. The default value
|
||||
* is set as 2 seconds.
|
||||
* @param timeout the
|
||||
*/
|
||||
public void setTimeout(long timeout) {
|
||||
mProvider.setTimeout_impl(timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves current timeout value (in milliseconds) for showing MediaControlView2. The default
|
||||
* value is set as 2 seconds.
|
||||
*/
|
||||
public long getTimeout() {
|
||||
return mProvider.getTimeout_impl();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
mProvider.onLayout_impl(changed, l, t, r, b);
|
||||
|
||||
@@ -152,9 +152,10 @@ public class VideoView2 extends ViewGroupHelper<VideoView2Provider> {
|
||||
* instance if any.
|
||||
*
|
||||
* @param mediaControlView a media control view2 instance.
|
||||
* @param intervalMs a time interval in milliseconds until VideoView2 hides MediaControlView2.
|
||||
*/
|
||||
public void setMediaControlView2(MediaControlView2 mediaControlView) {
|
||||
mProvider.setMediaControlView2_impl(mediaControlView);
|
||||
public void setMediaControlView2(MediaControlView2 mediaControlView, long intervalMs) {
|
||||
mProvider.setMediaControlView2_impl(mediaControlView, intervalMs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,6 +41,4 @@ public interface MediaControlView2Provider extends ViewGroupProvider {
|
||||
void setController_impl(MediaController controller);
|
||||
void setButtonVisibility_impl(int button, int visibility);
|
||||
void requestPlayButtonFocus_impl();
|
||||
void setTimeout_impl(long timeout);
|
||||
long getTimeout_impl();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ import java.util.concurrent.Executor;
|
||||
public interface VideoView2Provider extends ViewGroupProvider {
|
||||
void initialize(AttributeSet attrs, int defStyleAttr, int defStyleRes);
|
||||
|
||||
void setMediaControlView2_impl(MediaControlView2 mediaControlView);
|
||||
void setMediaControlView2_impl(MediaControlView2 mediaControlView, long intervalMs);
|
||||
MediaController getMediaController_impl();
|
||||
MediaControlView2 getMediaControlView2_impl();
|
||||
void setSubtitleEnabled_impl(boolean enable);
|
||||
|
||||
@@ -111,6 +111,11 @@ public abstract class ViewGroupHelper<T extends ViewGroupProvider> extends ViewG
|
||||
|
||||
// setMeasuredDimension is final
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
return mProvider.dispatchTouchEvent_impl(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkLayoutParams(LayoutParams p) {
|
||||
return mProvider.checkLayoutParams_impl(p);
|
||||
@@ -210,6 +215,11 @@ public abstract class ViewGroupHelper<T extends ViewGroupProvider> extends ViewG
|
||||
ViewGroupHelper.super.setMeasuredDimension(measuredWidth, measuredHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent_impl(MotionEvent ev) {
|
||||
return ViewGroupHelper.super.dispatchTouchEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkLayoutParams_impl(LayoutParams p) {
|
||||
return ViewGroupHelper.super.checkLayoutParams(p);
|
||||
@@ -311,6 +321,11 @@ public abstract class ViewGroupHelper<T extends ViewGroupProvider> extends ViewG
|
||||
ViewGroupHelper.this.setMeasuredDimension(measuredWidth, measuredHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent_impl(MotionEvent ev) {
|
||||
return ViewGroupHelper.this.dispatchTouchEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkLayoutParams_impl(LayoutParams p) {
|
||||
return ViewGroupHelper.this.checkLayoutParams(p);
|
||||
|
||||
@@ -51,6 +51,7 @@ public interface ViewGroupProvider {
|
||||
int getSuggestedMinimumWidth_impl();
|
||||
int getSuggestedMinimumHeight_impl();
|
||||
void setMeasuredDimension_impl(int measuredWidth, int measuredHeight);
|
||||
boolean dispatchTouchEvent_impl(MotionEvent ev);
|
||||
|
||||
// ViewGroup methods
|
||||
boolean checkLayoutParams_impl(LayoutParams p);
|
||||
|
||||
Reference in New Issue
Block a user