com.google.android.gms.maps.MapView Java Examples

The following examples show how to use com.google.android.gms.maps.MapView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapListActivity.java    From android-map_list with MIT License 6 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();

    int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);

    if (resultCode == ConnectionResult.SUCCESS) {
        mRecyclerView.setAdapter(mListAdapter);
    } else {
        GooglePlayServicesUtil.getErrorDialog(resultCode, this, 1).show();
    }

    if (mListAdapter != null) {
        for (MapView m : mListAdapter.getMapViews()) {
            m.onResume();
        }
    }
}
 
Example #2
Source File: MapActivity.java    From WechatHook-Dusan with Apache License 2.0 6 votes vote down vote up
private void changeToGoogleMapView() {
    zoom = mAmapView.getMap().getCameraPosition().zoom;
    latitude = mAmapView.getMap().getCameraPosition().target.latitude;
    longitude = mAmapView.getMap().getCameraPosition().target.longitude;

    mapbtn.setText("To 高德地图");
    mIsAmapDisplay = false;
    mGoogleMapView = new com.google.android.gms.maps.MapView(this, new GoogleMapOptions()
            .camera(new com.google.android.gms.maps.model
                    .CameraPosition(new com.google.android.gms.maps.model.LatLng(latitude, longitude), zoom, 0, 0)));
    mGoogleMapView.onCreate(null);
    mGoogleMapView.onResume();
    mContainerLayout.addView(mGoogleMapView, mParams);
    mGoogleMapView.getMapAsync(this);
    handler.sendEmptyMessageDelayed(0, 500);
}
 
Example #3
Source File: NewOrderFragment.java    From CourierApplication with Mozilla Public License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    mPresenter = new NewOrderPresenter(this);
    mPresenter.setGMapsUrl(getString(R.string.google_maps_key));
    mPresenter.sendFragmentActivityToInteractor();

    mDistanceView = (TextView) view.findViewById(R.id.neworder_textview_summary);
    mCalculateButton = (Button) view.findViewById(R.id.neworder_button_calculate);
    mAdditionalButton = (Button) view.findViewById(R.id.neworder_button_additional);
    mCallButton = (Button) view.findViewById(R.id.neworder_button_call);
    placesFrom = (TextView) view.findViewById(R.id.place_autocomplete_from);
    placesTo = (TextView) view.findViewById(R.id.place_autocomplete_to);
    mMapView = (MapView) view.findViewById(R.id.neworder_map);
    mMapView.onCreate(savedInstanceState);

    mPresenter.onMapAsyncCall();
    setListeners();
}
 
Example #4
Source File: PPTGoogleMapManager.java    From react-native-maps with MIT License 6 votes vote down vote up
/**
 * Implementation of the react create view instance method - returns the map view to react.
 *
 * @param context
 * @return MapView
 */
@Override
protected MapView createViewInstance(ThemedReactContext context) {
    mapView = new MapView(context);

    mapView.onCreate(null);
    mapView.onResume();

    if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
        locationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
    }

    reactContext = context;

    return mapView;
}
 
Example #5
Source File: GridAdapter.java    From snazzymaps-browser with Apache License 2.0 6 votes vote down vote up
/**
 * Manages creating or re-using the ViewHolder for each grid item.
 */
public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder;

    if (convertView == null) {
        convertView = ((LayoutInflater) mContext.getSystemService(
                Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.grid_item, null);
        holder = new ViewHolder();
        holder.mapView = (MapView) convertView.findViewById(R.id.grid_item);
        convertView.setTag(holder);
        holder.initializeMapView();
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    SnazzyMapsStyle style = (SnazzyMapsStyle) getItem(position);
    holder.mapView.setTag(style);
    if (holder.map != null) {
        initializeMap(holder.map, style);
    }

    return convertView;
}
 
Example #6
Source File: RawMapViewDemoActivity.java    From android-samples with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.raw_mapview_demo);

    // *** IMPORTANT ***
    // MapView requires that the Bundle you pass contain _ONLY_ MapView SDK
    // objects or sub-Bundles.
    Bundle mapViewBundle = null;
    if (savedInstanceState != null) {
        mapViewBundle = savedInstanceState.getBundle(MAPVIEW_BUNDLE_KEY);
    }
    mMapView = (MapView) findViewById(R.id.map);
    mMapView.onCreate(mapViewBundle);

    mMapView.getMapAsync(this);
}
 
