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

Prototype with pager #721

Open
wants to merge 32 commits into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
331fd6c
Merge pull request #695 from KovalevAndrey/1.x-release-1.5.0
KovalevAndrey Apr 15, 2024
4f37347
Merge branch '1.x' of github.com:bumble-tech/appyx into 1.x
KovalevAndrey Apr 22, 2024
9184c21
Shared element transition integration
KovalevAndrey Apr 26, 2024
e2b687a
Update CHANGELOG.md
KovalevAndrey Apr 26, 2024
984a512
Replace SharedTransitionLayout with Box where no sharedElement is sup…
KovalevAndrey Apr 26, 2024
c1c570d
Update crashing lint
KovalevAndrey Apr 26, 2024
06a138c
Movable content support and test for targetVisibilityState
KovalevAndrey Apr 29, 2024
18ef892
Update detekt-baseline.xml
KovalevAndrey Apr 29, 2024
bec8f87
Rename button to Shared element with movable content
KovalevAndrey Apr 30, 2024
378564a
Update emulator API
KovalevAndrey Apr 30, 2024
53bed47
Add documentation for movable content and shared element transition
KovalevAndrey Apr 30, 2024
734b49f
Update CHANGELOG.md
KovalevAndrey Apr 30, 2024
960e194
Add docs and uninstall test app
KovalevAndrey Apr 30, 2024
3d45d48
Uninstall RIBs test apk
KovalevAndrey May 1, 2024
7dfbbfb
Rename package and uninstall navigation compose test apk
KovalevAndrey May 1, 2024
592133a
Fix compilation error
KovalevAndrey May 1, 2024
155d01e
Fix compilation error
KovalevAndrey May 1, 2024
1411eed
Merge branch '1.x-shared-element-prototype' of github.com:KovalevAndr…
KovalevAndrey May 1, 2024
c3290b3
Add proguard rules release to sandbox app
KovalevAndrey May 1, 2024
def253f
Fix testing package name
KovalevAndrey May 1, 2024
a6d22a1
Update compose to alpha08
KovalevAndrey May 2, 2024
ade37a3
Temporary remove uninstalling com.bumble.appyx.sample.navigation.comp…
KovalevAndrey May 2, 2024
5131031
Update to alpha08
KovalevAndrey May 2, 2024
e9e5b4f
Update documentation/ui/transitions.md
KovalevAndrey May 7, 2024
8a1c9d1
Update documentation/ui/transitions.md
KovalevAndrey May 7, 2024
aeb4eb5
Update libraries/core/src/main/kotlin/com/bumble/appyx/core/composabl…
KovalevAndrey May 7, 2024
695b88c
Update documentation/ui/transitions.md
KovalevAndrey May 7, 2024
76d6c1f
- Added shared element example without movable content
KovalevAndrey May 7, 2024
9909b89
Add withMovableContent param to docs
KovalevAndrey May 8, 2024
f7d86d3
Merge branch 'main' of github.com:KovalevAndrey/appyx into shared-ele…
KovalevAndrey Jan 7, 2025
a3b930a
Fix dependencies
KovalevAndrey Jan 7, 2025
a92b273
creates a pager prototype
vladcipariu91 Jan 8, 2025
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Pending changes

