Loading packages/SystemUI/res/drawable/tv_pip_outline.xml 0 → 100644 +20 −0 Original line number Diff line number Diff line <?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="rectangle"> <stroke android:width="2dp" android:color="#EEEEEE" /> </shape> packages/SystemUI/res/layout/tv_pip_onboarding.xml +26 −17 Original line number Diff line number Diff line Loading @@ -18,34 +18,43 @@ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/pip_onboarding" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#C00288D1" android:gravity="center" android:gravity="top|center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="30sp" android:textColor="@android:color/white" android:text="@string/pip_onboarding_title" /> <!-- A rectangle arounds the PIP. Size and positions will be programatically set up to comply with config_defaultPictureInPictureBounds. --> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_sysbar_home" /> android:id="@+id/pip_outline" android:layout_width="0dp" android:layout_height="0dp" android:src="@drawable/tv_pip_outline" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="30dp" android:textSize="13sp" android:textColor="@android:color/white" android:layout_marginTop="24dp" android:fontFamily="sans-serif" android:textSize="16sp" android:textColor="#EEEEEE" android:lineSpacingMultiplier="1.28" android:text="@string/pip_onboarding_description" /> <Button android:id="@+id/close" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="15sp" android:layout_height="36dp" android:layout_marginTop="24dp" android:gravity="center" android:paddingStart="24dp" android:paddingEnd="24dp" android:fontFamily="sans-serif-condensed" android:textSize="16sp" android:textColor="#026089" android:textAllCaps="true" android:text="@string/pip_onboarding_button" /> android:text="@string/pip_onboarding_button" android:background="#EEEEEE" android:elevation="4dp" /> </LinearLayout> packages/SystemUI/res/values/dimens_tv.xml +4 −1 Original line number Diff line number Diff line Loading @@ -31,4 +31,7 @@ <!-- Values for focus animation --> <dimen name="recents_tv_unselected_item_z">6dp</dimen> <dimen name="recents_tv_selected_item_z_delta">10dp</dimen> <!-- Extra space around the PIP and its outline in PIP onboarding activity --> <dimen name="tv_pip_bounds_space">3dp</dimen> </resources> packages/SystemUI/res/values/strings_tv.xml +0 −2 Original line number Diff line number Diff line Loading @@ -34,8 +34,6 @@ <!-- Picture-in-Picture onboarding screen --> <eat-comment /> <!-- Title for onboarding screen. --> <string name="pip_onboarding_title" translatable="false">Picture-in-picture</string> <!-- Description for onboarding screen. --> <string name="pip_onboarding_description" translatable="false">Press and hold the HOME\nbutton to close or control it</string> <!-- Button to close onboarding screen. --> Loading packages/SystemUI/src/com/android/systemui/tv/pip/PipOnboardingActivity.java +18 −0 Original line number Diff line number Diff line Loading @@ -17,9 +17,11 @@ package com.android.systemui.tv.pip; import android.app.Activity; import android.graphics.Rect; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.ViewGroup.LayoutParams; import com.android.systemui.R; Loading @@ -33,6 +35,8 @@ public class PipOnboardingActivity extends Activity implements PipManager.Listen protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.tv_pip_onboarding); View pipOnboardingView = findViewById(R.id.pip_onboarding); View pipOutlineView = findViewById(R.id.pip_outline); mPipManager.addListener(this); findViewById(R.id.close).setOnClickListener(new View.OnClickListener() { @Override Loading @@ -40,6 +44,20 @@ public class PipOnboardingActivity extends Activity implements PipManager.Listen finish(); } }); int pipOutlineSpace = getResources().getDimensionPixelSize(R.dimen.tv_pip_bounds_space); int screenWidth = getResources().getDisplayMetrics().widthPixels; Rect pipBounds = mPipManager.getPipBounds(); pipOnboardingView.setPadding( pipBounds.left - pipOutlineSpace, pipBounds.top - pipOutlineSpace, screenWidth - pipBounds.right - pipOutlineSpace, 0); // Set width and height for outline view to enclose the PIP. LayoutParams lp = pipOutlineView.getLayoutParams(); lp.width = pipBounds.width() + pipOutlineSpace * 2; lp.height = pipBounds.height() + pipOutlineSpace * 2; pipOutlineView.setLayoutParams(lp); } @Override Loading Loading
packages/SystemUI/res/drawable/tv_pip_outline.xml 0 → 100644 +20 −0 Original line number Diff line number Diff line <?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="rectangle"> <stroke android:width="2dp" android:color="#EEEEEE" /> </shape>
packages/SystemUI/res/layout/tv_pip_onboarding.xml +26 −17 Original line number Diff line number Diff line Loading @@ -18,34 +18,43 @@ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/pip_onboarding" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#C00288D1" android:gravity="center" android:gravity="top|center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="30sp" android:textColor="@android:color/white" android:text="@string/pip_onboarding_title" /> <!-- A rectangle arounds the PIP. Size and positions will be programatically set up to comply with config_defaultPictureInPictureBounds. --> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_sysbar_home" /> android:id="@+id/pip_outline" android:layout_width="0dp" android:layout_height="0dp" android:src="@drawable/tv_pip_outline" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="30dp" android:textSize="13sp" android:textColor="@android:color/white" android:layout_marginTop="24dp" android:fontFamily="sans-serif" android:textSize="16sp" android:textColor="#EEEEEE" android:lineSpacingMultiplier="1.28" android:text="@string/pip_onboarding_description" /> <Button android:id="@+id/close" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="15sp" android:layout_height="36dp" android:layout_marginTop="24dp" android:gravity="center" android:paddingStart="24dp" android:paddingEnd="24dp" android:fontFamily="sans-serif-condensed" android:textSize="16sp" android:textColor="#026089" android:textAllCaps="true" android:text="@string/pip_onboarding_button" /> android:text="@string/pip_onboarding_button" android:background="#EEEEEE" android:elevation="4dp" /> </LinearLayout>
packages/SystemUI/res/values/dimens_tv.xml +4 −1 Original line number Diff line number Diff line Loading @@ -31,4 +31,7 @@ <!-- Values for focus animation --> <dimen name="recents_tv_unselected_item_z">6dp</dimen> <dimen name="recents_tv_selected_item_z_delta">10dp</dimen> <!-- Extra space around the PIP and its outline in PIP onboarding activity --> <dimen name="tv_pip_bounds_space">3dp</dimen> </resources>
packages/SystemUI/res/values/strings_tv.xml +0 −2 Original line number Diff line number Diff line Loading @@ -34,8 +34,6 @@ <!-- Picture-in-Picture onboarding screen --> <eat-comment /> <!-- Title for onboarding screen. --> <string name="pip_onboarding_title" translatable="false">Picture-in-picture</string> <!-- Description for onboarding screen. --> <string name="pip_onboarding_description" translatable="false">Press and hold the HOME\nbutton to close or control it</string> <!-- Button to close onboarding screen. --> Loading
packages/SystemUI/src/com/android/systemui/tv/pip/PipOnboardingActivity.java +18 −0 Original line number Diff line number Diff line Loading @@ -17,9 +17,11 @@ package com.android.systemui.tv.pip; import android.app.Activity; import android.graphics.Rect; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.ViewGroup.LayoutParams; import com.android.systemui.R; Loading @@ -33,6 +35,8 @@ public class PipOnboardingActivity extends Activity implements PipManager.Listen protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.tv_pip_onboarding); View pipOnboardingView = findViewById(R.id.pip_onboarding); View pipOutlineView = findViewById(R.id.pip_outline); mPipManager.addListener(this); findViewById(R.id.close).setOnClickListener(new View.OnClickListener() { @Override Loading @@ -40,6 +44,20 @@ public class PipOnboardingActivity extends Activity implements PipManager.Listen finish(); } }); int pipOutlineSpace = getResources().getDimensionPixelSize(R.dimen.tv_pip_bounds_space); int screenWidth = getResources().getDisplayMetrics().widthPixels; Rect pipBounds = mPipManager.getPipBounds(); pipOnboardingView.setPadding( pipBounds.left - pipOutlineSpace, pipBounds.top - pipOutlineSpace, screenWidth - pipBounds.right - pipOutlineSpace, 0); // Set width and height for outline view to enclose the PIP. LayoutParams lp = pipOutlineView.getLayoutParams(); lp.width = pipBounds.width() + pipOutlineSpace * 2; lp.height = pipBounds.height() + pipOutlineSpace * 2; pipOutlineView.setLayoutParams(lp); } @Override Loading