This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PhoneNumberVisualTransformation(locale: Locale = Locale.getDefault()) : VisualTransformation { | |
private val phoneNumberFormatter = | |
PhoneNumberUtil.getInstance().getAsYouTypeFormatter(locale.country) | |
override fun filter(text: AnnotatedString): TransformedText { | |
phoneNumberFormatter.clear() | |
var formatted = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class NutritionDateWithFoodItemsEntity( | |
@Embedded val nutritionDate: NutritionDateEntity, | |
@Relation( | |
parentColumn = "epochDay", | |
entityColumn = "createdAt", | |
associateBy = Junction(NutritionDateAndFoodItemCrossRefEntity::class) | |
) | |
val foodItems: List<FoodItemEntity> | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Modifier.repeatingClickable( | |
interactionSource: MutableInteractionSource, | |
enabled: Boolean, | |
maxDelayMillis: Long = 1000, | |
minDelayMillis: Long = 5, | |
delayDecayFactor: Float = .20f, | |
onClick: () -> Unit | |
): Modifier = composed { | |
val currentClickListener by rememberUpdatedState(onClick) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Preview | |
@Composable | |
fun CustomRepeatingButton() { | |
Box(modifier = Modifier.fillMaxSize()) { | |
var repeatCount by remember { mutableStateOf(0) } | |
val interactionSource = remember { MutableInteractionSource() } | |
Surface( | |
modifier = Modifier | |
.repeatingClickable( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Modifier.repeatingClickable( | |
interactionSource: InteractionSource, | |
enabled: Boolean, | |
maxDelayMillis: Long = 1000, | |
minDelayMillis: Long = 5, | |
delayDecayFactor: Float = .20f, | |
onClick: () -> Unit | |
): Modifier = composed { | |
val currentClickListener by rememberUpdatedState(onClick) |
NewerOlder