Merge "Expansion animations" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
bd7424947c
@@ -14,7 +14,7 @@
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<androidx.constraintlayout.motion.widget.MotionLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/split_shade_status_bar"
|
||||
@@ -26,7 +26,8 @@
|
||||
android:paddingLeft="@dimen/qs_panel_padding"
|
||||
android:paddingRight="@dimen/qs_panel_padding"
|
||||
android:visibility="gone"
|
||||
android:theme="@style/Theme.SystemUI.QuickSettings.Header">
|
||||
android:theme="@style/Theme.SystemUI.QuickSettings.Header"
|
||||
app:layoutDescription="@xml/combined_qs_header_scene">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:layout_width="wrap_content"
|
||||
@@ -39,76 +40,65 @@
|
||||
android:id="@+id/clock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintHeight_min="@dimen/split_shade_header_min_height"
|
||||
android:gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/status_bar_left_clock_starting_padding"
|
||||
android:paddingEnd="@dimen/status_bar_left_clock_end_padding"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.QS.Status"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/date"
|
||||
/>
|
||||
|
||||
<com.android.systemui.statusbar.policy.DateView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintHeight_min="@dimen/split_shade_header_min_height"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.QS.Status"
|
||||
app:datePattern="@string/abbrev_wday_month_day_no_year_alarm"
|
||||
app:layout_constraintStart_toEndOf="@id/clock"
|
||||
app:layout_constraintEnd_toStartOf="@id/carrier_group"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
/>
|
||||
|
||||
<include
|
||||
android:id="@+id/carrier_group"
|
||||
layout="@layout/qs_carrier_group"
|
||||
app:layout_constraintHeight_min="@dimen/split_shade_header_min_height"
|
||||
android:minHeight="@dimen/split_shade_header_min_height"
|
||||
app:layout_constraintWidth_min="48dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintHeight_min="@dimen/split_shade_header_min_height"
|
||||
app:layout_constrainedWidth="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginStart="8dp"
|
||||
android:focusable="false"
|
||||
android:minHeight="@dimen/split_shade_header_min_height"
|
||||
android:minWidth="48dp"
|
||||
app:layout_constraintStart_toEndOf="@id/date"
|
||||
app:layout_constraintEnd_toStartOf="@id/statusIcons"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/clock"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
/>
|
||||
|
||||
<com.android.systemui.statusbar.phone.StatusIconContainer
|
||||
android:id="@+id/statusIcons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintHeight_min="@dimen/split_shade_header_min_height"
|
||||
android:paddingEnd="@dimen/signal_cluster_battery_padding"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
app:layout_constraintStart_toEndOf="@id/carrier_group"
|
||||
app:layout_constraintEnd_toStartOf="@id/batteryRemainingIcon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/clock"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
/>
|
||||
|
||||
<com.android.systemui.battery.BatteryMeterView
|
||||
android:id="@+id/batteryRemainingIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="48dp"
|
||||
app:layout_constraintHeight_min="@dimen/split_shade_header_min_height"
|
||||
app:textAppearance="@style/TextAppearance.QS.Status"
|
||||
app:layout_constraintStart_toEndOf="@id/statusIcons"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/clock"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.motion.widget.MotionLayout>
|
||||
50
packages/SystemUI/res/xml/combined_qs_header_scene.xml
Normal file
50
packages/SystemUI/res/xml/combined_qs_header_scene.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2021 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<MotionScene
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<Transition
|
||||
android:id="@+id/header_transition"
|
||||
app:constraintSetEnd="@id/qs_header_constraint"
|
||||
app:constraintSetStart="@id/qqs_header_constraint">
|
||||
<KeyFrameSet>
|
||||
<KeyPosition
|
||||
app:keyPositionType="pathRelative"
|
||||
app:percentX="0"
|
||||
app:framePosition="50"
|
||||
app:motionTarget="@id/date" />
|
||||
</KeyFrameSet>
|
||||
</Transition>
|
||||
|
||||
<Transition
|
||||
android:id="@+id/split_header_transition"
|
||||
app:constraintSetStart="@id/split_header_constraint"
|
||||
app:constraintSetEnd="@id/split_header_constraint"/>
|
||||
|
||||
<!--
|
||||
Placeholder ConstraintSet. They are populated in the controller for this class.
|
||||
This is needed because there's no easy way to just refer to a `ConstraintSet` file. The
|
||||
options are either a layout file or inline the ConstraintSets.
|
||||
-->
|
||||
<ConstraintSet android:id="@id/qqs_header_constraint"/>
|
||||
|
||||
<ConstraintSet android:id="@id/qs_header_constraint"/>
|
||||
|
||||
<ConstraintSet android:id="@id/split_header_constraint" />
|
||||
|
||||
</MotionScene>
|
||||
@@ -17,66 +17,45 @@
|
||||
|
||||
<ConstraintSet
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/qqs_header_constraint"
|
||||
>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/clock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/date"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
/>
|
||||
android:id="@+id/clock">
|
||||
<Layout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/date"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toEndOf="@id/clock"
|
||||
app:layout_constraintEnd_toStartOf="@id/carrier_group"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
/>
|
||||
android:id="@+id/date">
|
||||
<Layout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toEndOf="@id/clock"
|
||||
app:layout_constraintEnd_toStartOf="@id/carrier_group"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/carrier_group"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constrainedWidth="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintStart_toEndOf="@id/date"
|
||||
app:layout_constraintEnd_toStartOf="@id/statusIcons"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
/>
|
||||
android:id="@+id/carrier_group">
|
||||
<CustomAttribute
|
||||
app:attributeName="alpha"
|
||||
app:customFloatValue="0"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/statusIcons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toEndOf="@id/carrier_group"
|
||||
app:layout_constraintEnd_toStartOf="@id/batteryRemainingIcon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/batteryRemainingIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toEndOf="@id/statusIcons"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
/>
|
||||
|
||||
</ConstraintSet>
|
||||
@@ -17,63 +17,46 @@
|
||||
|
||||
<ConstraintSet
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/qs_header_constraint"
|
||||
>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/clock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/date"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/carrier_group"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
/>
|
||||
android:id="@+id/clock">
|
||||
<Layout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/date"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/carrier_group"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/clock"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
/>
|
||||
android:id="@+id/date">
|
||||
<Layout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/clock"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
/>
|
||||
<Motion
|
||||
app:motionStagger="0.5"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/carrier_group"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
app:layout_constrainedWidth="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintStart_toEndOf="@id/clock"
|
||||
app:layout_constraintEnd_toStartOf="@id/statusIcons"
|
||||
app:layout_constraintTop_toTopOf="@id/clock"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
/>
|
||||
android:id="@+id/carrier_group">
|
||||
<CustomAttribute
|
||||
app:attributeName="alpha"
|
||||
app:customFloatValue="1"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/statusIcons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
app:layout_constraintStart_toEndOf="@id/carrier_group"
|
||||
app:layout_constraintEnd_toStartOf="@id/batteryRemainingIcon"
|
||||
app:layout_constraintTop_toTopOf="@id/clock"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/batteryRemainingIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
app:layout_constraintStart_toEndOf="@id/statusIcons"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/clock"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
</ConstraintSet>
|
||||
@@ -17,61 +17,41 @@
|
||||
|
||||
<ConstraintSet
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/split_header_constraint">
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/clock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/date"
|
||||
/>
|
||||
android:id="@+id/clock">
|
||||
<Layout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/date"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toEndOf="@id/clock"
|
||||
app:layout_constraintEnd_toStartOf="@id/carrier_group"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
/>
|
||||
android:id="@+id/date">
|
||||
<Layout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toEndOf="@id/clock"
|
||||
app:layout_constraintEnd_toStartOf="@id/carrier_group"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/carrier_group"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constrainedWidth="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintStart_toEndOf="@id/date"
|
||||
app:layout_constraintEnd_toStartOf="@id/statusIcons"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
/>
|
||||
android:id="@+id/carrier_group">
|
||||
<PropertySet
|
||||
android:alpha="1"
|
||||
app:customFloatValue="1"
|
||||
/>
|
||||
</Constraint>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/statusIcons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toEndOf="@id/carrier_group"
|
||||
app:layout_constraintEnd_toStartOf="@id/batteryRemainingIcon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/batteryRemainingIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toEndOf="@id/statusIcons"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
</ConstraintSet>
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user