-
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.
mvp working gmap patterner implementation
- Loading branch information
Showing
14 changed files
with
344 additions
and
23 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,62 @@ | ||
package com.amoskorir.patterner | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.google.android.gms.maps.* | ||
import com.google.android.gms.maps.model.LatLng | ||
import com.google.android.gms.maps.model.MarkerOptions | ||
import com.google.android.gms.maps.model.PolygonOptions | ||
|
||
|
||
class MainActivity : AppCompatActivity(), OnMapReadyCallback { | ||
|
||
var googleMap: GoogleMap? = null | ||
lateinit var mapView: MapView | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
initializeMap(savedInstanceState) | ||
} | ||
|
||
override fun onMapReady(map: GoogleMap?) { | ||
googleMap = map | ||
googleMap?.let { | ||
val zoomLevel = 7.0f //This goes up to 21 | ||
it.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(-0.3031, 36.0800), zoomLevel)) | ||
drawPolygon(it) | ||
} | ||
} | ||
|
||
private fun drawPolygon(map: GoogleMap) { | ||
val one = LatLng(0.5143, 35.2698) | ||
val two = LatLng(-0.3031, 36.0800) | ||
val four = LatLng(-1.2921, 36.8219) | ||
val three = LatLng(-0.0917, 34.7680) | ||
|
||
|
||
val list = listOf(one, two, four,three) | ||
|
||
val polygonOptions = PolygonOptions() | ||
polygonOptions.addAll(list) | ||
val groundOverlay = GMapPattern.getBitmapPolygonGround( | ||
this, | ||
polygonOptions, | ||
500, | ||
500, | ||
R.drawable.example_pattern | ||
) | ||
|
||
map.addGroundOverlay(groundOverlay) | ||
|
||
map.addPolygon(polygonOptions) | ||
} | ||
|
||
class MainActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
} | ||
private fun initializeMap(savedInstanceState: Bundle?) { | ||
mapView = findViewById(R.id.mapView) | ||
mapView.onCreate(savedInstanceState) | ||
MapsInitializer.initialize(this) | ||
mapView.onResume() | ||
mapView.getMapAsync(this) | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Sun Oct 25 08:53:24 EAT 2020 | ||
#Thu Apr 22 18:08:13 EAT 2021 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip |
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
Oops, something went wrong.