Add onClick for CardPreference

Bug: 326518399
Test: Manual Test
Change-Id: Id56e53cff43d14090ec8c08704a207fd9c829c1d
This commit is contained in:
pajacechen
2024-02-23 21:33:37 +08:00
parent 94c7bd7e31
commit 808573df9b

View File

@@ -61,6 +61,9 @@ constructor(
/** The visibility of secondary button on tips card. The default value is `false`. */
var secondaryButtonVisibility: Boolean = false
var onClick: (() -> Unit)? = null
/** The callback for click on card preference itself. */
private var onDismiss: (() -> Unit)? = null
/** Enable the dismiss button on tips card. */
@@ -84,9 +87,10 @@ constructor(
buttons = listOfNotNull(configPrimaryButton(), configSecondaryButton()),
onDismiss = onDismiss,
imageVector =
iconResId
?.takeIf { it != Resources.ID_NULL }
?.let { ImageVector.vectorResource(it) },
iconResId
?.takeIf { it != Resources.ID_NULL }
?.let { ImageVector.vectorResource(it) },
onClick = onClick,
)
)
}