From db5f345997819aee5551be85f1f7854022f3c623 Mon Sep 17 00:00:00 2001 From: cartland Date: Fri, 15 Aug 2025 13:11:52 -0700 Subject: [PATCH] Refactor: Rename Composable functions to follow naming conventions The lint tool reported "ComposableNaming" warnings in GlanceSnippets.kt. Composable functions that return Unit should be named using PascalCase, like classes, to clearly identify them as UI components. This commit renames 12 Composable functions to adhere to this convention. For example, `actionLambda` has been renamed to `ActionLambda`. This improves code readability and follows Compose best practices. --- .../compose/snippets/glance/GlanceSnippets.kt | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/glance/GlanceSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/glance/GlanceSnippets.kt index bb575a8b5..431bc6776 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/glance/GlanceSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/glance/GlanceSnippets.kt @@ -225,7 +225,7 @@ private object ActionLaunchSendBroadcastEvent { private object ActionLambda { @Composable - fun actionLambda() { + fun ActionLambda() { // [START android_compose_glance_lambda01] Text( text = "Submit", @@ -237,7 +237,7 @@ private object ActionLambda { } @Composable - fun actionLambda2() { + fun ActionLambda2() { // [START android_compose_glance_lambda02] Button( text = "Submit", @@ -436,7 +436,7 @@ object ManageAndUpdate { object BuildUIWithGlance { @Composable - fun example1() { + fun Example1() { // [START android_compose_glance_buildUI01] Row(modifier = GlanceModifier.fillMaxWidth().padding(16.dp)) { val modifier = GlanceModifier.defaultWeight() @@ -448,7 +448,7 @@ object BuildUIWithGlance { } @Composable - fun example2() { + fun Example2() { // [START android_compose_glance_buildUI02] // Remember to import Glance Composables @@ -466,7 +466,7 @@ object BuildUIWithGlance { } @Composable - fun example3() { + fun Example3() { // [START android_compose_glance_buildUI03] LazyColumn { item { @@ -480,7 +480,7 @@ object BuildUIWithGlance { } @Composable - fun example4() { + fun Example4() { val peopleNameList = arrayListOf() val peopleList = arrayListOf() @@ -631,7 +631,7 @@ object SizeModeSnippets3 { object AccessResources { @Composable - fun example1() { + fun Example1() { // [START android_compose_glance_buildUI10] LocalContext.current.getString(R.string.glance_title) // [END android_compose_glance_buildUI10] @@ -651,7 +651,7 @@ object AccessResources { object CompoundButton { @Composable - fun example1() { + fun Example1() { // [START android_compose_glance_buildUI12] var isApplesChecked by remember { mutableStateOf(false) } var isEnabledSwitched by remember { mutableStateOf(false) } @@ -860,7 +860,7 @@ object GlanceTheming { } @Composable - fun shapeExample() { + fun ShapeExample() { // Note : android_compose_glance_glancetheming04 is found in button_outline.xml // [START android_compose_glance_glancetheming05] GlanceModifier.background( @@ -898,7 +898,7 @@ object GlanceInnerPadding { object GlanceInteroperability { @Composable - fun example01() { + fun Example01() { // [START android_compose_glance_glanceinteroperability01] val packageName = LocalContext.current.packageName Column(modifier = GlanceModifier.fillMaxSize()) { @@ -909,7 +909,7 @@ object GlanceInteroperability { } @Composable - fun example02() { + fun Example02() { val packageName = null // [START android_compose_glance_glanceinteroperability02]