Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
android:name="android.hardware.camera"
android:required="true" />

<!-- Androidify can use XR features if they're available; they're not required. -->
<uses-feature android:name="android.software.xr.api.spatial" android:required="false" />

<uses-permission android:name="android.permission.CAMERA" />
<uses-sdk tools:overrideLibrary="com.google.ai.edge.aicore" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,24 @@
package com.android.developers.androidify.xr

import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.DisposableEffect
import androidx.xr.compose.platform.LocalSession
import androidx.xr.scenecore.scene
import kotlinx.coroutines.delay

/*
* A composable that attempts to continually hide the mainPanel.
* A composable that hides the mainPanel when it is disposed. When placed outside of an (Application)Subspace,
* this composable will be disposed after the Subspace, hiding the mainPanelEntity again.
*
* This is a temporary workaround for b/440325404, that causes the mainPanelEntity when an
* This is a temporary workaround for b/440325404, that causes the mainPanelEntity to appear when an
* ApplicationSubspace transitions out of the composition due to a race condition when transitioning
* the two hierarchies.
*/
@Composable
fun MainPanelWorkaround() {
val session = LocalSession.current
LaunchedEffect(null) {
while (true) {
delay(100L)
session?.scene?.mainPanelEntity?.setEnabled(false)
val session = LocalSession.current ?: return
DisposableEffect(session) {
onDispose {
session.scene.mainPanelEntity.setEnabled(false)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ fun EditScreenSpatial(
onDropCallback: (Uri) -> Unit = {},
) {
DisableSharedTransition {
MainPanelWorkaround()
SquiggleBackgroundSubspace(minimumHeight = 600.dp) {
MainPanelWorkaround()
SpatialColumn(SubspaceModifier.fillMaxWidth()) {
SpatialPanel(
SubspaceModifier.offset(z = 10.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ private const val squiggleSafeContentHeight = 0.6f
fun LoadingScreenSpatial(
onCancelPress: () -> Unit,
) {
MainPanelWorkaround()
BackgroundSubspace(
aspectRatio = 1.4f,
minimumHeight = 500.dp,
drawable = CreationR.drawable.squiggle_light,
) {
MainPanelWorkaround()
Orbiter(
position = ContentEdge.Top,
offsetType = OrbiterOffsetType.OuterEdge,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import com.android.developers.androidify.xr.SquiggleBackgroundSubspace

@Composable
fun AboutScreenSpatial(onBackPressed: () -> Unit, bottomButtons: @Composable () -> Unit) {
MainPanelWorkaround()
SquiggleBackgroundSubspace(500.dp) {
MainPanelWorkaround()
SpatialPanel {
Orbiter(
ContentEdge.Top,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ fun HomeScreenContentsSpatial(
onAboutClicked: () -> Unit,
) {
DisableSharedTransition {
MainPanelWorkaround()
SquiggleBackgroundSubspace(minimumHeight = 600.dp) {
MainPanelWorkaround()
Orbiter(
position = ContentEdge.Top,
offsetType = OrbiterOffsetType.OuterEdge,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ fun ResultsScreenSpatial(
) {
var offsetPose by remember { mutableStateOf(Pose()) }
DisableSharedTransition {
MainPanelWorkaround()
Subspace {
MainPanelWorkaround()

SpatialPanel(
SubspaceModifier
.offset(z = 5.dp)
Expand Down