- [#719](https://github.com/bumble-tech/appyx/pull/719) – **Updated**: Jetpack Compose to 1.7.6
- [#720](https://github.com/bumble-tech/appyx/pull/720) – **Added**: Shared element transition and movable content support

## 1.5.1

Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }
compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
# compose versions are resolved by BOM
compose-animation-core = { module = "androidx.compose.animation:animation-core" }
compose-animation-android = { group = "androidx.compose.animation", name = "animation-android" }
compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout" }
compose-foundation = { module = "androidx.compose.foundation:foundation" }
compose-material = { module = "androidx.compose.material3:material3" }
Expand Down
1 change: 1 addition & 0 deletions libraries/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dependencies {
api(project(":libraries:customisations"))
api(libs.androidx.lifecycle.common)
api(libs.compose.animation.core)
api(libs.compose.animation.android)
api(libs.compose.runtime)
api(libs.androidx.appcompat)
api(libs.kotlin.coroutines.android)
Expand Down
10 changes: 7 additions & 3 deletions libraries/core/detekt-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues />
<CurrentIssues />
<ManuallySuppressedIssues></ManuallySuppressedIssues>
<CurrentIssues>
<ID>CompositionLocalAllowlist:LocalNode.kt$LocalMovableContentMap</ID>
<ID>CompositionLocalAllowlist:LocalNode.kt$LocalNodeTargetVisibility</ID>
<ID>CompositionLocalAllowlist:LocalNode.kt$LocalSharedElementScope</ID>
</CurrentIssues>
</SmellBaseline>
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package com.bumble.appyx.core.node

import android.os.Parcelable
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.bumble.appyx.core.AppyxTestScenario
import com.bumble.appyx.core.composable.Children
import com.bumble.appyx.core.modality.BuildContext
import com.bumble.appyx.navmodel.backstack.BackStack
import com.bumble.appyx.navmodel.backstack.operation.pop
import com.bumble.appyx.navmodel.backstack.operation.push
import kotlinx.parcelize.Parcelize
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test

class BackStackTargetVisibilityTest {

private val backStack = BackStack<NavTarget>(
savedStateMap = null,
initialElement = NavTarget.NavTarget1
)

var nodeOneTargetVisibilityState: Boolean = false
var nodeTwoTargetVisibilityState: Boolean = false

var nodeFactory: (buildContext: BuildContext) -> TestParentNode = {
TestParentNode(buildContext = it, backStack = backStack)
}

@get:Rule
val rule = AppyxTestScenario { buildContext ->
nodeFactory(buildContext)
}

@Test
fun `GIVEN_backStack_WHEN_operations_called_THEN_child_nodes_have_correct_targetVisibility_state`() {
rule.start()
assertTrue(nodeOneTargetVisibilityState)

backStack.push(NavTarget.NavTarget2)
rule.waitForIdle()

assertFalse(nodeOneTargetVisibilityState)
assertTrue(nodeTwoTargetVisibilityState)

backStack.pop()
rule.waitForIdle()

assertFalse(nodeTwoTargetVisibilityState)
assertTrue(nodeOneTargetVisibilityState)
}


@Parcelize
sealed class NavTarget : Parcelable {

data object NavTarget1 : NavTarget()

data object NavTarget2 : NavTarget()
}

inner class TestParentNode(
buildContext: BuildContext,
val backStack: BackStack<NavTarget>,
) : ParentNode<NavTarget>(
buildContext = buildContext,
navModel = backStack
) {

override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node =
when (navTarget) {
NavTarget.NavTarget1 -> node(buildContext) {
nodeOneTargetVisibilityState = LocalNodeTargetVisibility.current
}

NavTarget.NavTarget2 -> node(buildContext) {
nodeTwoTargetVisibilityState = LocalNodeTargetVisibility.current
}
}

@Composable
override fun View(modifier: Modifier) {
Children(navModel)
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package com.bumble.appyx.core.node

import android.os.Parcelable
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.bumble.appyx.core.AppyxTestScenario
import com.bumble.appyx.core.composable.Children
import com.bumble.appyx.core.modality.BuildContext
import com.bumble.appyx.navmodel.spotlight.Spotlight
import com.bumble.appyx.navmodel.spotlight.operation.activate
import kotlinx.parcelize.Parcelize
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test

class SpotlightTargetVisibilityTest {

private lateinit var spotlight: Spotlight<NavTarget>

var nodeOneTargetVisibilityState: Boolean = false
var nodeTwoTargetVisibilityState: Boolean = false
var nodeThreeTargetVisibilityState: Boolean = false

var nodeFactory: (buildContext: BuildContext) -> TestParentNode = {
TestParentNode(buildContext = it, spotlight = spotlight)
}

@get:Rule
val rule = AppyxTestScenario { buildContext ->
nodeFactory(buildContext)
}

@Test
fun `GIVEN_spotlight_WHEN_operations_called_THEN_child_nodes_have_correct_targetVisibility_state`() {
val initialActiveIndex = 2
createSpotlight(initialActiveIndex)
rule.start()

assertTrue(nodeThreeTargetVisibilityState)

spotlight.activate(1)
rule.waitForIdle()

assertFalse(nodeOneTargetVisibilityState)
assertTrue(nodeTwoTargetVisibilityState)
assertFalse(nodeThreeTargetVisibilityState)

spotlight.activate(0)
rule.waitForIdle()

assertTrue(nodeOneTargetVisibilityState)
assertFalse(nodeTwoTargetVisibilityState)
assertFalse(nodeThreeTargetVisibilityState)
}


private fun createSpotlight(initialActiveIndex: Int) {
spotlight = Spotlight(
savedStateMap = null,
items = listOf(NavTarget.NavTarget1, NavTarget.NavTarget2, NavTarget.NavTarget3),
initialActiveIndex = initialActiveIndex
)
}

@Parcelize
sealed class NavTarget : Parcelable {

data object NavTarget1 : NavTarget()

data object NavTarget2 : NavTarget()

data object NavTarget3 : NavTarget()
}

inner class TestParentNode(
buildContext: BuildContext,
val spotlight: Spotlight<NavTarget>,
) : ParentNode<NavTarget>(
buildContext = buildContext,
navModel = spotlight
) {

override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node =
when (navTarget) {
NavTarget.NavTarget1 -> node(buildContext) {
nodeOneTargetVisibilityState = LocalNodeTargetVisibility.current
}

NavTarget.NavTarget2 -> node(buildContext) {
nodeTwoTargetVisibilityState = LocalNodeTargetVisibility.current
}
NavTarget.NavTarget3 -> node(buildContext) {
nodeThreeTargetVisibilityState = LocalNodeTargetVisibility.current
}
}

@Composable
override fun View(modifier: Modifier) {
Children(navModel)
}
}

}
Loading
Loading