1 /*
2  * Copyright 2024 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.material3.integration.macrobenchmark.target
18 
19 import android.os.Bundle
20 import androidx.activity.ComponentActivity
21 import androidx.activity.compose.setContent
22 import androidx.compose.material.icons.Icons
23 import androidx.compose.material.icons.filled.Favorite
24 import androidx.compose.material3.ExperimentalMaterial3Api
25 import androidx.compose.material3.Icon
26 import androidx.compose.material3.IconButton
27 import androidx.compose.material3.PlainTooltip
28 import androidx.compose.material3.Text
29 import androidx.compose.material3.TooltipBox
30 import androidx.compose.material3.TooltipDefaults
31 import androidx.compose.material3.rememberTooltipState
32 
33 class TooltipActivity : ComponentActivity() {
34 
35     @OptIn(ExperimentalMaterial3Api::class)
onCreatenull36     override fun onCreate(savedInstanceState: Bundle?) {
37         super.onCreate(savedInstanceState)
38         setContent {
39             TooltipBox(
40                 positionProvider = TooltipDefaults.rememberTooltipPositionProvider(),
41                 tooltip = {
42                     PlainTooltip(caretSize = TooltipDefaults.caretSize) {
43                         Text("Tooltip Description")
44                     }
45                 },
46                 state = rememberTooltipState()
47             ) {
48                 IconButton(onClick = { /* Icon button's click event */ }) {
49                     Icon(imageVector = Icons.Filled.Favorite, contentDescription = "tooltipAnchor")
50                 }
51             }
52         }
53     }
54 }
55