Use proper margins for NPV plugin and set the offset
Set the offset to the size of the QS area and add margin after that to visually separate the QS and NPVPlugin areas Test: visual Change-Id: I9dc676eef0a49f1648723cdd91043b839c880ee5
This commit is contained in:
@@ -20,10 +20,10 @@
|
||||
android:id="@+id/plugin_frame"
|
||||
android:theme="@style/qs_theme"
|
||||
android:layout_width="@dimen/qs_panel_width"
|
||||
android:layout_height="96dp"
|
||||
android:layout_height="105dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@*android:dimen/quick_qs_total_height"
|
||||
android:layout_marginTop="@dimen/notification_side_paddings"
|
||||
android:layout_marginLeft="@dimen/notification_side_paddings"
|
||||
android:layout_marginRight="@dimen/notification_side_paddings"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/qs_background_primary"/>
|
||||
android:background="@drawable/qs_background_primary"/>
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.view.ViewGroup.MarginLayoutParams
|
||||
import android.widget.FrameLayout
|
||||
import com.android.systemui.plugins.NPVPlugin
|
||||
import com.android.systemui.plugins.PluginListener
|
||||
@@ -36,6 +37,7 @@ class NPVPluginManager(
|
||||
|
||||
private var plugin: NPVPlugin? = null
|
||||
private var animator = createAnimator()
|
||||
private var yOffset = 0f
|
||||
|
||||
private fun createAnimator() = TouchAnimator.Builder()
|
||||
.addFloat(parent, "alpha", 1f, 0f)
|
||||
@@ -76,7 +78,7 @@ class NPVPluginManager(
|
||||
}
|
||||
|
||||
fun setExpansion(expansion: Float, headerTranslation: Float, heightDiff: Float) {
|
||||
parent.setTranslationY(expansion * heightDiff + headerTranslation)
|
||||
parent.setTranslationY(expansion * heightDiff + headerTranslation + yOffset)
|
||||
if (!expansion.isNaN()) animator.setPosition(expansion)
|
||||
}
|
||||
|
||||
@@ -88,5 +90,13 @@ class NPVPluginManager(
|
||||
animator = createAnimator()
|
||||
}
|
||||
|
||||
fun getHeight() = if (plugin != null) parent.height else 0
|
||||
fun getHeight() =
|
||||
if (plugin != null) {
|
||||
parent.height + (parent.getLayoutParams() as MarginLayoutParams).topMargin
|
||||
} else 0
|
||||
|
||||
fun setYOffset(y: Float) {
|
||||
yOffset = y
|
||||
parent.setTranslationY(yOffset)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -652,8 +652,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
mNotificationStackScroller.setLayoutParams(lp);
|
||||
}
|
||||
int sideMargin = res.getDimensionPixelOffset(R.dimen.notification_side_paddings);
|
||||
int topMargin =
|
||||
res.getDimensionPixelOffset(com.android.internal.R.dimen.quick_qs_total_height);
|
||||
int topMargin = sideMargin;
|
||||
lp = (FrameLayout.LayoutParams) mPluginFrame.getLayoutParams();
|
||||
if (lp.width != qsWidth || lp.gravity != panelGravity || lp.leftMargin != sideMargin
|
||||
|| lp.rightMargin != sideMargin || lp.topMargin != topMargin) {
|
||||
@@ -796,6 +795,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
int oldMaxHeight = mQsMaxExpansionHeight;
|
||||
if (mQs != null) {
|
||||
mQsMinExpansionHeight = mKeyguardShowing ? 0 : mQs.getQsMinExpansionHeight();
|
||||
mNPVPluginManager.setYOffset(mQsMinExpansionHeight);
|
||||
mQsMinExpansionHeight += mNPVPluginManager.getHeight();
|
||||
mQsMaxExpansionHeight = mQs.getDesiredHeight();
|
||||
mNotificationStackScroller.setMaxTopPadding(
|
||||
|
||||
Reference in New Issue
Block a user