Skip to content

Commit

Permalink
feat: added Kotlin MapColorScheme sample
Browse files Browse the repository at this point in the history
  • Loading branch information
kikoso committed Jul 22, 2024
1 parent d2471f0 commit c23aea5
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 64 deletions.
9 changes: 4 additions & 5 deletions ApiDemos/kotlin/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
lintOptions {
abortOnError false
Expand All @@ -49,17 +49,16 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api 'androidx.appcompat:appcompat:1.7.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.3.1"
implementation "androidx.recyclerview:recyclerview:1.3.2"
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.android.volley:volley:1.2.1'

// GMS
gmsImplementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.3'
gmsImplementation 'com.google.maps.android:maps-ktx:5.1.0'
gmsImplementation 'com.google.maps.android:maps-ktx:5.1.1'

// Below is used to run the easypermissions library to manage location permissions
// EasyPermissions is needed to help us request for permission to access location
Expand Down
113 changes: 57 additions & 56 deletions ApiDemos/kotlin/app/src/gms/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,62 +15,63 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AdvancedMarkersDemoActivity" />
<activity android:name=".BasicMapDemoActivity" />
<activity android:name=".BackgroundColorCustomizationDemoActivity" />
<activity android:name=".BackgroundColorCustomizationProgrammaticDemoActivity" />
<activity android:name=".CameraDemoActivity" />
<activity android:name=".CameraClampingDemoActivity" />
<activity android:name=".CloudBasedMapStylingDemoActivity" />
<activity android:name=".CircleDemoActivity" />
<activity android:name=".MarkerCloseInfoWindowOnRetapDemoActivity" />
<activity android:name=".EventsDemoActivity" />
<activity android:name=".GroundOverlayDemoActivity" />
<activity android:name=".IndoorDemoActivity" />
<activity android:name=".LayersDemoActivity" />
<activity android:name=".LiteDemoActivity" />
<activity android:name=".LiteListDemoActivity" />
<activity android:name=".LocationSourceDemoActivity" />
<activity android:name=".MapInPagerDemoActivity" />
<activity android:name=".MarkerDemoActivity" />
<activity android:name=".MultiMapDemoActivity" />
<activity android:name=".MyLocationDemoActivity" />
<activity android:name=".OptionsDemoActivity" />
<activity android:name=".PolygonDemoActivity" />
<activity android:name=".ProgrammaticDemoActivity" />
<activity android:name=".RawMapViewDemoActivity" />
<activity android:name=".RetainMapDemoActivity" />
<activity android:name=".SaveStateDemoActivity" />
<activity android:name=".SnapshotDemoActivity" />
<activity android:name=".SplitStreetViewPanoramaAndMapDemoActivity" />
<activity android:name=".StreetViewPanoramaBasicDemoActivity" />
<activity android:name=".StreetViewPanoramaEventsDemoActivity" />
<activity android:name=".StreetViewPanoramaNavigationDemoActivity" />
<activity android:name=".StreetViewPanoramaOptionsDemoActivity" />
<activity android:name=".StreetViewPanoramaViewDemoActivity" />
<activity android:name=".StyledMapDemoActivity" />
<activity android:name=".TagsDemoActivity" />
<activity android:name=".TileCoordinateDemoActivity" />
<activity android:name=".TileOverlayDemoActivity" />
<activity android:name=".UiSettingsDemoActivity" />
<activity android:name=".VisibleRegionDemoActivity" />
<activity android:name=".polyline.PolylineDemoActivity" />
</application>
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AdvancedMarkersDemoActivity" />
<activity android:name=".BasicMapDemoActivity" />
<activity android:name=".BackgroundColorCustomizationDemoActivity" />
<activity android:name=".BackgroundColorCustomizationProgrammaticDemoActivity" />
<activity android:name=".CameraDemoActivity" />
<activity android:name=".CameraClampingDemoActivity" />
<activity android:name=".CloudBasedMapStylingDemoActivity" />
<activity android:name=".CircleDemoActivity" />
<activity android:name=".MarkerCloseInfoWindowOnRetapDemoActivity" />
<activity android:name=".EventsDemoActivity" />
<activity android:name=".GroundOverlayDemoActivity" />
<activity android:name=".IndoorDemoActivity" />
<activity android:name=".LayersDemoActivity" />
<activity android:name=".LiteDemoActivity" />
<activity android:name=".LiteListDemoActivity" />
<activity android:name=".LocationSourceDemoActivity" />
<activity android:name=".MapInPagerDemoActivity" />
<activity android:name=".MapColorSchemeActivity" />
<activity android:name=".MarkerDemoActivity" />
<activity android:name=".MultiMapDemoActivity" />
<activity android:name=".MyLocationDemoActivity" />
<activity android:name=".OptionsDemoActivity" />
<activity android:name=".PolygonDemoActivity" />
<activity android:name=".ProgrammaticDemoActivity" />
<activity android:name=".RawMapViewDemoActivity" />
<activity android:name=".RetainMapDemoActivity" />
<activity android:name=".SaveStateDemoActivity" />
<activity android:name=".SnapshotDemoActivity" />
<activity android:name=".SplitStreetViewPanoramaAndMapDemoActivity" />
<activity android:name=".StreetViewPanoramaBasicDemoActivity" />
<activity android:name=".StreetViewPanoramaEventsDemoActivity" />
<activity android:name=".StreetViewPanoramaNavigationDemoActivity" />
<activity android:name=".StreetViewPanoramaOptionsDemoActivity" />
<activity android:name=".StreetViewPanoramaViewDemoActivity" />
<activity android:name=".StyledMapDemoActivity" />
<activity android:name=".TagsDemoActivity" />
<activity android:name=".TileCoordinateDemoActivity" />
<activity android:name=".TileOverlayDemoActivity" />
<activity android:name=".UiSettingsDemoActivity" />
<activity android:name=".VisibleRegionDemoActivity" />
<activity android:name=".polyline.PolylineDemoActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ private val TAG = AdvancedMarkersDemoActivity::class.java.name
*/
// [START maps_android_sample_marker_advanced]
class AdvancedMarkersDemoActivity : AppCompatActivity(), OnMapReadyCallback {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.advanced_markers_demo)
val mapFragment = supportFragmentManager.findFragmentById(R.id.map) as SupportMapFragment?
mapFragment?.getMapAsync(this)


}

