The code below renders the following text in both Android Views and in Jetpack Compose UI.
Contact our team on 555 555 555 Opt 3 to activate.
import android.app.Presentation | |
import android.content.Context | |
import android.graphics.Bitmap | |
import android.graphics.Picture | |
import android.graphics.SurfaceTexture | |
import android.hardware.display.DisplayManager | |
import android.view.Display | |
import android.view.Surface | |
import android.view.ViewGroup | |
import androidx.compose.foundation.layout.Box |
/* | |
* Copyright 2024 The Android Open Source Project, JunkFood02 | |
* | |
* 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 | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
class MainActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
WindowCompat.setDecorFitsSystemWindows(window, false) | |
super.onCreate(savedInstanceState) | |
setContent { | |
P2RTheme { | |
// A surface container using the 'background' color from the theme | |
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { | |
CompositionLocalProvider( | |
LocalOverscrollConfiguration provides null // Disable overscroll otherwise it consumes the drag before we get the chance |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.DisposableEffect | |
import androidx.compose.runtime.remember | |
import androidx.compose.runtime.snapshots.MutableSnapshot | |
import androidx.compose.runtime.snapshots.Snapshot | |
import java.util.WeakHashMap | |
@PublishedApi | |
internal class DebugStateObservation(private val id: String) { | |
private val map = WeakHashMap<Any, MutableList<Exception>>() |
sealed class PageLoadState(val endOfDataReached: Boolean) { | |
data class Error(val error: Throwable) : PageLoadState(false) { | |
override fun toString(): String = "Error(error=$error" | |
} | |
sealed class NotLoading(endOfDataReached: Boolean) : PageLoadState(endOfDataReached) { | |
object Complete : NotLoading(true) { | |
override fun toString(): String = "Complete" | |
} |
@Composable | |
fun AnimatedBorderCard( | |
modifier: Modifier, | |
contents: @Composable RowScope.() -> Unit | |
) { | |
val containerSize = 200.dp | |
var offsetFloat by remember { mutableStateOf(0f) } | |
LaunchedEffect(null) { | |
delay(100) | |
offsetFloat = containerSize.value * 10f |
import androidx.compose.animation.core.Animatable | |
import androidx.compose.animation.core.Spring | |
import androidx.compose.animation.core.SpringSpec | |
import androidx.compose.animation.core.spring | |
import androidx.compose.foundation.Canvas | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.size | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.LaunchedEffect |
/* | |
* MIT License | |
* | |
* Copyright (c) 2022 Albert Chang | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
The code below renders the following text in both Android Views and in Jetpack Compose UI.
Contact our team on 555 555 555 Opt 3 to activate.
/* | |
Copyright 2020 Cedric Kring. | |
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 | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, |