Skip to content

Commit a0d9e31

Browse files
committed
Reformat code
1 parent 065bdd1 commit a0d9e31

File tree

12 files changed

+61
-64
lines changed

12 files changed

+61
-64
lines changed

packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/ClusterManagersController.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ class ClusterManagersController
3535
ClusterManager.OnClusterClickListener<MarkerBuilder> {
3636
@NonNull private final Context context;
3737

38-
@VisibleForTesting
39-
@NonNull
38+
@VisibleForTesting @NonNull
4039
protected final HashMap<String, ClusterManager<MarkerBuilder>> clusterManagerIdToManager;
4140

4241
@NonNull private final MapsCallbackApi flutterApi;
@@ -54,8 +53,7 @@ class ClusterManagersController
5453
ClusterManagersController(
5554
@NonNull MapsCallbackApi flutterApi,
5655
@NonNull Context context,
57-
@NonNull PlatformMarkerType markerType
58-
) {
56+
@NonNull PlatformMarkerType markerType) {
5957
this.clusterManagerIdToManager = new HashMap<>();
6058
this.context = context;
6159
this.flutterApi = flutterApi;
@@ -109,10 +107,9 @@ void addClusterManager(String clusterManagerId) {
109107
}
110108

111109
/**
112-
* Initialize cluster renderer if it hasn't been initialized before.
113-
* ClusterManager uses default renderer which should be changed to (legacy) renderer or
114-
* advanced renderer
115-
**/
110+
* Initialize cluster renderer if it hasn't been initialized before. ClusterManager uses default
111+
* renderer which should be changed to (legacy) renderer or advanced renderer
112+
*/
116113
private void initializeRenderer(ClusterManager<MarkerBuilder> clusterManager) {
117114
final ClusterRenderer<MarkerBuilder> renderer = clusterManager.getRenderer();
118115
if (renderer.getClass() == MarkerClusterRenderer.class
@@ -261,17 +258,16 @@ protected void onClusterItemRendered(@NonNull T item, @NonNull Marker marker) {
261258

262259
/** AdvancedMarkerClusterRenderer is a ClusterRenderer that supports AdvancedMarkers */
263260
@VisibleForTesting
264-
static class AdvancedMarkerClusterRenderer<T extends MarkerBuilder> extends
265-
DefaultAdvancedMarkersClusterRenderer<T> {
261+
static class AdvancedMarkerClusterRenderer<T extends MarkerBuilder>
262+
extends DefaultAdvancedMarkersClusterRenderer<T> {
266263

267264
private final ClusterManagersController clusterManagersController;
268265

269266
public AdvancedMarkerClusterRenderer(
270267
Context context,
271268
GoogleMap map,
272269
ClusterManager<T> clusterManager,
273-
ClusterManagersController clusterManagersController
274-
) {
270+
ClusterManagersController clusterManagersController) {
275271
super(context, map, clusterManager);
276272
this.clusterManagersController = clusterManagersController;
277273
}

packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ public static BitmapDescriptor getBitmapFromPinConfig(
197197
Messages.PlatformBitmapPinConfig pinConfigBitmap,
198198
AssetManager assetManager,
199199
float density,
200-
BitmapDescriptorFactoryWrapper bitmapDescriptorFactory
201-
) {
200+
BitmapDescriptorFactoryWrapper bitmapDescriptorFactory) {
202201
try {
203202
final String backgroundColorKey = "backgroundColor";
204203
final String borderColorKey = "borderColor";
@@ -208,20 +207,23 @@ public static BitmapDescriptor getBitmapFromPinConfig(
208207
final String glyphBitmapDescriptorKey = "glyphBitmapDescriptor";
209208

210209
final Integer backgroundColor =
211-
pinConfigBitmap.getBackgroundColor() != null ? toInt(pinConfigBitmap.getBackgroundColor())
210+
pinConfigBitmap.getBackgroundColor() != null
211+
? toInt(pinConfigBitmap.getBackgroundColor())
212212
: null;
213213
final Integer borderColor =
214214
pinConfigBitmap.getBorderColor() != null ? toInt(pinConfigBitmap.getBorderColor()) : null;
215215
final String glyphText =
216216
pinConfigBitmap.getGlyphText() != null ? pinConfigBitmap.getGlyphText() : null;
217217
final Integer glyphTextColor =
218-
pinConfigBitmap.getGlyphTextColor() != null ? toInt(pinConfigBitmap.getGlyphTextColor())
218+
pinConfigBitmap.getGlyphTextColor() != null
219+
? toInt(pinConfigBitmap.getGlyphTextColor())
219220
: null;
220221
final Integer glyphColor =
221222
pinConfigBitmap.getGlyphColor() != null ? toInt(pinConfigBitmap.getGlyphColor()) : null;
222-
final BitmapDescriptor glyphBitmapDescriptor = pinConfigBitmap.getGlyphBitmap() != null
223-
? toBitmapDescriptor(pinConfigBitmap.getGlyphBitmap(), assetManager, density)
224-
: null;
223+
final BitmapDescriptor glyphBitmapDescriptor =
224+
pinConfigBitmap.getGlyphBitmap() != null
225+
? toBitmapDescriptor(pinConfigBitmap.getGlyphBitmap(), assetManager, density)
226+
: null;
225227

226228
final PinConfig.Builder pinConfigBuilder = PinConfig.builder();
227229
if (backgroundColor != null) {
@@ -234,9 +236,10 @@ public static BitmapDescriptor getBitmapFromPinConfig(
234236

235237
PinConfig.Glyph glyph = null;
236238
if (glyphText != null) {
237-
glyph = glyphTextColor != null
238-
? new PinConfig.Glyph(glyphText, glyphTextColor)
239-
: new PinConfig.Glyph(glyphText);
239+
glyph =
240+
glyphTextColor != null
241+
? new PinConfig.Glyph(glyphText, glyphTextColor)
242+
: new PinConfig.Glyph(glyphText);
240243
} else if (glyphBitmapDescriptor != null) {
241244
glyph = new PinConfig.Glyph(glyphBitmapDescriptor);
242245
} else if (glyphColor != null) {

packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ GoogleMapController build(
4141
LifecycleProvider lifecycleProvider,
4242
PlatformMarkerType markerType) {
4343
final GoogleMapController controller =
44-
new GoogleMapController(id, context, binaryMessenger, lifecycleProvider, options,
45-
markerType);
44+
new GoogleMapController(
45+
id, context, binaryMessenger, lifecycleProvider, options, markerType);
4646
controller.init();
4747
controller.setMyLocationEnabled(myLocationEnabled);
4848
controller.setMyLocationButtonEnabled(myLocationButtonEnabled);

packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,9 @@ public Boolean isInfoWindowShown(@NonNull String markerId) {
10341034
public @NonNull Boolean isAdvancedMarkersAvailable() {
10351035
if (googleMap == null) {
10361036
throw new FlutterError(
1037-
"GoogleMap uninitialized", "getMapCapabilities() called prior to map initialization",
1038-
null
1039-
);
1037+
"GoogleMap uninitialized",
1038+
"getMapCapabilities() called prior to map initialization",
1039+
null);
10401040
}
10411041
final MapCapabilities mapCapabilities = googleMap.getMapCapabilities();
10421042
return mapCapabilities.isAdvancedMarkersAvailable();

packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkerBuilder.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ class MarkerBuilder implements MarkerOptionsSink, ClusterItem {
1818
private boolean consumeTapEvents;
1919

2020
MarkerBuilder(String markerId, String clusterManagerId, PlatformMarkerType markerType) {
21-
this.markerOptions = markerType == PlatformMarkerType.ADVANCED_MARKER
22-
? new AdvancedMarkerOptions()
23-
: new MarkerOptions();
21+
this.markerOptions =
22+
markerType == PlatformMarkerType.ADVANCED_MARKER
23+
? new AdvancedMarkerOptions()
24+
: new MarkerOptions();
2425
this.markerId = markerId;
2526
this.clusterManagerId = clusterManagerId;
2627
}

packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkerController.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ public void setZIndex(float zIndex) {
144144
}
145145

146146
@Override
147-
public void setCollisionBehavior(int collisionBehavior) {
148-
}
147+
public void setCollisionBehavior(int collisionBehavior) {}
149148

150149
String getGoogleMapsMarkerId() {
151150
return googleMapsMarkerId;

packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkersController.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
package io.flutter.plugins.googlemaps;
66

77
import android.content.res.AssetManager;
8-
98
import androidx.annotation.NonNull;
10-
119
import com.google.android.gms.maps.model.LatLng;
1210
import com.google.android.gms.maps.model.Marker;
1311
import com.google.android.gms.maps.model.MarkerOptions;
@@ -180,8 +178,7 @@ public void onClusterItemRendered(MarkerBuilder markerBuilder, Marker marker) {
180178
private void addMarker(@NonNull Messages.PlatformMarker marker) {
181179
String markerId = marker.getMarkerId();
182180
String clusterManagerId = marker.getClusterManagerId();
183-
MarkerBuilder markerBuilder = new MarkerBuilder(markerId, clusterManagerId,
184-
markerType);
181+
MarkerBuilder markerBuilder = new MarkerBuilder(markerId, clusterManagerId, markerType);
185182
Convert.interpretMarkerOptions(
186183
marker, markerBuilder, assetManager, density, bitmapDescriptorFactoryWrapper);
187184
addMarker(markerBuilder);

packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ClusterManagersControllerTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ public void AddClusterManagersAndMarkers() {
106106
clusterManagersToAdd.add(initialClusterManager);
107107
controller.addClusterManagers(clusterManagersToAdd);
108108

109-
MarkerBuilder markerBuilder1 = new MarkerBuilder(markerId1, clusterManagerId,
110-
PlatformMarkerType.MARKER);
111-
MarkerBuilder markerBuilder2 = new MarkerBuilder(markerId2, clusterManagerId,
112-
PlatformMarkerType.MARKER);
109+
MarkerBuilder markerBuilder1 =
110+
new MarkerBuilder(markerId1, clusterManagerId, PlatformMarkerType.MARKER);
111+
MarkerBuilder markerBuilder2 =
112+
new MarkerBuilder(markerId2, clusterManagerId, PlatformMarkerType.MARKER);
113113

114114
final Messages.PlatformMarker markerData1 =
115115
createPlatformMarker(markerId1, location1, clusterManagerId);
@@ -149,11 +149,11 @@ public void SelectClusterRenderer() {
149149
when(googleMap.getCameraPosition())
150150
.thenReturn(CameraPosition.builder().target(new LatLng(0, 0)).build());
151151

152-
ClusterManagersController controller1 = spy(
153-
new ClusterManagersController(flutterApi, context, PlatformMarkerType.MARKER));
152+
ClusterManagersController controller1 =
153+
spy(new ClusterManagersController(flutterApi, context, PlatformMarkerType.MARKER));
154154
controller1.init(googleMap, markerManager);
155-
ClusterManagersController controller2 = spy(
156-
new ClusterManagersController(flutterApi, context, PlatformMarkerType.ADVANCED_MARKER));
155+
ClusterManagersController controller2 =
156+
spy(new ClusterManagersController(flutterApi, context, PlatformMarkerType.ADVANCED_MARKER));
157157
controller2.init(googleMap, markerManager);
158158

159159
Messages.PlatformClusterManager initialClusterManager1 =
@@ -168,23 +168,23 @@ public void SelectClusterRenderer() {
168168
clusterManagersToAdd2.add(initialClusterManager2);
169169
controller2.addClusterManagers(clusterManagersToAdd2);
170170

171-
MarkerBuilder markerBuilder1 = new MarkerBuilder(markerId1, clusterManagerId1,
172-
PlatformMarkerType.MARKER);
171+
MarkerBuilder markerBuilder1 =
172+
new MarkerBuilder(markerId1, clusterManagerId1, PlatformMarkerType.MARKER);
173173
markerBuilder1.setPosition(new LatLng(10.0, 20.0));
174174
controller1.addItem(markerBuilder1);
175175

176-
MarkerBuilder markerBuilder2 = new MarkerBuilder(markerId2, clusterManagerId2,
177-
PlatformMarkerType.ADVANCED_MARKER);
176+
MarkerBuilder markerBuilder2 =
177+
new MarkerBuilder(markerId2, clusterManagerId2, PlatformMarkerType.ADVANCED_MARKER);
178178
markerBuilder2.setPosition(new LatLng(20.0, 10.0));
179179
controller2.addItem(markerBuilder2);
180180

181-
ClusterManager<?> clusterManager1 = controller1.clusterManagerIdToManager.get(
182-
clusterManagerId1);
181+
ClusterManager<?> clusterManager1 =
182+
controller1.clusterManagerIdToManager.get(clusterManagerId1);
183183
assertNotNull(clusterManager1);
184184
assertSame(clusterManager1.getRenderer().getClass(), MarkerClusterRenderer.class);
185185

186-
ClusterManager<?> clusterManager2 = controller2.clusterManagerIdToManager.get(
187-
clusterManagerId2);
186+
ClusterManager<?> clusterManager2 =
187+
controller2.clusterManagerIdToManager.get(clusterManagerId2);
188188
assertNotNull(clusterManager2);
189189
assertSame(clusterManager2.getRenderer().getClass(), AdvancedMarkerClusterRenderer.class);
190190
}

packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,14 +336,15 @@ public void GetBitmapFromBytesThrowsErrorIfInvalidImageData() {
336336

337337
@Test
338338
public void GetBitmapFromPinConfig() {
339-
Messages.PlatformBitmapPinConfig bitmap = new Messages.PlatformBitmapPinConfig.Builder()
340-
.setBackgroundColor(0xFFFFFFL)
341-
.setBorderColor(0xFFFFFFL)
342-
.build();
339+
Messages.PlatformBitmapPinConfig bitmap =
340+
new Messages.PlatformBitmapPinConfig.Builder()
341+
.setBackgroundColor(0xFFFFFFL)
342+
.setBorderColor(0xFFFFFFL)
343+
.build();
343344

344345
when(bitmapDescriptorFactoryWrapper.fromPinConfig(any())).thenReturn(mockBitmapDescriptor);
345-
BitmapDescriptor result = Convert.getBitmapFromPinConfig(bitmap, assetManager, 1f,
346-
bitmapDescriptorFactoryWrapper);
346+
BitmapDescriptor result =
347+
Convert.getBitmapFromPinConfig(bitmap, assetManager, 1f, bitmapDescriptorFactoryWrapper);
347348
Assert.assertEquals(mockBitmapDescriptor, result);
348349
}
349350

packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public void before() {
7575
// See getGoogleMapControllerWithMockedDependencies for version with dependency injections.
7676
public GoogleMapController getGoogleMapController() {
7777
GoogleMapController googleMapController =
78-
new GoogleMapController(0, context, mockMessenger, activity::getLifecycle, null,
79-
PlatformMarkerType.MARKER);
78+
new GoogleMapController(
79+
0, context, mockMessenger, activity::getLifecycle, null, PlatformMarkerType.MARKER);
8080
googleMapController.init();
8181
return googleMapController;
8282
}

0 commit comments

Comments
 (0)