Example #7
Source File: MapFragment.java    From actor-platform with GNU Affero General Public License v3.0 6 votes vote down vote up
@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;

}
 
Example #8
Source File: GeoPackageTileTableCacheOverlay.java    From mage-android with Apache License 2.0 6 votes vote down vote up
@Override
public String onMapClick(LatLng latLng, MapView mapView, GoogleMap map) {
    StringBuilder message = new StringBuilder();

    for(FeatureOverlayQuery featureOverlayQuery: featureOverlayQueries){
        String overlayMessage = featureOverlayQuery.buildMapClickMessage(latLng, mapView, map);
        if(overlayMessage != null){
            if(message.length() > 0){
                message.append("\n\n");
            }
            message.append(overlayMessage);
        }
    }

    return message.length() > 0 ? message.toString() : null;
}
 
Example #9
Source File: PlaceActivity.java    From ratebeer with GNU General Public License v3.0 5 votes vote down vote up
@SuppressLint("PrivateResource")
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_place);

	mainToolbar = setupDefaultUpButton();
	mainToolbar.inflateMenu(R.menu.menu_link);

	mapView = (MapView) findViewById(R.id.map_view);
	mapView.onCreate(savedInstanceState);
	loadingProgress = (ProgressBar) findViewById(R.id.loading_progress);
	detailsLayout = findViewById(R.id.details_layout);

}
 
Example #10
Source File: GalleryAdapter.java    From animation-samples with Apache License 2.0 5 votes vote down vote up
private void initializeMapView(MapView mapView) {
    mapView.onCreate(null);
    mapView.getMapAsync(mInitialOnMapReadyCallback);
    // lite mode enabled within map's layout declaration
    // Requirement to set clickable to false in order to not open the Google Maps application.
    // See: https://developers.google.com/maps/documentation/android-api/events#disabling_click_events_in_lite_mode
    mapView.setClickable(false);
}
 
Example #11
Source File: LocalPlacesAdapter.java    From ratebeer with GNU General Public License v3.0 5 votes vote down vote up
public MapHeaderHolder(View v) {
	super(v);
	mapView = (MapView) v;
	// Call through onCreate and onResume because we had these already but the MapView did not yet exist then
	mapView.onCreate(null);
	mapView.onResume();
	mapView.getMapAsync(googleMap -> googleMap.getUiSettings().setMapToolbarEnabled(false));
}
 
Example #12
Source File: RecyclerViewLiteModeAdapter.java    From Airbnb-Android-Google-Map-View with MIT License 5 votes vote down vote up
public ViewHolder(View itemLayoutView) {
    super(itemLayoutView);
    mapView=(MapView) itemLayoutView.findViewById(R.id.lite_map);
    tvTitle = (TextView) itemLayoutView.findViewById(R.id.tv_title);
    tvLocation = (TextView) itemLayoutView.findViewById(R.id.tv_location);
    tvCategories = (TextView) itemLayoutView.findViewById(R.id.tv_categories);
    tvRating = (TextView) itemLayoutView.findViewById(R.id.tv_rating);
    tvDistanceInKm = (TextView) itemLayoutView.findViewById(R.id.tv_distanceinkm);
    tvOffers = (TextView) itemLayoutView.findViewById(R.id.tv_offers);
    ivMain = (ImageView) itemLayoutView.findViewById(R.id.iv_main);
    mBook = (Button) itemLayoutView.findViewById(R.id.btn_book);
    mPay = (Button) itemLayoutView.findViewById(R.id.btn_pay);
}
 
Example #13
Source File: GeoPackageFeatureTableCacheOverlay.java    From mage-android with Apache License 2.0 5 votes vote down vote up
@Override
public String onMapClick(LatLng latLng, MapView mapView, GoogleMap map) {
    String message = null;

    if (featureOverlayQuery != null) {
        message = featureOverlayQuery.buildMapClickMessage(latLng, mapView, map);
    }

    return message;
}
 
