blob: c54e73a7cda68afabca926a6fcdb24b2840941ec [file] [log] [blame]
Youngsang Chof1647922015-12-17 13:39:39 -08001/*
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
17package com.android.systemui.tv.pip;
18
19import android.app.Activity;
Youngsang Chof1647922015-12-17 13:39:39 -080020import android.os.Bundle;
Youngsang Chof1647922015-12-17 13:39:39 -080021
22import com.android.systemui.R;
Jaewan Kim62338192016-02-25 10:00:05 -080023
Youngsang Chof1647922015-12-17 13:39:39 -080024/**
25 * Activity to show the PIP menu to control PIP.
26 */
27public class PipMenuActivity extends Activity implements PipManager.Listener {
28 private static final String TAG = "PipMenuActivity";
Youngsang Chof1647922015-12-17 13:39:39 -080029
30 private final PipManager mPipManager = PipManager.getInstance();
Youngsang Chof1647922015-12-17 13:39:39 -080031
Jaewan Kim8f584b82016-03-22 22:16:59 +090032 private PipControlsView mPipControlsView;
Jaewan Kim1a9dc562016-02-17 13:41:51 -080033
Youngsang Chof1647922015-12-17 13:39:39 -080034 @Override
35 protected void onCreate(Bundle bundle) {
36 super.onCreate(bundle);
37 setContentView(R.layout.tv_pip_menu);
38 mPipManager.addListener(this);
Jaewan Kim1a9dc562016-02-17 13:41:51 -080039
Jaewan Kim8f584b82016-03-22 22:16:59 +090040 mPipControlsView = (PipControlsView) findViewById(R.id.pip_controls);
Youngsang Chof1647922015-12-17 13:39:39 -080041 }
42
Jaewan Kim9c23b282016-02-25 20:04:12 -080043 @Override
44 public void onPause() {
45 super.onPause();
Jaewan Kima0d4d252016-03-31 13:37:10 +090046 finish();
Jaewan Kim9c23b282016-02-25 20:04:12 -080047 }
48
Youngsang Chof1647922015-12-17 13:39:39 -080049 @Override
50 protected void onDestroy() {
Youngsang Chof1647922015-12-17 13:39:39 -080051 super.onDestroy();
Wale Ogunwale480dca02016-02-06 13:58:29 -080052 mPipManager.removeListener(this);
53 mPipManager.resumePipResizing(
54 PipManager.SUSPEND_PIP_RESIZE_REASON_WAITING_FOR_MENU_ACTIVITY_FINISH);
Youngsang Chof1647922015-12-17 13:39:39 -080055 }
56
57 @Override
Jaewan Kim82ac50d2016-03-21 17:34:28 +090058 public void onPipEntered() { }
59
60 @Override
Youngsang Chof1647922015-12-17 13:39:39 -080061 public void onPipActivityClosed() {
62 finish();
63 }
64
65 @Override
66 public void onShowPipMenu() { }
67
68 @Override
69 public void onMoveToFullscreen() {
70 finish();
71 }
Wale Ogunwale480dca02016-02-06 13:58:29 -080072
73 @Override
74 public void onPipResizeAboutToStart() {
75 finish();
76 mPipManager.suspendPipResizing(
77 PipManager.SUSPEND_PIP_RESIZE_REASON_WAITING_FOR_MENU_ACTIVITY_FINISH);
78 }
Youngsang Chof1647922015-12-17 13:39:39 -080079}