summaryrefslogtreecommitdiff
path: root/core/java/android/widget/MediaControlView2.java
diff options
context:
space:
mode:
authorJin Seok Park <jinpark@google.com>2018-01-24 06:35:28 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-01-24 06:35:28 +0000
commit8b314b2b5dcbba49dae55eadced4a968beeffff7 (patch)
tree9fa98ed88c3601880904e1c2f97423b84df66552 /core/java/android/widget/MediaControlView2.java
parentaf1113242b6f2f349dda5c9501278ddfd100f211 (diff)
parentd9ce1bce82d1e4224351a833614f72825614704f (diff)
Merge "Add API documentation for MediaControlView2"
Diffstat (limited to 'core/java/android/widget/MediaControlView2.java')
-rw-r--r--core/java/android/widget/MediaControlView2.java55
1 files changed, 35 insertions, 20 deletions
diff --git a/core/java/android/widget/MediaControlView2.java b/core/java/android/widget/MediaControlView2.java
index 0aa2b64dfc4a..42ba61b1b933 100644
--- a/core/java/android/widget/MediaControlView2.java
+++ b/core/java/android/widget/MediaControlView2.java
@@ -28,6 +28,21 @@ import android.view.KeyEvent;
import android.view.MotionEvent;
/**
+ * A View that contains the controls for MediaPlayer2.
+ * It provides a wide range of UI including buttons such as "Play/Pause", "Rewind", "Fast Forward",
+ * "Subtitle", "Full Screen", and it is also possible to add multiple custom buttons.
+ *
+ * <p>
+ * <em> MediaControlView2 can be initialized in two different ways: </em>
+ * 1) When VideoView2 is initialized, it automatically initializes a MediaControlView2 instance and
+ * adds it to the view.
+ * 2) Initialize MediaControlView2 programmatically and add it to a ViewGroup instance.
+ *
+ * In the first option, VideoView2 automatically connects MediaControlView2 to MediaController2,
+ * which is necessary to communicate with MediaSession2. In the second option, however, the
+ * developer needs to manually retrieve a MediaController2 instance and set it to MediaControlView2
+ * by calling setController(MediaController2 controller).
+ *
* TODO PUBLIC API
* @hide
*/
@@ -55,103 +70,103 @@ public class MediaControlView2 extends FrameLayout {
.createMediaControlView2(this, new SuperProvider());
}
+ /**
+ * @hide
+ */
public MediaControlView2Provider getProvider() {
return mProvider;
}
/**
- * TODO: add docs
+ * Sets MediaController2 instance to control corresponding MediaSession2.
*/
public void setController(MediaController controller) {
mProvider.setController_impl(controller);
}
/**
- * TODO: add docs
+ * Shows the control view on screen. It will disappear automatically after 3 seconds of
+ * inactivity.
*/
public void show() {
mProvider.show_impl();
}
/**
- * TODO: add docs
+ * Shows the control view on screen. It will disappear automatically after {@code timeout}
+ * milliseconds of inactivity.
*/
public void show(int timeout) {
mProvider.show_impl(timeout);
}
/**
- * TODO: add docs
+ * Returns whether the control view is currently shown or hidden.
*/
public boolean isShowing() {
return mProvider.isShowing_impl();
}
/**
- * TODO: add docs
+ * Hide the control view from the screen.
*/
public void hide() {
mProvider.hide_impl();
}
/**
- * TODO: add docs
- */
- public void showCCButton() {
- mProvider.showCCButton_impl();
- }
-
- /**
- * TODO: add docs
+ * Returns whether the media is currently playing or not.
*/
public boolean isPlaying() {
return mProvider.isPlaying_impl();
}
/**
- * TODO: add docs
+ * Returns the current position of the media in milliseconds.
*/
public int getCurrentPosition() {
return mProvider.getCurrentPosition_impl();
}
/**
- * TODO: add docs
+ * Returns the percentage of how much of the media is currently buffered in storage.
*/
public int getBufferPercentage() {
return mProvider.getBufferPercentage_impl();
}
/**
- * TODO: add docs
+ * Returns whether the media can be paused or not.
*/
public boolean canPause() {
return mProvider.canPause_impl();
}
/**
- * TODO: add docs
+ * Returns whether the media can be rewound or not.
*/
public boolean canSeekBackward() {
return mProvider.canSeekBackward_impl();
}
/**
- * TODO: add docs
+ * Returns whether the media can be fast-forwarded or not.
*/
public boolean canSeekForward() {
return mProvider.canSeekForward_impl();
}
/**
- * TODO: add docs
+ * If the media selected has a subtitle track, calling this method will display the subtitle at
+ * the bottom of the view. If a media has multiple subtitle tracks, this method will select the
+ * first one of them.
*/
public void showSubtitle() {
mProvider.showSubtitle_impl();
}
/**
- * TODO: add docs
+ * Hides the currently displayed subtitle.
*/
public void hideSubtitle() {
mProvider.hideSubtitle_impl();