Skip to content

Commit d86c2a5

Browse files
authored
chore: export all demo activities and group the activities in main screen (#768)
* chore(demo): Export all sample activities Updated the `AndroidManifest.xml` in the `maps-app` sample to set `android:exported="true"` for all sample activities. This change allows each activity to be launched directly, simplifying demonstration and testing. * feat(maps-app): Group demo activities on main screen To make the main screen less cluttered and easier to navigate, the demo activities have been grouped into a list. This provides a cleaner and more organized user experience. This change also pulls in Material 3. * feat(maps-app): Use Material 3 Scaffold This commit updates the main screen to use a Material 3 Scaffold, providing a more modern and consistent layout. The TopAppBar has also been updated to be center-aligned. * refactor(demo): Extract strings and refactor list composables Refactored the demo list screen to support internationalization by extracting all hardcoded strings into `strings.xml`. The `Activity` and `ActivityGroup` data classes were updated to use `@StringRes` integer IDs instead of `String` literals. Additionally, the `DemoList` composable has been broken down into smaller, more focused composables (`GroupHeaderItem` and `DemoActivityItem`) to improve readability and maintainability. * chore(demo): Add copyright header to Demo.kt and clean up unused import * docs: Improve comment for expanded group state in DemoList
1 parent 573e0e2 commit d86c2a5

File tree

6 files changed

+416
-194
lines changed

6 files changed

+416
-194
lines changed

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ kotlinxCoroutines = "1.10.2"
1616
leakcanaryAndroid = "2.14"
1717
mapsecrets = "2.0.1"
1818
mapsktx = "5.2.0"
19+
material3 = "1.3.2"
1920
org-jacoco-core = "0.8.13"
2021
screenshot = "0.0.1-alpha11"
2122
constraintlayout = "2.2.1"
@@ -29,6 +30,7 @@ androidx-compose-activity = { module = "androidx.activity:activity-compose", ver
2930
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "compose-bom" }
3031
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation" }
3132
androidx-compose-material = { module = "androidx.compose.material:material" }
33+
androidx-compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "material3" }
3234
androidx-compose-ui = { module = "androidx.compose.ui:ui" }
3335
androidx-compose-ui-preview-tooling = { module = "androidx.compose.ui:ui-tooling-preview" }
3436
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }

maps-app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ dependencies {
6262
implementation(libs.androidx.compose.activity)
6363
implementation(libs.androidx.compose.foundation)
6464
implementation(libs.androidx.compose.material)
65+
implementation(libs.androidx.compose.material3)
6566
implementation(libs.kotlin)
6667
implementation(libs.kotlinx.coroutines.android)
6768
implementation(libs.androidx.compose.ui.preview.tooling)
@@ -71,7 +72,6 @@ dependencies {
7172
debugImplementation(libs.androidx.compose.ui.tooling)
7273
debugImplementation(libs.leakcanary.android)
7374

74-
7575
androidTestImplementation(platform(libs.androidx.compose.bom))
7676
androidTestImplementation(libs.androidx.test.core)
7777
androidTestImplementation(libs.androidx.test.rules)

maps-app/src/main/AndroidManifest.xml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,57 +39,67 @@
3939
<category android:name="android.intent.category.LAUNCHER" />
4040
</intent-filter>
4141
</activity>
42+
43+
<!--
44+
All activities in this sample are exported. This is for demonstration
45+
purposes, to make it easy to launch each sample activity directly.
46+
47+
In a real-world application, you should carefully consider which activities
48+
to export. In most cases, only the main launcher activity should be exported.
49+
Exporting an activity means that any other app on the device can launch it.
50+
-->
51+
4252
<activity
4353
android:name=".BasicMapActivity"
44-
android:exported="false" />
54+
android:exported="true" />
4555
<activity
4656
android:name=".markerexamples.AdvancedMarkersActivity"
47-
android:exported="false"/>
57+
android:exported="true"/>
4858
<activity
4959
android:name=".MapInColumnActivity"
50-
android:exported="false"/>
60+
android:exported="true"/>
5161
<activity
5262
android:name=".MapsInLazyColumnActivity"
53-
android:exported="false"/>
63+
android:exported="true"/>
5464
<activity
5565
android:name=".markerexamples.MarkerClusteringActivity"
56-
android:exported="false"/>
66+
android:exported="true"/>
5767
<activity
5868
android:name=".LocationTrackingActivity"
59-
android:exported="false"/>
69+
android:exported="true"/>
6070
<activity
6171
android:name=".ScaleBarActivity"
62-
android:exported="false"/>
72+
android:exported="true"/>
6373
<activity
6474
android:name=".StreetViewActivity"
65-
android:exported="false"/>
75+
android:exported="true"/>
6676
<activity
6777
android:name=".CustomControlsActivity"
68-
android:exported="false"/>
78+
android:exported="true"/>
6979
<activity
7080
android:name=".AccessibilityActivity"
71-
android:exported="false"/>
81+
android:exported="true"/>
7282
<activity
7383
android:name=".RecompositionActivity"
74-
android:exported="false"/>
84+
android:exported="true"/>
7585
<activity
7686
android:name=".FragmentDemoActivity"
77-
android:exported="false"/>
87+
android:exported="true"/>
7888
<activity
7989
android:name=".markerexamples.markerdragevents.MarkerDragEventsActivity"
80-
android:exported="false"/>
90+
android:exported="true"/>
8191
<activity
8292
android:name=".markerexamples.markerscollection.MarkersCollectionActivity"
83-
android:exported="false"/>
93+
android:exported="true"/>
8494
<activity
8595
android:name=".markerexamples.syncingdraggablemarkerwithdatamodel.SyncingDraggableMarkerWithDataModelActivity"
86-
android:exported="false"/>
96+
android:exported="true"/>
8797
<activity
8898
android:name=".markerexamples.updatingnodragmarkerwithdatamodel.UpdatingNoDragMarkerWithDataModelActivity"
89-
android:exported="false"/>
99+
android:exported="true"/>
90100
<activity
91101
android:name=".markerexamples.draggablemarkerscollectionwithpolygon.DraggableMarkersCollectionWithPolygonActivity"
92-
android:exported="false"/>
102+
android:exported="true"/>
93103

94104
<!-- Used by createComponentActivity() for unit testing -->
95105
<activity android:name="androidx.activity.ComponentActivity" />

0 commit comments

Comments
 (0)