Merge "Renamed Activity class multi-window APIs"
This commit is contained in:
committed by
Android (Google) Code Review
commit
cd7ce74e67
@@ -20,7 +20,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PlaybackOverlayActivity extends Activity {
|
public class PlaybackOverlayActivity extends Activity {
|
||||||
private List<PictureInPictureModeListener> mListeners = new ArrayList<>();
|
private List<PictureInPictureListener> mListeners = new ArrayList<>();
|
||||||
|
|
||||||
/** Called when the activity is first created. */
|
/** Called when the activity is first created. */
|
||||||
@Override
|
@Override
|
||||||
@@ -31,21 +31,21 @@ public class PlaybackOverlayActivity extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPictureInPictureModeChanged(boolean pictureInPictureMode) {
|
public void onPictureInPictureChanged(boolean inPictureInPicture) {
|
||||||
for (PictureInPictureModeListener listener : mListeners) {
|
for (PictureInPictureListener listener : mListeners) {
|
||||||
listener.onPictureInPictureModeChanged(pictureInPictureMode);
|
listener.onPictureInPictureChanged(inPictureInPicture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerPictureInPictureModeListener(PictureInPictureModeListener listener) {
|
public void registerPictureInPictureListener(PictureInPictureListener listener) {
|
||||||
mListeners.add(listener);
|
mListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unregisterPictureInPictureModeListener(PictureInPictureModeListener listener) {
|
public void unregisterPictureInPictureListener(PictureInPictureListener listener) {
|
||||||
mListeners.remove(listener);
|
mListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface PictureInPictureModeListener {
|
public interface PictureInPictureListener {
|
||||||
void onPictureInPictureModeChanged(boolean pictureInPictureMode);
|
void onPictureInPictureChanged(boolean inPictureInPicture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
public class PlaybackOverlayFragment
|
public class PlaybackOverlayFragment
|
||||||
extends android.support.v17.leanback.app.PlaybackOverlayFragment
|
extends android.support.v17.leanback.app.PlaybackOverlayFragment
|
||||||
implements PlaybackOverlayActivity.PictureInPictureModeListener {
|
implements PlaybackOverlayActivity.PictureInPictureListener {
|
||||||
private static final String TAG = "leanback.PlaybackControlsFragment";
|
private static final String TAG = "leanback.PlaybackControlsFragment";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,7 +127,7 @@ public class PlaybackOverlayFragment
|
|||||||
@Override
|
@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().enterPictureInPictureMode();
|
getActivity().enterPictureInPicture();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
super.onActionClicked(action);
|
super.onActionClicked(action);
|
||||||
@@ -171,19 +171,19 @@ public class PlaybackOverlayFragment
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
mGlue.setFadingEnabled(true);
|
mGlue.setFadingEnabled(true);
|
||||||
mGlue.enableProgressUpdating(mGlue.hasValidMedia() && mGlue.isMediaPlaying());
|
mGlue.enableProgressUpdating(mGlue.hasValidMedia() && mGlue.isMediaPlaying());
|
||||||
((PlaybackOverlayActivity) getActivity()).registerPictureInPictureModeListener(this);
|
((PlaybackOverlayActivity) getActivity()).registerPictureInPictureListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
mGlue.enableProgressUpdating(false);
|
mGlue.enableProgressUpdating(false);
|
||||||
((PlaybackOverlayActivity) getActivity()).unregisterPictureInPictureModeListener(this);
|
((PlaybackOverlayActivity) getActivity()).unregisterPictureInPictureListener(this);
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPictureInPictureModeChanged(boolean pictureInPictureMode) {
|
public void onPictureInPictureChanged(boolean inPictureInPicture) {
|
||||||
if (pictureInPictureMode) {
|
if (inPictureInPicture) {
|
||||||
// Hide the controls in picture-in-picture mode.
|
// Hide the controls in picture-in-picture mode.
|
||||||
setFadingEnabled(true);
|
setFadingEnabled(true);
|
||||||
fadeOut();
|
fadeOut();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PlaybackOverlaySupportActivity extends FragmentActivity {
|
public class PlaybackOverlaySupportActivity extends FragmentActivity {
|
||||||
private List<PictureInPictureModeListener> mListeners = new ArrayList<>();
|
private List<PictureInPictureListener> mListeners = new ArrayList<>();
|
||||||
|
|
||||||
/** Called when the activity is first created. */
|
/** Called when the activity is first created. */
|
||||||
@Override
|
@Override
|
||||||
@@ -33,21 +33,21 @@ public class PlaybackOverlaySupportActivity extends FragmentActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPictureInPictureModeChanged(boolean pictureInPictureMode) {
|
public void onPictureInPictureChanged(boolean inPictureInPicture) {
|
||||||
for (PictureInPictureModeListener listener : mListeners) {
|
for (PictureInPictureListener listener : mListeners) {
|
||||||
listener.onPictureInPictureModeChanged(pictureInPictureMode);
|
listener.onPictureInPictureChanged(inPictureInPicture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerPictureInPictureModeListener(PictureInPictureModeListener listener) {
|
public void registerPictureInPictureListener(PictureInPictureListener listener) {
|
||||||
mListeners.add(listener);
|
mListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unregisterPictureInPictureModeListener(PictureInPictureModeListener listener) {
|
public void unregisterPictureInPictureListener(PictureInPictureListener listener) {
|
||||||
mListeners.remove(listener);
|
mListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface PictureInPictureModeListener {
|
public interface PictureInPictureListener {
|
||||||
void onPictureInPictureModeChanged(boolean pictureInPictureMode);
|
void onPictureInPictureChanged(boolean inPictureInPicture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
public class PlaybackOverlaySupportFragment
|
public class PlaybackOverlaySupportFragment
|
||||||
extends android.support.v17.leanback.app.PlaybackOverlaySupportFragment
|
extends android.support.v17.leanback.app.PlaybackOverlaySupportFragment
|
||||||
implements PlaybackOverlaySupportActivity.PictureInPictureModeListener {
|
implements PlaybackOverlaySupportActivity.PictureInPictureListener {
|
||||||
private static final String TAG = "leanback.PlaybackControlsFragment";
|
private static final String TAG = "leanback.PlaybackControlsFragment";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,7 +129,7 @@ public class PlaybackOverlaySupportFragment
|
|||||||
@Override
|
@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().enterPictureInPictureMode();
|
getActivity().enterPictureInPicture();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
super.onActionClicked(action);
|
super.onActionClicked(action);
|
||||||
@@ -173,20 +173,20 @@ public class PlaybackOverlaySupportFragment
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
mGlue.setFadingEnabled(true);
|
mGlue.setFadingEnabled(true);
|
||||||
mGlue.enableProgressUpdating(mGlue.hasValidMedia() && mGlue.isMediaPlaying());
|
mGlue.enableProgressUpdating(mGlue.hasValidMedia() && mGlue.isMediaPlaying());
|
||||||
((PlaybackOverlaySupportActivity) getActivity()).registerPictureInPictureModeListener(this);
|
((PlaybackOverlaySupportActivity) getActivity()).registerPictureInPictureListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
mGlue.enableProgressUpdating(false);
|
mGlue.enableProgressUpdating(false);
|
||||||
((PlaybackOverlaySupportActivity) getActivity()).unregisterPictureInPictureModeListener(
|
((PlaybackOverlaySupportActivity) getActivity()).unregisterPictureInPictureListener(
|
||||||
this);
|
this);
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPictureInPictureModeChanged(boolean pictureInPictureMode) {
|
public void onPictureInPictureChanged(boolean inPictureInPicture) {
|
||||||
if (pictureInPictureMode) {
|
if (inPictureInPicture) {
|
||||||
// Hide the controls in picture-in-picture mode.
|
// Hide the controls in picture-in-picture mode.
|
||||||
setFadingEnabled(true);
|
setFadingEnabled(true);
|
||||||
fadeOut();
|
fadeOut();
|
||||||
|
|||||||
Reference in New Issue
Block a user