This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
/** | |
* A [Modifier] that tracks all input, and calls [block] every time input is received. | |
*/ | |
private fun Modifier.notifyInput(block: () -> Unit): Modifier = | |
composed { | |
val currentBlock by rememberUpdatedState(block) | |
pointerInput(Unit) { | |
while (currentCoroutineContext().isActive) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
@Composable | |
fun HomeListWithArticleDetailsScreen( | |
onInteractWithList: () -> Unit, | |
onInteractWithDetail: (String) -> Unit, | |
// ... | |
) { | |
Row { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.CompositionLocalProvider | |
import androidx.compose.ui.platform.LocalInspectionMode | |
import app.cash.paparazzi.DeviceConfig | |
import app.cash.paparazzi.Paparazzi | |
import com.airbnb.android.showkase.models.Showkase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2023 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 */ | |
@Ignore("Flaky test, don't do this!) | |
@Test | |
fun checkHeightOfColumn() { | |
lateinit var density: Density | |
lateinit var layoutCoordinates: LayoutCoordinates | |
composeTestRule.setContent { | |
density = LocalDensity.current |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2023 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 */ | |
@Test | |
fun checkHeightOfColumn() { | |
lateinit var density: Density | |
lateinit var layoutCoordinates: LayoutCoordinates | |
composeTestRule.setContent { | |
density = LocalDensity.current | |
Column( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2022 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* https://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2024 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* https://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2024 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* https://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
@Preview(widthDp = 400, heightDp = 600) | |
@Preview(widthDp = 400, heightDp = 500) | |
@Preview(widthDp = 400, heightDp = 450) | |
@Preview(widthDp = 400, heightDp = 400) | |
@Preview(widthDp = 400, heightDp = 350) | |
@Preview(widthDp = 400, heightDp = 300) | |
private fun TextTruncation() { | |
Surface { | |
Layout( |