Merge "PIP: Apply the latest UI spec for PIP menu" into nyc-dev
This commit is contained in:
@@ -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>
|
||||
|
||||
24
packages/SystemUI/res/drawable/tv_pip_button_focused.xml
Normal file
24
packages/SystemUI/res/drawable/tv_pip_button_focused.xml
Normal file
@@ -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>
|
||||
26
packages/SystemUI/res/drawable/tv_pip_close_button.xml
Normal file
26
packages/SystemUI/res/drawable/tv_pip_close_button.xml
Normal file
@@ -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>
|
||||
26
packages/SystemUI/res/drawable/tv_pip_full_button.xml
Normal file
26
packages/SystemUI/res/drawable/tv_pip_full_button.xml
Normal file
@@ -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>
|
||||
26
packages/SystemUI/res/drawable/tv_pip_pause_button.xml
Normal file
26
packages/SystemUI/res/drawable/tv_pip_pause_button.xml
Normal file
@@ -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>
|
||||
@@ -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" >
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="350dp"
|
||||
android:background="#CC000000"
|
||||
android:gravity="top|center_horizontal"
|
||||
android:clipChildren="false">
|
||||
|
||||
<Button android:id="@+id/full"
|
||||
android:layout_width="match_parent"
|
||||
<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">
|
||||
|
||||
<Button android:id="@+id/exit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/pip_exit"
|
||||
android:textSize="10sp"
|
||||
android:focusable="true" />
|
||||
<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/cancel"
|
||||
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_cancel"
|
||||
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" />
|
||||
|
||||
<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_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>
|
||||
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -33,29 +33,62 @@ 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();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.exit).setOnClickListener(new View.OnClickListener() {
|
||||
mFullButtonView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
mFullDescriptionView.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
mPlayPauseButtonView = findViewById(R.id.play_pause);
|
||||
mPlayPauseDescriptionView = findViewById(R.id.play_pause_desc);
|
||||
mPlayPauseButtonView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO: Implement play/pause.
|
||||
}
|
||||
});
|
||||
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.closePip();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
|
||||
mCloseButtonView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mPipManager.resizePinnedStack(PipManager.STATE_PIP_OVERLAY);
|
||||
finish();
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
mCloseDescriptionView.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user