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

Commit 8b228017 authored by Matt Casey's avatar Matt Casey
Browse files

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

Flag: ACONFIG com.android.systemui.screenshot_shelf_ui_2 TRUNKFOOD
Bug: 335315940
Bug: 329659738
Test: manual test with fake code.
Change-Id: Ic8662ed00e0905510bd1419087576c881ee4c97b
parent 1f324bbc
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,
)