Loading packages/SystemUI/compose/gallery/src/com/android/systemui/qs/footer/Fakes.kt +5 −1 Original line number Diff line number Diff line Loading @@ -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, ) Loading packages/SystemUI/src/com/android/systemui/common/shared/model/Icon.kt +4 −0 Original line number Diff line number Diff line Loading @@ -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() } packages/SystemUI/src/com/android/systemui/common/ui/binder/ContentDescriptionViewBinder.kt +8 −6 Original line number Diff line number Diff line Loading @@ -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) } } } Loading packages/SystemUI/src/com/android/systemui/common/ui/binder/IconViewBinder.kt +1 −0 Original line number Diff line number Diff line Loading @@ -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) Loading packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java +2 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
packages/SystemUI/compose/gallery/src/com/android/systemui/qs/footer/Fakes.kt +5 −1 Original line number Diff line number Diff line Loading @@ -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, ) Loading
packages/SystemUI/src/com/android/systemui/common/shared/model/Icon.kt +4 −0 Original line number Diff line number Diff line Loading @@ -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() }
packages/SystemUI/src/com/android/systemui/common/ui/binder/ContentDescriptionViewBinder.kt +8 −6 Original line number Diff line number Diff line Loading @@ -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) } } } Loading
packages/SystemUI/src/com/android/systemui/common/ui/binder/IconViewBinder.kt +1 −0 Original line number Diff line number Diff line Loading @@ -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) Loading
packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java +2 −1 Original line number Diff line number Diff line Loading @@ -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