1 // CHECKSTYLE:OFF Generated code 2 /* This file is auto-generated from PlaybackTransportControlActivity.java. DO NOT MODIFY. */ 3 4 /* 5 * Copyright (C) 2016 The Android Open Source Project 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20 package com.example.android.leanback; 21 22 import android.support.v4.app.FragmentActivity; 23 import android.os.Bundle; 24 25 import java.util.ArrayList; 26 import java.util.List; 27 28 /** 29 * Host PlaybackFragment and provide PIP events. 30 */ 31 public class PlaybackTransportControlSupportActivity extends FragmentActivity { 32 private List<PictureInPictureListener> mListeners = new ArrayList<>(); 33 34 /** Called when the activity is first created. */ 35 @Override 36 public void onCreate(Bundle savedInstanceState) { 37 super.onCreate(savedInstanceState); 38 setContentView(R.layout.playback_transportcontrol_activity_support); 39 } 40 41 @Override 42 public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) { 43 for (PictureInPictureListener listener : mListeners) { 44 listener.onPictureInPictureModeChanged(isInPictureInPictureMode); 45 } 46 } 47 48 /** 49 * Register a PIP listener. 50 */ 51 public void registerPictureInPictureListener(PictureInPictureListener listener) { 52 mListeners.add(listener); 53 } 54 55 /** 56 * Unregister a PIP listener. 57 */ 58 public void unregisterPictureInPictureListener(PictureInPictureListener listener) { 59 mListeners.remove(listener); 60 } 61 62 /** 63 * Interface of PIP event on Activity. 64 */ 65 public interface PictureInPictureListener { 66 /** 67 * Called when Activity's PIP mode is changed. 68 */ 69 void onPictureInPictureModeChanged(boolean isInPictureInPictureMode); 70 } 71 } 72