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

Commit 30431020 authored by Matt Casey's avatar Matt Casey Committed by Automerger Merge Worker
Browse files

Merge "Allow a custom background drawable to be provided for the action...

Merge "Allow a custom background drawable to be provided for the action button." into 24D1-dev am: d95fc067

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



Change-Id: I9b3c06c9b6f0cc5cbeb1e93902a53cac1f308733
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 21a1a483 d95fc067
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -37,6 +37,14 @@ object ActionButtonViewBinder {
        // models would remove/create separate views.
        drawable?.setIcon(viewModel.appearance.icon)
        textView.text = viewModel.appearance.label

        viewModel.appearance.customBackground?.also {
            if (it.canApplyTheme()) {
                it.applyTheme(view.rootView.context.theme)
            }
            view.background = it
        }

        setMargins(iconView, textView, viewModel.appearance.label?.isNotEmpty() ?: false)
        if (viewModel.onClicked != null) {
            view.setOnClickListener { viewModel.onClicked.invoke() }
+4 −1
Original line number Diff line number Diff line
@@ -19,8 +19,11 @@ package com.android.systemui.screenshot.ui.viewmodel
import android.graphics.drawable.Drawable

/** Data describing how an action should be shown to the user. */
data class ActionButtonAppearance(
data class ActionButtonAppearance
@JvmOverloads
constructor(
    val icon: Drawable?,
    val label: CharSequence?,
    val description: CharSequence,
    val customBackground: Drawable? = null,
)