From 5af6c39ddf25434186e68a8f3701a4a9057dbc5f Mon Sep 17 00:00:00 2001 From: cartland Date: Fri, 15 Aug 2025 14:13:49 -0700 Subject: [PATCH] Refactor(text): Use KTX extension for isDigitsOnly check The lint tool reported a "UseKtx" warning in StateBasedText.kt. The code was using the static `TextUtils.isDigitsOnly()` method. This commit refactors the code to use the more idiomatic `isDigitsOnly()` Kotlin extension function from the Android KTX library. --- .../java/com/example/compose/snippets/text/StateBasedText.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/text/StateBasedText.kt b/compose/snippets/src/main/java/com/example/compose/snippets/text/StateBasedText.kt index b43aef25f..fb3e75807 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/text/StateBasedText.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/text/StateBasedText.kt @@ -15,8 +15,6 @@ */ package com.example.compose.snippets.text - -import android.text.TextUtils import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height @@ -249,7 +247,7 @@ class CustomInputTransformation : InputTransformation { // [START android_compose_state_text_16] class DigitOnlyInputTransformation : InputTransformation { override fun TextFieldBuffer.transformInput() { - if (!TextUtils.isDigitsOnly(asCharSequence())) { + if (!asCharSequence().isDigitsOnly()) { revertAllChanges() } }