Example #14
Source File: SwipeableCardAdapter.java    From SwipeableCard with Apache License 2.0 5 votes vote down vote up
CardViewHolder(View itemView) {
    super(itemView);
    /*
    Set up recycler view custom object.
     */
    card = (CardView)itemView.findViewById(R.id.card);
    image = (ImageView) itemView.findViewById(it.michelelacorte.swipeablecard.R.id.image);
    text = (TextView) itemView.findViewById(it.michelelacorte.swipeablecard.R.id.text);
    subTitle = (TextView) itemView.findViewById(it.michelelacorte.swipeablecard.R.id.subTitle);
    toolbar = (Toolbar) itemView.findViewById(it.michelelacorte.swipeablecard.R.id.toolbar);
    mapView = (MapView) itemView.findViewById(R.id.mapLite);
    streetNameView = (TextView) itemView.findViewById(R.id.streetName);
    relativeNormal = (RelativeLayout) itemView.findViewById(R.id.relativeNormal);
    relativeMaps = (RelativeLayout) itemView.findViewById(R.id.relativeMaps);
    relativeCreditCard = (RelativeLayout) itemView.findViewById(R.id.relativeCreditCard);
    relativeCreditCardCreation = (RelativeLayout) itemView.findViewById(R.id.relativeCreditCardCreation);
    newCreditCard = (Button) itemView.findViewById(R.id.creditCardButton);
    creditCardView = (CreditCardView) itemView.findViewById(R.id.creditCard);
    /**
     * Set-up customizable Icon and Text
     */
    iconBtn1 = (ImageView) itemView.findViewById(R.id.iconBtn1);
    iconBtn2 = (ImageView) itemView.findViewById(R.id.iconBtn2);
    iconBtn3 = (ImageView) itemView.findViewById(R.id.iconBtn3);
    textBtn1 = (TextView) itemView.findViewById(R.id.textBtn1);
    textBtn2 = (TextView) itemView.findViewById(R.id.textBtn2);
}
 
Example #15
Source File: MapLocationViewHolder.java    From android-map_list with MIT License 5 votes vote down vote up
public MapLocationViewHolder(Context context, View view) {
    super(view);

    mContext = context;

    title = (TextView) view.findViewById(R.id.title);
    description = (TextView) view.findViewById(R.id.description);
    mapView = (MapView) view.findViewById(R.id.map);

    mapView.onCreate(null);
    mapView.getMapAsync(this);
}
 
Example #16
Source File: MapListActivity.java    From android-map_list with MIT License 5 votes vote down vote up
@Override
public void onLowMemory() {
    super.onLowMemory();

    if (mListAdapter != null) {
        for (MapView m : mListAdapter.getMapViews()) {
            m.onLowMemory();
        }
    }
}
 
Example #17
Source File: MapListActivity.java    From android-map_list with MIT License 5 votes vote down vote up
@Override
protected void onPause() {
    super.onPause();

    if (mListAdapter != null) {
        for (MapView m : mListAdapter.getMapViews()) {
            m.onPause();
        }
    }
}
 
Example #18
Source File: MapListActivity.java    From android-map_list with MIT License 5 votes vote down vote up
@Override
protected void onDestroy() {
    if (mListAdapter != null) {
        for (MapView m : mListAdapter.getMapViews()) {
            m.onDestroy();
        }
    }

    super.onDestroy();
}
 
Example #19
Source File: FenceRecyclerAdapter.java    From JCVD with MIT License 5 votes vote down vote up
public ViewHolder(View itemView) {
    super(itemView);

    mTextView = (TextView) itemView.findViewById(R.id.text);
    mMapView = (MapView)itemView.findViewById(R.id.map);
    itemView.setOnClickListener(mClickListener);
}
 
Example #20
Source File: GglMap.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void onCreate(View rootView, Bundle savedInstanceState) {
    this.mapView = new MapView(rootView.getContext());
    this.mapView.onCreate(savedInstanceState);
    this.mapView.setEnabled(true);
    this.mapView.setClickable(true);
    this.mapView.getMapAsync(this);
}
 
Example #21
Source File: GalleryViewHolder.java    From animation-samples with Apache License 2.0 5 votes vote down vote up
GalleryViewHolder(View view) {
    super(view);
    context = itemView.getContext();
    descriptionContainer = itemView.findViewById(R.id.container_description);
    titleText = (TextView) itemView.findViewById(R.id.text_title);
    descriptionText = (TextView) itemView.findViewById(R.id.text_description);
    mapView = (MapView) itemView.findViewById(R.id.map_view);
}
 
Example #22
Source File: PPTGoogleMapManager.java    From react-native-maps with MIT License 5 votes vote down vote up
/**
 * Sets the user's location marker, if it has been enabled.
 *
 * @param map
 * @param cameraPosition
 */
