Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82f8756b authored by Daniel Yu's avatar Daniel Yu
Browse files

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
parent 7c909cc8
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -99,15 +99,15 @@ in the PIP window.</p>
<h2 id="pip_button">Switching Your Activity to Picture-in-picture</h2>
<h2 id="pip_button">Switching Your Activity to Picture-in-picture</h2>


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


<pre>
<pre>
&#64;Override
&#64;Override
public void onActionClicked(Action action) {
public void onActionClicked(Action action) {
    if (action.getId() == R.id.lb_control_picture_in_picture) {
    if (action.getId() == R.id.lb_control_picture_in_picture) {
        getActivity().enterPictureInPicture();
        getActivity().enterPictureInPictureMode();
        return;
        return;
    }
    }
    ...
    ...
@@ -129,14 +129,14 @@ control bar PIP actions and uses the PIP icon.</p>
<p>When your activity enters PIP mode, your activity should only show video
<p>When your activity enters PIP mode, your activity should only show video
playback. Remove UI elements before your activity enters PIP,
playback. Remove UI elements before your activity enters PIP,
and restore these elements when your activity becomes full-screen again.
and restore these elements when your activity becomes full-screen again.
Override <code>Activity.onPictureInPictureChanged()</code> or
Override <code>Activity.onPictureInPictureModeChanged()</code> or
<code>Fragment.onPictureInPictureChanged()</code> and enable or
<code>Fragment.onPictureInPictureModeChanged()</code> and enable or
disable your UI elements as needed, for example:</p>
disable your UI elements as needed, for example:</p>


<pre>
<pre>
&#64;Override
&#64;Override
public void onPictureInPictureChanged(boolean inPictureInPicture) {
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
    if (inPictureInPicture) {
    if (isInPictureInPictureMode) {
        // Hide the controls in picture-in-picture mode.
        // Hide the controls in picture-in-picture mode.
        ...
        ...
    } else {
    } else {
@@ -159,8 +159,8 @@ example:</p>
<pre>
<pre>
&#64;Override
&#64;Override
public void onPause() {
public void onPause() {
    // If called due to PIP, do not pause playback
    // If called while in PIP mode, do not pause playback
    if (inPictureInPicture()) {
    if (isInPictureInPictureMode()) {
        // Continue playback
        // Continue playback
        ...
        ...
    }
    }