Add TransferProgressIndicator composable.

Adds a composable version of `TransferProgressView`.
This commit is contained in:
Jeffrey Starke
2025-04-17 11:11:30 -04:00
committed by Cody Henthorne
parent 3d1895500c
commit 48d26beb77
8 changed files with 218 additions and 14 deletions

View File

@@ -5,10 +5,18 @@
package org.signal.core.ui.compose
import androidx.compose.foundation.Indication
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.Dp
import org.signal.core.ui.R
@@ -21,3 +29,34 @@ fun Modifier.horizontalGutters(
): Modifier {
return padding(horizontal = gutterSize)
}
/**
* Configures a component to be clickable within its bounds and show a default indication when pressed.
*
* This modifier is designed for use on container components, making it easier to create a clickable container with proper accessibility configuration.
*/
@Composable
fun Modifier.clickableContainer(
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
indication: Indication = ripple(bounded = false),
enabled: Boolean = true,
contentDescription: String?,
onClickLabel: String,
role: Role? = null,
onClick: () -> Unit
): Modifier = clickable(
interactionSource = interactionSource,
indication = indication,
enabled = enabled,
onClickLabel = onClickLabel,
role = role,
onClick = onClick
).then(
if (contentDescription != null) {
Modifier.semantics(mergeDescendants = true) {
this.contentDescription = contentDescription
}
} else {
Modifier
}
)