-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: copies some snippets that were in v3 only to gms (#1715)
* feat: copies some snippets that were in v3 only to gms chore: the java compatibility version * fix: updates copyright dates and adds missing copyright * fix: copyright header for strings.xml * fix: set Java Version back to 17 * fix: set Java Version back to 17 * fix: set Java Version back to 17 * fix: set Java Version back to 17 * fix: set Java Version back to 17 * feat: creates AdvancedMarkersCollisionActivity to demonstrate marker collision behavior * chore: not adding jar files in libs directory * feat: set Java 21 everywhere --------- Co-authored-by: Enrique López Mañas <[email protected]>
- Loading branch information
Showing
23 changed files
with
349 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
snippets/app/src/gms/java/com/google/maps/example/AdvancedMarkersCollisionActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.google.maps.example; | ||
|
||
import android.os.Bundle; | ||
|
||
import androidx.annotation.Nullable; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import com.google.android.gms.maps.GoogleMap; | ||
import com.google.android.gms.maps.model.AdvancedMarkerOptions; | ||
import com.google.android.gms.maps.model.AdvancedMarkerOptions.CollisionBehavior; | ||
import com.google.android.gms.maps.model.LatLng; | ||
import com.google.android.gms.maps.model.Marker; | ||
|
||
class AdvancedMarkersCollisionActivity extends AppCompatActivity { | ||
|
||
private GoogleMap map; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
// [START maps_android_marker_collision] | ||
Marker marker = map.addMarker( | ||
new AdvancedMarkerOptions() | ||
.position(new LatLng(10.0, 10.0)) | ||
.zIndex(10f) // Optional. | ||
.collisionBehavior(CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY) | ||
); | ||
// [END maps_android_marker_collision] | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
snippets/app/src/gms/java/com/google/maps/example/CloudBasedMapStylingActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.google.maps.example; | ||
|
||
import android.os.Bundle; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import com.google.android.gms.maps.GoogleMapOptions; | ||
import com.google.android.gms.maps.MapFragment; | ||
|
||
public class CloudBasedMapStylingActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
// [START maps_android_cloud_based_map_styling] | ||
MapFragment mapFragment = MapFragment.newInstance( | ||
new GoogleMapOptions() | ||
.mapId(getResources().getString(R.string.map_id))); | ||
// [END maps_android_cloud_based_map_styling] | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
snippets/app/src/gms/java/com/google/maps/example/PolylineCustomizationActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.google.maps.example; | ||
|
||
import android.graphics.Color; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import com.google.android.gms.maps.GoogleMap; | ||
import com.google.android.gms.maps.model.BitmapDescriptorFactory; | ||
import com.google.android.gms.maps.model.LatLng; | ||
import com.google.android.gms.maps.model.Polyline; | ||
import com.google.android.gms.maps.model.PolylineOptions; | ||
import com.google.android.gms.maps.model.StampStyle; | ||
import com.google.android.gms.maps.model.StrokeStyle; | ||
import com.google.android.gms.maps.model.StyleSpan; | ||
import com.google.android.gms.maps.model.TextureStyle; | ||
|
||
public class PolylineCustomizationActivity extends AppCompatActivity { | ||
|
||
private GoogleMap map; | ||
|
||
private void multicoloredPolyline() { | ||
// [START maps_android_polyline_multicolored] | ||
Polyline line = map.addPolyline(new PolylineOptions() | ||
.add(new LatLng(47.6677146,-122.3470447), new LatLng(47.6442757,-122.2814693)) | ||
.addSpan(new StyleSpan(Color.RED)) | ||
.addSpan(new StyleSpan(Color.GREEN))); | ||
// [END maps_android_polyline_multicolored] | ||
} | ||
|
||
private void multicoloredGradientPolyline() { | ||
// [START maps_android_polyline_gradient] | ||
Polyline line = map.addPolyline(new PolylineOptions() | ||
.add(new LatLng(47.6677146,-122.3470447), new LatLng(47.6442757,-122.2814693)) | ||
.addSpan(new StyleSpan(StrokeStyle.gradientBuilder(Color.RED, Color.YELLOW).build()))); | ||
// [END maps_android_polyline_gradient] | ||
} | ||
|
||
private void stampedPolyline() { | ||
// [START maps_android_polyline_stamped] | ||
StampStyle stampStyle = | ||
TextureStyle.newBuilder(BitmapDescriptorFactory.fromResource(R.drawable.walking_dot)).build(); | ||
StyleSpan span = new StyleSpan(StrokeStyle.colorBuilder(Color.RED).stamp(stampStyle).build()); | ||
map.addPolyline(new PolylineOptions() | ||
.add(new LatLng(47.6677146,-122.3470447), new LatLng(47.6442757,-122.2814693)) | ||
.addSpan(span)); | ||
// [END maps_android_polyline_stamped] | ||
} | ||
} |
Oops, something went wrong.