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

Commit 533feecc authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

Removes ContainedDrawable.

Replaced by Icon. The content description field of the model classes has
been folded into the Icon as well.

Fix: 243151778
Test: Built and ran system UI
Change-Id: I91495dedf8abbfa698988ead8df5f4bdc74c73ec
parent df2bdd51
Loading
Loading
Loading
Loading
+0 −27
Original line number Diff line number Diff line
/*
 *  Copyright (C) 2022 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.
 *
 */

package com.android.systemui.containeddrawable

import android.graphics.drawable.Drawable
import androidx.annotation.DrawableRes

/** Convenience container for [Drawable] or a way to load it later. */
sealed class ContainedDrawable {
    data class WithDrawable(val drawable: Drawable) : ContainedDrawable()
    data class WithResource(@DrawableRes val resourceId: Int) : ContainedDrawable()
}
+0 −1
Original line number Diff line number Diff line
@@ -104,7 +104,6 @@ constructor(
                KeyguardQuickAffordanceModel.Visible(
                    configKey = configs[index]::class,
                    icon = visibleState.icon,
                    contentDescriptionResourceId = visibleState.contentDescriptionResourceId,
                )
            } else {
                KeyguardQuickAffordanceModel.Hidden
+2 −8
Original line number Diff line number Diff line
@@ -17,8 +17,7 @@

package com.android.systemui.keyguard.domain.model

import androidx.annotation.StringRes
import com.android.systemui.containeddrawable.ContainedDrawable
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.keyguard.domain.quickaffordance.KeyguardQuickAffordanceConfig
import kotlin.reflect.KClass

@@ -35,11 +34,6 @@ sealed class KeyguardQuickAffordanceModel {
        /** Identifier for the affordance this is modeling. */
        val configKey: KClass<out KeyguardQuickAffordanceConfig>,
        /** An icon for the affordance. */
        val icon: ContainedDrawable,
        /**
         * Resource ID for a string to use for the accessibility content description text of the
         * affordance.
         */
        @StringRes val contentDescriptionResourceId: Int,
        val icon: Icon,
    ) : KeyguardQuickAffordanceModel()
}
+10 −3
Original line number Diff line number Diff line
@@ -23,7 +23,8 @@ import androidx.annotation.DrawableRes
import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLogging
import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
import com.android.systemui.containeddrawable.ContainedDrawable
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.controls.ControlsServiceInfo
import com.android.systemui.controls.controller.StructureInfo
import com.android.systemui.controls.dagger.ControlsComponent
@@ -122,8 +123,14 @@ constructor(
                visibility == ControlsComponent.Visibility.AVAILABLE
        ) {
            KeyguardQuickAffordanceConfig.State.Visible(
                icon = ContainedDrawable.WithResource(iconResourceId),
                contentDescriptionResourceId = component.getTileTitleId(),
                icon =
                    Icon.Resource(
                        res = iconResourceId,
                        contentDescription =
                            ContentDescription.Resource(
                                res = component.getTileTitleId(),
                            ),
                    ),
            )
        } else {
            KeyguardQuickAffordanceConfig.State.Hidden
+2 −8
Original line number Diff line number Diff line
@@ -18,9 +18,8 @@
package com.android.systemui.keyguard.domain.quickaffordance

import android.content.Intent
import androidx.annotation.StringRes
import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.containeddrawable.ContainedDrawable
import com.android.systemui.common.shared.model.Icon
import kotlinx.coroutines.flow.Flow

/** Defines interface that can act as data source for a single quick affordance model. */
@@ -44,12 +43,7 @@ interface KeyguardQuickAffordanceConfig {
        /** An affordance is visible. */
        data class Visible(
            /** An icon for the affordance. */
            val icon: ContainedDrawable,
            /**
             * Resource ID for a string to use for the accessibility content description text of the
             * affordance.
             */
            @StringRes val contentDescriptionResourceId: Int,
            val icon: Icon,
        ) : State()
    }

Loading