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

Commit d95fc067 authored by Matt Casey's avatar Matt Casey Committed by Android (Google) Code Review
Browse files

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

parents 53ba4b4b 8b228017
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,
)