Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e756b4f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use proper margins for NPV plugin and set the offset"

parents 390e3363 d43e133a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -20,9 +20,9 @@
    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"
+12 −2
Original line number Diff line number Diff line
@@ -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)
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -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(