Skip to content

Instantly share code, notes, and snippets.

View alexvanyo's full-sized avatar
💛

Alex Vanyo alexvanyo

💛
View GitHub Profile
/* Copyright 2024 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
@Composable
fun DebugVisibleWindowInsets(
modifier: Modifier = Modifier,
debugColor: Color = Color.Magenta.copy(alpha = 0.5f),
) {
Box(modifier = modifier.fillMaxSize()) {
Spacer(
/* Copyright 2024 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
composeTestRule.setContent {
DeviceConfigurationOverride(
DeviceConfigurationOverride.WindowInsets(
WindowInsetsCompat.Builder()
.setInsets(
WindowInsetsCompat.Type.statusBars(),
DpRect(
@alexvanyo
alexvanyo / DeviceConfigurationOverrideWindowInsets.kt
Last active August 2, 2024 21:40
DeviceConfigurationOverride for testing Compose components with an arbitrary WindowInsets value
/*
* 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
/*
* 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
/*
* 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
/*
* 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
@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(
@alexvanyo
alexvanyo / PowerableUpdatable.kt
Last active April 11, 2024 17:39
Updatable and PoweredUpdatable
/*
* 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
@alexvanyo
alexvanyo / EdgeToEdgeAlertDialog.kt
Last active September 17, 2024 01:48
EdgeToEdgeDialogs
/*
* 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
@alexvanyo
alexvanyo / SnapshotStateSet.kt
Created April 5, 2023 21:56
An implementation of a MutableSet backed by snapshot state
/*
* 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