This repository was archived by the owner on Feb 22, 2023. It is now read-only.
  
  
  - 
                Notifications
    You must be signed in to change notification settings 
- Fork 9.7k
[google_maps_flutter] add tile overlays #3434
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            22 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      5ebc39d
              
                platform_interface
              
              
                 e459267
              
                dart
              
              
                 964a5f6
              
                android implemenattion
              
              
                 d6731de
              
                integration_tests
              
              
                 7a7bef2
              
                style fix
              
              
                 040eee6
              
                ios
              
              
                 03390c2
              
                fix no tile return value
              
              
                 5e22757
              
                merge master
              
              
                 5a34d94
              
                fix merge issue
              
              
                 83e10f9
              
                fix with new platform interface api
              
              
                 c4db2c7
              
                Merge branch 'master' into gmap_cutsom_tiles
              
              
                 c09b713
              
                format
              
              
                 b25a00a
              
                minor refactoring
              
              
                 8224d53
              
                minor java code fixes
              
              
                 b9581f9
              
                remove mistake commit
              
              
                 ca69b19
              
                Update packages/google_maps_flutter/google_maps_flutter/android/src/m…
              
              
                 0483931
              
                review
              
              
                 8ceb6a5
              
                revert platform_interface to version dependency
              
              
                 ac26845
              
                update deps to 1.2.0
              
              
                 93808a4
              
                Merge branch 'master' into gmap_cutsom_tiles
              
              
                 4fd5296
              
                Merge branch 'master' into gmap_cutsom_tiles
              
              
                 3d97fd2
              
                rerun ci
              
              
                 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this is to use lambda.