diff options
| author | 2016-02-17 13:41:51 -0800 | |
|---|---|---|
| committer | 2016-02-25 10:03:14 -0800 | |
| commit | 1a9dc566bea8abc8293ab9db40711147e99a65ea (patch) | |
| tree | f4bbb03d214a4c2403a12ab09b4570037ab74357 | |
| parent | c92a7d12e345e05272f3e84d49d75c77dc6e3edc (diff) | |
PIP: Apply the latest UI spec for PIP menu
Bug: 27190196
Change-Id: I71b5f2eb46ee90af8601f4ec02e20e2792ebc4de
9 files changed, 228 insertions, 38 deletions
diff --git a/core/res/res/values-television/config.xml b/core/res/res/values-television/config.xml index a3a311295ca1..ae19150de3c0 100644 --- a/core/res/res/values-television/config.xml +++ b/core/res/res/values-television/config.xml @@ -25,7 +25,7 @@ <bool name="config_defaultWindowFeatureOptionsPanel">false</bool> <!-- Default bounds [left top right bottom] on screen for picture-in-picture windows. --> - <string translatable="false" name="config_defaultPictureInPictureBounds">"1328 54 1808 324"</string> + <string translatable="false" name="config_defaultPictureInPictureBounds">"1420 100 1820 325"</string> <!-- Bounds [left top right bottom] on screen for picture-in-picture (PIP) windows, when the PIP is located in center. --> @@ -34,5 +34,4 @@ <!-- Bounds [left top right bottom] on screen for picture-in-picture (PIP) windows, when the PIP is shown with Recents. --> <string translatable="false" name="config_pictureInPictureBoundsInRecents">"1480 123 1760 303"</string> - </resources> diff --git a/packages/SystemUI/res/drawable/tv_pip_button_focused.xml b/packages/SystemUI/res/drawable/tv_pip_button_focused.xml new file mode 100644 index 000000000000..5cabb77a6971 --- /dev/null +++ b/packages/SystemUI/res/drawable/tv_pip_button_focused.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2016 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="oval"> + <size + android:width="36dp" + android:height="36dp" /> + <solid + android:color="#4DFFFFFF" /> +</shape> diff --git a/packages/SystemUI/res/drawable/tv_pip_close_button.xml b/packages/SystemUI/res/drawable/tv_pip_close_button.xml new file mode 100644 index 000000000000..86fda0d31346 --- /dev/null +++ b/packages/SystemUI/res/drawable/tv_pip_close_button.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2016 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android" + android:constantSize="true"> + <item android:state_focused="true"> + <layer-list> + <item android:drawable="@drawable/tv_pip_button_focused" /> + <item android:drawable="@drawable/ic_close_white" /> + </layer-list> + </item> + <item android:drawable="@drawable/ic_close_white" /> +</selector> diff --git a/packages/SystemUI/res/drawable/tv_pip_full_button.xml b/packages/SystemUI/res/drawable/tv_pip_full_button.xml new file mode 100644 index 000000000000..332c669de154 --- /dev/null +++ b/packages/SystemUI/res/drawable/tv_pip_full_button.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2016 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android" + android:constantSize="true"> + <item android:state_focused="true"> + <layer-list> + <item android:drawable="@drawable/tv_pip_button_focused" /> + <item android:drawable="@drawable/ic_fullscreen_white_24dp" /> + </layer-list> + </item> + <item android:drawable="@drawable/ic_fullscreen_white_24dp" /> +</selector> diff --git a/packages/SystemUI/res/drawable/tv_pip_pause_button.xml b/packages/SystemUI/res/drawable/tv_pip_pause_button.xml new file mode 100644 index 000000000000..d277b07c199e --- /dev/null +++ b/packages/SystemUI/res/drawable/tv_pip_pause_button.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2016 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android" + android:constantSize="true"> + <item android:state_focused="true"> + <layer-list> + <item android:drawable="@drawable/tv_pip_button_focused" /> + <item android:drawable="@drawable/ic_pause_white_24dp" /> + </layer-list> + </item> + <item android:drawable="@drawable/ic_pause_white_24dp" /> +</selector> diff --git a/packages/SystemUI/res/layout/tv_pip_menu.xml b/packages/SystemUI/res/layout/tv_pip_menu.xml index 3562c644e61e..0b98d0ea71f5 100644 --- a/packages/SystemUI/res/layout/tv_pip_menu.xml +++ b/packages/SystemUI/res/layout/tv_pip_menu.xml @@ -18,36 +18,94 @@ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_gravity="end" - android:paddingStart="10dp" - android:paddingEnd="10dp" - android:background="#88FFFFFF" - android:gravity="center_vertical" > - - <Button android:id="@+id/full" - android:layout_width="match_parent" + android:orientation="horizontal" + android:paddingTop="350dp" + android:background="#CC000000" + android:gravity="top|center_horizontal" + android:clipChildren="false"> + + <LinearLayout + android:layout_width="34dp" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/pip_fullscreen" - android:textSize="10sp" - android:focusable="true" /> + android:layout_marginEnd="3dp" + android:orientation="vertical" + android:gravity="center" + android:clipChildren="false"> + + <ImageView android:id="@+id/full" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:focusable="true" + android:src="@drawable/tv_pip_full_button" /> - <Button android:id="@+id/exit" - android:layout_width="match_parent" + <TextView android:id="@+id/full_desc" + android:layout_width="100dp" + android:layout_height="wrap_content" + android:layout_marginTop="3dp" + android:gravity="center" + android:visibility="invisible" + android:text="@string/pip_fullscreen" + android:fontFamily="sans-serif" + android:textSize="12sp" + android:textColor="#EEEEEE" + android:clipChildren="false" /> + </LinearLayout> + + <LinearLayout + android:layout_width="34dp" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/pip_exit" - android:textSize="10sp" - android:focusable="true" /> + android:layout_marginStart="3dp" + android:layout_marginEnd="3dp" + android:orientation="vertical" + android:gravity="center" + android:visibility="gone" + android:clipChildren="false"> + + <ImageView android:id="@+id/play_pause" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:focusable="true" + android:src="@drawable/tv_pip_pause_button" /> - <Button android:id="@+id/cancel" - android:layout_width="match_parent" + <TextView android:id="@+id/play_pause_desc" + android:layout_width="100dp" + android:layout_height="wrap_content" + android:layout_marginTop="3dp" + android:gravity="center" + android:visibility="invisible" + android:text="@string/pip_pause" + android:fontFamily="sans-serif" + android:textSize="12sp" + android:textColor="#EEEEEE" + android:clipChildren="false" /> + </LinearLayout> + + <LinearLayout + android:layout_width="34dp" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/pip_cancel" - android:textSize="10sp" - android:focusable="true" /> + android:layout_marginStart="3dp" + android:orientation="vertical" + android:gravity="center" + android:clipChildren="false"> + + <ImageView android:id="@+id/close" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:focusable="true" + android:src="@drawable/tv_pip_close_button" /> + + <TextView android:id="@+id/close_desc" + android:layout_width="100dp" + android:layout_height="wrap_content" + android:layout_marginTop="3dp" + android:gravity="center" + android:visibility="invisible" + android:text="@string/pip_close" + android:fontFamily="sans-serif" + android:textSize="12sp" + android:textColor="#EEEEEE" + android:clipChildren="false" /> + </LinearLayout> </LinearLayout> diff --git a/packages/SystemUI/res/values/strings_tv.xml b/packages/SystemUI/res/values/strings_tv.xml index 7c4768d29cfe..9ef03430e1e4 100644 --- a/packages/SystemUI/res/values/strings_tv.xml +++ b/packages/SystemUI/res/values/strings_tv.xml @@ -20,7 +20,7 @@ <!-- Picture-in-Picture menu --> <eat-comment /> <!-- Button to close PIP on PIP UI --> - <string name="pip_exit" translatable="false">Close PIP</string> + <string name="pip_close" translatable="false">Close PIP</string> <!-- Button to move PIP screen to the fullscreen on PIP UI --> <string name="pip_fullscreen" translatable="false">Full screen</string> <!-- Button to play the current media on PIP UI --> diff --git a/packages/SystemUI/src/com/android/systemui/tv/pip/PipManager.java b/packages/SystemUI/src/com/android/systemui/tv/pip/PipManager.java index ec49256abb23..0925638ad8cc 100644 --- a/packages/SystemUI/src/com/android/systemui/tv/pip/PipManager.java +++ b/packages/SystemUI/src/com/android/systemui/tv/pip/PipManager.java @@ -424,9 +424,7 @@ public class PipManager { } Intent intent = new Intent(mContext, PipMenuActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - final ActivityOptions options = ActivityOptions.makeBasic(); - options.setLaunchStackId(PINNED_STACK_ID); - mContext.startActivity(intent, options.toBundle()); + mContext.startActivity(intent); } public void addListener(Listener listener) { diff --git a/packages/SystemUI/src/com/android/systemui/tv/pip/PipMenuActivity.java b/packages/SystemUI/src/com/android/systemui/tv/pip/PipMenuActivity.java index 7e229d4b90f4..4171dbcc4372 100644 --- a/packages/SystemUI/src/com/android/systemui/tv/pip/PipMenuActivity.java +++ b/packages/SystemUI/src/com/android/systemui/tv/pip/PipMenuActivity.java @@ -33,31 +33,64 @@ public class PipMenuActivity extends Activity implements PipManager.Listener { private final PipManager mPipManager = PipManager.getInstance(); private MediaController mMediaController; + private View mFullButtonView; + private View mFullDescriptionView; + private View mPlayPauseButtonView; + private View mPlayPauseDescriptionView; + private View mCloseButtonView; + private View mCloseDescriptionView; + @Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.tv_pip_menu); mPipManager.addListener(this); - findViewById(R.id.full).setOnClickListener(new View.OnClickListener() { + mFullButtonView = findViewById(R.id.full); + mFullDescriptionView = findViewById(R.id.full_desc); + mFullButtonView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mPipManager.movePipToFullscreen(); + finish(); + } + }); + mFullButtonView.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + mFullDescriptionView.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE); } }); - findViewById(R.id.exit).setOnClickListener(new View.OnClickListener() { + + mPlayPauseButtonView = findViewById(R.id.play_pause); + mPlayPauseDescriptionView = findViewById(R.id.play_pause_desc); + mPlayPauseButtonView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - mPipManager.closePip(); - finish(); + // TODO: Implement play/pause. } }); - findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() { + mPlayPauseButtonView.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + mPlayPauseDescriptionView.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE); + } + }); + + mCloseButtonView = findViewById(R.id.close); + mCloseDescriptionView = findViewById(R.id.close_desc); + mCloseButtonView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - mPipManager.resizePinnedStack(PipManager.STATE_PIP_OVERLAY); + mPipManager.closePip(); finish(); } }); + mCloseButtonView.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + mCloseDescriptionView.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE); + } + }); } @Override |