forked from flutter/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[google_maps_flutter] add tile overlays (flutter#3434)
- Loading branch information
Chris Yang
authored
Feb 3, 2021
1 parent
47a5ea7
commit 37d658e
Showing
24 changed files
with
1,505 additions
and
3 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
46 changes: 46 additions & 0 deletions
46
..._maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/TileOverlayBuilder.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,46 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.googlemaps; | ||
|
||
import com.google.android.gms.maps.model.TileOverlayOptions; | ||
import com.google.android.gms.maps.model.TileProvider; | ||
|
||
class TileOverlayBuilder implements TileOverlaySink { | ||
|
||
private final TileOverlayOptions tileOverlayOptions; | ||
|
||
TileOverlayBuilder() { | ||
this.tileOverlayOptions = new TileOverlayOptions(); | ||
} | ||
|
||
TileOverlayOptions build() { | ||
return tileOverlayOptions; | ||
} | ||
|
||
@Override | ||
public void setFadeIn(boolean fadeIn) { | ||
tileOverlayOptions.fadeIn(fadeIn); | ||
} | ||
|
||
@Override | ||
public void setTransparency(float transparency) { | ||
tileOverlayOptions.transparency(transparency); | ||
} | ||
|
||
@Override | ||
public void setZIndex(float zIndex) { | ||
tileOverlayOptions.zIndex(zIndex); | ||
} | ||
|
||
@Override | ||
public void setVisible(boolean visible) { | ||
tileOverlayOptions.visible(visible); | ||
} | ||
|
||
@Override | ||
public void setTileProvider(TileProvider tileProvider) { | ||
tileOverlayOptions.tileProvider(tileProvider); | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
...ps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/TileOverlayController.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 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.googlemaps; | ||
|
||
import com.google.android.gms.maps.model.TileOverlay; | ||
import com.google.android.gms.maps.model.TileProvider; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
class TileOverlayController implements TileOverlaySink { | ||
|
||
private final TileOverlay tileOverlay; | ||
|
||
TileOverlayController(TileOverlay tileOverlay) { | ||
this.tileOverlay = tileOverlay; | ||
} | ||
|
||
void remove() { | ||
tileOverlay.remove(); | ||
} | ||
|
||
void clearTileCache() { | ||
tileOverlay.clearTileCache(); | ||
} | ||
|
||
Map<String, Object> getTileOverlayInfo() { | ||
Map<String, Object> tileOverlayInfo = new HashMap<>(); | ||
tileOverlayInfo.put("fadeIn", tileOverlay.getFadeIn()); | ||
tileOverlayInfo.put("transparency", tileOverlay.getTransparency()); | ||
tileOverlayInfo.put("id", tileOverlay.getId()); | ||
tileOverlayInfo.put("zIndex", tileOverlay.getZIndex()); | ||
tileOverlayInfo.put("visible", tileOverlay.isVisible()); | ||
return tileOverlayInfo; | ||
} | ||
|
||
@Override | ||
public void setFadeIn(boolean fadeIn) { | ||
tileOverlay.setFadeIn(fadeIn); | ||
} | ||
|
||
@Override | ||
public void setTransparency(float transparency) { | ||
tileOverlay.setTransparency(transparency); | ||
} | ||
|
||
@Override | ||
public void setZIndex(float zIndex) { | ||
tileOverlay.setZIndex(zIndex); | ||
} | ||
|
||
@Override | ||
public void setVisible(boolean visible) { | ||
tileOverlay.setVisible(visible); | ||
} | ||
|
||
@Override | ||
public void setTileProvider(TileProvider tileProvider) { | ||
// You can not change tile provider after creation | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...gle_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/TileOverlaySink.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,20 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.googlemaps; | ||
|
||
import com.google.android.gms.maps.model.TileProvider; | ||
|
||
/** Receiver of TileOverlayOptions configuration. */ | ||
interface TileOverlaySink { | ||
void setFadeIn(boolean fadeIn); | ||
|
||
void setTransparency(float transparency); | ||
|
||
void setZIndex(float zIndex); | ||
|
||
void setVisible(boolean visible); | ||
|
||
void setTileProvider(TileProvider tileProvider); | ||
} |
Oops, something went wrong.