Loading packages/SystemUI/res/layout/tv_pip_controls.xml +5 −5 Original line number Original line Diff line number Diff line Loading @@ -22,24 +22,24 @@ <com.android.systemui.pip.tv.PipControlButtonView <com.android.systemui.pip.tv.PipControlButtonView android:id="@+id/full_button" android:id="@+id/full_button" android:layout_width="100dp" android:layout_width="@dimen/picture_in_picture_button_width" android:layout_height="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_fullscreen_white_24dp" android:src="@drawable/ic_fullscreen_white_24dp" android:text="@string/pip_fullscreen" /> android:text="@string/pip_fullscreen" /> <com.android.systemui.pip.tv.PipControlButtonView <com.android.systemui.pip.tv.PipControlButtonView android:id="@+id/close_button" android:id="@+id/close_button" android:layout_width="100dp" android:layout_width="@dimen/picture_in_picture_button_width" android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="-50dp" android:layout_marginStart="@dimen/picture_in_picture_button_start_margin" android:src="@drawable/ic_close_white" android:src="@drawable/ic_close_white" android:text="@string/pip_close" /> android:text="@string/pip_close" /> <com.android.systemui.pip.tv.PipControlButtonView <com.android.systemui.pip.tv.PipControlButtonView android:id="@+id/play_pause_button" android:id="@+id/play_pause_button" android:layout_width="100dp" android:layout_width="@dimen/picture_in_picture_button_width" android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="-50dp" android:layout_marginStart="@dimen/picture_in_picture_button_start_margin" android:src="@drawable/ic_pause_white" android:src="@drawable/ic_pause_white" android:text="@string/pip_pause" android:text="@string/pip_pause" android:visibility="gone" /> android:visibility="gone" /> Loading packages/SystemUI/res/layout/tv_pip_custom_control.xml 0 → 100644 +23 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ** ** Copyright 2017, 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. */ --> <com.android.systemui.pip.tv.PipControlButtonView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="@dimen/picture_in_picture_button_width" android:layout_height="wrap_content" android:layout_marginStart="@dimen/picture_in_picture_button_start_margin" /> packages/SystemUI/res/values-tvdpi/dimens.xml +4 −0 Original line number Original line Diff line number Diff line Loading @@ -24,4 +24,8 @@ <fraction name="battery_subpixel_smoothing_right">10%</fraction> <fraction name="battery_subpixel_smoothing_right">10%</fraction> <dimen name="battery_margin_bottom">1px</dimen> <dimen name="battery_margin_bottom">1px</dimen> <!-- The dimensions to user for picture-in-picture action buttons. --> <dimen name="picture_in_picture_button_width">100dp</dimen> <dimen name="picture_in_picture_button_start_margin">-50dp</dimen> </resources> </resources> packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java +9 −7 Original line number Original line Diff line number Diff line Loading @@ -427,11 +427,7 @@ public class PipMenuActivity extends Activity { } else { } else { actionsContainer.setVisibility(View.VISIBLE); actionsContainer.setVisibility(View.VISIBLE); if (mActionsGroup != null) { if (mActionsGroup != null) { // Hide extra views // Ensure we have as many buttons as actions for (int i = mActions.size(); i < mActionsGroup.getChildCount(); i++) { mActionsGroup.getChildAt(i).setVisibility(View.GONE); } // Add needed views final LayoutInflater inflater = LayoutInflater.from(this); final LayoutInflater inflater = LayoutInflater.from(this); while (mActionsGroup.getChildCount() < mActions.size()) { while (mActionsGroup.getChildCount() < mActions.size()) { final ImageView actionView = (ImageView) inflater.inflate( final ImageView actionView = (ImageView) inflater.inflate( Loading @@ -439,6 +435,13 @@ public class PipMenuActivity extends Activity { mActionsGroup.addView(actionView); mActionsGroup.addView(actionView); } } // Update the visibility of all views for (int i = 0; i < mActionsGroup.getChildCount(); i++) { mActionsGroup.getChildAt(i).setVisibility(i < mActions.size() ? View.VISIBLE : View.GONE); } // Recreate the layout // Recreate the layout final boolean isLandscapePip = stackBounds != null && final boolean isLandscapePip = stackBounds != null && (stackBounds.width() > stackBounds.height()); (stackBounds.width() > stackBounds.height()); Loading @@ -460,10 +463,9 @@ public class PipMenuActivity extends Activity { Log.w(TAG, "Failed to send action", e); Log.w(TAG, "Failed to send action", e); } } }); }); } else { actionView.setAlpha(DISABLED_ACTION_ALPHA); } } actionView.setEnabled(action.isEnabled()); actionView.setEnabled(action.isEnabled()); actionView.setAlpha(action.isEnabled() ? 1f : DISABLED_ACTION_ALPHA); // Update the margin between actions // Update the margin between actions LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) Loading packages/SystemUI/src/com/android/systemui/pip/tv/PipControlButtonView.java +24 −3 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.AnimatorInflater; import android.content.Context; import android.content.Context; import android.content.res.TypedArray; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.LayoutInflater; import android.view.View; import android.view.View; Loading @@ -33,6 +34,7 @@ import com.android.systemui.R; * A view containing PIP controls including fullscreen, close, and media controls. * A view containing PIP controls including fullscreen, close, and media controls. */ */ public class PipControlButtonView extends RelativeLayout { public class PipControlButtonView extends RelativeLayout { private OnFocusChangeListener mFocusChangeListener; private OnFocusChangeListener mFocusChangeListener; private ImageView mIconImageView; private ImageView mIconImageView; ImageView mButtonImageView; ImageView mButtonImageView; Loading Loading @@ -121,20 +123,39 @@ public class PipControlButtonView extends RelativeLayout { mFocusChangeListener = listener; mFocusChangeListener = listener; } } /** * Sets the drawable for the button with the given drawable. */ public void setImageDrawable(Drawable d) { mIconImageView.setImageDrawable(d); } /** /** * Sets the drawable for the button with the given resource id. * Sets the drawable for the button with the given resource id. */ */ public void setImageResource(int resId) { public void setImageResource(int resId) { if (resId != 0) { mIconImageView.setImageResource(resId); mIconImageView.setImageResource(resId); } } } /** * Sets the text for description the with the given string. */ public void setText(CharSequence text) { mButtonImageView.setContentDescription(text); mDescriptionTextView.setText(text); } /** /** * Sets the text for description the with the given resource id. * Sets the text for description the with the given resource id. */ */ public void setText(int resId) { public void setText(int resId) { if (resId != 0) { mButtonImageView.setContentDescription(getContext().getString(resId)); mButtonImageView.setContentDescription(getContext().getString(resId)); mDescriptionTextView.setText(resId); mDescriptionTextView.setText(resId); } } } private static void cancelAnimator(Animator animator) { private static void cancelAnimator(Animator animator) { if (animator.isStarted()) { if (animator.isStarted()) { Loading Loading
packages/SystemUI/res/layout/tv_pip_controls.xml +5 −5 Original line number Original line Diff line number Diff line Loading @@ -22,24 +22,24 @@ <com.android.systemui.pip.tv.PipControlButtonView <com.android.systemui.pip.tv.PipControlButtonView android:id="@+id/full_button" android:id="@+id/full_button" android:layout_width="100dp" android:layout_width="@dimen/picture_in_picture_button_width" android:layout_height="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_fullscreen_white_24dp" android:src="@drawable/ic_fullscreen_white_24dp" android:text="@string/pip_fullscreen" /> android:text="@string/pip_fullscreen" /> <com.android.systemui.pip.tv.PipControlButtonView <com.android.systemui.pip.tv.PipControlButtonView android:id="@+id/close_button" android:id="@+id/close_button" android:layout_width="100dp" android:layout_width="@dimen/picture_in_picture_button_width" android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="-50dp" android:layout_marginStart="@dimen/picture_in_picture_button_start_margin" android:src="@drawable/ic_close_white" android:src="@drawable/ic_close_white" android:text="@string/pip_close" /> android:text="@string/pip_close" /> <com.android.systemui.pip.tv.PipControlButtonView <com.android.systemui.pip.tv.PipControlButtonView android:id="@+id/play_pause_button" android:id="@+id/play_pause_button" android:layout_width="100dp" android:layout_width="@dimen/picture_in_picture_button_width" android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="-50dp" android:layout_marginStart="@dimen/picture_in_picture_button_start_margin" android:src="@drawable/ic_pause_white" android:src="@drawable/ic_pause_white" android:text="@string/pip_pause" android:text="@string/pip_pause" android:visibility="gone" /> android:visibility="gone" /> Loading
packages/SystemUI/res/layout/tv_pip_custom_control.xml 0 → 100644 +23 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ** ** Copyright 2017, 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. */ --> <com.android.systemui.pip.tv.PipControlButtonView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="@dimen/picture_in_picture_button_width" android:layout_height="wrap_content" android:layout_marginStart="@dimen/picture_in_picture_button_start_margin" />
packages/SystemUI/res/values-tvdpi/dimens.xml +4 −0 Original line number Original line Diff line number Diff line Loading @@ -24,4 +24,8 @@ <fraction name="battery_subpixel_smoothing_right">10%</fraction> <fraction name="battery_subpixel_smoothing_right">10%</fraction> <dimen name="battery_margin_bottom">1px</dimen> <dimen name="battery_margin_bottom">1px</dimen> <!-- The dimensions to user for picture-in-picture action buttons. --> <dimen name="picture_in_picture_button_width">100dp</dimen> <dimen name="picture_in_picture_button_start_margin">-50dp</dimen> </resources> </resources>
packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java +9 −7 Original line number Original line Diff line number Diff line Loading @@ -427,11 +427,7 @@ public class PipMenuActivity extends Activity { } else { } else { actionsContainer.setVisibility(View.VISIBLE); actionsContainer.setVisibility(View.VISIBLE); if (mActionsGroup != null) { if (mActionsGroup != null) { // Hide extra views // Ensure we have as many buttons as actions for (int i = mActions.size(); i < mActionsGroup.getChildCount(); i++) { mActionsGroup.getChildAt(i).setVisibility(View.GONE); } // Add needed views final LayoutInflater inflater = LayoutInflater.from(this); final LayoutInflater inflater = LayoutInflater.from(this); while (mActionsGroup.getChildCount() < mActions.size()) { while (mActionsGroup.getChildCount() < mActions.size()) { final ImageView actionView = (ImageView) inflater.inflate( final ImageView actionView = (ImageView) inflater.inflate( Loading @@ -439,6 +435,13 @@ public class PipMenuActivity extends Activity { mActionsGroup.addView(actionView); mActionsGroup.addView(actionView); } } // Update the visibility of all views for (int i = 0; i < mActionsGroup.getChildCount(); i++) { mActionsGroup.getChildAt(i).setVisibility(i < mActions.size() ? View.VISIBLE : View.GONE); } // Recreate the layout // Recreate the layout final boolean isLandscapePip = stackBounds != null && final boolean isLandscapePip = stackBounds != null && (stackBounds.width() > stackBounds.height()); (stackBounds.width() > stackBounds.height()); Loading @@ -460,10 +463,9 @@ public class PipMenuActivity extends Activity { Log.w(TAG, "Failed to send action", e); Log.w(TAG, "Failed to send action", e); } } }); }); } else { actionView.setAlpha(DISABLED_ACTION_ALPHA); } } actionView.setEnabled(action.isEnabled()); actionView.setEnabled(action.isEnabled()); actionView.setAlpha(action.isEnabled() ? 1f : DISABLED_ACTION_ALPHA); // Update the margin between actions // Update the margin between actions LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) Loading
packages/SystemUI/src/com/android/systemui/pip/tv/PipControlButtonView.java +24 −3 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.AnimatorInflater; import android.content.Context; import android.content.Context; import android.content.res.TypedArray; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.LayoutInflater; import android.view.View; import android.view.View; Loading @@ -33,6 +34,7 @@ import com.android.systemui.R; * A view containing PIP controls including fullscreen, close, and media controls. * A view containing PIP controls including fullscreen, close, and media controls. */ */ public class PipControlButtonView extends RelativeLayout { public class PipControlButtonView extends RelativeLayout { private OnFocusChangeListener mFocusChangeListener; private OnFocusChangeListener mFocusChangeListener; private ImageView mIconImageView; private ImageView mIconImageView; ImageView mButtonImageView; ImageView mButtonImageView; Loading Loading @@ -121,20 +123,39 @@ public class PipControlButtonView extends RelativeLayout { mFocusChangeListener = listener; mFocusChangeListener = listener; } } /** * Sets the drawable for the button with the given drawable. */ public void setImageDrawable(Drawable d) { mIconImageView.setImageDrawable(d); } /** /** * Sets the drawable for the button with the given resource id. * Sets the drawable for the button with the given resource id. */ */ public void setImageResource(int resId) { public void setImageResource(int resId) { if (resId != 0) { mIconImageView.setImageResource(resId); mIconImageView.setImageResource(resId); } } } /** * Sets the text for description the with the given string. */ public void setText(CharSequence text) { mButtonImageView.setContentDescription(text); mDescriptionTextView.setText(text); } /** /** * Sets the text for description the with the given resource id. * Sets the text for description the with the given resource id. */ */ public void setText(int resId) { public void setText(int resId) { if (resId != 0) { mButtonImageView.setContentDescription(getContext().getString(resId)); mButtonImageView.setContentDescription(getContext().getString(resId)); mDescriptionTextView.setText(resId); mDescriptionTextView.setText(resId); } } } private static void cancelAnimator(Animator animator) { private static void cancelAnimator(Animator animator) { if (animator.isStarted()) { if (animator.isStarted()) { Loading