File tree Expand file tree Collapse file tree 7 files changed +16
-15
lines changed
core/xr/src/main/java/com/android/developers/androidify/xr
creation/src/main/java/com/android/developers/androidify/creation/xr
home/src/main/java/com/android/developers/androidify/home/xr
results/src/main/java/com/android/developers/androidify/results/xr Expand file tree Collapse file tree 7 files changed +16
-15
lines changed Original file line number Diff line number Diff line change 23
23
android : name =" android.hardware.camera"
24
24
android : required =" true" />
25
25
26
+ <!-- Androidify can use XR features if they're available; they're not required. -->
27
+ <uses-feature android : name =" android.software.xr.api.spatial" android : required =" false" />
28
+
26
29
<uses-permission android : name =" android.permission.CAMERA" />
27
30
<uses-sdk tools : overrideLibrary =" com.google.ai.edge.aicore" />
28
31
Original file line number Diff line number Diff line change 16
16
package com.android.developers.androidify.xr
17
17
18
18
import androidx.compose.runtime.Composable
19
- import androidx.compose.runtime.LaunchedEffect
19
+ import androidx.compose.runtime.DisposableEffect
20
20
import androidx.xr.compose.platform.LocalSession
21
21
import androidx.xr.scenecore.scene
22
- import kotlinx.coroutines.delay
23
22
24
23
/*
25
- * A composable that attempts to continually hide the mainPanel.
24
+ * A composable that hides the mainPanel when it is disposed. When placed outside of an (Application)Subspace,
25
+ * this composable will be disposed after the Subspace, hiding the mainPanelEntity again.
26
26
*
27
- * This is a temporary workaround for b/440325404, that causes the mainPanelEntity when an
27
+ * This is a temporary workaround for b/440325404, that causes the mainPanelEntity to appear when an
28
28
* ApplicationSubspace transitions out of the composition due to a race condition when transitioning
29
29
* the two hierarchies.
30
30
*/
31
31
@Composable
32
32
fun MainPanelWorkaround () {
33
- val session = LocalSession .current
34
- LaunchedEffect (null ) {
35
- while (true ) {
36
- delay(100L )
37
- session?.scene?.mainPanelEntity?.setEnabled(false )
33
+ val session = LocalSession .current ? : return
34
+ DisposableEffect (session) {
35
+ onDispose {
36
+ session.scene.mainPanelEntity.setEnabled(false )
38
37
}
39
38
}
40
39
}
Original file line number Diff line number Diff line change @@ -75,8 +75,8 @@ fun EditScreenSpatial(
75
75
onDropCallback : (Uri ) -> Unit = {},
76
76
) {
77
77
DisableSharedTransition {
78
+ MainPanelWorkaround ()
78
79
SquiggleBackgroundSubspace (minimumHeight = 600 .dp) {
79
- MainPanelWorkaround ()
80
80
SpatialColumn (SubspaceModifier .fillMaxWidth()) {
81
81
SpatialPanel (
82
82
SubspaceModifier .offset(z = 10 .dp)
Original file line number Diff line number Diff line change @@ -52,12 +52,12 @@ private const val squiggleSafeContentHeight = 0.6f
52
52
fun LoadingScreenSpatial (
53
53
onCancelPress : () -> Unit ,
54
54
) {
55
+ MainPanelWorkaround ()
55
56
BackgroundSubspace (
56
57
aspectRatio = 1.4f ,
57
58
minimumHeight = 500 .dp,
58
59
drawable = CreationR .drawable.squiggle_light,
59
60
) {
60
- MainPanelWorkaround ()
61
61
Orbiter (
62
62
position = ContentEdge .Top ,
63
63
offsetType = OrbiterOffsetType .OuterEdge ,
Original file line number Diff line number Diff line change @@ -33,8 +33,8 @@ import com.android.developers.androidify.xr.SquiggleBackgroundSubspace
33
33
34
34
@Composable
35
35
fun AboutScreenSpatial (onBackPressed : () -> Unit , bottomButtons : @Composable () -> Unit ) {
36
+ MainPanelWorkaround ()
36
37
SquiggleBackgroundSubspace (500 .dp) {
37
- MainPanelWorkaround ()
38
38
SpatialPanel {
39
39
Orbiter (
40
40
ContentEdge .Top ,
Original file line number Diff line number Diff line change @@ -69,8 +69,8 @@ fun HomeScreenContentsSpatial(
69
69
onAboutClicked : () -> Unit ,
70
70
) {
71
71
DisableSharedTransition {
72
+ MainPanelWorkaround ()
72
73
SquiggleBackgroundSubspace (minimumHeight = 600 .dp) {
73
- MainPanelWorkaround ()
74
74
Orbiter (
75
75
position = ContentEdge .Top ,
76
76
offsetType = OrbiterOffsetType .OuterEdge ,
Original file line number Diff line number Diff line change @@ -59,9 +59,8 @@ fun ResultsScreenSpatial(
59
59
) {
60
60
var offsetPose by remember { mutableStateOf(Pose ()) }
61
61
DisableSharedTransition {
62
+ MainPanelWorkaround ()
62
63
Subspace {
63
- MainPanelWorkaround ()
64
-
65
64
SpatialPanel (
66
65
SubspaceModifier
67
66
.offset(z = 5 .dp)
You can’t perform that action at this time.
0 commit comments