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

Commit 0e70fe8b authored by Aaron Liu's avatar Aaron Liu Committed by Android (Google) Code Review
Browse files

Merge "Hide unconstrained views in blueprints." into main

parents 3fcdcfdc b4183f1c
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -17,7 +17,10 @@

package com.android.systemui.keyguard.data.repository

import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.view.children
import com.android.systemui.common.ui.data.repository.ConfigurationRepository
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
@@ -96,8 +99,16 @@ constructor(
/** Determines the constraints for the ConstraintSet in the lockscreen root view. */
interface KeyguardBlueprint {
    val id: String
    val shouldRemoveUnconstrainedViews: Boolean
        get() = true

    fun apply(constraintSet: ConstraintSet)
    fun apply(constraintLayout: ConstraintSet)
    fun removeUnConstrainedViews(constraintLayout: ConstraintLayout, constraintSet: ConstraintSet) {
        constraintLayout.children
            .map { it.id }
            .filterNot { constraintSet.knownIds.contains(it) }
            .forEach { constraintSet.setVisibility(it, View.GONE) }
    }
}

/**
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ class KeyguardBlueprintViewBinder {
                                val emptyLayout = ConstraintSet.Layout()
                                knownIds.forEach { getConstraint(it).layout.copyFrom(emptyLayout) }
                                blueprint?.apply(this)
                                blueprint?.removeUnConstrainedViews(constraintLayout, this)
                                applyTo(constraintLayout)
                            }
                            Trace.endSection()