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

Commit e6749153 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Automerger Merge Worker
Browse files

Merge "[View binding] Add ContentDescription as part of the Icon viewmodel."...

Merge "[View binding] Add ContentDescription as part of the Icon viewmodel." into tm-qpr-dev am: 001f5e8c am: a1121c79

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19790133



Change-Id: Ide9295e3dfb0c33e7572bb4e13ddd22c76912ca6
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f2a62612 a1121c79
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -83,7 +83,11 @@ private fun fakeFooterActionsViewModel(
                flowOf(
                    securityText?.let { text ->
                        SecurityButtonConfig(
                            icon = Icon.Resource(R.drawable.ic_info_outline),
                            icon =
                                Icon.Resource(
                                    R.drawable.ic_info_outline,
                                    contentDescription = null,
                                ),
                            text = text,
                            isClickable = securityClickable,
                        )
+4 −0
Original line number Diff line number Diff line
@@ -24,11 +24,15 @@ import android.graphics.drawable.Drawable
 * [Icon.Resource] to a resource.
 */
sealed class Icon {
    abstract val contentDescription: ContentDescription?

    data class Loaded(
        val drawable: Drawable,
        override val contentDescription: ContentDescription?,
    ) : Icon()

    data class Resource(
        @DrawableRes val res: Int,
        override val contentDescription: ContentDescription?,
    ) : Icon()
}
+8 −6
Original line number Diff line number Diff line
@@ -21,13 +21,15 @@ import com.android.systemui.common.shared.model.ContentDescription

object ContentDescriptionViewBinder {
    fun bind(
        contentDescription: ContentDescription,
        contentDescription: ContentDescription?,
        view: View,
    ) {
        view.contentDescription =
            when (contentDescription) {
            is ContentDescription.Loaded -> view.contentDescription = contentDescription.description
                null -> null
                is ContentDescription.Loaded -> contentDescription.description
                is ContentDescription.Resource -> {
                view.contentDescription = view.context.resources.getString(contentDescription.res)
                    view.context.resources.getString(contentDescription.res)
                }
            }
    }
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ object IconViewBinder {
        icon: Icon,
        view: ImageView,
    ) {
        ContentDescriptionViewBinder.bind(icon.contentDescription, view)
        when (icon) {
            is Icon.Loaded -> view.setImageDrawable(icon.drawable)
            is Icon.Resource -> view.setImageResource(icon.res)
+2 −1
Original line number Diff line number Diff line
@@ -97,7 +97,8 @@ public class QSSecurityFooter extends ViewController<View>
        super(rootView);
        mFooterText = mView.findViewById(R.id.footer_text);
        mPrimaryFooterIcon = mView.findViewById(R.id.primary_footer_icon);
        mFooterIcon = new Icon.Resource(R.drawable.ic_info_outline);
        mFooterIcon = new Icon.Resource(
                R.drawable.ic_info_outline, /* contentDescription= */ null);
        mContext = rootView.getContext();
        mSecurityController = securityController;
        mMainHandler = mainHandler;
Loading