diff --git a/packages/SystemUI/res/layout/combined_qs_header.xml b/packages/SystemUI/res/layout/combined_qs_header.xml index f0b59d825417d..1f10e5dfeed83 100644 --- a/packages/SystemUI/res/layout/combined_qs_header.xml +++ b/packages/SystemUI/res/layout/combined_qs_header.xml @@ -14,7 +14,7 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + android:theme="@style/Theme.SystemUI.QuickSettings.Header" + app:layoutDescription="@xml/combined_qs_header_scene"> - \ No newline at end of file + \ No newline at end of file diff --git a/packages/SystemUI/res/xml/combined_qs_header_scene.xml b/packages/SystemUI/res/xml/combined_qs_header_scene.xml new file mode 100644 index 0000000000000..d61e4a95bb680 --- /dev/null +++ b/packages/SystemUI/res/xml/combined_qs_header_scene.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/xml/qqs_header.xml b/packages/SystemUI/res/xml/qqs_header.xml index fdf73d53e905e..3d7b549fc54b8 100644 --- a/packages/SystemUI/res/xml/qqs_header.xml +++ b/packages/SystemUI/res/xml/qqs_header.xml @@ -17,66 +17,45 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/qqs_header_constraint" +> + android:id="@+id/clock"> + + + android:id="@+id/date"> + + + android:id="@+id/carrier_group"> + + - - \ No newline at end of file diff --git a/packages/SystemUI/res/xml/qs_header.xml b/packages/SystemUI/res/xml/qs_header.xml index 72e518eab839d..6a0ab866966ce 100644 --- a/packages/SystemUI/res/xml/qs_header.xml +++ b/packages/SystemUI/res/xml/qs_header.xml @@ -17,63 +17,46 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/qs_header_constraint" +> + android:id="@+id/clock"> + + + android:id="@+id/date"> + + + + android:id="@+id/carrier_group"> + + - - - \ No newline at end of file diff --git a/packages/SystemUI/res/xml/split_header.xml b/packages/SystemUI/res/xml/split_header.xml index a3ee1e2fae645..44d42a05cd46e 100644 --- a/packages/SystemUI/res/xml/split_header.xml +++ b/packages/SystemUI/res/xml/split_header.xml @@ -17,61 +17,41 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/split_header_constraint"> + android:id="@+id/clock"> + + + android:id="@+id/date"> + + + android:id="@+id/carrier_group"> + + - - - \ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java index 9477e0087d2f1..0fc4f4a94bdaf 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java @@ -309,6 +309,10 @@ public class QuickStatusBarHeader extends FrameLayout { } private void updateAnimators() { + if (mUseCombinedQSHeader) { + mTranslationAnimator = null; + return; + } updateAlphaAnimator(); int offset = mTopViewMeasureHeight; @@ -321,6 +325,10 @@ public class QuickStatusBarHeader extends FrameLayout { } private void updateAlphaAnimator() { + if (mUseCombinedQSHeader) { + mAlphaAnimator = null; + return; + } TouchAnimator.Builder builder = new TouchAnimator.Builder() .addFloat(mSecurityHeaderView, "alpha", 0, 1) // These views appear on expanding down diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeHeaderController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeHeaderController.kt index bac4234389aa5..c814622ff0749 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeHeaderController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeHeaderController.kt @@ -17,8 +17,7 @@ package com.android.systemui.statusbar.phone import android.view.View -import androidx.constraintlayout.widget.ConstraintLayout -import androidx.constraintlayout.widget.ConstraintSet +import androidx.constraintlayout.motion.widget.MotionLayout import com.android.systemui.R import com.android.systemui.animation.ShadeInterpolation import com.android.systemui.battery.BatteryMeterView @@ -39,6 +38,11 @@ class SplitShadeHeaderController @Inject constructor( batteryMeterViewController: BatteryMeterViewController ) { + companion object { + private val HEADER_TRANSITION_ID = R.id.header_transition + private val SPLIT_HEADER_TRANSITION_ID = R.id.split_header_transition + } + private val combinedHeaders = featureFlags.useCombinedQSHeaders() // TODO(b/194178072) Handle RSSI hiding when multi carrier private val iconManager: StatusBarIconController.IconManager @@ -59,6 +63,7 @@ class SplitShadeHeaderController @Inject constructor( } field = value updateVisibility() + updatePosition() } var splitShadeMode = false @@ -68,6 +73,7 @@ class SplitShadeHeaderController @Inject constructor( } field = value updateVisibility() + updateConstraints() } var shadeExpandedFraction = -1f @@ -83,13 +89,22 @@ class SplitShadeHeaderController @Inject constructor( if (visible && field != value) { field = value updateVisibility() + updatePosition() } } - private val constraintSplit = ConstraintSet() - .apply { load(statusBar.context, R.xml.split_header) } - private val constraintQQS = ConstraintSet().apply { load(statusBar.context, R.xml.qqs_header) } - private val constraintQS = ConstraintSet().apply { load(statusBar.context, R.xml.qs_header) } + init { + if (statusBar is MotionLayout) { + val context = statusBar.context + val resources = statusBar.resources + statusBar.getConstraintSet(R.id.qqs_header_constraint) + .load(context, resources.getXml(R.xml.qqs_header)) + statusBar.getConstraintSet(R.id.qs_header_constraint) + .load(context, resources.getXml(R.xml.qs_header)) + statusBar.getConstraintSet(R.id.split_header_constraint) + .load(context, resources.getXml(R.xml.split_header)) + } + } init { batteryMeterViewController.init() @@ -104,6 +119,8 @@ class SplitShadeHeaderController @Inject constructor( qsCarrierGroupController = qsCarrierGroupControllerBuilder .setQSCarrierGroup(statusBar.findViewById(R.id.carrier_group)) .build() + updateVisibility() + updateConstraints() } private fun updateVisibility() { @@ -118,20 +135,25 @@ class SplitShadeHeaderController @Inject constructor( statusBar.visibility = visibility visible = visibility == View.VISIBLE } - updateConstraints() } private fun updateConstraints() { if (!combinedHeaders) { return } - statusBar as ConstraintLayout + statusBar as MotionLayout if (splitShadeMode) { - constraintSplit.applyTo(statusBar) - } else if (qsExpandedFraction == 1f) { - constraintQS.applyTo(statusBar) + statusBar.setTransition(SPLIT_HEADER_TRANSITION_ID) } else { - constraintQQS.applyTo(statusBar) + statusBar.setTransition(HEADER_TRANSITION_ID) + statusBar.transitionToStart() + updatePosition() + } + } + + private fun updatePosition() { + if (statusBar is MotionLayout && !splitShadeMode && visible) { + statusBar.setProgress(qsExpandedFraction) } }