From 82f8756b288c0a5be585ca815e5228a16acb21f7 Mon Sep 17 00:00:00 2001 From: Daniel Yu Date: Tue, 5 Apr 2016 13:46:49 -0700 Subject: [PATCH] docs: Updating PIP N preview docs for DP2 Updates for MW and PIP API name changes. Doc changes will get published when DP2 is released (and not before). Also added updates based on reviewers' suggestions. Bug: 28004022 Change-Id: Ie873be3d1d7238b387dc09f28cf5286c9f448115 --- .../preview/features/picture-in-picture.jd | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/html/preview/features/picture-in-picture.jd b/docs/html/preview/features/picture-in-picture.jd index 106ad8b7f065d..893f8c1ca568b 100644 --- a/docs/html/preview/features/picture-in-picture.jd +++ b/docs/html/preview/features/picture-in-picture.jd @@ -99,15 +99,15 @@ in the PIP window.

Switching Your Activity to Picture-in-picture

When you need to switch your activity into PIP mode, call -Activity.enterPictureInPicture(). The following example switches -to PIP mode when the user selects a dedicated PIP button on a media control -bar:

+Activity.enterPictureInPictureMode(). The following example +switches to PIP mode when the user selects a dedicated PIP button on a media +control bar:

 @Override
 public void onActionClicked(Action action) {
     if (action.getId() == R.id.lb_control_picture_in_picture) {
-        getActivity().enterPictureInPicture();
+        getActivity().enterPictureInPictureMode();
         return;
     }
     ...
@@ -129,14 +129,14 @@ control bar PIP actions and uses the PIP icon.

When your activity enters PIP mode, your activity should only show video playback. Remove UI elements before your activity enters PIP, and restore these elements when your activity becomes full-screen again. -Override Activity.onPictureInPictureChanged() or -Fragment.onPictureInPictureChanged() and enable or +Override Activity.onPictureInPictureModeChanged() or +Fragment.onPictureInPictureModeChanged() and enable or disable your UI elements as needed, for example:

 @Override
-public void onPictureInPictureChanged(boolean inPictureInPicture) {
-    if (inPictureInPicture) {
+public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
+    if (isInPictureInPictureMode) {
         // Hide the controls in picture-in-picture mode.
         ...
     } else {
@@ -159,8 +159,8 @@ example:

 @Override
 public void onPause() {
-    // If called due to PIP, do not pause playback
-    if (inPictureInPicture()) {
+    // If called while in PIP mode, do not pause playback
+    if (isInPictureInPictureMode()) {
         // Continue playback
         ...
     }