Skip to content

Commit da5f82c

Browse files
committed
Merge branch 'main' of https://github.com/garanj/androidify
2 parents 4973a88 + 1cdf28e commit da5f82c

File tree

13 files changed

+346
-147
lines changed

13 files changed

+346
-147
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
android:name="android.hardware.camera"
2424
android:required="true" />
2525

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+
2629
<uses-permission android:name="android.permission.CAMERA" />
2730
<uses-sdk tools:overrideLibrary="com.google.ai.edge.aicore" />
2831

app/src/main/java/com/android/developers/androidify/navigation/MainNavigation.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import androidx.compose.runtime.mutableStateOf
3131
import androidx.compose.runtime.remember
3232
import androidx.compose.runtime.setValue
3333
import androidx.compose.ui.platform.LocalContext
34+
import androidx.compose.ui.platform.LocalUriHandler
3435
import androidx.compose.ui.unit.IntOffset
3536
import androidx.hilt.navigation.compose.hiltViewModel
3637
import androidx.lifecycle.viewmodel.navigation3.rememberViewModelStoreNavEntryDecorator
@@ -184,13 +185,20 @@ fun MainNavigation() {
184185
}
185186
entry<About> {
186187
val context = LocalContext.current
188+
val uriHandler = LocalUriHandler.current
187189
AboutScreen(
188190
onBackPressed = {
189191
backStack.removeLastOrNull()
190192
},
191193
onLicensesClicked = {
192194
context.startActivity(Intent(context, OssLicensesMenuActivity::class.java))
193195
},
196+
onPrivacyClicked = {
197+
uriHandler.openUri("https://policies.google.com/privacy")
198+
},
199+
onTermsClicked = {
200+
uriHandler.openUri("https://policies.google.com/terms")
201+
}
194202
)
195203
}
196204
},

core/xr/src/main/java/com/android/developers/androidify/xr/MainPanelWorkaround.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,24 @@
1616
package com.android.developers.androidify.xr
1717

1818
import androidx.compose.runtime.Composable
19-
import androidx.compose.runtime.LaunchedEffect
19+
import androidx.compose.runtime.DisposableEffect
2020
import androidx.xr.compose.platform.LocalSession
2121
import androidx.xr.scenecore.scene
22-
import kotlinx.coroutines.delay
2322

2423
/*
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.
2626
*
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
2828
* ApplicationSubspace transitions out of the composition due to a race condition when transitioning
2929
* the two hierarchies.
3030
*/
3131
@Composable
3232
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)
3837
}
3938
}
4039
}

feature/creation/src/main/java/com/android/developers/androidify/creation/EditScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ fun EditScreenScaffoldWithAppBar(
151151
},
152152
actions = {
153153
AboutButton { onAboutPressed() }
154-
if (couldRequestFullSpace()) {
154+
if (uiState.xrEnabled && couldRequestFullSpace()) {
155155
RequestFullSpaceIconButton()
156156
}
157157
},

feature/creation/src/main/java/com/android/developers/androidify/creation/xr/EditScreenSpatial.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ fun EditScreenSpatial(
7575
onDropCallback: (Uri) -> Unit = {},
7676
) {
7777
DisableSharedTransition {
78+
MainPanelWorkaround()
7879
SquiggleBackgroundSubspace(minimumHeight = 600.dp) {
79-
MainPanelWorkaround()
8080
SpatialColumn(SubspaceModifier.fillMaxWidth()) {
8181
SpatialPanel(
8282
SubspaceModifier.offset(z = 10.dp)

feature/creation/src/main/java/com/android/developers/androidify/creation/xr/LoadingScreenSpatial.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ private const val squiggleSafeContentHeight = 0.6f
5252
fun LoadingScreenSpatial(
5353
onCancelPress: () -> Unit,
5454
) {
55+
MainPanelWorkaround()
5556
BackgroundSubspace(
5657
aspectRatio = 1.4f,
5758
minimumHeight = 500.dp,
5859
drawable = CreationR.drawable.squiggle_light,
5960
) {
60-
MainPanelWorkaround()
6161
Orbiter(
6262
position = ContentEdge.Top,
6363
offsetType = OrbiterOffsetType.OuterEdge,

0 commit comments

Comments
 (0)