1 /*
2  * Copyright 2021 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  *      http://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 androidx.compose.ui.inspection.testdata
18 
19 import android.os.Bundle
20 import androidx.activity.ComponentActivity
21 import androidx.activity.compose.setContent
22 import androidx.compose.foundation.layout.Column
23 import androidx.compose.foundation.layout.Row
24 import androidx.compose.material.Button
25 import androidx.compose.material.Text
26 import androidx.compose.runtime.Composable
27 import androidx.compose.ui.Modifier
28 import androidx.compose.ui.inspection.test.R
29 import androidx.compose.ui.semantics.semantics
30 import androidx.compose.ui.text.font.Font
31 import androidx.compose.ui.text.font.FontFamily
32 import androidx.compose.ui.text.font.FontStyle
33 import androidx.compose.ui.text.font.FontWeight
34 
35 class ParametersTestActivity : ComponentActivity() {
36     private val fontFamily =
37         FontFamily(
38             Font(resId = R.font.samplefont, weight = FontWeight.W400, style = FontStyle.Normal),
39             Font(resId = R.font.samplefont, weight = FontWeight.W400, style = FontStyle.Italic)
40         )
41 
onCreatenull42     override fun onCreate(savedInstanceState: Bundle?) {
43         super.onCreate(savedInstanceState)
44         setContent {
45             Column(modifier = Modifier.semantics(true) {}) {
46                 Button(onClick = { println("smth") }) { Text("one", fontFamily = fontFamily) }
47                 Button(onClick = ::testClickHandler) { Text("two", fontFamily = fontFamily) }
48                 FunctionWithIntArray(intArrayOf(10, 11, 12, 13, 14, 15, 16, 17))
49                 Text("four")
50                 SomeContent { Column { Text("five") } }
51                 Row(modifier = Modifier.semantics(true) {}) {
52                     Text("Text1")
53                     Text("Text2")
54                     Text("Text3")
55                     Text("Text4")
56                     Text("Text5")
57                     Text("Text6")
58                     Text("Text7")
59                     Text("Text8")
60                 }
61             }
62         }
63     }
64 }
65 
66 @Suppress("UNUSED_PARAMETER")
67 @Composable
FunctionWithIntArraynull68 fun FunctionWithIntArray(intArray: IntArray) {
69     Text("three")
70 }
71 
72 @Composable fun SomeContent(content: @Composable () -> Unit) = content()
73 
testClickHandlernull74 internal fun testClickHandler() {}
75