Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation sample app #625

Merged
merged 119 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
8d6add8
Rename :demos:appyx-navigation -> :demos:sandbox-appyx-navigation
zsoltk Oct 5, 2023
6c260fd
Add new dummy :demos:appyx-navigation module
zsoltk Oct 5, 2023
2a171ee
Update settings.gradle
zsoltk Oct 5, 2023
cd52c79
Created NavTargets
aashay-gaikwad Oct 5, 2023
59789e4
Parent nodes for Profile, Main & CakeCategory
Oct 5, 2023
3bf8ac8
Using Spotlight in Main + placeholder for CakeUi
Oct 5, 2023
605d0b6
Merge branch '2.x' into navigation-sample-app
zsoltk Oct 6, 2023
a702986
Merge branch 'material-nav' into navigation-sample-app
zsoltk Oct 6, 2023
5d2f73b
Post-merge: apply changes to renamed module
zsoltk Oct 6, 2023
26b7f0c
Post-merge: apply renaming of motionController -> visualisation
zsoltk Oct 6, 2023
e93e160
Post-merge: fix gradle
zsoltk Oct 6, 2023
dedf224
Merge branch 'material-nav' into navigation-sample-app
zsoltk Oct 6, 2023
82ab0c8
Apply material nav
zsoltk Oct 6, 2023
831b89d
Set home as default nav target
zsoltk Oct 6, 2023
575dfbb
Reorganise main nodes
zsoltk Oct 6, 2023
d7801d0
Use passed in modifier rather than new one
zsoltk Oct 6, 2023
c1e9fa3
Tweak ui
zsoltk Oct 6, 2023
1b1a9e6
Rename mentions of InteractionTarget -> NavTarget
zsoltk Oct 6, 2023
c3d432b
Merge branch 'unify-position-alignment' into navigation-sample-app
zsoltk Oct 8, 2023
7dd1261
Add SpotlightHero
zsoltk Oct 8, 2023
cf11ef6
Implement hero mode
zsoltk Oct 8, 2023
38abf8e
Add cake model
zsoltk Oct 8, 2023
14f99f6
Add oval shape transformation to hero transition
zsoltk Oct 8, 2023
abac1d1
Add cmp image loader module
KovalevAndrey Oct 9, 2023
e8024b2
Allow dragging multiple Draggables
zsoltk Oct 9, 2023
0402fad
Add cake images
zsoltk Oct 9, 2023
0194e4b
Implement split carousel with cakes
zsoltk Oct 9, 2023
36cd058
Tweak visualisations
zsoltk Oct 9, 2023
b36ad24
Use Dispatchers.Default
zsoltk Oct 10, 2023
3ef38ae
Set contentDescription
zsoltk Oct 10, 2023
0fcb33d
Set AspectRatio visibilityThreshold to 0.001f
zsoltk Oct 10, 2023
f172191
Snap to initial viewPoint value after recreation to avoid unnecessary…
zsoltk Oct 10, 2023
da9546b
Reset theme
zsoltk Oct 10, 2023
07994d1
Add cake details panel
zsoltk Oct 10, 2023
099c8d6
Merge branch 'navigation-sample-app' of github.com:bumble-tech/appyx …
mmartosdev Oct 10, 2023
f62b194
Make Node.executeAction take a suspend function
zsoltk Oct 10, 2023
b6fa622
Add Navigator demo
zsoltk Oct 10, 2023
1185de3
Update web main.kt
zsoltk Oct 10, 2023
a84999d
Update main.ios.kt
zsoltk Oct 10, 2023
0abe19a
Fix image content scaling to maintain proportions
zsoltk Oct 11, 2023
79be526
Update image
zsoltk Oct 11, 2023
89a9a6e
Coerce rounded corners % in 0, 100 to avoid crash
zsoltk Oct 11, 2023
043df00
Merge branch 'navigation-sample-app' of github.com:bumble-tech/appyx …
mmartosdev Oct 11, 2023
3a8a603
Fix appyx-navigation:web module
mmartosdev Oct 11, 2023
63076a5
Update image
zsoltk Oct 12, 2023
c93b745
Add back handling strategy to SpotlightHero
zsoltk Oct 12, 2023
056f4ef
Add deep link handling
zsoltk Oct 13, 2023
714473b
Created Cart, supported adding items
Oct 13, 2023
d54792a
Having cart as a NavItem
Oct 13, 2023
2e2ce2d
Added CartItemsNode and supporting cart empty case
Oct 13, 2023
161556f
Add simple copy task to bundle images for the web build.
Oct 13, 2023
33b51c2
Merge remote-tracking branch 'upstream/navigation-sample-app' into na…
Oct 13, 2023
f887c92
Added CartContent UI
Oct 13, 2023
491aca0
Merge branch 'navigation-sample-app' of https://github.com/bumble-tec…
Oct 13, 2023
329ef51
Removed semantics for badge text
Oct 13, 2023
d9cfa70
Support clearing cart
Oct 13, 2023
23764bc
Navigating from Cakes in cart to Cake hero
Oct 13, 2023
b2a2844
Use container size instead of screen size to decide nav rail vs nav bar
zsoltk Oct 13, 2023
0518e2c
Fix produce distribution for web target.
Oct 13, 2023
7951d2a
Merge remote-tracking branch 'upstream/navigation-sample-app' into na…
Oct 13, 2023
e722ed9
Use update
zsoltk Oct 15, 2023
978ac4e
Make backdrop text disappear in hero mode
zsoltk Oct 15, 2023
b26359d
Increase default window height
zsoltk Oct 15, 2023
b9ac9b6
Fixed iOS target navigation issue + copying resources during build
Oct 16, 2023
bfefffe
Fix JS compiler bug for wasm.
Oct 16, 2023
0f9420d
Fix cart not updating
zsoltk Oct 16, 2023
027b687
Ensure the chosen random cake is farther than the next one
zsoltk Oct 16, 2023
b4ac010
Add gesture control for hero mode
zsoltk Oct 16, 2023
410d8a2
Merge remote-tracking branch 'bumble-tech/navigation-sample-app' into…
zsoltk Oct 16, 2023
a1bb860
Make viewPoint animatables available to all children in motionProperties
zsoltk Oct 16, 2023
8910679
Simplify by removing all non-standard element states
zsoltk Oct 16, 2023
6e8e59e
Unify two spotlights into one
zsoltk Oct 16, 2023
2e7b865
Tweak window size
zsoltk Oct 16, 2023
8d2fc7a
Add RootNode & LoggedOutNode
zsoltk Oct 16, 2023
858af9e
Add logout button
zsoltk Oct 16, 2023
fedbab0
Add placeholder screens for splash and login
zsoltk Oct 17, 2023
ef06180
Reorganise packages
zsoltk Oct 17, 2023
7ee59f4
Add simple User model
zsoltk Oct 17, 2023
aa13292
Demonstrate wait-for-auth deep link use-case
zsoltk Oct 17, 2023
844208c
Tweak layout
zsoltk Oct 17, 2023
b3984aa
Modify image loader to work locally and embedded for web targets.
Oct 19, 2023
4c0f174
Merge branch '2.x' into navigation-sample-app
zsoltk Oct 19, 2023
fd3eb7d
Merge remote-tracking branch 'bumble-tech/navigation-sample-app' into…
zsoltk Oct 19, 2023
e4473ef
Pass initial state to visualisation to avoid some flickering
zsoltk Oct 20, 2023
3adb667
Fix HorizontalPager api call
zsoltk Oct 20, 2023
a86ba96
Remove hack
zsoltk Oct 20, 2023
ba3d8fa
Move cart buttons to below items
zsoltk Oct 20, 2023
060c7a3
Nodes for ShippingDetails, Payment and OrderConfirmed
Oct 22, 2023
2a06d3e
Add some placeholder screens to checkout flow
zsoltk Oct 22, 2023
c711caf
Reorganise packages
zsoltk Oct 22, 2023
5ee222a
Retain cart
zsoltk Oct 23, 2023
138c9ae
Merge remote-tracking branch 'bumble-tech/navigation-sample-app' into…
zsoltk Oct 23, 2023
fac5213
Use Surface in new nodes
zsoltk Oct 23, 2023
35ab340
Use new screens
zsoltk Oct 23, 2023
00baecc
Add tint to success icon
zsoltk Oct 23, 2023
2422a21
Updated checkout nodes
Oct 24, 2023
da7d953
Resize fix
Oct 24, 2023
2bc0171
Merge remote-tracking branch 'upstream/navigation-sample-app' into na…
Oct 24, 2023
99e955e
Add animations into Cart tab
mapm14 Oct 24, 2023
5b33430
Merge remote-tracking branch 'origin/navigation-sample-app' into navi…
mapm14 Oct 24, 2023
960e6ab
Resolve conflicts
mapm14 Oct 24, 2023
2701de2
BackStackParallax on Checkout when on iOS
Oct 25, 2023
5676908
Updated changelog
Oct 25, 2023
de12adc
Revert "Updated changelog"
Oct 25, 2023
0e1070f
Fix animation in LazyColumn
mapm14 Oct 25, 2023
64c9092
Merge remote-tracking branch 'origin/navigation-sample-app' into navi…
mapm14 Oct 25, 2023
03a279d
Suppressed warning
Oct 25, 2023
09bd5c5
Fixed dark mode on Logged out + BackStackParallax for iOS
Oct 25, 2023
8267e8d
Renamed platform name files
Oct 25, 2023
9d076f6
Removed unnecessary deps
Oct 25, 2023
aaf6476
Removed unnecessary deps
Oct 25, 2023
bad845d
Supporting ImmutableMap
Oct 25, 2023
0c13453
Fix detekt
Oct 25, 2023
abd3efa
Handled params and warnings
Oct 25, 2023
89ee3e4
Fix detekt
Oct 26, 2023
bb1ceb6
Add heads up for running on debug mode
manuelvicnt Oct 26, 2023
9158555
Renaming + updated compose-bom
Oct 26, 2023
a40cc70
Renamed sandbox-app for web
Oct 26, 2023
e6b2511
Moved warning suppression
Oct 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.bumble.appyx.interactions.core.ui.gesture.dragHorizontalDirection
import com.bumble.appyx.interactions.core.ui.gesture.dragVerticalDirection
import com.bumble.appyx.interactions.core.ui.property.impl.Alpha
import com.bumble.appyx.interactions.core.ui.property.impl.GenericFloatProperty
import com.bumble.appyx.interactions.core.ui.property.impl.GenericFloatProperty.Target
import com.bumble.appyx.interactions.core.ui.property.impl.Scale
import com.bumble.appyx.interactions.core.ui.property.impl.position.BiasAlignment.OutsideAlignment.Companion.InContainer
import com.bumble.appyx.interactions.core.ui.property.impl.position.BiasAlignment.OutsideAlignment.Companion.OutsideBottom
Expand All @@ -33,10 +34,7 @@ class SpotlightSlider<InteractionTarget : Any>(
) : BaseVisualisation<InteractionTarget, State<InteractionTarget>, MutableUiState, TargetUiState>(
uiContext = uiContext
) {
private val scrollX = GenericFloatProperty(
uiContext.coroutineScope,
GenericFloatProperty.Target(0f)
) // TODO sync this with the model's initial value rather than assuming 0
private val scrollX = GenericFloatProperty(uiContext.coroutineScope, Target(0f))
override val viewpointDimensions: List<Pair<(State<InteractionTarget>) -> Float, GenericFloatProperty>> =
listOf(
{ state: State<InteractionTarget> -> state.activeIndex } to scrollX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ class SpotlightSliderRotation<InteractionTarget : Any>(
) : BaseVisualisation<InteractionTarget, State<InteractionTarget>, MutableUiState, TargetUiState>(
uiContext = uiContext
) {
private val scrollX = GenericFloatProperty(
uiContext.coroutineScope,
Target(0f)
) // TODO sync this with the model's initial value rather than assuming 0
private val scrollX = GenericFloatProperty(uiContext.coroutineScope, Target(0f))
override val viewpointDimensions: List<Pair<(State<InteractionTarget>) -> Float, GenericFloatProperty>> =
listOf(
{ state: State<InteractionTarget> -> state.activeIndex } to scrollX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SpotlightSliderScale<InteractionTarget : Any>(
uiContext = uiContext
) {
@Suppress("MaxLineLength")
private val scrollX = GenericFloatProperty(uiContext.coroutineScope, Target(0f)) // TODO sync this with the model's initial value rather than assuming 0
private val scrollX = GenericFloatProperty(uiContext.coroutineScope, Target(0f))
override val viewpointDimensions: List<Pair<(State<InteractionTarget>) -> Float, GenericFloatProperty>> =
listOf(
{ state: State<InteractionTarget> -> state.activeIndex } to scrollX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ open class BaseAppyxComponent<InteractionTarget : Any, ModelState : Any>(
}
}

private fun onVisualisationReady(visualisation: Visualisation<InteractionTarget, ModelState>) {
protected open fun onVisualisationReady(visualisation: Visualisation<InteractionTarget, ModelState>) {
visualisation.updateBounds(transitionBounds)
observeAnimationChanges(visualisation)
observeVisualisation(visualisation)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.bumble.appyx.interactions.core.ui.property.impl

import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.animation.core.Easing
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import com.bumble.appyx.interactions.core.ui.math.lerpFloat
import com.bumble.appyx.interactions.core.ui.property.Interpolatable
import com.bumble.appyx.interactions.core.ui.property.MotionProperty
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

class AspectRatio(
coroutineScope: CoroutineScope,
target: Target,
visibilityThreshold: Float = 0.001f,
displacement: StateFlow<Float> = MutableStateFlow(0f),
) : MotionProperty<Float, AnimationVector1D>(
coroutineScope = coroutineScope,
animatable = Animatable(target.value),
visibilityThreshold = visibilityThreshold,
displacement = displacement
), Interpolatable<AspectRatio.Target> {

class Target(
val value: Float,
val easing: Easing? = null,
) : MotionProperty.Target

override fun calculateRenderValue(base: Float, displacement: Float): Float =
base - displacement

override val modifier: Modifier
get() = Modifier.composed {
val value = renderValueFlow.collectAsState().value
this.aspectRatio(value)
}


override suspend fun lerpTo(start: Target, end: Target, fraction: Float) {
snapTo(
lerpFloat(
start = start.value,
end = end.value,
progress = easingTransform(end.easing, fraction)
)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.bumble.appyx.interactions.core.ui.property.impl
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.ui.Modifier
import com.bumble.appyx.interactions.core.ui.context.UiContext
import com.bumble.appyx.interactions.core.ui.math.lerpFloat
import com.bumble.appyx.interactions.core.ui.property.Interpolatable
import com.bumble.appyx.interactions.core.ui.property.MotionProperty
Expand All @@ -12,7 +11,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlin.jvm.JvmInline

class GenericFloatProperty(
open class GenericFloatProperty(
coroutineScope: CoroutineScope,
target: Target,
displacement: StateFlow<Float> = MutableStateFlow(0f),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

@Suppress("MagicNumber")
class RoundedCorners(
coroutineScope: CoroutineScope,
target: Target,
Expand All @@ -42,7 +43,7 @@ class RoundedCorners(
override val modifier: Modifier
get() = Modifier.composed {
val value by renderValueFlow.collectAsState()
this.clip(RoundedCornerShape(value))
this.clip(RoundedCornerShape(value.coerceIn(0, 100)))
}

override suspend fun lerpTo(start: Target, end: Target, fraction: Float) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,31 @@ sealed class BiasAlignment(
companion object {

@Stable
val InContainer = OutsideAlignment(0f, 0f)
val OutsideTopLeft = OutsideAlignment(-1f, -1f)

@Stable
val OutsideLeft = OutsideAlignment(-1f, 0f)
val OutsideTop = OutsideAlignment(0f, -1f)

@Stable
val OutsideTopLeft = OutsideAlignment(-1f, -1f)
val OutsideTopRight = OutsideAlignment(1f, -1f)

@Stable
val OutsideBottomLeft = OutsideAlignment(-1f, 1f)
val OutsideLeft = OutsideAlignment(-1f, 0f)

@Stable
val OutsideRight = OutsideAlignment(1f, 0f)
val InContainer = OutsideAlignment(0f, 0f)

@Stable
val OutsideBottomRight = OutsideAlignment(1f, 1f)
val OutsideRight = OutsideAlignment(1f, 0f)

@Stable
val OutsideTopRight = OutsideAlignment(1f, -1f)
val OutsideBottomLeft = OutsideAlignment(-1f, 1f)

@Stable
val OutsideBottom = OutsideAlignment(0f, 1f)

@Stable
val OutsideTop = OutsideAlignment(0f, -1f)
val OutsideBottomRight = OutsideAlignment(1f, 1f)
}

override fun align(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ abstract class BaseVisualisation<InteractionTarget : Any, ModelState, MutableUiS

cleanUpCacheForDestroyedElements(matchedTargetUiStates)

val isRecreating = mutableUiStateCache.isEmpty()
coroutineScope.launch {
updateViewpoint(update)
updateViewpoint(update, isRecreating)
}


Expand All @@ -118,7 +119,7 @@ abstract class BaseVisualisation<InteractionTarget : Any, ModelState, MutableUiS
ObserveElementAnimationChanges(mutableUiState, t1)
ManageAnimations(mutableUiState, t1, update)
},
motionProperties = mutableUiState.motionProperties,
motionProperties = mutableUiState.motionProperties + viewpointDimensions.map { it.second },
modifier = mutableUiState.modifier,
progress = MutableStateFlow(1f),
)
Expand Down Expand Up @@ -193,17 +194,24 @@ abstract class BaseVisualisation<InteractionTarget : Any, ModelState, MutableUiS
}
}

private suspend fun updateViewpoint(update: Update<ModelState>) {
private suspend fun updateViewpoint(
update: Update<ModelState>,
isRecreating: Boolean
) {
viewpointDimensions.forEach { (fieldOfState, viewpointDimension) ->
val targetValue = fieldOfState(update.currentTargetState)
viewpointDimension.animateTo(
targetValue,
spring(
stiffness = currentSpringSpec.stiffness,
dampingRatio = currentSpringSpec.dampingRatio
)
) {
AppyxLogger.d(TAG, "Viewpoint animateTo (Update) – $targetValue")
if (isRecreating) {
viewpointDimension.snapTo(targetValue)
} else {
viewpointDimension.animateTo(
targetValue,
spring(
stiffness = currentSpringSpec.stiffness,
dampingRatio = currentSpringSpec.dampingRatio
)
) {
AppyxLogger.d(TAG, "Viewpoint animateTo (Update) – $targetValue")
}
}
}
}
Expand Down Expand Up @@ -245,7 +253,7 @@ abstract class BaseVisualisation<InteractionTarget : Any, ModelState, MutableUiS
Box(modifier = mutableUiState.visibilityModifier)
InterpolateUiState(segmentProgress, mutableUiState, t0, t1, initialProgress)
},
motionProperties = mutableUiState.motionProperties,
motionProperties = mutableUiState.motionProperties + viewpointDimensions.map { it.second },
modifier = mutableUiState.modifier,
progress = segmentProgress,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.bumble.appyx.navigation.collections

import androidx.compose.runtime.Immutable

@Immutable
data class ImmutableMap<K, out V>(private val map: Map<K, V>) : Map<K, V> by map

fun <K, V> Map<K, V>.toImmutableMap(): ImmutableMap<K, V> =
ImmutableMap(this)
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.compose.ui.unit.round
import com.bumble.appyx.interactions.core.gesture.GestureValidator
import com.bumble.appyx.interactions.core.gesture.detectDragGesturesOrCancellation
import com.bumble.appyx.interactions.core.model.BaseAppyxComponent
import com.bumble.appyx.interactions.core.model.progress.Draggable
import com.bumble.appyx.interactions.core.model.removedElements
import com.bumble.appyx.interactions.core.modifiers.onPointerEvent
import com.bumble.appyx.interactions.core.ui.LocalBoxScope
Expand All @@ -42,6 +43,8 @@ import com.bumble.appyx.interactions.core.ui.context.UiContext
import com.bumble.appyx.interactions.core.ui.output.ElementUiModel
import com.bumble.appyx.interactions.core.ui.property.impl.position.PositionAlignment
import com.bumble.appyx.interactions.core.ui.property.motionPropertyRenderValue
import com.bumble.appyx.navigation.collections.ImmutableList
import com.bumble.appyx.navigation.collections.immutableListOf
import com.bumble.appyx.navigation.integration.LocalScreenSize
import com.bumble.appyx.navigation.node.ParentNode
import kotlin.math.roundToInt
Expand All @@ -53,6 +56,7 @@ internal val defaultExtraTouch = 48.dp
fun <InteractionTarget : Any, ModelState : Any> ParentNode<InteractionTarget>.AppyxComponent(
appyxComponent: BaseAppyxComponent<InteractionTarget, ModelState>,
modifier: Modifier = Modifier,
draggables: ImmutableList<Draggable> = immutableListOf(appyxComponent),
clipToBounds: Boolean = false,
gestureValidator: GestureValidator = GestureValidator.defaultValidator,
gestureExtraTouchArea: Dp = defaultExtraTouch,
Expand Down Expand Up @@ -102,7 +106,13 @@ fun <InteractionTarget : Any, ModelState : Any> ParentNode<InteractionTarget>.Ap
) {
CompositionLocalProvider(LocalBoxScope provides this@Box) {
childrenBlock(
ChildrenTransitionScope(containerSize, appyxComponent, gestureExtraTouchArea, gestureValidator)
ChildrenTransitionScope(
containerSize = containerSize,
appyxComponent = appyxComponent,
draggables = draggables,
gestureExtraTouchArea = gestureExtraTouchArea,
gestureValidator = gestureValidator
)
)
}
}
Expand All @@ -111,6 +121,7 @@ fun <InteractionTarget : Any, ModelState : Any> ParentNode<InteractionTarget>.Ap
class ChildrenTransitionScope<InteractionTarget : Any, NavState : Any>(
private val containerSize: IntSize,
private val appyxComponent: BaseAppyxComponent<InteractionTarget, NavState>,
private val draggables: List<Draggable>,
private val gestureExtraTouchArea: Dp,
private val gestureValidator: GestureValidator
) {
Expand Down Expand Up @@ -163,7 +174,9 @@ class ChildrenTransitionScope<InteractionTarget : Any, NavState : Any>(
.pointerInput(appyxComponent) {
detectDragGesturesOrCancellation(
onDragStart = { position ->
appyxComponent.onStartDrag(position)
draggables.forEach {
it.onStartDrag(position)
}
},
onDrag = { change, dragAmount ->
if (gestureValidator.isGestureValid(
Expand All @@ -172,15 +185,21 @@ class ChildrenTransitionScope<InteractionTarget : Any, NavState : Any>(
)
) {
change.consume()
appyxComponent.onDrag(dragAmount, density)
draggables.forEach {
it.onDrag(dragAmount, density)
}
true
} else {
appyxComponent.onDragEnd()
draggables.forEach {
it.onDragEnd()
}
false
}
},
onDragEnd = {
appyxComponent.onDragEnd()
draggables.forEach {
it.onDragEnd()
}
},
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ open class Node internal constructor(
}

protected suspend inline fun <reified T : Node> executeAction(
crossinline action: () -> Unit
crossinline action: suspend () -> Unit
): T = withContext(lifecycleScope.coroutineContext) {
action()
this@Node as T
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ interface NodeAware<N : Node> : NodeReadyObserver<N> {
val node: N
}

interface NodeReadyObserver<N : Node> : Plugin {
fun init(node: N) {}
fun interface NodeReadyObserver<N : Node> : Plugin {
fun init(node: N)
}

interface NodeLifecycleAware : Plugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package com.bumble.appyx.interactions.bottomnav

import androidx.compose.material.icons.Icons.Filled
import androidx.compose.material.icons.Icons.Outlined
import androidx.compose.material.icons.filled.Cake
import androidx.compose.material.icons.filled.Extension
import androidx.compose.material.icons.filled.Style
import androidx.compose.material.icons.filled.ViewCarousel
import androidx.compose.material.icons.outlined.Cake
import androidx.compose.material.icons.outlined.Extension
import androidx.compose.material.icons.outlined.GridView
import androidx.compose.material.icons.outlined.Style
Expand All @@ -30,9 +31,9 @@ enum class MainNavItem : Parcelable {
when (navBarItem) {
CARDS -> AppyxNavItem(
text = "Cards",
unselectedIcon = Outlined.Style,
selectedIcon = Filled.Style,
iconModifier = Modifier.rotate(180f),
unselectedIcon = Outlined.Cake,
selectedIcon = Filled.Cake,
modifier = Modifier.rotate(180f),
node = { node(it) { DatingCards() } }
)

Expand Down
Loading