Skip to content

Commit

Permalink
introduce android xr
Browse files Browse the repository at this point in the history
  • Loading branch information
matsumo0922 committed Dec 16, 2024
1 parent 683b354 commit a1b68fa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions composeApp/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-sdk tools:overrideLibrary="androidx.xr.scenecore, androidx.xr.compose, androidx.xr.compose.material3" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
Expand Down Expand Up @@ -96,6 +98,10 @@
<meta-data
android:name="com.google.android.gms.ads.flag.NATIVE_AD_DEBUGGER_ENABLED"
android:value="false" />

<property
android:name="android.window.PROPERTY_XR_ACTIVITY_START_MODE"
android:value="XR_ACTIVITY_START_MODE_FULL_SPACE_MANAGED" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import androidx.xr.compose.material3.EnableXrComponentOverrides
import androidx.xr.compose.material3.ExperimentalMaterial3XrApi
import com.google.android.play.core.review.ReviewManagerFactory
import kotlinx.collections.immutable.persistentMapOf
import kotlinx.coroutines.flow.first
Expand Down Expand Up @@ -47,7 +49,7 @@ class MainActivity : FragmentActivity(), KoinComponent {

private var stayTime = 0L

@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class, ExperimentalMaterial3XrApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
val splashScreen = installSplashScreen()

Expand All @@ -72,7 +74,7 @@ class MainActivity : FragmentActivity(), KoinComponent {
onDispose {}
}

PreComposeApp {
EnableXrComponentOverrides {
PixiViewApp(
modifier = Modifier.fillMaxSize(),
windowSize = windowSize.widthSizeClass,
Expand Down
11 changes: 9 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ androidxPreference = "1.2.1"
androidxDataStore = "1.1.1"
androidxPalette = "1.0.0"
androidxAnnotation = "1.8.2"
androidxMedia3 = "1.4.1"
androidxCompose = "2024.09.03"
androidxMedia3 = "1.5.0"
androidxCompose = "2024.12.01"
androidxXR = "1.0.0-alpha01"

# Google
playReview = "2.0.1"
Expand Down Expand Up @@ -148,6 +149,10 @@ androidx-compose-ui-binding = { module = "androidx.compose.ui:ui-viewbinding" }
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }

# XR Compose
androidx-xr-compose = { module = "androidx.xr.compose:compose", version.ref = "androidxXR" }
androidx-xr-material3 = { module = "androidx.xr.compose.material3:material3", version.ref = "androidxXR" }

# KMP
kmp-lifecycle-runtime-compose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose", version.ref = "kmpLifecycle" }
kmp-lifecycle-viewmodel-compose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "kmpLifecycle" }
Expand Down Expand Up @@ -263,6 +268,8 @@ ui-android-api = [
"androidx-compose-runtime",
"androidx-compose-ui",
"androidx-compose-ui-binding",
"androidx-xr-compose",
"androidx-xr-material3",
"accompanist-systemuicontroller",
"accompanist-compose-theme-adapter",
"accompanist-compose-theme-adapter3",
Expand Down

0 comments on commit a1b68fa

Please sign in to comment.