1835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout/* 2835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout * Copyright (C) 2014 The Android Open Source Project 3835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout * 4835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout * in compliance with the License. You may obtain a copy of the License at 6835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout * 7835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout * http://www.apache.org/licenses/LICENSE-2.0 8835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout * 9835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout * Unless required by applicable law or agreed to in writing, software distributed under the License 10835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout * or implied. See the License for the specific language governing permissions and limitations under 12835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout * the License. 13835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout */ 14835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stoutpackage com.example.android.leanback; 15835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout 16835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stoutimport android.app.Activity; 17835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stoutimport android.os.Bundle; 18835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout 19c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kangimport java.util.ArrayList; 20c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kangimport java.util.List; 21c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang 2265a34663cf08f17738720000ee9900fe714578efDongwon Kangpublic class PlaybackOverlayActivity extends Activity { 23c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang private List<PictureInPictureListener> mListeners = new ArrayList<>(); 2465a34663cf08f17738720000ee9900fe714578efDongwon Kang 25835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout /** Called when the activity is first created. */ 26835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout @Override 27835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout public void onCreate(Bundle savedInstanceState) 28835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout { 29835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout super.onCreate(savedInstanceState); 30835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout setContentView(R.layout.playback_controls); 31835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout } 32c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang 33c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang @Override 34fa89d61337d39582448bd60ee66782c8e5265e7dAndrii Kulian public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) { 35c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang for (PictureInPictureListener listener : mListeners) { 36fa89d61337d39582448bd60ee66782c8e5265e7dAndrii Kulian listener.onPictureInPictureModeChanged(isInPictureInPictureMode); 37c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang } 38c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang } 39c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang 40c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang public void registerPictureInPictureListener(PictureInPictureListener listener) { 41c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang mListeners.add(listener); 42c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang } 43c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang 44c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang public void unregisterPictureInPictureListener(PictureInPictureListener listener) { 45c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang mListeners.remove(listener); 46c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang } 47c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang 48c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang public interface PictureInPictureListener { 49fa89d61337d39582448bd60ee66782c8e5265e7dAndrii Kulian void onPictureInPictureModeChanged(boolean isInPictureInPictureMode); 50c383f2f8ce9251819d7417a68e18f5bc57de9f0cDongwon Kang } 51835d13d3009a3e27652179e0f2f7bd87da81c1b6Craig Stout} 52