pepos
09/09/2023, 3:07 AMpepos
09/09/2023, 3:08 AMclass MainActivity : ComponentActivity() {
    private lateinit var appyxIntegrationPoint: ActivityIntegrationPoint
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        appyxIntegrationPoint = ActivityIntegrationPoint(
            activity = this,
            savedInstanceState = savedInstanceState
        )
        setContent {
            NodeHost(appyxIntegrationPoint) {
                RootNode(it)
            }
        }
    }
}
class RootNode(
    buildContext: BuildContext,
    private val backStack: BackStack<NavTarget> = BackStack(
        initialElement = NavTarget.Child1,
        savedStateMap = buildContext.savedStateMap
    )
) : ParentNode<RootNode.NavTarget>(
    buildContext = buildContext,
    navModel = backStack
) {
    sealed class NavTarget : Parcelable {
        @Parcelize
        data object Child1 : NavTarget()
    }
    override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node =
        when (navTarget) {
            NavTarget.Child1 -> Child1Node(
                buildContext = buildContext
            )
        }
    @Composable
    override fun View(modifier: Modifier) {
        Box(modifier = modifier.fillMaxSize()) {
            var selected by remember { mutableStateOf(true) }
            Box(
                modifier = modifier
                    .fillMaxSize()
                    .background(
                        if (selected) {
                            Color.Cyan
                        } else {
                            Color.Red
                        }
                    ).clickable {
                        selected = !selected
                    },
                contentAlignment = Alignment.Center,
            ) {
                Text(
                    text = "Google Maps Appyx 1.3.0"
                )
            }
            Children(
                modifier = modifier.fillMaxSize(),
                navModel = backStack,
                transitionHandler = rememberBackstackSlider(transitionSpec = { spring() })
            )
        }
    }
}
class Child1Node(
    buildContext: BuildContext
) : Node(buildContext) {
    @Composable
    override fun View(modifier: Modifier) {
        Box(
            modifier = modifier,
            contentAlignment = Alignment.BottomCenter
        ) {
            Box(modifier = Modifier
                .fillMaxWidth()
                .height(200.dp)
                .padding(10.dp)
                .background(Color.Black.copy(alpha = 0.3f))
                .clickable {  }
            )
        }
    }
}pepos
09/09/2023, 3:08 AMclass MainActivity : ComponentActivity() {
    private lateinit var appyxIntegrationPoint: ActivityIntegrationPoint
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        appyxIntegrationPoint = ActivityIntegrationPoint(
            activity = this,
            savedInstanceState = savedInstanceState
        )
        setContent {
            NodeHost(
                lifecycle = AndroidLifecycle(LocalLifecycleOwner.current.lifecycle),
                integrationPoint = appyxIntegrationPoint
            ) {
                RootNode(it)
            }
        }
    }
}
class RootNode(
    buildContext: BuildContext,
    private val backStack: BackStack<NavTarget> = BackStack(
        model = BackStackModel(
            initialTarget = NavTarget.Child1,
            savedStateMap = buildContext.savedStateMap
        ),
        motionController = { BackStackSlider(it) }
    )
) : ParentNode<RootNode.NavTarget>(
    appyxComponent = backStack,
    buildContext = buildContext
) {
    sealed class NavTarget : Parcelable {
        @Parcelize
        data object Child1 : NavTarget()
    }
    override fun resolve(interactionTarget: NavTarget, buildContext: BuildContext): Node =
        when (interactionTarget) {
            NavTarget.Child1 -> Child1Node(
                buildContext = buildContext
            )
        }
    @Composable
    override fun View(modifier: Modifier) {
        Box(modifier = modifier.fillMaxSize()) {
            var selected by remember { mutableStateOf(true) }
            Box(
                modifier = modifier
                    .fillMaxSize()
                    .background(
                        if (selected) {
                            Color.Cyan
                        } else {
                            Color.Red
                        }
                    ).clickable {
                        selected = !selected
                    },
                contentAlignment = Alignment.Center,
            ) {
                Text(
                    text = "Google Maps Appyx 2.0.0-alpha04"
                )
            }
            AppyxComponent(
                appyxComponent = backStack,
                modifier = modifier.fillMaxSize()
            )
        }
    }
}
class Child1Node(
    buildContext: BuildContext
) : Node(buildContext) {
    @Composable
    override fun View(modifier: Modifier) {
        Box(
            modifier = modifier,
            contentAlignment = Alignment.BottomCenter
        ) {
            Box(modifier = Modifier
                .fillMaxWidth()
                .height(200.dp)
                .padding(10.dp)
                .background(Color.Black.copy(alpha = 0.3f))
                .clickable {  }
            )
        }
    }
}Andrei Kovalev
09/09/2023, 11:34 AMAndrei Kovalev
09/09/2023, 11:38 AMZsolt
09/09/2023, 5:16 PMpepos
09/09/2023, 7:12 PMpepos
09/09/2023, 7:12 PMZsolt
09/12/2023, 7:52 AMpepos
09/14/2023, 10:47 PMAndrei Kovalev
09/15/2023, 8:25 AMpepos
09/15/2023, 4:41 PMpepos
09/18/2023, 8:06 PMAndrei Kovalev
09/19/2023, 6:59 AMZsolt
09/19/2023, 11:56 AMBoxChildrenAppyxComponentChildrenBoxAppyxComponentBoxZsolt
10/09/2023, 5:09 PM• By default, when there are multiple eligible composables on the same level of the tree, only the composable with the highest z-index is “hit”. For example, when you add two overlappingI wonder if this would help your case.composables to aButton, only the one drawn on top receives any pointer events. You can theoretically override this behavior by creating your ownBoximplementation and settingPointerInputModifierNodeto true.sharePointerInputWithSiblings
pepos
06/09/2024, 12:23 AMpepos
06/09/2024, 12:24 AMAppyxInteractionsContainer