This file contains hidden or 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 fun <C> ChipField( | |
chips: List<C>, | |
chipContent: @Composable (C) -> Unit. | |
modifier: Modifier = Modifier | |
) { | |
SelectionContainer( | |
allowCursor = true, | |
// some sort of callback or hoisted state for reading/mutating selection | |
modifier.textFieldFocusable() | |
) { |
This file contains hidden or 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
import androidx.compose.animation.core.Animatable | |
import androidx.compose.animation.core.Spring | |
import androidx.compose.animation.core.animateFloatAsState | |
import androidx.compose.animation.core.spring | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.gestures.detectDragGestures | |
import androidx.compose.foundation.layout.aspectRatio | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.wrapContentSize | |
import androidx.compose.integration.demos.BlockFilter.Companion.Lighting |
This file contains hidden or 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
/** | |
* Fork of AppCompat ContextThemeWrapper (barely) to correctly support applying override | |
* configurations – all the features we don't need are dropped, it always extends the base context's | |
* theme, the theme can't be set explicitly, and it adds one critical piece of functionality: the new | |
* theme is [rebased][Theme.rebase] after being cloned from the base context's theme. | |
*/ | |
open class ContextConfigThemeWrapper( | |
base: Context, | |
private val overrideConfiguration: Configuration | |
) : ContextWrapper(base) { |
This file contains hidden or 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
import android.annotation.SuppressLint | |
import androidx.compose.animation.core.animateDpAsState | |
import androidx.compose.animation.core.animateFloatAsState | |
import androidx.compose.foundation.Canvas | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.gestures.awaitFirstDown | |
import androidx.compose.foundation.gestures.forEachGesture | |
import androidx.compose.foundation.gestures.horizontalDrag | |
import androidx.compose.foundation.layout.Arrangement.spacedBy | |
import androidx.compose.foundation.layout.Box |
This file contains hidden or 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 fun App() { | |
DebugBounds { | |
Column(Modifier.background(Color.White).fillMaxSize()) { | |
BasicText("Some text") | |
Spacer(Modifier.size(10.dp)) | |
BasicText("More text") | |
Spacer(Modifier.size(5.dp)) | |
BasicText("Button", Modifier | |
.clickable { } | |
.background(Color.Blue, RoundedCornerShape(3.dp)) |
This file contains hidden or 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
import android.util.Log | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.currentComposer | |
import androidx.compose.runtime.remember | |
import androidx.compose.ui.unit.IntBounds | |
import androidx.ui.tooling.CallGroup | |
import androidx.ui.tooling.Group | |
import androidx.ui.tooling.NodeGroup | |
import androidx.ui.tooling.asTree |
This file contains hidden or 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
import androidx.animation.PhysicsBuilder | |
import androidx.animation.Spring.DampingRatioHighBouncy | |
import androidx.animation.Spring.StiffnessLow | |
import androidx.compose.Composable | |
import androidx.compose.Model | |
import androidx.compose.remember | |
import androidx.ui.animation.animate | |
import androidx.ui.core.DrawClipToBounds | |
import androidx.ui.core.Text | |
import androidx.ui.core.drawLayer |
This file contains hidden or 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
interface Host { | |
suspend fun getMovies(): List<Movies> | |
suspend fun setWatched(movie: Movie): Boolean | |
close() | |
} | |
class HostImpl( | |
// You could have a different WorkerPool for each system you need to talk to | |
// that has its own throttling requirements. | |
private val workerPool: WorkerPool |
This file contains hidden or 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
import kotlinx.coroutines.* | |
import kotlinx.coroutines.channels.Channel | |
import kotlin.coroutines.CoroutineContext | |
import kotlin.coroutines.coroutineContext | |
class DatabaseExecutor( | |
nWorkers: Int, | |
context: CoroutineContext | |
) { |