blob: b26991bf31e054c8a1ab2453d47f522480a7c8d0 [file] [log] [blame]
Sungsoo Lime3259042018-01-16 09:25:28 +09001/*
2 * Copyright 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.widget;
18
19import android.annotation.IntDef;
20import android.annotation.NonNull;
21import android.annotation.Nullable;
22import android.content.Context;
Sungsoo Lime3259042018-01-16 09:25:28 +090023import android.media.AudioAttributes;
Insun Kangde16c4d2018-01-17 23:06:18 +090024import android.media.AudioManager;
Sungsoo Limaf2a1ad2018-01-24 11:36:10 +090025import android.media.MediaPlayerBase;
Sungsoo Lime3259042018-01-16 09:25:28 +090026import android.media.update.ApiLoader;
27import android.media.update.VideoView2Provider;
28import android.media.update.ViewProvider;
29import android.net.Uri;
30import android.util.AttributeSet;
31import android.view.KeyEvent;
32import android.view.MotionEvent;
33
34import java.lang.annotation.Retention;
35import java.lang.annotation.RetentionPolicy;
Sungsoo Limaf2a1ad2018-01-24 11:36:10 +090036import java.util.List;
Sungsoo Lime3259042018-01-16 09:25:28 +090037import java.util.Map;
38
Insun Kangeb78d512018-01-22 18:04:07 +090039// TODO: Use @link tag to refer MediaPlayer2 in docs once MediaPlayer2.java is submitted. Same to
40// MediaSession2.
41// TODO: change the reference from MediaPlayer to MediaPlayer2.
Sungsoo Lime3259042018-01-16 09:25:28 +090042/**
Insun Kangeb78d512018-01-22 18:04:07 +090043 * Displays a video file. VideoView2 class is a View class which is wrapping MediaPlayer2 so that
44 * developers can easily implement a video rendering application.
45 *
46 * <p>
47 * <em> Data sources that VideoView2 supports : </em>
48 * VideoView2 can play video files and audio-only fiels as
49 * well. It can load from various sources such as resources or content providers. The supported
50 * media file formats are the same as MediaPlayer2.
51 *
52 * <p>
53 * <em> View type can be selected : </em>
54 * VideoView2 can render videos on top of TextureView as well as
55 * SurfaceView selectively. The default is SurfaceView and it can be changed using
56 * {@link #setViewType(int)} method. Using SurfaceView is recommended in most cases for saving
57 * battery. TextureView might be preferred for supporting various UIs such as animation and
58 * translucency.
59 *
60 * <p>
61 * <em> Differences between {@link VideoView} class : </em>
62 * VideoView2 covers and inherits the most of
63 * VideoView's functionalities. The main differences are
64 * <ul>
65 * <li> VideoView2 inherits FrameLayout and renders videos using SurfaceView and TextureView
66 * selectively while VideoView inherits SurfaceView class.
67 * <li> VideoView2 is integrated with MediaControlView2 and a default MediaControlView2 instance is
68 * attached to VideoView2 by default. If a developer does not want to use the default
69 * MediaControlView2, needs to set enableControlView attribute to false. For instance,
70 * <pre>
71 * &lt;VideoView2
72 * android:id="@+id/video_view"
73 * xmlns:widget="http://schemas.android.com/apk/com.android.media.update"
74 * widget:enableControlView="false" /&gt;
75 * </pre>
76 * If a developer wants to attach a customed MediaControlView2, then set enableControlView attribute
77 * to false and assign the customed media control widget using {@link #setMediaControlView2}.
78 * <li> VideoView2 is integrated with MediaPlayer2 while VideoView is integrated with MediaPlayer.
79 * <li> VideoView2 is integrated with MediaSession2 and so it responses with media key events.
80 * A VideoView2 keeps a MediaSession2 instance internally and connects it to a corresponding
81 * MediaControlView2 instance.
82 * </p>
83 * </ul>
84 *
85 * <p>
86 * <em> Audio focus and audio attributes : </em>
87 * By default, VideoView2 requests audio focus with
88 * {@link AudioManager#AUDIOFOCUS_GAIN}. Use {@link #setAudioFocusRequest(int)} to change this
89 * behavior. The default {@link AudioAttributes} used during playback have a usage of
90 * {@link AudioAttributes#USAGE_MEDIA} and a content type of
91 * {@link AudioAttributes#CONTENT_TYPE_MOVIE}, use {@link #setAudioAttributes(AudioAttributes)} to
92 * modify them.
93 *
94 * <p>
95 * Note: VideoView2 does not retain its full state when going into the background. In particular, it
96 * does not restore the current play state, play position, selected tracks. Applications should save
97 * and restore these on their own in {@link android.app.Activity#onSaveInstanceState} and
98 * {@link android.app.Activity#onRestoreInstanceState}.
99 *
Sungsoo Lime3259042018-01-16 09:25:28 +0900100 * @hide
101 */
102public class VideoView2 extends FrameLayout {
Insun Kangeb78d512018-01-22 18:04:07 +0900103 /** @hide */
Sungsoo Lime3259042018-01-16 09:25:28 +0900104 @IntDef({
105 VIEW_TYPE_TEXTUREVIEW,
106 VIEW_TYPE_SURFACEVIEW
107 })
108 @Retention(RetentionPolicy.SOURCE)
109 public @interface ViewType {}
Insun Kangeb78d512018-01-22 18:04:07 +0900110
Sungsoo Lime3259042018-01-16 09:25:28 +0900111 public static final int VIEW_TYPE_SURFACEVIEW = 1;
112 public static final int VIEW_TYPE_TEXTUREVIEW = 2;
113
114 private final VideoView2Provider mProvider;
115
Sungsoo Lime3259042018-01-16 09:25:28 +0900116 public VideoView2(@NonNull Context context) {
117 this(context, null);
118 }
119
Sungsoo Lime3259042018-01-16 09:25:28 +0900120 public VideoView2(@NonNull Context context, @Nullable AttributeSet attrs) {
121 this(context, attrs, 0);
122 }
123
Sungsoo Lime3259042018-01-16 09:25:28 +0900124 public VideoView2(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
125 this(context, attrs, defStyleAttr, 0);
126 }
127
Sungsoo Lime3259042018-01-16 09:25:28 +0900128 public VideoView2(
129 @NonNull Context context, @Nullable AttributeSet attrs,
130 int defStyleAttr, int defStyleRes) {
131 super(context, attrs, defStyleAttr, defStyleRes);
132
Insun Kangde16c4d2018-01-17 23:06:18 +0900133 mProvider = ApiLoader.getProvider(context).createVideoView2(this, new SuperProvider(),
134 attrs, defStyleAttr, defStyleRes);
Sungsoo Lime3259042018-01-16 09:25:28 +0900135 }
136
137 /**
138 * @hide
139 */
140 public VideoView2Provider getProvider() {
141 return mProvider;
142 }
143
144 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900145 * Sets MediaControlView2 instance. It will replace the previously assigned MediaControlView2
146 * instance if any.
147 *
148 * @param mediaControlView a media control view2 instance.
Sungsoo Lime3259042018-01-16 09:25:28 +0900149 */
Insun Kangde16c4d2018-01-17 23:06:18 +0900150 public void setMediaControlView2(MediaControlView2 mediaControlView) {
151 mProvider.setMediaControlView2_impl(mediaControlView);
152 }
153
154 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900155 * Returns MediaControlView2 instance which is currently attached to VideoView2 by default or by
156 * {@link #setMediaControlView2} method.
Insun Kangde16c4d2018-01-17 23:06:18 +0900157 */
158 public MediaControlView2 getMediaControlView2() {
159 return mProvider.getMediaControlView2_impl();
160 }
161
162 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900163 * Starts playback with the media contents specified by {@link #setVideoURI} and
164 * {@link #setVideoPath}.
165 * If it has been paused, this method will resume playback from the current position.
Insun Kangde16c4d2018-01-17 23:06:18 +0900166 */
Sungsoo Lime3259042018-01-16 09:25:28 +0900167 public void start() {
168 mProvider.start_impl();
169 }
170
171 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900172 * Pauses playback.
Sungsoo Lime3259042018-01-16 09:25:28 +0900173 */
174 public void pause() {
175 mProvider.pause_impl();
176 }
177
178 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900179 * Gets the duration of the media content specified by #setVideoURI and #setVideoPath
180 * in milliseconds.
Sungsoo Lime3259042018-01-16 09:25:28 +0900181 */
182 public int getDuration() {
183 return mProvider.getDuration_impl();
184 }
185
186 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900187 * Gets current playback position in milliseconds.
Sungsoo Lime3259042018-01-16 09:25:28 +0900188 */
189 public int getCurrentPosition() {
190 return mProvider.getCurrentPosition_impl();
191 }
192
Insun Kangeb78d512018-01-22 18:04:07 +0900193 // TODO: mention about key-frame related behavior.
Sungsoo Lime3259042018-01-16 09:25:28 +0900194 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900195 * Moves the media by specified time position.
196 * @param msec the offset in milliseconds from the start to seek to.
Sungsoo Lime3259042018-01-16 09:25:28 +0900197 */
198 public void seekTo(int msec) {
199 mProvider.seekTo_impl(msec);
200 }
201
202 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900203 * Says if the media is currently playing.
204 * @return true if the media is playing, false if it is not (eg. paused or stopped).
Sungsoo Lime3259042018-01-16 09:25:28 +0900205 */
206 public boolean isPlaying() {
207 return mProvider.isPlaying_impl();
208 }
209
Insun Kangeb78d512018-01-22 18:04:07 +0900210 // TODO: check what will return if it is a local media.
Sungsoo Lime3259042018-01-16 09:25:28 +0900211 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900212 * Gets the percentage (0-100) of the content that has been buffered or played so far.
Sungsoo Lime3259042018-01-16 09:25:28 +0900213 */
214 public int getBufferPercentage() {
215 return mProvider.getBufferPercentage_impl();
216 }
217
218 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900219 * Returns the audio session ID.
Sungsoo Lime3259042018-01-16 09:25:28 +0900220 */
221 public int getAudioSessionId() {
222 return mProvider.getAudioSessionId_impl();
223 }
224
225 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900226 * Starts rendering closed caption or subtitles if there is any. The first subtitle track will
227 * be chosen by default if there multiple subtitle tracks exist.
Sungsoo Lime3259042018-01-16 09:25:28 +0900228 */
229 public void showSubtitle() {
230 mProvider.showSubtitle_impl();
231 }
232
233 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900234 * Stops showing closed captions or subtitles.
Sungsoo Lime3259042018-01-16 09:25:28 +0900235 */
236 public void hideSubtitle() {
237 mProvider.hideSubtitle_impl();
238 }
239
Insun Kangeb78d512018-01-22 18:04:07 +0900240 // TODO: This should be revised after integration with MediaPlayer2.
Sungsoo Lime3259042018-01-16 09:25:28 +0900241 /**
Insun Kangde16c4d2018-01-17 23:06:18 +0900242 * Sets playback speed.
243 *
244 * It is expressed as a multiplicative factor, where normal speed is 1.0f. If it is less than
245 * or equal to zero, it will be just ignored and nothing will be changed. If it exceeds the
246 * maximum speed that internal engine supports, system will determine best handling or it will
247 * be reset to the normal speed 1.0f.
Insun Kangde16c4d2018-01-17 23:06:18 +0900248 * @param speed the playback speed. It should be positive.
Insun Kangde16c4d2018-01-17 23:06:18 +0900249 */
250 public void setSpeed(float speed) {
251 mProvider.setSpeed_impl(speed);
252 }
253
254 /**
255 * Returns current speed setting.
256 *
257 * If setSpeed() has never been called, returns the default value 1.0f.
258 * @return current speed setting
Insun Kangde16c4d2018-01-17 23:06:18 +0900259 */
260 public float getSpeed() {
261 return mProvider.getSpeed_impl();
262 }
263
264 /**
265 * Sets which type of audio focus will be requested during the playback, or configures playback
266 * to not request audio focus. Valid values for focus requests are
267 * {@link AudioManager#AUDIOFOCUS_GAIN}, {@link AudioManager#AUDIOFOCUS_GAIN_TRANSIENT},
268 * {@link AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK}, and
269 * {@link AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE}. Or use
270 * {@link AudioManager#AUDIOFOCUS_NONE} to express that audio focus should not be
271 * requested when playback starts. You can for instance use this when playing a silent animation
272 * through this class, and you don't want to affect other audio applications playing in the
273 * background.
274 *
275 * @param focusGain the type of audio focus gain that will be requested, or
Sungsoo Limaf2a1ad2018-01-24 11:36:10 +0900276 * {@link AudioManager#AUDIOFOCUS_NONE} to disable the use audio focus during
277 * playback.
Sungsoo Lime3259042018-01-16 09:25:28 +0900278 */
279 public void setAudioFocusRequest(int focusGain) {
280 mProvider.setAudioFocusRequest_impl(focusGain);
281 }
282
283 /**
Insun Kangde16c4d2018-01-17 23:06:18 +0900284 * Sets the {@link AudioAttributes} to be used during the playback of the video.
285 *
286 * @param attributes non-null <code>AudioAttributes</code>.
Sungsoo Lime3259042018-01-16 09:25:28 +0900287 */
288 public void setAudioAttributes(@NonNull AudioAttributes attributes) {
289 mProvider.setAudioAttributes_impl(attributes);
290 }
291
292 /**
Sungsoo Limaf2a1ad2018-01-24 11:36:10 +0900293 * Sets a remote player for handling playback of the selected route from MediaControlView2.
294 * If this is not called, MediaCotrolView2 will not show the route button.
295 *
296 * @param routeCategories the list of media control categories in
297 * {@link android.support.v7.media.MediaControlIntent}
298 * @param player the player to handle the selected route. If null, a default
299 * route player will be used.
300 * @throws IllegalStateException if MediaControlView2 is not set.
301 */
302 public void setRouteAttributes(@NonNull List<String> routeCategories,
303 @Nullable MediaPlayerBase player) {
304 mProvider.setRouteAttributes_impl(routeCategories, player);
305 }
306
307 /**
Insun Kangde16c4d2018-01-17 23:06:18 +0900308 * Sets video path.
309 *
310 * @param path the path of the video.
Sungsoo Lime3259042018-01-16 09:25:28 +0900311 */
312 public void setVideoPath(String path) {
313 mProvider.setVideoPath_impl(path);
314 }
315
316 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900317 * Sets video URI.
318 *
319 * @param uri the URI of the video.
Sungsoo Lime3259042018-01-16 09:25:28 +0900320 */
321 public void setVideoURI(Uri uri) {
322 mProvider.setVideoURI_impl(uri);
323 }
324
325 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900326 * Sets video URI using specific headers.
327 *
328 * @param uri the URI of the video.
329 * @param headers the headers for the URI request.
330 * Note that the cross domain redirection is allowed by default, but that can be
331 * changed with key/value pairs through the headers parameter with
332 * "android-allow-cross-domain-redirect" as the key and "0" or "1" as the value
333 * to disallow or allow cross domain redirection.
Sungsoo Lime3259042018-01-16 09:25:28 +0900334 */
335 public void setVideoURI(Uri uri, Map<String, String> headers) {
336 mProvider.setVideoURI_impl(uri, headers);
337 }
338
339 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900340 * Selects which view will be used to render video between SurfacView and TextureView.
341 *
342 * @param viewType the view type to render video
343 * <ul>
344 * <li>{@link #VIEW_TYPE_SURFACEVIEW}
345 * <li>{@link #VIEW_TYPE_TEXTUREVIEW}
346 * </ul>
Sungsoo Lime3259042018-01-16 09:25:28 +0900347 */
Sungsoo Lime3259042018-01-16 09:25:28 +0900348 public void setViewType(@ViewType int viewType) {
349 mProvider.setViewType_impl(viewType);
350 }
351
352 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900353 * Returns view type.
354 *
355 * @return view type. See {@see setViewType}.
Sungsoo Lime3259042018-01-16 09:25:28 +0900356 */
357 @ViewType
358 public int getViewType() {
359 return mProvider.getViewType_impl();
360 }
361
362 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900363 * Stops playback and release all the resources. This should be called whenever a VideoView2
364 * instance is no longer to be used.
Sungsoo Lime3259042018-01-16 09:25:28 +0900365 */
366 public void stopPlayback() {
367 mProvider.stopPlayback_impl();
368 }
369
370 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900371 * Registers a callback to be invoked when the media file is loaded and ready to go.
372 *
373 * @param l the callback that will be run.
Sungsoo Lime3259042018-01-16 09:25:28 +0900374 */
Insun Kangde16c4d2018-01-17 23:06:18 +0900375 public void setOnPreparedListener(OnPreparedListener l) {
Sungsoo Lime3259042018-01-16 09:25:28 +0900376 mProvider.setOnPreparedListener_impl(l);
377 }
378
379 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900380 * Registers a callback to be invoked when the end of a media file has been reached during
381 * playback.
382 *
383 * @param l the callback that will be run.
Sungsoo Lime3259042018-01-16 09:25:28 +0900384 */
Insun Kangde16c4d2018-01-17 23:06:18 +0900385 public void setOnCompletionListener(OnCompletionListener l) {
Sungsoo Lime3259042018-01-16 09:25:28 +0900386 mProvider.setOnCompletionListener_impl(l);
387 }
388
389 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900390 * Registers a callback to be invoked when an error occurs during playback or setup. If no
391 * listener is specified, or if the listener returned false, VideoView2 will inform the user of
392 * any errors.
393 *
394 * @param l The callback that will be run
Sungsoo Lime3259042018-01-16 09:25:28 +0900395 */
Insun Kangde16c4d2018-01-17 23:06:18 +0900396 public void setOnErrorListener(OnErrorListener l) {
Sungsoo Lime3259042018-01-16 09:25:28 +0900397 mProvider.setOnErrorListener_impl(l);
398 }
399
400 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900401 * Registers a callback to be invoked when an informational event occurs during playback or
402 * setup.
403 *
404 * @param l The callback that will be run
Sungsoo Lime3259042018-01-16 09:25:28 +0900405 */
Insun Kangde16c4d2018-01-17 23:06:18 +0900406 public void setOnInfoListener(OnInfoListener l) {
Sungsoo Lime3259042018-01-16 09:25:28 +0900407 mProvider.setOnInfoListener_impl(l);
408 }
409
410 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900411 * Registers a callback to be invoked when a view type change is done.
412 * {@see #setViewType(int)}
413 * @param l The callback that will be run
Sungsoo Lime3259042018-01-16 09:25:28 +0900414 */
415 public void setOnViewTypeChangedListener(OnViewTypeChangedListener l) {
416 mProvider.setOnViewTypeChangedListener_impl(l);
417 }
418
419 /**
Insun Kangde16c4d2018-01-17 23:06:18 +0900420 * Interface definition of a callback to be invoked when the viw type has been changed.
Sungsoo Lime3259042018-01-16 09:25:28 +0900421 */
422 public interface OnViewTypeChangedListener {
423 /**
Insun Kangde16c4d2018-01-17 23:06:18 +0900424 * Called when the view type has been changed.
Insun Kangeb78d512018-01-22 18:04:07 +0900425 * @see #setViewType(int)
426 * @param viewType
427 * <ul>
428 * <li>{@link #VIEW_TYPE_SURFACEVIEW}
429 * <li>{@link #VIEW_TYPE_TEXTUREVIEW}
430 * </ul>
Sungsoo Lime3259042018-01-16 09:25:28 +0900431 */
432 void onViewTypeChanged(@ViewType int viewType);
433 }
434
Insun Kangde16c4d2018-01-17 23:06:18 +0900435 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900436 * Interface definition of a callback to be invoked when the media source is ready for playback.
Insun Kangde16c4d2018-01-17 23:06:18 +0900437 */
438 public interface OnPreparedListener {
439 /**
440 * Called when the media file is ready for playback.
441 */
442 void onPrepared();
443 }
444
445 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900446 * Interface definition for a callback to be invoked when playback of a media source has
447 * completed.
Insun Kangde16c4d2018-01-17 23:06:18 +0900448 */
449 public interface OnCompletionListener {
450 /**
451 * Called when the end of a media source is reached during playback.
452 */
453 void onCompletion();
454 }
455
456 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900457 * Interface definition of a callback to be invoked when there has been an error during an
458 * asynchronous operation.
Insun Kangde16c4d2018-01-17 23:06:18 +0900459 */
460 public interface OnErrorListener {
Insun Kangeb78d512018-01-22 18:04:07 +0900461 // TODO: Redefine error codes.
Insun Kangde16c4d2018-01-17 23:06:18 +0900462 /**
463 * Called to indicate an error.
Insun Kangeb78d512018-01-22 18:04:07 +0900464 * @param what the type of error that has occurred
465 * @param extra an extra code, specific to the error.
466 * @return true if the method handled the error, false if it didn't.
467 * @see MediaPlayer#OnErrorListener
Insun Kangde16c4d2018-01-17 23:06:18 +0900468 */
469 boolean onError(int what, int extra);
470 }
471
472 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900473 * Interface definition of a callback to be invoked to communicate some info and/or warning
474 * about the media or its playback.
Insun Kangde16c4d2018-01-17 23:06:18 +0900475 */
476 public interface OnInfoListener {
477 /**
478 * Called to indicate an info or a warning.
Insun Kangde16c4d2018-01-17 23:06:18 +0900479 * @param what the type of info or warning.
480 * @param extra an extra code, specific to the info.
Insun Kangeb78d512018-01-22 18:04:07 +0900481 *
482 * @see MediaPlayer#OnInfoListener
Insun Kangde16c4d2018-01-17 23:06:18 +0900483 */
484 void onInfo(int what, int extra);
485 }
486
Sungsoo Lime3259042018-01-16 09:25:28 +0900487 @Override
Insun Kangfd3fdfd2018-01-23 15:01:37 +0900488 protected void onAttachedToWindow() {
489 mProvider.onAttachedToWindow_impl();
490 }
491
492 @Override
493 protected void onDetachedFromWindow() {
494 mProvider.onDetachedFromWindow_impl();
495 }
496
497 @Override
Sungsoo Lime3259042018-01-16 09:25:28 +0900498 public CharSequence getAccessibilityClassName() {
499 return mProvider.getAccessibilityClassName_impl();
500 }
501
502 @Override
503 public boolean onTouchEvent(MotionEvent ev) {
504 return mProvider.onTouchEvent_impl(ev);
505 }
506
507 @Override
508 public boolean onTrackballEvent(MotionEvent ev) {
509 return mProvider.onTrackballEvent_impl(ev);
510 }
511
512 @Override
513 public boolean onKeyDown(int keyCode, KeyEvent event) {
514 return mProvider.onKeyDown_impl(keyCode, event);
515 }
516
517 @Override
518 public void onFinishInflate() {
519 mProvider.onFinishInflate_impl();
520 }
521
522 @Override
523 public boolean dispatchKeyEvent(KeyEvent event) {
524 return mProvider.dispatchKeyEvent_impl(event);
525 }
526
527 @Override
528 public void setEnabled(boolean enabled) {
529 mProvider.setEnabled_impl(enabled);
530 }
531
532 private class SuperProvider implements ViewProvider {
533 @Override
Insun Kangfd3fdfd2018-01-23 15:01:37 +0900534 public void onAttachedToWindow_impl() {
535 VideoView2.super.onAttachedToWindow();
536 }
537
538 @Override
539 public void onDetachedFromWindow_impl() {
540 VideoView2.super.onDetachedFromWindow();
541 }
542
543 @Override
Sungsoo Lime3259042018-01-16 09:25:28 +0900544 public CharSequence getAccessibilityClassName_impl() {
545 return VideoView2.super.getAccessibilityClassName();
546 }
547
548 @Override
549 public boolean onTouchEvent_impl(MotionEvent ev) {
550 return VideoView2.super.onTouchEvent(ev);
551 }
552
553 @Override
554 public boolean onTrackballEvent_impl(MotionEvent ev) {
555 return VideoView2.super.onTrackballEvent(ev);
556 }
557
558 @Override
559 public boolean onKeyDown_impl(int keyCode, KeyEvent event) {
560 return VideoView2.super.onKeyDown(keyCode, event);
561 }
562
563 @Override
564 public void onFinishInflate_impl() {
565 VideoView2.super.onFinishInflate();
566 }
567
568 @Override
569 public boolean dispatchKeyEvent_impl(KeyEvent event) {
570 return VideoView2.super.dispatchKeyEvent(event);
571 }
572
573 @Override
574 public void setEnabled_impl(boolean enabled) {
575 VideoView2.super.setEnabled(enabled);
576 }
577 }
578}