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

Commit f883daee authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge "Fix insets in QS." into main

parents d0b12dac ecfb48ea
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -207,6 +207,8 @@ public interface QS extends FragmentBase {

    default void setQqsHeightListener(QqsHeightListener listener) {}

    default void setQSContentPaddingBottom(int padding) {}

    /**
     * Callback for when QSPanel container is scrolled
     */
+8 −1
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshotFlow
@@ -196,6 +197,7 @@ constructor(
    private val scrollState = ScrollState(0)
    private val locationTemp = IntArray(2)
    private var bottomBarPositionInRoot = IntRect(IntOffset(0, 0), 0)
    private var bottomContentPadding by mutableIntStateOf(0)
    private val containerView: FrameLayoutTouchPassthrough?
        get() = view as? FrameLayoutTouchPassthrough

@@ -634,6 +636,10 @@ constructor(
        return qqsVisible.value
    }

    override fun setQSContentPaddingBottom(padding: Int) {
        bottomContentPadding = padding
    }

    private fun setListenerCollections() {
        lifecycleScope.launch {
            lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) {
@@ -938,7 +944,7 @@ constructor(
                    }
                }
            }
            Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.systemBars))
            Spacer(Modifier.height { bottomContentPadding }.fillMaxWidth())
        }
    }

@@ -1008,6 +1014,7 @@ constructor(
            }
            println("QQS visible", qqsVisible.value)
            println("Always composed", alwaysCompose)
            println("bottom QS padding", bottomContentPadding)
            if (::viewModel.isInitialized) {
                printSection("View Model") { viewModel.dump(this@run, args) }
            }
+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.navigationbar.NavigationModeController
import com.android.systemui.plugins.qs.QS
import com.android.systemui.plugins.qs.QSContainerController
import com.android.systemui.qs.flags.QSComposeFragment
import com.android.systemui.res.R
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.shared.system.QuickStepContract
@@ -229,6 +230,11 @@ constructor(
        mView.setPadding(0, 0, 0, containerPadding)
        mView.setNotificationsMarginBottom(notificationsMargin)
        mView.setQSContainerPaddingBottom(qsContainerPadding)
        if (QSComposeFragment.isEnabled && !isQSCustomizing) {
            // To have complete control when QS is in compose, we add negative margin to negate
            // the padding of the container. That way we can adjust the padding inside compose.
            mView.setQSNegativeMarginBottom(containerPadding)
        }
    }

    private fun calculateBottomSpacing(): Paddings {
+13 −1
Original line number Diff line number Diff line
@@ -115,7 +115,11 @@ public class NotificationsQuickSettingsContainer extends ConstraintLayout

    public void setQSContainerPaddingBottom(int paddingBottom) {
        mLastQSPaddingBottom = paddingBottom;
        if (!QSComposeFragment.isEnabled()) {
        if (QSComposeFragment.isEnabled()) {
            if (mQs != null) {
                mQs.setQSContentPaddingBottom(paddingBottom);
            }
        } else {
            if (mQSContainer != null) {
                mQSContainer.setPadding(
                        mQSContainer.getPaddingLeft(),
@@ -127,6 +131,14 @@ public class NotificationsQuickSettingsContainer extends ConstraintLayout
        }
    }

    public void setQSNegativeMarginBottom(int margin) {
        if (QSComposeFragment.isEnabled() && mQSContainer != null) {
            MarginLayoutParams params = (MarginLayoutParams) mQSContainer.getLayoutParams();
            params.bottomMargin = -margin;
            mQSContainer.setLayoutParams(params);
        }
    }

    public void setInsetsChangedListener(Consumer<WindowInsets> onInsetsChangedListener) {
        mInsetsChangedListener = onInsetsChangedListener;
    }