Loading packages/SystemUI/src/com/android/systemui/qs/composefragment/QSFragmentCompose.kt +89 −49 Original line number Original line Diff line number Diff line Loading @@ -17,12 +17,15 @@ package com.android.systemui.qs.composefragment package com.android.systemui.qs.composefragment import android.annotation.SuppressLint import android.annotation.SuppressLint import android.content.Context import android.graphics.PointF import android.graphics.Rect import android.graphics.Rect import android.os.Bundle import android.os.Bundle import android.util.IndentingPrintWriter import android.util.IndentingPrintWriter import android.view.LayoutInflater import android.view.LayoutInflater import android.view.View import android.view.View import android.view.ViewGroup import android.view.ViewGroup import android.widget.FrameLayout import androidx.activity.OnBackPressedDispatcher import androidx.activity.OnBackPressedDispatcher import androidx.activity.OnBackPressedDispatcherOwner import androidx.activity.OnBackPressedDispatcherOwner import androidx.activity.setViewTreeOnBackPressedDispatcherOwner import androidx.activity.setViewTreeOnBackPressedDispatcherOwner Loading Loading @@ -185,7 +188,8 @@ constructor( savedInstanceState: Bundle?, savedInstanceState: Bundle?, ): View { ): View { val context = inflater.context val context = inflater.context return ComposeView(context).apply { val composeView = ComposeView(context).apply { setBackPressedDispatcher() setBackPressedDispatcher() setContent { setContent { PlatformTheme { PlatformTheme { Loading Loading @@ -241,6 +245,19 @@ constructor( } } } } } } val frame = FrameLayoutTouchPassthrough( context, { notificationScrimClippingParams.isEnabled }, { notificationScrimClippingParams.top }, ) frame.addView( composeView, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT, ) return frame } } /** /** Loading Loading @@ -762,3 +779,26 @@ private class ExpansionTransition(currentProgress: Float) : } } private const val EDIT_MODE_TIME_MILLIS = 500 private const val EDIT_MODE_TIME_MILLIS = 500 /** * Ignore touches below the value returned by [clippingTopProvider], when clipping is enabled, as * per [clippingEnabledProvider]. */ private class FrameLayoutTouchPassthrough( context: Context, private val clippingEnabledProvider: () -> Boolean, private val clippingTopProvider: () -> Int, ) : FrameLayout(context) { override fun isTransformedTouchPointInView( x: Float, y: Float, child: View?, outLocalPoint: PointF?, ): Boolean { return if (clippingEnabledProvider() && y + translationY > clippingTopProvider()) { false } else { super.isTransformedTouchPointInView(x, y, child, outLocalPoint) } } } Loading
packages/SystemUI/src/com/android/systemui/qs/composefragment/QSFragmentCompose.kt +89 −49 Original line number Original line Diff line number Diff line Loading @@ -17,12 +17,15 @@ package com.android.systemui.qs.composefragment package com.android.systemui.qs.composefragment import android.annotation.SuppressLint import android.annotation.SuppressLint import android.content.Context import android.graphics.PointF import android.graphics.Rect import android.graphics.Rect import android.os.Bundle import android.os.Bundle import android.util.IndentingPrintWriter import android.util.IndentingPrintWriter import android.view.LayoutInflater import android.view.LayoutInflater import android.view.View import android.view.View import android.view.ViewGroup import android.view.ViewGroup import android.widget.FrameLayout import androidx.activity.OnBackPressedDispatcher import androidx.activity.OnBackPressedDispatcher import androidx.activity.OnBackPressedDispatcherOwner import androidx.activity.OnBackPressedDispatcherOwner import androidx.activity.setViewTreeOnBackPressedDispatcherOwner import androidx.activity.setViewTreeOnBackPressedDispatcherOwner Loading Loading @@ -185,7 +188,8 @@ constructor( savedInstanceState: Bundle?, savedInstanceState: Bundle?, ): View { ): View { val context = inflater.context val context = inflater.context return ComposeView(context).apply { val composeView = ComposeView(context).apply { setBackPressedDispatcher() setBackPressedDispatcher() setContent { setContent { PlatformTheme { PlatformTheme { Loading Loading @@ -241,6 +245,19 @@ constructor( } } } } } } val frame = FrameLayoutTouchPassthrough( context, { notificationScrimClippingParams.isEnabled }, { notificationScrimClippingParams.top }, ) frame.addView( composeView, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT, ) return frame } } /** /** Loading Loading @@ -762,3 +779,26 @@ private class ExpansionTransition(currentProgress: Float) : } } private const val EDIT_MODE_TIME_MILLIS = 500 private const val EDIT_MODE_TIME_MILLIS = 500 /** * Ignore touches below the value returned by [clippingTopProvider], when clipping is enabled, as * per [clippingEnabledProvider]. */ private class FrameLayoutTouchPassthrough( context: Context, private val clippingEnabledProvider: () -> Boolean, private val clippingTopProvider: () -> Int, ) : FrameLayout(context) { override fun isTransformedTouchPointInView( x: Float, y: Float, child: View?, outLocalPoint: PointF?, ): Boolean { return if (clippingEnabledProvider() && y + translationY > clippingTopProvider()) { false } else { super.isTransformedTouchPointInView(x, y, child, outLocalPoint) } } }