Merge "Don't clip tiles as pages as scrolled" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c41e5371d7
@@ -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" />
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
android:elevation="4dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:scrollbars="none"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:layout_weight="1">
|
||||
<com.android.systemui.qs.QSPanel
|
||||
android:id="@+id/quick_settings_panel"
|
||||
@@ -43,7 +45,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:focusable="true"
|
||||
android:accessibilityTraversalBefore="@android:id/edit">
|
||||
android:accessibilityTraversalBefore="@android:id/edit"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
<include layout="@layout/qs_footer_impl" />
|
||||
<include layout="@layout/qs_media_divider"
|
||||
android:id="@+id/divider"/>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -321,5 +321,9 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
|
||||
public boolean isExpanded() {
|
||||
return mView.isExpanded();
|
||||
}
|
||||
|
||||
void setPageMargin(int pageMargin) {
|
||||
mView.setPageMargin(pageMargin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user