diff --git a/packages/SystemUI/res/layout/qs_paged_tile_layout.xml b/packages/SystemUI/res/layout/qs_paged_tile_layout.xml index c3f11138129f7..666ec2705e5d4 100644 --- a/packages/SystemUI/res/layout/qs_paged_tile_layout.xml +++ b/packages/SystemUI/res/layout/qs_paged_tile_layout.xml @@ -21,5 +21,6 @@ android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" - android:clipChildren="true" + android:clipChildren="false" + android:clipToPadding="false" android:paddingBottom="@dimen/qs_paged_tile_layout_padding_bottom" /> diff --git a/packages/SystemUI/res/layout/qs_panel.xml b/packages/SystemUI/res/layout/qs_panel.xml index 30e52e9a763ca..2cafd1b210521 100644 --- a/packages/SystemUI/res/layout/qs_panel.xml +++ b/packages/SystemUI/res/layout/qs_panel.xml @@ -36,6 +36,8 @@ android:elevation="4dp" android:importantForAccessibility="no" android:scrollbars="none" + android:clipChildren="false" + android:clipToPadding="false" android:layout_weight="1"> + android:accessibilityTraversalBefore="@android:id/edit" + android:clipToPadding="false" + android:clipChildren="false"> diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java index f7fa5bfc42488..c552e89a36259 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java +++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java @@ -8,7 +8,6 @@ import android.animation.PropertyValuesHolder; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; -import android.graphics.Rect; import android.os.Bundle; import android.util.AttributeSet; import android.util.Log; @@ -63,7 +62,6 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { private int mPageToRestore = -1; private int mLayoutOrientation; private int mLayoutDirection; - private final Rect mClippingRect; private final UiEventLogger mUiEventLogger = QSEvents.INSTANCE.getQsUiEventsLogger(); private int mExcessHeight; private int mLastExcessHeight; @@ -78,14 +76,16 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { setCurrentItem(0, false); mLayoutOrientation = getResources().getConfiguration().orientation; mLayoutDirection = getLayoutDirection(); - mClippingRect = new Rect(); - - // Make sure there's a space between pages when scroling - setPageMargin(context.getResources().getDimensionPixelOffset( - R.dimen.qs_tile_margin_horizontal)); } private int mLastMaxHeight = -1; + @Override + public void setPageMargin(int marginPixels) { + if (marginPixels != getPageMargin()) { + super.setPageMargin(marginPixels); + } + } + public void saveInstanceState(Bundle outState) { outState.putInt(CURRENT_PAGE, getCurrentItem()); } @@ -352,14 +352,6 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { return changed; } - @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - super.onLayout(changed, l, t, r, b); - // Clip to margins - mClippingRect.set(0, 0, (r - l), b - t); - setClipBounds(mClippingRect); - } - @Override public boolean setMinRows(int minRows) { mMinRows = minRows; diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java index 661dbf60bb3b5..9abb430e6fb31 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java @@ -314,6 +314,9 @@ public class QSContainerImpl extends FrameLayout { if (view == mQSPanelContainer) { // QS panel lays out some of its content full width qsPanelController.setContentMargins(mContentPadding, mContentPadding); + // Set it as double the side margin (to simulate end margin of current page + + // start margin of next page). + qsPanelController.setPageMargin(2 * mSideMargins); } else if (view == mHeader) { // The header contains the QQS panel which needs to have special padding, to // visually align them. diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java index d5cb777416a73..814846c4c4e2d 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java @@ -480,8 +480,12 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca private void updateQsBounds() { if (mLastQSExpansion == 1.0f) { // Fully expanded, let's set the layout bounds as clip bounds. This is necessary because - // it's a scrollview and otherwise wouldn't be clipped. - mQsBounds.set(0, 0, mQSPanelScrollView.getWidth(), mQSPanelScrollView.getHeight()); + // it's a scrollview and otherwise wouldn't be clipped. However, we set the horizontal + // bounds so the pages go to the ends of QSContainerImpl + ViewGroup.MarginLayoutParams lp = + (ViewGroup.MarginLayoutParams) mQSPanelScrollView.getLayoutParams(); + mQsBounds.set(-lp.leftMargin, 0, mQSPanelScrollView.getWidth() + lp.rightMargin, + mQSPanelScrollView.getHeight()); } mQSPanelScrollView.setClipBounds(mQsBounds); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index f7b6686ec9063..4e16b7414ff16 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -672,6 +672,16 @@ public class QSPanel extends LinearLayout implements Tunable { switchSecurityFooter(); } + protected void setPageMargin(int pageMargin) { + if (mRegularTileLayout instanceof PagedTileLayout) { + ((PagedTileLayout) mRegularTileLayout).setPageMargin(pageMargin); + } + if (mHorizontalTileLayout != mRegularTileLayout + && mHorizontalTileLayout instanceof PagedTileLayout) { + ((PagedTileLayout) mHorizontalTileLayout).setPageMargin(pageMargin); + } + } + void setUsingHorizontalLayout(boolean horizontal, ViewGroup mediaHostView, boolean force, UiEventLogger uiEventLogger) { if (horizontal != mUsingHorizontalLayout || force) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java index 93ccfc7288e78..fff3d1fe4b5fd 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java @@ -321,5 +321,9 @@ public class QSPanelController extends QSPanelControllerBase { public boolean isExpanded() { return mView.isExpanded(); } + + void setPageMargin(int pageMargin) { + mView.setPageMargin(pageMargin); + } }