Merge "Fix up the QS gutter" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
78ee090f78
@@ -62,6 +62,9 @@ public interface QS extends FragmentBase {
|
||||
|
||||
View getHeader();
|
||||
|
||||
default void setHasNotifications(boolean hasNotifications) {
|
||||
}
|
||||
|
||||
@ProvidesInterface(version = HeightListener.VERSION)
|
||||
public interface HeightListener {
|
||||
public static final int VERSION = 1;
|
||||
|
||||
@@ -27,20 +27,22 @@
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:paddingTop="0dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<include
|
||||
android:id="@+id/date_time_alarm_group"
|
||||
layout="@layout/status_bar_alarm_group"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:gravity="end">
|
||||
|
||||
<com.android.systemui.statusbar.phone.MultiUserSwitch
|
||||
@@ -113,4 +115,9 @@
|
||||
android:padding="14dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/qs_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="bottom" />
|
||||
|
||||
</com.android.systemui.qs.QSFooter>
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:gravity="center"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
|
||||
@@ -17,14 +17,11 @@
|
||||
package com.android.systemui.qs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Point;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.qs.customize.QSCustomizer;
|
||||
|
||||
@@ -44,6 +41,7 @@ public class QSContainerImpl extends FrameLayout {
|
||||
private QSFooter mQSFooter;
|
||||
private int mGutterHeight;
|
||||
private View mBackground;
|
||||
private float mFullElevation;
|
||||
|
||||
public QSContainerImpl(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -59,6 +57,7 @@ public class QSContainerImpl extends FrameLayout {
|
||||
mQSFooter = findViewById(R.id.qs_footer);
|
||||
mBackground = findViewById(R.id.qs_background);
|
||||
mGutterHeight = getContext().getResources().getDimensionPixelSize(R.dimen.qs_gutter_height);
|
||||
mFullElevation = mQSPanel.getElevation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,7 +84,7 @@ public class QSContainerImpl extends FrameLayout {
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
updateBottom();
|
||||
updateExpansion();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,27 +95,47 @@ public class QSContainerImpl extends FrameLayout {
|
||||
*/
|
||||
public void setHeightOverride(int heightOverride) {
|
||||
mHeightOverride = heightOverride;
|
||||
updateBottom();
|
||||
updateExpansion();
|
||||
}
|
||||
|
||||
public void updateBottom() {
|
||||
public void updateExpansion() {
|
||||
int height = calculateContainerHeight();
|
||||
setBottom(getTop() + height + mGutterHeight);
|
||||
int gutterHeight = Math.round(mQsExpansion * mGutterHeight);
|
||||
setBottom(getTop() + height + gutterHeight);
|
||||
mQSDetail.setBottom(getTop() + height);
|
||||
mBackground.setBottom(mQSDetail.getBottom());
|
||||
mBackground.setBottom(getTop() + height);
|
||||
// Pin QS Footer to the bottom of the panel.
|
||||
mQSFooter.setTranslationY(height - mQSFooter.getHeight());
|
||||
|
||||
float elevation = mQsExpansion * mFullElevation;
|
||||
mQSDetail.setElevation(elevation);
|
||||
mBackground.setElevation(elevation);
|
||||
mQSFooter.setElevation(elevation);
|
||||
mQSPanel.setElevation(elevation);
|
||||
}
|
||||
|
||||
protected int calculateContainerHeight() {
|
||||
int heightOverride = mHeightOverride != -1 ? mHeightOverride : getMeasuredHeight();
|
||||
return mQSCustomizer.isCustomizing() ? mQSCustomizer.getHeight()
|
||||
: (int) (mQsExpansion * (heightOverride - mHeader.getHeight()))
|
||||
: Math.round(mQsExpansion * (heightOverride - mHeader.getHeight()))
|
||||
+ mHeader.getHeight();
|
||||
}
|
||||
|
||||
public void setExpansion(float expansion) {
|
||||
mQsExpansion = expansion;
|
||||
updateBottom();
|
||||
updateExpansion();
|
||||
}
|
||||
|
||||
public void setGutterEnabled(boolean gutterEnabled) {
|
||||
if (gutterEnabled == (mGutterHeight != 0)) {
|
||||
return;
|
||||
}
|
||||
if (gutterEnabled) {
|
||||
mGutterHeight = getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.qs_gutter_height);
|
||||
} else {
|
||||
mGutterHeight = 0;
|
||||
}
|
||||
updateExpansion();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,6 +235,7 @@ public class QSFooter extends FrameLayout implements
|
||||
}
|
||||
|
||||
TouchAnimator.Builder animatorBuilder = new TouchAnimator.Builder();
|
||||
animatorBuilder.setStartDelay(QSAnimator.EXPANDED_TILE_DELAY);
|
||||
|
||||
if (mShowEditIcon) {
|
||||
animatorBuilder.addFloat(mEdit, "alpha", 0, 1);
|
||||
|
||||
@@ -34,7 +34,6 @@ import android.widget.FrameLayout.LayoutParams;
|
||||
import com.android.systemui.Interpolators;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.R.id;
|
||||
import com.android.systemui.R.style;
|
||||
import com.android.systemui.plugins.qs.QS;
|
||||
import com.android.systemui.qs.customize.QSCustomizer;
|
||||
import com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer;
|
||||
@@ -130,6 +129,11 @@ public class QSFragment extends Fragment implements QS {
|
||||
return mHeader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHasNotifications(boolean hasNotifications) {
|
||||
mContainer.setGutterEnabled(hasNotifications);
|
||||
}
|
||||
|
||||
public void setPanelView(HeightListener panelView) {
|
||||
mPanelView = panelView;
|
||||
}
|
||||
@@ -307,7 +311,7 @@ public class QSFragment extends Fragment implements QS {
|
||||
|
||||
public void notifyCustomizeChanged() {
|
||||
// The customize state changed, so our height changed.
|
||||
mContainer.updateBottom();
|
||||
mContainer.updateExpansion();
|
||||
mQSPanel.setVisibility(!mQSCustomizer.isCustomizing() ? View.VISIBLE : View.INVISIBLE);
|
||||
mHeader.setVisibility(!mQSCustomizer.isCustomizing() ? View.VISIBLE : View.INVISIBLE);
|
||||
mFooter.setVisibility(!mQSCustomizer.isCustomizing() ? View.VISIBLE : View.INVISIBLE);
|
||||
@@ -340,7 +344,7 @@ public class QSFragment extends Fragment implements QS {
|
||||
}
|
||||
|
||||
public int getQsMinExpansionHeight() {
|
||||
return mHeader.getHeight() + mGutterHeight;
|
||||
return mHeader.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2535,6 +2535,9 @@ public class NotificationPanelView extends PanelView implements
|
||||
|
||||
public void setNoVisibleNotifications(boolean noNotifications) {
|
||||
mNoVisibleNotifications = noNotifications;
|
||||
if (mQs != null) {
|
||||
mQs.setHasNotifications(!noNotifications);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPulsing(boolean pulsing) {
|
||||
|
||||
Reference in New Issue
Block a user