Skip to content

Commit 5e8b9b4

Browse files
authored
Initial commit of part2
1 parent 7a889de commit 5e8b9b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1788
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ you through best practices of building apps for XR devices.
66

77
- [Learn Android XR Fundamentals](/xr-fundamentals/)
88
- [Part 1 - Modes and Spatial Panels](https://developer.android.com/codelabs/xr-fundamentals-part-1)
9+
- [Part 2 - Orbiters and Spatial Environments](https://developer.android.com/codelabs/xr-fundamentals-part-2)
910

1011
Clone the repo or download and unarchive the ZIP file. The folders in the repo
1112
contain Android Studio projects that enable you to modify and build the sample

xr-fundamentals/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
This directory contains the code for the "Learn Android XR Fundamentals" series
44
of codelabs:
55

6-
- [Learn Android XR Fundamentals: Part 1 - Modes and Spatial Panels](https://developer.android.com/codelabs/xr-fundamentals-part-1)
6+
- [Learn Android XR Fundamentals: Part 1 - Modes and Spatial Panels](https://developer.android.com/codelabs/xr-fundamentals-part-1)
7+
- [Learn Android XR Fundamentals: Part 2 - Orbiters and Environments](https://developer.android.com/codelabs/xr-fundamentals-part-1)

xr-fundamentals/part1/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ android {
2626

2727
defaultConfig {
2828
applicationId = "com.example.android.xrfundamentals"
29-
minSdk = 30
29+
minSdk = 34
3030
targetSdk = 35
3131
versionCode = 1
3232
versionName = "1.0"

xr-fundamentals/part1/app/src/main/java/com/example/android/xrfundamentals/ui/component/ToggleSpaceModeButton.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
package com.example.android.xrfundamentals.ui.component
1818

1919
import androidx.annotation.DrawableRes
20+
import androidx.compose.material3.FilledTonalIconButton
2021
import androidx.compose.material3.Icon
21-
import androidx.compose.material3.IconButton
2222
import androidx.compose.runtime.Composable
2323
import androidx.compose.ui.Modifier
2424
import androidx.compose.ui.res.painterResource
@@ -56,7 +56,7 @@ fun ToggleSpaceModeButton(
5656
onClick: () -> Unit,
5757
modifier: Modifier = Modifier
5858
) {
59-
IconButton(
59+
FilledTonalIconButton(
6060
modifier = modifier,
6161
onClick = onClick
6262
) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
plugins {
18+
alias(libs.plugins.android.application)
19+
alias(libs.plugins.kotlin.android)
20+
alias(libs.plugins.kotlin.compose)
21+
}
22+
23+
android {
24+
namespace = "com.example.android.xrfundamentals"
25+
compileSdk = 35
26+
27+
defaultConfig {
28+
applicationId = "com.example.android.xrfundamentals"
29+
minSdk = 34
30+
targetSdk = 35
31+
versionCode = 1
32+
versionName = "1.0"
33+
34+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
35+
}
36+
37+
buildTypes {
38+
release {
39+
isMinifyEnabled = false
40+
proguardFiles(
41+
getDefaultProguardFile("proguard-android-optimize.txt"),
42+
"proguard-rules.pro"
43+
)
44+
}
45+
}
46+
compileOptions {
47+
sourceCompatibility = JavaVersion.VERSION_11
48+
targetCompatibility = JavaVersion.VERSION_11
49+
}
50+
kotlinOptions {
51+
jvmTarget = "11"
52+
}
53+
buildFeatures {
54+
compose = true
55+
}
56+
}
57+
58+
dependencies {
59+
implementation(libs.androidx.core.ktx)
60+
implementation(libs.androidx.lifecycle.runtime.ktx)
61+
implementation(libs.androidx.activity.compose)
62+
implementation(platform(libs.androidx.compose.bom))
63+
implementation(libs.androidx.ui)
64+
implementation(libs.androidx.ui.graphics)
65+
implementation(libs.androidx.ui.tooling.preview)
66+
implementation(libs.androidx.material3)
67+
implementation(libs.androidx.material3.adaptive)
68+
implementation(libs.androidx.xr.compose)
69+
implementation(libs.androidx.xr.scenecore)
70+
implementation(libs.jetbrains.kotlinx.coroutines.guava)
71+
testImplementation(libs.junit)
72+
androidTestImplementation(libs.androidx.junit)
73+
androidTestImplementation(libs.androidx.espresso.core)
74+
androidTestImplementation(platform(libs.androidx.compose.bom))
75+
androidTestImplementation(libs.androidx.ui.test.junit4)
76+
debugImplementation(libs.androidx.ui.tooling)
77+
debugImplementation(libs.androidx.ui.test.manifest)
78+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="utf-8"?><!--
2+
Copyright 2024 Google LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
18+
19+
<uses-feature android:name="android.software.xr.api.spatial" android:required="false"/>
20+
21+
<application
22+
android:allowBackup="true"
23+
android:icon="@mipmap/ic_launcher"
24+
android:label="@string/app_name"
25+
android:roundIcon="@mipmap/ic_launcher_round"
26+
android:supportsRtl="true"
27+
android:theme="@style/Theme.XRFundamentals">
28+
<activity
29+
android:name=".MainActivity"
30+
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density|uiMode"
31+
android:exported="true"
32+
android:theme="@style/Theme.XRFundamentals">
33+
<intent-filter>
34+
<action android:name="android.intent.action.MAIN" />
35+
<category android:name="android.intent.category.LAUNCHER" />
36+
</intent-filter>
37+
</activity>
38+
</application>
39+
40+
</manifest>
Binary file not shown.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.example.android.xrfundamentals
18+
19+
import android.os.Bundle
20+
import androidx.activity.ComponentActivity
21+
import androidx.activity.compose.setContent
22+
import androidx.activity.enableEdgeToEdge
23+
import com.example.android.xrfundamentals.ui.theme.XRFundamentalsTheme
24+
25+
class MainActivity : ComponentActivity() {
26+
override fun onCreate(savedInstanceState: Bundle?) {
27+
super.onCreate(savedInstanceState)
28+
enableEdgeToEdge()
29+
setContent {
30+
XRFundamentalsTheme {
31+
XRFundamentalsApp()
32+
}
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)