Skip to content

Commit d6d74ed

Browse files
authored
Refactor: Rename Composable functions to follow naming conventions (#592)
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.
1 parent a73d3b4 commit d6d74ed

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

compose/snippets/src/main/java/com/example/compose/snippets/glance/GlanceSnippets.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ private object ActionLaunchSendBroadcastEvent {
225225

226226
private object ActionLambda {
227227
@Composable
228-
fun actionLambda() {
228+
fun ActionLambda() {
229229
// [START android_compose_glance_lambda01]
230230
Text(
231231
text = "Submit",
@@ -237,7 +237,7 @@ private object ActionLambda {
237237
}
238238

239239
@Composable
240-
fun actionLambda2() {
240+
fun ActionLambda2() {
241241
// [START android_compose_glance_lambda02]
242242
Button(
243243
text = "Submit",
@@ -436,7 +436,7 @@ object ManageAndUpdate {
436436
object BuildUIWithGlance {
437437

438438
@Composable
439-
fun example1() {
439+
fun Example1() {
440440
// [START android_compose_glance_buildUI01]
441441
Row(modifier = GlanceModifier.fillMaxWidth().padding(16.dp)) {
442442
val modifier = GlanceModifier.defaultWeight()
@@ -448,7 +448,7 @@ object BuildUIWithGlance {
448448
}
449449

450450
@Composable
451-
fun example2() {
451+
fun Example2() {
452452

453453
// [START android_compose_glance_buildUI02]
454454
// Remember to import Glance Composables
@@ -466,7 +466,7 @@ object BuildUIWithGlance {
466466
}
467467

468468
@Composable
469-
fun example3() {
469+
fun Example3() {
470470
// [START android_compose_glance_buildUI03]
471471
LazyColumn {
472472
item {
@@ -480,7 +480,7 @@ object BuildUIWithGlance {
480480
}
481481

482482
@Composable
483-
fun example4() {
483+
fun Example4() {
484484
val peopleNameList = arrayListOf<String>()
485485
val peopleList = arrayListOf<Person>()
486486

@@ -631,7 +631,7 @@ object SizeModeSnippets3 {
631631

632632
object AccessResources {
633633
@Composable
634-
fun example1() {
634+
fun Example1() {
635635
// [START android_compose_glance_buildUI10]
636636
LocalContext.current.getString(R.string.glance_title)
637637
// [END android_compose_glance_buildUI10]
@@ -651,7 +651,7 @@ object AccessResources {
651651

652652
object CompoundButton {
653653
@Composable
654-
fun example1() {
654+
fun Example1() {
655655
// [START android_compose_glance_buildUI12]
656656
var isApplesChecked by remember { mutableStateOf(false) }
657657
var isEnabledSwitched by remember { mutableStateOf(false) }
@@ -860,7 +860,7 @@ object GlanceTheming {
860860
}
861861

862862
@Composable
863-
fun shapeExample() {
863+
fun ShapeExample() {
864864
// Note : android_compose_glance_glancetheming04 is found in button_outline.xml
865865
// [START android_compose_glance_glancetheming05]
866866
GlanceModifier.background(
@@ -898,7 +898,7 @@ object GlanceInnerPadding {
898898

899899
object GlanceInteroperability {
900900
@Composable
901-
fun example01() {
901+
fun Example01() {
902902
// [START android_compose_glance_glanceinteroperability01]
903903
val packageName = LocalContext.current.packageName
904904
Column(modifier = GlanceModifier.fillMaxSize()) {
@@ -909,7 +909,7 @@ object GlanceInteroperability {
909909
}
910910

911911
@Composable
912-
fun example02() {
912+
fun Example02() {
913913
val packageName = null
914914

915915
// [START android_compose_glance_glanceinteroperability02]

0 commit comments

Comments
 (0)