-
Notifications
You must be signed in to change notification settings - Fork 394
[WIP] Jetpack XR library update for July '26 #978
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,10 +151,12 @@ class GenerateHandJointData : ComponentActivity() { | |
| @OptIn(FlowPreview::class) | ||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
| val session = (Session.create(context = this) as SessionCreateSuccess).session | ||
| val config = Config.Builder(session.config).setHandTracking(HandTrackingMode.BOTH).build() | ||
| session.configure(config) | ||
|
|
||
| lifecycleScope.launch { | ||
| val session = (Session.create(context = this@GenerateHandJointData) as SessionCreateSuccess).session | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for my own understanding, what does the syntax of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| val config = Config.Builder(session.config).setHandTracking(HandTrackingMode.BOTH).build() | ||
| session.configure(config) | ||
|
|
||
| Hand.right(session).state.sample(500.milliseconds).collect { rightHandState -> | ||
| val bufferString = buildString { | ||
| append("mapOf(") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,9 +44,8 @@ import androidx.xr.compose.subspace.SpatialRow | |
| import androidx.xr.compose.subspace.layout.SpatialRoundedCornerShape | ||
| import androidx.xr.compose.subspace.layout.SubspaceModifier | ||
| import androidx.xr.compose.subspace.layout.height | ||
| import androidx.xr.compose.subspace.layout.movable | ||
| import androidx.xr.compose.subspace.layout.resizable | ||
| import androidx.xr.compose.subspace.layout.transformingMovable | ||
| import androidx.xr.compose.subspace.layout.transformingResizable | ||
| import androidx.xr.compose.subspace.layout.width | ||
| import androidx.xr.compose.unit.DpVolumeOffset | ||
| import com.example.xr.R | ||
|
|
@@ -59,8 +58,8 @@ private fun OrbiterExampleSubspace() { | |
| SubspaceModifier | ||
| .height(824.dp) | ||
| .width(1400.dp) | ||
| .transformingResizable() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question here - how is this deprecation being handled? Do we have enough changes that we should think about doing a migration guide? Or perhaps a few things we should highlight in the Beta Blog post in August?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think @amyZepp would be a good person to make that call. What do you think Amy? |
||
| .transformingMovable(), | ||
| .resizable() | ||
| .movable(), | ||
| ) { | ||
| SpatialPanelContent() | ||
| OrbiterExample() | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,7 +17,6 @@ | |||||||||||||||||||||
| package com.example.xr.compose | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import androidx.compose.runtime.Composable | ||||||||||||||||||||||
| import androidx.compose.ui.platform.LocalDensity | ||||||||||||||||||||||
| import androidx.compose.ui.unit.dp | ||||||||||||||||||||||
| import androidx.xr.compose.platform.LocalSession | ||||||||||||||||||||||
| import androidx.xr.compose.spatial.Subspace | ||||||||||||||||||||||
|
|
@@ -26,17 +25,17 @@ import androidx.xr.compose.subspace.SceneCoreEntitySizeAdapter | |||||||||||||||||||||
| import androidx.xr.compose.subspace.layout.SubspaceModifier | ||||||||||||||||||||||
| import androidx.xr.compose.subspace.layout.offset | ||||||||||||||||||||||
| import androidx.xr.compose.unit.IntVolumeSize | ||||||||||||||||||||||
| import androidx.xr.compose.unit.Meter | ||||||||||||||||||||||
| import androidx.xr.runtime.math.FloatSize2d | ||||||||||||||||||||||
| import androidx.xr.runtime.math.IntSize2d | ||||||||||||||||||||||
| import androidx.xr.runtime.math.Pose | ||||||||||||||||||||||
| import androidx.xr.scenecore.SurfaceEntity | ||||||||||||||||||||||
| import androidx.xr.scenecore.scene | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @Composable | ||||||||||||||||||||||
| fun SceneCoreEntityExample() { | ||||||||||||||||||||||
| val session = LocalSession.current ?: return | ||||||||||||||||||||||
| // [START androidxr_compose_SceneCoreEntity] | ||||||||||||||||||||||
| val density = LocalDensity.current | ||||||||||||||||||||||
| val virtualPixelDensity = session.scene.virtualPixelDensity | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Subspace { | ||||||||||||||||||||||
| SceneCoreEntity( | ||||||||||||||||||||||
| modifier = SubspaceModifier.offset(x = 50.dp), | ||||||||||||||||||||||
|
|
@@ -58,8 +57,8 @@ fun SceneCoreEntityExample() { | |||||||||||||||||||||
| size: IntVolumeSize | ||||||||||||||||||||||
| ) { | ||||||||||||||||||||||
| val extents = FloatSize2d( | ||||||||||||||||||||||
| Meter.fromPixel(size.width.toFloat(), density).toM(), | ||||||||||||||||||||||
| Meter.fromPixel(size.height.toFloat(), density).toM(), | ||||||||||||||||||||||
| size.width.toFloat(), | ||||||||||||||||||||||
| size.height.toFloat() | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is the data we are returning from these values fundamentally different now? I am trying to understand if we have a sneaky breaking change that might be hard to detect and leading to bugs. |
||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
Comment on lines
59
to
62
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The suggest didn't work due to the unresolved reference |
||||||||||||||||||||||
| entity.shape = SurfaceEntity.Shape.Quad(extents) | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm that we are handling this name change properly - is this a breaking change or is
AnchorEntitystill available and marked as depracated?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a breaking change. Any code using the old AnchorEntity class will need to be updated to use AnchorSpace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No breakage for downstream clients just yet - see cs.android.com;
AnchorEntityis being marked@Deprecated.