From d0356314163c8cd6975342d69791c548993c5304 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Fri, 11 Aug 2023 12:10:23 -0700 Subject: [PATCH] Change rootview to general constraintlayout. Make parameter more generalized so that we can possibly bind blueprints to other constraint layouts. Bug: 295555276 Test: Ensure that it builds properly. Change-Id: Ic440ee3866d317aaa64368b242fa5043046a2cd5 --- .../keyguard/ui/binder/KeyguardBlueprintViewBinder.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt index 23b80b05a7858..ed4dd6a15c183 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt @@ -19,10 +19,10 @@ package com.android.systemui.keyguard.ui.binder import android.os.Trace import android.util.Log +import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle -import com.android.systemui.keyguard.ui.view.KeyguardRootView import com.android.systemui.keyguard.ui.viewmodel.KeyguardBlueprintViewModel import com.android.systemui.lifecycle.repeatWhenAttached import kotlinx.coroutines.launch @@ -31,19 +31,19 @@ class KeyguardBlueprintViewBinder { companion object { private const val TAG = "KeyguardBlueprintViewBinder" - fun bind(keyguardRootView: KeyguardRootView, viewModel: KeyguardBlueprintViewModel) { - keyguardRootView.repeatWhenAttached { + fun bind(constraintLayout: ConstraintLayout, viewModel: KeyguardBlueprintViewModel) { + constraintLayout.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.CREATED) { launch { viewModel.blueprint.collect { blueprint -> Trace.beginSection("KeyguardBlueprintController#applyBlueprint") Log.d(TAG, "applying blueprint: $blueprint") ConstraintSet().apply { - clone(keyguardRootView) + clone(constraintLayout) val emptyLayout = ConstraintSet.Layout() knownIds.forEach { getConstraint(it).layout.copyFrom(emptyLayout) } blueprint?.apply(this) - applyTo(keyguardRootView) + applyTo(constraintLayout) } Trace.endSection() }