Skip to content

Commit a3e2e72

Browse files
committed
feat(codelab): introduce aloha explorer 3d maps starter and solution
- Added starter architecture with comprehensive TODO curriculm. - Added full solution module reflecting best-practices. - Included instructional codelab.md guide covering Camera animations, Popovers, Extrusions and Compose interop. - Properly excluded build/ and .idea/ artifacts.
1 parent 28d07d5 commit a3e2e72

85 files changed

Lines changed: 4975 additions & 0 deletions

File tree

Some content is hidden

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

codelab/codelab.md

Lines changed: 979 additions & 0 deletions
Large diffs are not rendered by default.

codelab/solution/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties
16+
/secrets.properties

codelab/solution/app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
4+
alias(libs.plugins.kotlin.compose)
5+
alias(libs.plugins.secrets.gradle.plugin)
6+
}
7+
8+
android {
9+
namespace = "com.example.alohaexplorer"
10+
compileSdk = libs.versions.compileSdk.get().toInt()
11+
12+
buildFeatures {
13+
viewBinding = true
14+
compose = true
15+
buildConfig = true
16+
}
17+
18+
defaultConfig {
19+
applicationId = "com.example.alohaexplorer"
20+
minSdk = libs.versions.minSdk.get().toInt()
21+
targetSdk = libs.versions.targetSdk.get().toInt()
22+
versionCode = 1
23+
versionName = "1.0"
24+
25+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
26+
}
27+
28+
buildTypes {
29+
release {
30+
isMinifyEnabled = false
31+
proguardFiles(
32+
getDefaultProguardFile("proguard-android-optimize.txt"),
33+
"proguard-rules.pro"
34+
)
35+
}
36+
}
37+
compileOptions {
38+
sourceCompatibility = JavaVersion.VERSION_17
39+
targetCompatibility = JavaVersion.VERSION_17
40+
}
41+
buildFeatures {
42+
compose = true
43+
buildConfig = true
44+
}
45+
}
46+
47+
kotlin {
48+
compilerOptions {
49+
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
50+
}
51+
}
52+
53+
dependencies {
54+
implementation(libs.androidx.activity)
55+
implementation(libs.androidx.activity.compose)
56+
implementation(libs.androidx.appcompat)
57+
implementation(libs.androidx.constraintlayout)
58+
implementation(libs.androidx.core.ktx)
59+
implementation(libs.androidx.lifecycle.runtime.ktx)
60+
implementation(libs.androidx.material3)
61+
implementation(libs.androidx.ui)
62+
implementation(libs.androidx.ui.graphics)
63+
implementation(libs.androidx.ui.tooling.preview)
64+
implementation(libs.material)
65+
implementation(platform(libs.androidx.compose.bom))
66+
67+
debugImplementation(libs.androidx.ui.tooling)
68+
69+
testImplementation(libs.junit)
70+
71+
androidTestImplementation(libs.androidx.junit)
72+
androidTestImplementation(libs.androidx.espresso.core)
73+
74+
implementation(libs.play.services.maps3d)
75+
}
76+
77+
secrets {
78+
// Optionally specify a different file name containing your secrets.
79+
// The plugin defaults to "local.properties"
80+
propertiesFileName = "secrets.properties"
81+
82+
// A properties file containing default secret values. This file can be
83+
// checked in version control.
84+
defaultPropertiesFileName = "local.defaults.properties"
85+
}
86+
87+
tasks.register<Exec>("launchDebug") {
88+
dependsOn("installDebug")
89+
commandLine("adb", "shell", "am", "start", "-n", "com.example.alohaexplorer/.MainActivity")
90+
doLast {
91+
println("Launched com.example.alohaexplorer/.MainActivity")
92+
}
93+
}
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: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.example.alohaexplorer
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.example.alohaexplorer", appContext.packageName)
23+
}
24+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
<application
7+
android:allowBackup="true"
8+
android:dataExtractionRules="@xml/data_extraction_rules"
9+
android:fullBackupContent="@xml/backup_rules"
10+
android:icon="@mipmap/ic_launcher"
11+
android:label="@string/app_name"
12+
android:roundIcon="@mipmap/ic_launcher_round"
13+
android:supportsRtl="true"
14+
android:theme="@style/Theme.AlohaExplorer">
15+
16+
<meta-data
17+
android:name="com.google.android.geo.maps3d.API_KEY"
18+
android:value="${MAPS3D_API_KEY}"
19+
/>
20+
21+
<activity
22+
android:name=".MainActivity"
23+
android:exported="true">
24+
<intent-filter>
25+
<action android:name="android.intent.action.MAIN" />
26+
<category android:name="android.intent.category.LAUNCHER" />
27+
</intent-filter>
28+
</activity>
29+
30+
<activity
31+
android:name=".Map3DComposeActivity"
32+
android:exported="true"
33+
android:label="Aloha Compose" />
34+
</application>
35+
36+
</manifest>
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
package com.example.alohaexplorer
2+
3+
import com.google.android.gms.maps3d.model.camera
4+
import com.google.android.gms.maps3d.model.latLngAltitude
5+
6+
// Step 1: Honolulu
7+
val HONOLULU = latLngAltitude {
8+
latitude = 21.3069
9+
longitude = -157.8583
10+
altitude = 0.0
11+
}
12+
13+
// Step 2: Iolani Palace
14+
val IOLANI_PALACE = latLngAltitude {
15+
latitude = 21.306740
16+
longitude = -157.858803
17+
altitude = 0.0
18+
}
19+
20+
// Step 6: Waikiki Beach
21+
val WAIKIKI = latLngAltitude {
22+
latitude = 21.2766
23+
longitude = -157.8286
24+
altitude = 0.0
25+
}
26+
27+
val DIAMOND_HEAD = latLngAltitude {
28+
latitude = 21.26194
29+
longitude = -157.80556
30+
altitude = 0.0
31+
}
32+
33+
val KOKO_HEAD = latLngAltitude {
34+
latitude = 21.270856
35+
longitude = -157.694442
36+
altitude = 0.0
37+
}
38+
39+
val PEARL_HARBOR = latLngAltitude {
40+
latitude = 21.31861
41+
longitude = -157.92250
42+
altitude = 0.0
43+
}
44+
45+
val MOUNT_KAALA = latLngAltitude {
46+
latitude = 21.50694
47+
longitude = -158.14278
48+
altitude = 0.0
49+
}
50+
51+
val LANIKAI_BEACH = latLngAltitude {
52+
latitude = 21.39309
53+
longitude = -157.71546
54+
altitude = 0.0
55+
}
56+
57+
// Models must be loaded from a URL. Here we use Cloud Storage.
58+
const val BALLOON_MODEL_URL = "https://storage.googleapis.com/gmp-maps-demos/p3d-map/assets/balloon-pin-BlXF32yD.glb"
59+
const val BALLOON_SCALE = 5.0
60+
61+
// Step 5: Iolani Palace Geometry (Lat, Lng pairs)
62+
val IOLANI_PALACE_GEO = listOf(
63+
21.307180365, -157.858769898,
64+
21.306765552, -157.858390366,
65+
21.306476932, -157.858755146,
66+
21.306892995, -157.859134679,
67+
)
68+
69+
val POLYGON_CAMERA = camera {
70+
center = latLngAltitude {
71+
latitude = 21.307051
72+
longitude = -157.858546
73+
altitude = 7.1
74+
}
75+
heading = 78.0
76+
tilt = 53.0
77+
range = 644.0
78+
}
79+
80+
val MARKER_CAMERA = camera {
81+
center = latLngAltitude {
82+
latitude = 21.306648
83+
longitude = -157.859336
84+
altitude = 26.8
85+
}
86+
tilt = 68.0
87+
range = 1024.0
88+
heading = 61.0
89+
}
90+
91+
val CUSTOM_MARKER_CAMERA = camera {
92+
this.center = latLngAltitude {
93+
this.latitude = 21.306370
94+
this.longitude = -157.855474
95+
this.altitude = 6.6
96+
}
97+
this.heading = 39.0
98+
this.tilt = 68.0
99+
this.range = 1399.0
100+
}
101+
102+
val BALLOON_CAMERA = camera {
103+
center = WAIKIKI
104+
tilt = 60.0
105+
range = 1000.0
106+
heading = 0.0
107+
}

0 commit comments

Comments
 (0)