


| package lk.mobile.meghanaada; | |
| import android.Manifest; | |
| import android.content.pm.PackageManager; | |
| import android.graphics.Color; | |
| import android.os.Bundle; | |
| import androidx.core.app.ActivityCompat; | |
| import androidx.fragment.app.FragmentActivity; | |
| import com.google.android.gms.maps.CameraUpdateFactory; | |
| import com.google.android.gms.maps.GoogleMap; | |
| import com.google.android.gms.maps.OnMapReadyCallback; | |
| import com.google.android.gms.maps.SupportMapFragment; | |
| import com.google.android.gms.maps.model.CameraPosition; | |
| import com.google.android.gms.maps.model.LatLng; | |
| import com.google.android.gms.maps.model.MarkerOptions; | |
| import com.google.android.gms.maps.model.Polyline; | |
| import com.google.android.gms.maps.model.PolylineOptions; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { | |
| private GoogleMap mMap; | |
| private final int REQUEST_LOCATION_PERMISSION = 1; | |
| Polyline line; | |
| // Static LatLng | |
| LatLng startLatLng = new LatLng(30.707104, 76.690749); | |
| LatLng endLatLng = new LatLng(30.721419, 76.730017); | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_maps); | |
| // Obtain the SupportMapFragment and get notified when the map is ready to be used. | |
| SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() | |
| .findFragmentById(R.id.map); | |
| mapFragment.getMapAsync(this); | |
| } | |
| /** | |
| * Manipulates the map once available. | |
| * This callback is triggered when the map is ready to be used. | |
| * This is where we can add markers or lines, add listeners or move the camera. In this case, | |
| * we just add a marker near Sydney, Australia. | |
| * If Google Play services is not installed on the device, the user will be prompted to install | |
| * it inside the SupportMapFragment. This method will only be triggered once the user has | |
| * installed Google Play services and returned to the app. | |
| */ | |
| @Override | |
| public void onMapReady(GoogleMap googleMap) { | |
| mMap = googleMap; | |
| // Add a marker in Sydney and move the camera 7.051456, 79.916215 | |
| LatLng currentLoc = new LatLng(6.959817, 79.912472); | |
| mMap.addMarker(new MarkerOptions().position(currentLoc).title("Your Location")); | |
| // mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); | |
| CameraPosition cameraPosition = new CameraPosition.Builder().target(currentLoc).zoom(15).build(); | |
| mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); | |
| mMap.getUiSettings().setZoomControlsEnabled(false); // true to enable | |
| mMap.getUiSettings().setCompassEnabled(true); | |
| mMap.getUiSettings().setMyLocationButtonEnabled(true); | |
| mMap.getUiSettings().setRotateGesturesEnabled(true); | |
| List<LatLng> list = decodePoly(); | |
| PolylineOptions options = new PolylineOptions().width(30).color(Color.CYAN).geodesic(true); | |
| for (int z = 0; z < list.size(); z++) { | |
| LatLng point = list.get(z); | |
| options.add(point); | |
| } | |
| line = mMap.addPolyline(options); | |
| List<LatLng> list2 = decodePoly2(); | |
| PolylineOptions options2 = new PolylineOptions().width(30).color(Color.CYAN).geodesic(true); | |
| for (int z = 0; z < list2.size(); z++) { | |
| LatLng point = list2.get(z); | |
| options2.add(point); | |
| } | |
| line = mMap.addPolyline(options2); | |
| List<LatLng> list3 = decodePoly3(); | |
| PolylineOptions options3 = new PolylineOptions().width(30).color(Color.CYAN).geodesic(true); | |
| for (int z = 0; z < list3.size(); z++) { | |
| LatLng point = list3.get(z); | |
| options3.add(point); | |
| } | |
| line = mMap.addPolyline(options3); | |
| List<LatLng> list4 = decodePoly4(); | |
| PolylineOptions options4 = new PolylineOptions().width(30).color(Color.CYAN).geodesic(true); | |
| for (int z = 0; z < list4.size(); z++) { | |
| LatLng point = list4.get(z); | |
| options4.add(point); | |
| } | |
| line = mMap.addPolyline(options4); | |
| if (ActivityCompat.checkSelfPermission(MapsActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(MapsActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { | |
| ActivityCompat.requestPermissions(MapsActivity.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1); | |
| return; | |
| } else { | |
| mMap.setMyLocationEnabled(true); // false to disable | |
| } | |
| } | |
| private List<LatLng> decodePoly() { | |
| List<LatLng> poly = new ArrayList<LatLng>(); | |
| LatLng p = new LatLng(6.949815, 79.919730); | |
| poly.add(p); | |
| p = new LatLng(6.950080, 79.917289); | |
| poly.add(p); | |
| p = new LatLng(6.950669, 79.913839); | |
| poly.add(p); | |
| p = new LatLng(6.951299, 79.910584); | |
| poly.add(p); | |
| return poly; | |
| } | |
| private List<LatLng> decodePoly2() { | |
| List<LatLng> poly = new ArrayList<LatLng>(); | |
| LatLng p = new LatLng(6.949815, 79.919730); | |
| poly.add(p); | |
| p = new LatLng(6.948684, 79.918838); | |
| poly.add(p); | |
| p = new LatLng(6.947275, 79.917418); | |
| poly.add(p); | |
| p = new LatLng(6.947116, 79.914530); | |
| poly.add(p); | |
| p = new LatLng(6.949094, 79.912660); | |
| poly.add(p); | |
| p = new LatLng(6.950552, 79.911296); | |
| poly.add(p); | |
| p = new LatLng(6.951028, 79.910084); | |
| poly.add(p); | |
| return poly; | |
| } | |
| private List<LatLng> decodePoly3() { | |
| List<LatLng> poly = new ArrayList<LatLng>(); | |
| LatLng p = new LatLng(6.950053, 79.919377); | |
| poly.add(p); | |
| p = new LatLng(6.950894, 79.919940); | |
| poly.add(p); | |
| p = new LatLng(6.951725, 79.919822); | |
| poly.add(p); | |
| p = new LatLng(6.952854, 79.920820); | |
| poly.add(p); | |
| p = new LatLng(6.953631, 79.923245); | |
| poly.add(p); | |
| p = new LatLng(6.952758, 79.925702); | |
| poly.add(p); | |
| p = new LatLng(6.952886, 79.929854); | |
| poly.add(p); | |
| p = new LatLng(6.952407, 79.932193); | |
| poly.add(p); | |
| p = new LatLng(6.951554, 79.933501); | |
| poly.add(p); | |
| p = new LatLng(6.950500, 79.936366); | |
| poly.add(p); | |
| p = new LatLng(6.946091, 79.940185); | |
| poly.add(p); | |
| return poly; | |
| } | |
| private List<LatLng> decodePoly4() { | |
| List<LatLng> poly = new ArrayList<LatLng>(); | |
| LatLng p = new LatLng(6.951430, 79.910108); | |
| poly.add(p); | |
| p = new LatLng(6.951328, 79.909004); | |
| poly.add(p); | |
| p = new LatLng(6.952096, 79.902695); | |
| poly.add(p); | |
| p = new LatLng(6.955738, 79.900853); | |
| poly.add(p); | |
| p = new LatLng(6.957758, 79.898258); | |
| poly.add(p); | |
| p = new LatLng(6.957338, 79.895324); | |
| poly.add(p); | |
| p = new LatLng(6.955873, 79.892238); | |
| poly.add(p); | |
| p = new LatLng(6.955873, 79.887744); | |
| poly.add(p); | |
| p = new LatLng(6.955706, 79.883173); | |
| poly.add(p); | |
| p = new LatLng(6.960615, 79.880716); | |
| poly.add(p); | |
| p = new LatLng(6.964705, 79.881832); | |
| poly.add(p); | |
| return poly; | |
| } | |
| } |
https://www.youtube.com/watch?v=EICi0IxaRmk&t=12s
Our Team - Megha Naada - Sound of the cloud - Different Strengths - Hearts with empathy!
We are creative and critical thinkers... We are active Earth and space science explorers... We are the next generation of scientists, technologists, designers and engineers and story tellers...We are the experienced humanitarian intervention activists... We are solving a real earth problem for the next 48 hours
We are GO FOR LAUNCH 🚀
We are Team MEGHA NAADA!
