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
package com.example.kormics | |
import androidx.compose.animation.core.LinearEasing | |
import androidx.compose.animation.core.LinearOutSlowInEasing | |
import androidx.compose.animation.core.animateDpAsState | |
import androidx.compose.animation.core.animateFloatAsState | |
import androidx.compose.animation.core.tween | |
import androidx.compose.foundation.ExperimentalFoundationApi | |
import androidx.compose.foundation.Image | |
import androidx.compose.foundation.background |
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
package com.vishal2376.animations | |
import androidx.compose.animation.Crossfade | |
import androidx.compose.animation.core.animateFloatAsState | |
import androidx.compose.animation.core.tween | |
import androidx.compose.foundation.ExperimentalFoundationApi | |
import androidx.compose.foundation.Image | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.Arrangement | |
import androidx.compose.foundation.layout.Box |
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
package dev.efemoney.orchestra.ui | |
import androidx.compose.animation.asDisposableClock | |
import androidx.compose.animation.core.AnimationClockObservable | |
import androidx.compose.animation.core.TargetAnimation | |
import androidx.compose.animation.core.tween | |
import androidx.compose.foundation.animation.AndroidFlingDecaySpec | |
import androidx.compose.foundation.animation.FlingConfig | |
import androidx.compose.foundation.gestures.ScrollableController | |
import androidx.compose.foundation.gestures.scrollable |
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
@FlowPreview | |
fun <T> Flow<T>.mergeWith(other: Flow<T>): Flow<T> = flow { | |
coroutineScope { | |
launch { | |
other.collect { | |
emit(it) | |
} | |
} | |
launch { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="320dp" | |
xmlns:app="http://schemas.android.com/apk/res-auto"> | |
<androidx.constraintlayout.widget.Guideline android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:orientation="vertical" | |
android:id="@+id/left_guide" |
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
class CoroutinesPresenter(private val dispatcherProvider: DispatchersProvider, | |
private val repository: Reviewsrepository) { | |
private val job = Job() | |
private val uiScope = CoroutineContext(dispatcherProvider.main + job) //runs on main thread | |
fun fetchData(count: Int, page: Int) { | |
try { | |
uiScope.launch { | |
arbitraryView.setLoading(true) |
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
public fun <E> CoroutineScope.actor( | |
context: CoroutineContext = EmptyCoroutineContext, | |
capacity: Int = 0, | |
start: CoroutineStart = CoroutineStart.DEFAULT, | |
onCompletion: CompletionHandler? = null, | |
block: suspend ActorScope<E>.() -> Unit | |
): SendChannel<E> |
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
fun main() = runBlocking { | |
val multiplesOfThree = produce { | |
(1..10).filter { | |
it % 3 == 0 | |
}.forEach { | |
send(it) //send can only be called inside the ProducerScope | |
} | |
} |
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
public fun <E> CoroutineScope.produce( | |
context: CoroutineContext = EmptyCoroutineContext, | |
capacity: Int = 0, | |
block: suspend ProducerScope<E>.() -> Unit | |
): ReceiveChannel<E> |
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
fun main() = runBlocking { | |
val channel = BroadcastChannel<Int>(1) | |
repeat(10) { | |
channel.send(it) | |
} | |
} |
NewerOlder