Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.systemui.tv.pip; |
| 18 | |
| 19 | import android.app.Activity; |
Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 20 | import android.os.Bundle; |
Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 21 | |
| 22 | import com.android.systemui.R; |
Jaewan Kim | 6233819 | 2016-02-25 10:00:05 -0800 | [diff] [blame] | 23 | |
Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 24 | /** |
| 25 | * Activity to show the PIP menu to control PIP. |
| 26 | */ |
| 27 | public class PipMenuActivity extends Activity implements PipManager.Listener { |
| 28 | private static final String TAG = "PipMenuActivity"; |
Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 29 | |
| 30 | private final PipManager mPipManager = PipManager.getInstance(); |
Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 31 | |
Jaewan Kim | 8f584b8 | 2016-03-22 22:16:59 +0900 | [diff] [blame] | 32 | private PipControlsView mPipControlsView; |
Jaewan Kim | 1a9dc56 | 2016-02-17 13:41:51 -0800 | [diff] [blame] | 33 | |
Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 34 | @Override |
| 35 | protected void onCreate(Bundle bundle) { |
| 36 | super.onCreate(bundle); |
| 37 | setContentView(R.layout.tv_pip_menu); |
| 38 | mPipManager.addListener(this); |
Jaewan Kim | 1a9dc56 | 2016-02-17 13:41:51 -0800 | [diff] [blame] | 39 | |
Jaewan Kim | 8f584b8 | 2016-03-22 22:16:59 +0900 | [diff] [blame] | 40 | mPipControlsView = (PipControlsView) findViewById(R.id.pip_controls); |
Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 41 | } |
| 42 | |
Jaewan Kim | 9c23b28 | 2016-02-25 20:04:12 -0800 | [diff] [blame] | 43 | @Override |
| 44 | public void onPause() { |
| 45 | super.onPause(); |
Jaewan Kim | a0d4d25 | 2016-03-31 13:37:10 +0900 | [diff] [blame] | 46 | finish(); |
Jaewan Kim | 9c23b28 | 2016-02-25 20:04:12 -0800 | [diff] [blame] | 47 | } |
| 48 | |
Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 49 | @Override |
| 50 | protected void onDestroy() { |
Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 51 | super.onDestroy(); |
Wale Ogunwale | 480dca0 | 2016-02-06 13:58:29 -0800 | [diff] [blame] | 52 | mPipManager.removeListener(this); |
| 53 | mPipManager.resumePipResizing( |
| 54 | PipManager.SUSPEND_PIP_RESIZE_REASON_WAITING_FOR_MENU_ACTIVITY_FINISH); |
Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | @Override |
Jaewan Kim | 82ac50d | 2016-03-21 17:34:28 +0900 | [diff] [blame] | 58 | public void onPipEntered() { } |
| 59 | |
| 60 | @Override |
Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 61 | public void onPipActivityClosed() { |
| 62 | finish(); |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public void onShowPipMenu() { } |
| 67 | |
| 68 | @Override |
| 69 | public void onMoveToFullscreen() { |
| 70 | finish(); |
| 71 | } |
Wale Ogunwale | 480dca0 | 2016-02-06 13:58:29 -0800 | [diff] [blame] | 72 | |
| 73 | @Override |
| 74 | public void onPipResizeAboutToStart() { |
| 75 | finish(); |
| 76 | mPipManager.suspendPipResizing( |
| 77 | PipManager.SUSPEND_PIP_RESIZE_REASON_WAITING_FOR_MENU_ACTIVITY_FINISH); |
| 78 | } |
Youngsang Cho | f164792 | 2015-12-17 13:39:39 -0800 | [diff] [blame] | 79 | } |