-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: compose animation become an extension of compose module
- Loading branch information
1 parent
c8aab69
commit 75e533c
Showing
18 changed files
with
382 additions
and
519 deletions.
There are no files selected for viewing
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
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
47 changes: 0 additions & 47 deletions
47
compose-animation/common/src/dev/programadorthi/routing/compose/ComposeEntry.kt
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
compose-animation/common/src/dev/programadorthi/routing/compose/ComposeManager.kt
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
compose-animation/common/src/dev/programadorthi/routing/compose/ComposeRoutingExt.kt
This file was deleted.
Oops, something went wrong.
63 changes: 63 additions & 0 deletions
63
...se-animation/common/src/dev/programadorthi/routing/compose/animation/ComposeAnimations.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package dev.programadorthi.routing.compose.animation | ||
|
||
import androidx.compose.animation.AnimatedContentTransitionScope | ||
import androidx.compose.animation.EnterTransition | ||
import androidx.compose.animation.ExitTransition | ||
import dev.programadorthi.routing.core.application.ApplicationCall | ||
import io.ktor.util.AttributeKey | ||
import kotlin.jvm.JvmSuppressWildcards | ||
|
||
internal typealias Animation<T> = @JvmSuppressWildcards | ||
AnimatedContentTransitionScope<ApplicationCall>.() -> T | ||
|
||
private val ComposeRoutingEnterTransitionAttributeKey: AttributeKey<Animation<EnterTransition>> = | ||
AttributeKey("ComposeRoutingEnterTransitionAttributeKey") | ||
|
||
private val ComposeRoutingExitTransitionAttributeKey: AttributeKey<Animation<ExitTransition>> = | ||
AttributeKey("ComposeRoutingExitTransitionAttributeKey") | ||
|
||
private val ComposeRoutingPopEnterTransitionAttributeKey: AttributeKey<Animation<EnterTransition>> = | ||
AttributeKey("ComposeRoutingPopEnterTransitionAttributeKey") | ||
|
||
private val ComposeRoutingPopExitTransitionAttributeKey: AttributeKey<Animation<ExitTransition>> = | ||
AttributeKey("ComposeRoutingPopExitTransitionAttributeKey") | ||
|
||
internal var ApplicationCall.enterTransition: Animation<EnterTransition>? | ||
get() = attributes.getOrNull(ComposeRoutingEnterTransitionAttributeKey) | ||
set(value) { | ||
if (value != null) { | ||
attributes.put(ComposeRoutingEnterTransitionAttributeKey, value) | ||
} else { | ||
attributes.remove(ComposeRoutingEnterTransitionAttributeKey) | ||
} | ||
} | ||
|
||
internal var ApplicationCall.exitTransition: Animation<ExitTransition>? | ||
get() = attributes.getOrNull(ComposeRoutingExitTransitionAttributeKey) | ||
set(value) { | ||
if (value != null) { | ||
attributes.put(ComposeRoutingExitTransitionAttributeKey, value) | ||
} else { | ||
attributes.remove(ComposeRoutingExitTransitionAttributeKey) | ||
} | ||
} | ||
|
||
internal var ApplicationCall.popEnterTransition: Animation<EnterTransition>? | ||
get() = attributes.getOrNull(ComposeRoutingPopEnterTransitionAttributeKey) | ||
set(value) { | ||
if (value != null) { | ||
attributes.put(ComposeRoutingPopEnterTransitionAttributeKey, value) | ||
} else { | ||
attributes.remove(ComposeRoutingPopEnterTransitionAttributeKey) | ||
} | ||
} | ||
|
||
internal var ApplicationCall.popExitTransition: Animation<ExitTransition>? | ||
get() = attributes.getOrNull(ComposeRoutingPopExitTransitionAttributeKey) | ||
set(value) { | ||
if (value != null) { | ||
attributes.put(ComposeRoutingPopExitTransitionAttributeKey, value) | ||
} else { | ||
attributes.remove(ComposeRoutingPopExitTransitionAttributeKey) | ||
} | ||
} |
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
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
Oops, something went wrong.