override fun onMapReady(map: GoogleMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,15 @@ class DemoDetailsList {
R.string.map_in_pager_demo_description,
MapInPagerDemoActivity::class.java
),
DemoDetails(
R.string.map_color_scheme_demo_label,
R.string.map_color_scheme_demo_description,
MapColorSchemeActivity::class.java
),
DemoDetails(
R.string.markers_demo_label,
R.string.markers_demo_description,
MarkerDemoActivity::class.java
MapColorSchemeActivity::class.java
),
DemoDetails(
R.string.multi_map_demo_label,
Expand Down
5 changes: 5 additions & 0 deletions ApiDemos/kotlin/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
<string name="flat">Flat</string>
<string name="reset_map">Reset</string>
<string name="map_not_ready">Map is not ready</string>
<string name="map_color_scheme_demo_description">Demonstrates how to use the MapColorScheme.</string>
<string name="map_color_scheme_demo_label">MapColorScheme</string>
<string name="markers_demo_description">Demonstrates how to add Markers to a map.</string>
<string name="markers_demo_label">Markers</string>
<string name="on_marker_drag">onMarkerDrag. Current Position: (%1$f, %2$f)</string>
Expand Down Expand Up @@ -351,6 +353,9 @@
<string name="style_label_default">Default</string>
<string name="style_choose">Choose style</string>
<string name="style_set_to">Style set to: %1$s</string>
<string name="map_color_light_mode">Light</string>
<string name="map_color_dark_mode">Dark</string>
<string name="map_color_follow_system_mode">Follow System\n</string>


</resources>

0 comments on commit c23aea5

Please sign in to comment.