diff options
4 files changed, 123 insertions, 66 deletions
diff --git a/packages/SystemUI/res/drawable/qs_footer_drag_handle.xml b/packages/SystemUI/res/drawable/qs_footer_drag_handle.xml new file mode 100644 index 000000000000..509cd1fb5db7 --- /dev/null +++ b/packages/SystemUI/res/drawable/qs_footer_drag_handle.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 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" > + <solid + android:color="#e5e5e5" /> + <corners android:radius="2dp" /> +</shape> diff --git a/packages/SystemUI/res/layout/qs_footer_impl.xml b/packages/SystemUI/res/layout/qs_footer_impl.xml index 9f6a946dea2e..997fe6dd44bb 100644 --- a/packages/SystemUI/res/layout/qs_footer_impl.xml +++ b/packages/SystemUI/res/layout/qs_footer_impl.xml @@ -32,80 +32,108 @@ <LinearLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="16dp" + android:layout_height="match_parent" + android:layout_marginStart="8dp" android:layout_marginEnd="8dp" - android:gravity="end"> + android:gravity="end" > - <com.android.keyguard.CarrierText - android:id="@+id/qs_carrier_text" + <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" - android:layout_weight="1" - android:gravity="center_vertical|start" - android:ellipsize="marquee" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?android:attr/textColorPrimary" - android:textDirection="locale" - android:singleLine="true" /> + android:layout_weight="1" > + <!-- Add an extra 8dp margin before carrier text without shifting it right --> + <android.widget.Space + android:layout_width="8dp" + android:layout_height="match_parent" /> - <com.android.systemui.statusbar.phone.MultiUserSwitch - android:id="@+id/multi_user_switch" - android:layout_width="48dp" - android:layout_height="48dp" - android:layout_alignParentEnd="true" - android:background="@drawable/ripple_drawable" - android:focusable="true"> + <com.android.keyguard.CarrierText + android:id="@+id/qs_carrier_text" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:gravity="center_vertical|start" + android:ellipsize="marquee" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="?android:attr/textColorPrimary" + android:textDirection="locale" + android:singleLine="true" /> + </LinearLayout> - <ImageView - android:id="@+id/multi_user_avatar" - android:layout_width="@dimen/multi_user_avatar_expanded_size" - android:layout_height="@dimen/multi_user_avatar_expanded_size" - android:layout_gravity="center" - android:scaleType="centerInside"/> - </com.android.systemui.statusbar.phone.MultiUserSwitch> + <FrameLayout + android:layout_width="24dp" + android:layout_height="match_parent" > + <View + android:id="@+id/qs_drag_handle_view" + android:layout_width="match_parent" + android:layout_height="4dp" + android:layout_marginTop="28dp" + android:background="@drawable/qs_footer_drag_handle" /> + </FrameLayout> - <com.android.systemui.statusbar.AlphaOptimizedImageView - android:id="@android:id/edit" - android:layout_width="48dp" - android:layout_height="48dp" - android:background="?android:attr/selectableItemBackgroundBorderless" - android:clickable="true" - android:clipToPadding="false" - android:contentDescription="@string/accessibility_quick_settings_edit" - android:focusable="true" - android:padding="16dp" - android:src="@drawable/ic_mode_edit" - android:tint="?android:attr/colorForeground"/> + <LinearLayout + android:id="@+id/qs_footer_actions_container" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:gravity="end" > + <com.android.systemui.statusbar.phone.MultiUserSwitch + android:id="@+id/multi_user_switch" + android:layout_width="48dp" + android:layout_height="48dp" + android:layout_alignParentEnd="true" + android:background="@drawable/ripple_drawable" + android:focusable="true"> - <com.android.systemui.statusbar.AlphaOptimizedFrameLayout - android:id="@+id/settings_button_container" - android:layout_width="48dp" - android:layout_height="48dp" - android:clipChildren="false" - android:clipToPadding="false"> + <ImageView + android:id="@+id/multi_user_avatar" + android:layout_width="@dimen/multi_user_avatar_expanded_size" + android:layout_height="@dimen/multi_user_avatar_expanded_size" + android:layout_gravity="center" + android:scaleType="centerInside"/> + </com.android.systemui.statusbar.phone.MultiUserSwitch> - <com.android.systemui.statusbar.phone.SettingsButton - android:id="@+id/settings_button" - style="@android:style/Widget.Material.Button.Borderless" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@drawable/ripple_drawable" - android:contentDescription="@string/accessibility_quick_settings_settings" - android:src="@drawable/ic_settings_16dp" + <com.android.systemui.statusbar.AlphaOptimizedImageView + android:id="@android:id/edit" + android:layout_width="48dp" + android:layout_height="48dp" + android:background="?android:attr/selectableItemBackgroundBorderless" + android:clickable="true" + android:clipToPadding="false" + android:contentDescription="@string/accessibility_quick_settings_edit" + android:focusable="true" + android:padding="16dp" + android:src="@drawable/ic_mode_edit" android:tint="?android:attr/colorForeground"/> - <com.android.systemui.statusbar.AlphaOptimizedImageView - android:id="@+id/tuner_icon" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:paddingStart="36dp" - android:paddingEnd="4dp" - android:src="@drawable/tuner" - android:tint="?android:attr/textColorTertiary" - android:visibility="invisible"/> + <com.android.systemui.statusbar.AlphaOptimizedFrameLayout + android:id="@+id/settings_button_container" + android:layout_width="48dp" + android:layout_height="48dp" + android:clipChildren="false" + android:clipToPadding="false"> + + <com.android.systemui.statusbar.phone.SettingsButton + android:id="@+id/settings_button" + style="@android:style/Widget.Material.Button.Borderless" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/ripple_drawable" + android:contentDescription="@string/accessibility_quick_settings_settings" + android:src="@drawable/ic_settings_16dp" + android:tint="?android:attr/colorForeground"/> + + <com.android.systemui.statusbar.AlphaOptimizedImageView + android:id="@+id/tuner_icon" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingStart="36dp" + android:paddingEnd="4dp" + android:src="@drawable/tuner" + android:tint="?android:attr/textColorTertiary" + android:visibility="invisible"/> - </com.android.systemui.statusbar.AlphaOptimizedFrameLayout> + </com.android.systemui.statusbar.AlphaOptimizedFrameLayout> + </LinearLayout> </LinearLayout> </com.android.systemui.qs.QSFooterImpl> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java index 92475da697bd..76baee4c836f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java @@ -84,6 +84,8 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, protected View mEdit; private TouchAnimator mAnimator; + private View mActionsContainer; + public QSFooterImpl(Context context, AttributeSet attrs) { super(context, attrs); } @@ -107,6 +109,8 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, mMultiUserSwitch = findViewById(R.id.multi_user_switch); mMultiUserAvatar = mMultiUserSwitch.findViewById(R.id.multi_user_avatar); + mActionsContainer = findViewById(R.id.qs_footer_actions_container); + // RenderThread is doing more harm than good when touching the header (to expand quick // settings), so disable it for this view ((RippleDrawable) mSettingsButton.getBackground()).setForceSoftware(true); @@ -158,10 +162,8 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, @Nullable private TouchAnimator createSettingsAlphaAnimator() { return new TouchAnimator.Builder() - .addFloat(mEdit, "alpha", 0, 1) - .addFloat(mMultiUserSwitch, "alpha", 0, 1) .addFloat(mCarrierText, "alpha", 0, 1) - .addFloat(mSettingsButton, "alpha", 0, 1) + .addFloat(mActionsContainer, "alpha", 0, 1) .build(); } @@ -269,6 +271,11 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, @Override public void onClick(View v) { + // Don't do anything until view are unhidden + if (!mExpanded) { + return; + } + if (v == mSettingsButton) { if (!Dependency.get(DeviceProvisionedController.class).isCurrentUserSetup()) { // If user isn't setup just unlock the device and dump them back at SUW. diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java index 669439d7f6ca..d8e10516fe69 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java @@ -69,7 +69,7 @@ public class QSFragment extends Fragment implements QS { @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { - inflater =inflater.cloneInContext(new ContextThemeWrapper(getContext(), R.style.qs_theme)); + inflater = inflater.cloneInContext(new ContextThemeWrapper(getContext(), R.style.qs_theme)); return inflater.inflate(R.layout.qs_panel, container, false); } |