Skip to content

Commit 6cc9fa4

Browse files
Kotlin for Compose snippets (#49)
* Kotlin for Compose snippets * Apply Spotless * Kotlin for Compose spotless --------- Co-authored-by: florina-muntenescu <[email protected]>
1 parent b5c6455 commit 6cc9fa4

File tree

2 files changed

+413
-0
lines changed

2 files changed

+413
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2023 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.example.compose.snippets.kotlin;
18+
19+
public class JavaSnippets {
20+
21+
// [START android_compose_kotlin_java_default_arguments]
22+
// We don't need to do this in Kotlin!
23+
void drawSquare(int sideLength) { }
24+
25+
void drawSquare(int sideLength, int thickness) { }
26+
27+
void drawSquare(int sideLength, int thickness, Color edgeColor) { }
28+
// [END android_compose_kotlin_java_default_arguments]
29+
30+
void functionCall() {
31+
// [START android_compose_kotlin_java_call]
32+
drawSquare(30, 5, Color.Red);
33+
// [END android_compose_kotlin_java_call]
34+
}
35+
}
36+
37+
class Color {
38+
public static Color Red;
39+
}

0 commit comments

Comments
 (0)