Search in sources :

Example 1 with MapView

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);
}
Also used : CameraPosition(com.google.android.gms.maps.model.CameraPosition) GoogleMap(com.google.android.gms.maps.GoogleMap) RelativeLayout(android.widget.RelativeLayout) MapView(com.google.android.gms.maps.MapView) OnMapReadyCallback(com.google.android.gms.maps.OnMapReadyCallback)

Example 2 with 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;
}
Also used : MapView(com.google.android.gms.maps.MapView) LatLng(com.google.android.gms.maps.model.LatLng) View(android.view.View) MapView(com.google.android.gms.maps.MapView) TextView(android.widget.TextView)

Example 3 with MapView

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;
}
Also used : MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) GoogleMap(com.google.android.gms.maps.GoogleMap) MapView(com.google.android.gms.maps.MapView) OnMapReadyCallback(com.google.android.gms.maps.OnMapReadyCallback) LatLng(com.google.android.gms.maps.model.LatLng)

Example 4 with MapView

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;
}
Also used : SimpleLocation(im.delight.android.location.SimpleLocation) View(android.view.View) MapView(com.google.android.gms.maps.MapView)

Example 5 with MapView

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);
}
Also used : CameraPosition(com.google.android.gms.maps.model.CameraPosition) CircleOptions(com.google.android.gms.maps.model.CircleOptions) GoogleMap(com.google.android.gms.maps.GoogleMap) RelativeLayout(android.widget.RelativeLayout) MapView(com.google.android.gms.maps.MapView) OnMapReadyCallback(com.google.android.gms.maps.OnMapReadyCallback)

Aggregations

MapView (com.google.android.gms.maps.MapView)8 View (android.view.View)4 TextView (android.widget.TextView)3 GoogleMap (com.google.android.gms.maps.GoogleMap)3 OnMapReadyCallback (com.google.android.gms.maps.OnMapReadyCallback)3 RelativeLayout (android.widget.RelativeLayout)2 CameraPosition (com.google.android.gms.maps.model.CameraPosition)2 LatLng (com.google.android.gms.maps.model.LatLng)2 Bundle (android.os.Bundle)1 Nullable (android.support.annotation.Nullable)1 AdapterView (android.widget.AdapterView)1 CompoundButton (android.widget.CompoundButton)1 Nullable (androidx.annotation.Nullable)1 CircleOptions (com.google.android.gms.maps.model.CircleOptions)1 MarkerOptions (com.google.android.gms.maps.model.MarkerOptions)1 GlyphTextView (com.waz.zclient.ui.text.GlyphTextView)1 SimpleLocation (im.delight.android.location.SimpleLocation)1