@ReactProp(name = "cameraPosition")
public void setCameraPosition(MapView map, ReadableMap cameraPosition) {
    float zoom = (float) cameraPosition.getDouble("zoom");

    if (cameraPosition.hasKey("auto") && cameraPosition.getBoolean("auto")) {
        Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

        if (location == null) {
            return;
        }

        cameraUpdate = CameraUpdateFactory.newLatLngZoom(
                new LatLng(location.getLatitude(), location.getLongitude()),
                zoom
        );

        map.getMapAsync(this);
    } else {
        cameraUpdate = CameraUpdateFactory.newLatLngZoom(
                new LatLng(
                        cameraPosition.getDouble("latitude"),
                        cameraPosition.getDouble("longitude")
                ), zoom
        );

        map.getMapAsync(this);
    }
}
 
Example #23
Source File: PPTGoogleMapManager.java    From react-native-maps with MIT License 5 votes vote down vote up
/**
 * Adds marker icons to the map.
 *
 * @param map
 * @param markers
 */
@ReactProp(name = "markers")
public void setMarkers(MapView map, ReadableArray markers) {
    this.markers = markers;

    map.getMapAsync(this);
}
 
Example #24
Source File: PPTGoogleMapManager.java    From react-native-maps with MIT License 5 votes vote down vote up
/**
 * Sets the user's location marker, if it has been enabled.
 *
 * @param showsUserLocation
 */
@ReactProp(name = "showsUserLocation")
public void setShowsUserLocation(MapView map, boolean showsUserLocation) {
    this.showsUserLocation = showsUserLocation;

    map.getMapAsync(this);
}
 
Example #25
Source File: PPTGoogleMapManager.java    From react-native-maps with MIT License 5 votes vote down vote up
/**
 * Controls whether scroll gestures are enabled (default) or disabled.
 *
 * @param map
 * @param scrollGestures
 */
@ReactProp(name = "scrollGestures")
public void setScrollGestures(MapView map, boolean scrollGestures) {
    this.scrollGestures = scrollGestures;

    map.getMapAsync(this);
}
 
Example #26
Source File: PPTGoogleMapManager.java    From react-native-maps with MIT License 5 votes vote down vote up
/**
 * Controls whether zoom gestures are enabled (default) or disabled.
 *
 * @param map
 * @param zoomGestures
 */
@ReactProp(name = "zoomGestures")
public void setZoomGestures(MapView map, boolean zoomGestures) {
    this.zoomGestures = zoomGestures;

    map.getMapAsync(this);
}
 
Example #27
Source File: PPTGoogleMapManager.java    From react-native-maps with MIT License 5 votes vote down vote up
/**
 * Controls whether tilt gestures are enabled (default) or disabled.
 *
 * @param map
 * @param tiltGestures
 */
@ReactProp(name = "tiltGestures")
public void setTiltGestures(MapView map, boolean tiltGestures) {
    this.tiltGestures = tiltGestures;

    map.getMapAsync(this);
}
 
Example #28
Source File: PPTGoogleMapManager.java    From react-native-maps with MIT License 5 votes vote down vote up
/**
 * Controls whether rotate gestures are enabled (default) or disabled.
 *
 * @param map
 * @param rotateGestures
 */
@ReactProp(name = "rotateGestures")
public void setRotateGestures(MapView map, boolean rotateGestures) {
    this.rotateGestures = rotateGestures;

    map.getMapAsync(this);
}
 
Example #29
Source File: PPTGoogleMapManager.java    From react-native-maps with MIT License 5 votes vote down vote up
/**
 * Enables or disables the compass.
 *
 * @param map
 * @param compassButton
 */
@ReactProp(name = "compassButton")
public void setCompassButton(MapView map, boolean compassButton) {
    this.compassButton = compassButton;

    map.getMapAsync(this);
}
 
Example #30
Source File: PPTGoogleMapManager.java    From react-native-maps with MIT License 5 votes vote down vote up
/**
 * Enables or disables the My Location button.
 *
 * @param map
 * @param myLocationButton
 */
@ReactProp(name = "myLocationButton")
public void setMyLocationButton(MapView map, boolean myLocationButton) {
    this.myLocationButton = myLocationButton;

    map.getMapAsync(this);
}