Loading core/java/android/widget/VideoView2.java +31 −0 Original line number Diff line number Diff line Loading @@ -24,10 +24,12 @@ import android.media.AudioAttributes; import android.media.AudioManager; import android.media.MediaPlayerInterface; import android.media.session.MediaController; import android.media.session.PlaybackState; import android.media.update.ApiLoader; import android.media.update.VideoView2Provider; import android.media.update.ViewProvider; import android.net.Uri; import android.os.Bundle; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.MotionEvent; Loading Loading @@ -320,6 +322,19 @@ public class VideoView2 extends FrameLayout { return mProvider.getViewType_impl(); } /** * Sets custom actions which will be shown as custom buttons in {@link MediaControlView2}. * * @param actionList A list of {@link PlaybackState.CustomAction}. The return value of * {@link PlaybackState.CustomAction#getIcon()} will be used to draw buttons * in {@link MediaControlView2}. * @param listener A listener to be called when a custom button is clicked. */ public void setCustomActions(List<PlaybackState.CustomAction> actionList, OnCustomActionListener listener) { mProvider.setCustomActions_impl(actionList, listener); } /** * Registers a callback to be invoked when the media file is loaded and ready to go. * Loading Loading @@ -455,6 +470,22 @@ public class VideoView2 extends FrameLayout { void onFullScreenChanged(View view, boolean fullScreen); } /** * Interface definition of a callback to be invoked to inform that a custom action is performed. * * TODO: When MediaSession2 is ready, modify the method to match the signature. */ public interface OnCustomActionListener { /** * Called to indicate that a custom action is performed. * * @param action The action that was originally sent in the * {@link PlaybackState.CustomAction}. * @param extras Optional extras. */ void onCustomAction(String action, Bundle extras); } @Override protected void onAttachedToWindow() { mProvider.onAttachedToWindow_impl(); Loading media/java/android/media/update/VideoView2Provider.java +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.media.update; import android.media.AudioAttributes; import android.media.MediaPlayerInterface; import android.media.session.MediaController; import android.media.session.PlaybackState; import android.net.Uri; import android.widget.MediaControlView2; import android.widget.VideoView2; Loading Loading @@ -57,6 +58,8 @@ public interface VideoView2Provider extends ViewProvider { void setVideoUri_impl(Uri uri, Map<String, String> headers); void setViewType_impl(int viewType); int getViewType_impl(); void setCustomActions_impl(List<PlaybackState.CustomAction> actionList, VideoView2.OnCustomActionListener listener); void setOnPreparedListener_impl(VideoView2.OnPreparedListener l); void setOnCompletionListener_impl(VideoView2.OnCompletionListener l); void setOnErrorListener_impl(VideoView2.OnErrorListener l); Loading Loading
core/java/android/widget/VideoView2.java +31 −0 Original line number Diff line number Diff line Loading @@ -24,10 +24,12 @@ import android.media.AudioAttributes; import android.media.AudioManager; import android.media.MediaPlayerInterface; import android.media.session.MediaController; import android.media.session.PlaybackState; import android.media.update.ApiLoader; import android.media.update.VideoView2Provider; import android.media.update.ViewProvider; import android.net.Uri; import android.os.Bundle; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.MotionEvent; Loading Loading @@ -320,6 +322,19 @@ public class VideoView2 extends FrameLayout { return mProvider.getViewType_impl(); } /** * Sets custom actions which will be shown as custom buttons in {@link MediaControlView2}. * * @param actionList A list of {@link PlaybackState.CustomAction}. The return value of * {@link PlaybackState.CustomAction#getIcon()} will be used to draw buttons * in {@link MediaControlView2}. * @param listener A listener to be called when a custom button is clicked. */ public void setCustomActions(List<PlaybackState.CustomAction> actionList, OnCustomActionListener listener) { mProvider.setCustomActions_impl(actionList, listener); } /** * Registers a callback to be invoked when the media file is loaded and ready to go. * Loading Loading @@ -455,6 +470,22 @@ public class VideoView2 extends FrameLayout { void onFullScreenChanged(View view, boolean fullScreen); } /** * Interface definition of a callback to be invoked to inform that a custom action is performed. * * TODO: When MediaSession2 is ready, modify the method to match the signature. */ public interface OnCustomActionListener { /** * Called to indicate that a custom action is performed. * * @param action The action that was originally sent in the * {@link PlaybackState.CustomAction}. * @param extras Optional extras. */ void onCustomAction(String action, Bundle extras); } @Override protected void onAttachedToWindow() { mProvider.onAttachedToWindow_impl(); Loading
media/java/android/media/update/VideoView2Provider.java +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.media.update; import android.media.AudioAttributes; import android.media.MediaPlayerInterface; import android.media.session.MediaController; import android.media.session.PlaybackState; import android.net.Uri; import android.widget.MediaControlView2; import android.widget.VideoView2; Loading Loading @@ -57,6 +58,8 @@ public interface VideoView2Provider extends ViewProvider { void setVideoUri_impl(Uri uri, Map<String, String> headers); void setViewType_impl(int viewType); int getViewType_impl(); void setCustomActions_impl(List<PlaybackState.CustomAction> actionList, VideoView2.OnCustomActionListener listener); void setOnPreparedListener_impl(VideoView2.OnPreparedListener l); void setOnCompletionListener_impl(VideoView2.OnCompletionListener l); void setOnErrorListener_impl(VideoView2.OnErrorListener l); Loading