use of com.google.android.gms.maps.MapView in project wigle-wifi-wardriving by wiglenet.
the class DBResultActivity method setupMap.
private void setupMap(final LatLng center, final Bundle savedInstanceState) {
mapView = new MapView(this);
mapView.onCreate(savedInstanceState);
MapsInitializer.initialize(this);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final GoogleMap googleMap) {
mapRender = new MapRender(DBResultActivity.this, googleMap, true);
if (center != null) {
final CameraPosition cameraPosition = new CameraPosition.Builder().target(center).zoom(DEFAULT_ZOOM).build();
googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
}
});
final RelativeLayout rlView = (RelativeLayout) findViewById(R.id.db_map_rl);
rlView.addView(mapView);
}
use of com.google.android.gms.maps.MapView in project wigle-wifi-wardriving by wiglenet.
the class MappingFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mapView = new MapView(getActivity());
final int serviceAvailable = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());
if (serviceAvailable == ConnectionResult.SUCCESS) {
try {
mapView.onCreate(savedInstanceState);
} catch (final SecurityException ex) {
MainActivity.error("security exception oncreateview map: " + ex, ex);
}
} else {
WiGLEToast.showOverFragment(this.getActivity(), R.string.fatal_pre_message, getString(R.string.map_needs_playservice));
}
MapsInitializer.initialize(getActivity());
final View view = inflater.inflate(R.layout.map, container, false);
LatLng oldCenter = null;
int oldZoom = Integer.MIN_VALUE;
if (state.oldCenter != null) {
// pry an orientation change, which calls destroy
oldCenter = state.oldCenter;
oldZoom = state.oldZoom;
}
setupMapView(view, oldCenter, oldZoom);
return view;
}
use of com.google.android.gms.maps.MapView in project actor-platform by actorapp.
the class MapFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
longitude = getArguments().getDouble("longitude");
latitude = getArguments().getDouble("latitude");
final MapView map = new MapView(getActivity());
map.onCreate(null);
map.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
mapController = googleMap;
googleMap.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).title(""));
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude, longitude), 16));
map.onResume();
}
});
return map;
}
use of com.google.android.gms.maps.MapView in project BloodHub by kazijehangir.
the class RequestMapFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_request_map, container, false);
mMapView = (MapView) rootView.findViewById(R.id.mapView);
mMapView.onCreate(savedInstanceState);
location = new SimpleLocation(getContext());
// needed to get the map to display immediately`
mMapView.onResume();
// For showing a move to my location button googleMap.setMyLocationEnabled(true);
if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
setupMap();
} else {
// Show rationale and request permission.
if (permissionRequestCount < REQUEST_LIMIT) {
permissionRequestCount++;
ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, MY_PERMISSIONS_REQUEST_FINE_LOCATION);
}
}
return rootView;
}
use of com.google.android.gms.maps.MapView in project wigle-wifi-wardriving by wiglenet.
the class NetworkActivity method setupMap.
private void setupMap(final Network network, final Bundle savedInstanceState) {
mapView = new MapView(this);
try {
mapView.onCreate(savedInstanceState);
} catch (NullPointerException ex) {
MainActivity.error("npe in mapView.onCreate: " + ex, ex);
}
MapsInitializer.initialize(this);
if (network.getLatLng() != null) {
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final GoogleMap googleMap) {
final CameraPosition cameraPosition = new CameraPosition.Builder().target(network.getLatLng()).zoom(DEFAULT_ZOOM).build();
googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
googleMap.addCircle(new CircleOptions().center(network.getLatLng()).radius(5).fillColor(Color.argb(128, 240, 240, 240)).strokeColor(Color.argb(200, 255, 32, 32)).strokeWidth(3f).zIndex(100));
}
});
}
final RelativeLayout rlView = (RelativeLayout) findViewById(R.id.netmap_rl);
rlView.addView(mapView);
}
Aggregations