Ejemplo n.º 1
0
 private void SetCenter()
 {
     if (Element != null && Element.Center != null)
     {
         googleMap.MoveCamera(GMaps.CameraUpdateFactory.NewLatLngZoom(new LatLng(Element.Center.Latitude, Element.Center.Longitude), (float)Element.ZoomLevel));
     }
 }
Ejemplo n.º 2
0
        public void OnMapReady(GoogleMap googleMap)
        {
            this.googleMap = googleMap;

            LatLng denmarkLatLng = new LatLng(56, 10.5);
            googleMap.MoveCamera(CameraUpdateFactory.NewLatLng(denmarkLatLng));
            googleMap.AnimateCamera(CameraUpdateFactory.ZoomTo(6));
        }
Ejemplo n.º 3
0
        public void OnMapReady (GoogleMap googleMap)
        {
            map = googleMap;

            map.UiSettings.ZoomControlsEnabled = false;

            map.MoveCamera (CameraUpdateFactory.NewLatLngZoom (new LatLng (-33.87365, 151.20689), 10));
        }
Ejemplo n.º 4
0
        public void OnMapReady(GoogleMap googleMap)
        {
            mMap = googleMap;
              LatLng latlng = new LatLng(loc.Latitude, loc.Longitude); //Wijnhaven
              CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom(latlng, 15);
              mMap.MoveCamera(camera);
              MarkerOptions start = new MarkerOptions()
               .SetPosition(latlng)
               .SetTitle("Uw huidige locatie")
               .SetSnippet("U bevind zich hier")
               .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue));

              mMap.AddMarker(start);
              MarkerFactory mFactory = new MarkerFactory(preLoad.csvFT.getMarkers());
              float lowest = 99999;
              for (Iterator iter = mFactory.getIterator(); iter.hasNext();)
              {
            FietsTrommel ft = iter.next();
            if (ft.xcoord.Length > 0 && ft.ycoord.Length > 0)
            {
              double lat = Convert.ToDouble(ft.xcoord.Replace('.', ','));
              double lon = Convert.ToDouble(ft.ycoord.Replace('.', ','));
              Location fietsT = new Location("");
              fietsT.Latitude = lat;
              fietsT.Longitude = lon;

              if (fietsT.DistanceTo(loc) < 500)
              {
            LatLng coords = new LatLng(lat, lon);
            MarkerOptions newMarker = new MarkerOptions()
             .SetPosition(coords)
             .SetTitle(ft.Straat)
             .SetSnippet("Sinds: " + ft.Mutdatum)
             .Draggable(true);

            mMap.AddMarker(newMarker);
              }
              if (fietsT.DistanceTo(loc) < lowest)
              {
            lowest = fietsT.DistanceTo(loc);
            closest = ft;
              }
            }
              }
              Location closestF = new Location("");
              double closLat = Convert.ToDouble(closest.xcoord.Replace('.', ','));
              double closLon = Convert.ToDouble(closest.ycoord.Replace('.', ','));
              closestF.Latitude = closLat;
              closestF.Longitude = closLon;
        }
Ejemplo n.º 5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.dashboard_listview_detail);
            progress = new ProgressDialog (this);
            lat = 37.09035962;
            lan = -95.71368456;
            flag = FindViewById<ImageView> (Resource.Id.ivNew1);
            flag.Click += Flag_Click;
            ivListEmpty = FindViewById<LinearLayout> (Resource.Id.ivEmptylist);
            lvlist = FindViewById<ListView> (Resource.Id.lvListDetail);
            llMap = FindViewById<RelativeLayout> (Resource.Id.llmap);
            tvnumber = FindViewById<TextView> (Resource.Id.tvNumber);
            tvdesc = FindViewById<TextView> (Resource.Id.tvdesc);
            tvtime = FindViewById<TextView> (Resource.Id.tvTime);
            tvreply = FindViewById<TextView> (Resource.Id.tvReply);
            ListSipp = new List<SippReplyModel> ();

            Typeface tf = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Light.ttf");
            Typeface tf1 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Semibold.ttf");
            Typeface tf2 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Bold.ttf");

            adapter = new CustomListViewDetail (this, ListSipp);
            lvlist.Adapter = adapter;
            if (adapter.IsEmpty) {
                ivListEmpty.Visibility = ViewStates.Visible;
            } else {
                ivListEmpty.Visibility = ViewStates.Gone;
            }

            mapFrag = (MapFragment)FragmentManager.FindFragmentById (Resource.Id.map);
            map = mapFrag.Map;
            map.UiSettings.CompassEnabled = true;
            map.UiSettings.ZoomControlsEnabled = false;
            map.MyLocationEnabled = false;

            LatLng lastLatLng = new LatLng (lat, lan);
            map.MoveCamera (CameraUpdateFactory.NewLatLngZoom (lastLatLng, 15));
            MarkerOptions marker = new MarkerOptions ();
            marker.SetPosition (new LatLng (lat, lan));
            map.AddMarker (marker);
            llMap.Background.SetAlpha (200);
            llMap.Click += LlMap_Click;
            tvnumber.SetTypeface (tf, TypefaceStyle.Normal);
            tvnumber.SetTypeface (tf2, TypefaceStyle.Normal);
            tvtime.SetTypeface (tf1, TypefaceStyle.Normal);
            tvreply.SetTypeface (tf1, TypefaceStyle.Normal);
        }
Ejemplo n.º 6
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate (bundle);
     SetContentView (Resource.Layout.map_activity);
     lat = Intent.GetDoubleExtra ("lat", 0);
     lan = Intent.GetDoubleExtra ("lan", 0);
     mapFrag = (MapFragment)FragmentManager.FindFragmentById (Resource.Id.map);
     map = mapFrag.Map;
     map.UiSettings.CompassEnabled = true;
     map.UiSettings.ZoomControlsEnabled = true;
     LatLng lastLatLng = new LatLng (lat, lan);
     map.MoveCamera (CameraUpdateFactory.NewLatLngZoom (lastLatLng, 15));
     MarkerOptions marker = new MarkerOptions ();
     marker.SetPosition (new LatLng (lat, lan));
     map.AddMarker (marker);
 }
        protected override void OnResume()
        {
            base.OnResume();
            var mapFragment =  (SupportMapFragment) SupportFragmentManager.FindFragmentByTag("map");

            // The value of mapFragment.Map may be null if the mapFragment isn't completely initialize yet.
            // This will cause problems with other things too, like the CameraUpdateFactory.
            // By initializing our GoogleMap here in OnResume, the MapFragment should be
            // properly instantiated and ready for use.
            _map = mapFragment.Map;
            Debug.Assert(_map != null, "The _map cannot be null!");

            // We create an instance of CameraUpdate, and move the map to it.
            var cameraUpdate = CameraUpdateFactory.NewLatLngZoom(VimyRidge, 15);
            _map.MoveCamera(cameraUpdate);
        }
Ejemplo n.º 8
0
        async void SearchGas_OnClick(object sender, EventArgs eventArgs)
        {
            if (_currentLocation == null)
            {
                _addressText.Text = "Location is null";
                return;
            }

            Algorithm algorithm = new Algorithm();

            GeoPoint currentLoc  = new GeoPoint(_currentLocation.Latitude, _currentLocation.Longitude);
            GeoPoint destination = Algorithm.getFinalDestination();

            TravelData currentRoute = await algorithm.getOriginalRoute("driving", currentLoc, destination);

            List <GeoPoint> pointsToSearch = algorithm.findPointsToSearch(currentRoute, 500, currentLoc);

            MapFragment mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);

            Android.Gms.Maps.GoogleMap map = mapFrag.Map;

            foreach (GeoPoint point in pointsToSearch)
            {
                MarkerOptions markerOpt1 = new MarkerOptions();
                markerOpt1.SetPosition(new LatLng(point.latitude, point.longitude));
                markerOpt1.SetTitle("Test Marker");
                map.AddMarker(markerOpt1);

                CircleOptions circleOptions = new CircleOptions();
                circleOptions.InvokeCenter(new LatLng(point.latitude, point.longitude));
                circleOptions.InvokeRadius(500);
                map.AddCircle(circleOptions);
            }

            LatLng location2 = new LatLng(pointsToSearch[3].latitude, pointsToSearch[7].longitude);

            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
            builder.Target(location2);
            builder.Zoom(12);
            //builder.Bearing(155);
            //builder.Tilt(65);
            CameraPosition cameraPosition = builder.Build();
            CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            map.MoveCamera(cameraUpdate);
        }
Ejemplo n.º 9
0
		protected override void OnAttached()
		{
			var mapView = Control as MapView;
			if(mapView == null)
				return;

			behavior = (MapExtensionBehavior) (Element as Map)?.Behaviors?.FirstOrDefault(x =>
				x is MapExtensionBehavior);
			if(behavior == null)
				return;
			

			var zoomButton = mapView.FindViewById(1); // ズームボタン LinearLayout
			if(zoomButton != null)
			{
				zoomButton.Visibility = Android.Views.ViewStates.Invisible;
			}

			var locationButton = mapView.FindViewById(2); // 現在位置ボタン ImageView
			if(locationButton != null)
			{
				locationButton.Visibility = Android.Views.ViewStates.Invisible;
			}

			var callback = new OnMapReadyCallback();
			callback.MapReady += (sender, e) => {
				googleMap = callback.GoogleMap;

				googleMap.MyLocationChange += GoogleMap_MyLocationChange;
				// なぜかCameraChangeにハンドラを追加するとXF.Maps.Map.VisibleRegionが更新されなくなる
//				googleMap.CameraChange += GoogleMap_CameraChange;

				var point = new LatLng(
					XFAedSearch.Droid.Helpers.Settings.Latitude,
					XFAedSearch.Droid.Helpers.Settings.Longitude);
				googleMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(point,
					XFAedSearch.Droid.Helpers.Settings.ZoomLevel));

				googleMap.SetOnMapLoadedCallback(new MapLoadedCallback {
					OnMapLoadedAction = () => MapLoaded?.Invoke(this, new EventArgs())
				});
			};
			mapView.GetMapAsync(callback);

		}
        public void OnMapReady (GoogleMap googleMap)
        {
            googleMap.MoveCamera (CameraUpdateFactory.NewLatLngZoom (NEWARK, 11));

            images.Clear ();
            images.Add (BitmapDescriptorFactory.FromResource (Resource.Drawable.newark_nj_1922));
            images.Add (BitmapDescriptorFactory.FromResource (Resource.Drawable.newark_prudential_sunny));

            currentEntry = 0;

            groundOverlay = googleMap.AddGroundOverlay (new GroundOverlayOptions ()
                .InvokeImage (images [currentEntry])
                .Anchor (0, 1)
                .Position (NEWARK, 8600f, 6500f));

            transparencyBar.ProgressChanged += (sender, e) => {
                if (groundOverlay != null)
                    groundOverlay.Transparency = (float)e.Progress / (float)TRANSPARENCY_MAX;                    
            };

            googleMap.SetContentDescription ("Google Map with ground overlay.");
        }
Ejemplo n.º 11
0
        async void markPlaces(List <Place> places)
        {
            MapFragment mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);

            Android.Gms.Maps.GoogleMap map = mapFrag.Map;

            foreach (Place place in places)
            {
                drawMark("pitStop", place.Location);
            }

            LatLng location2 = new LatLng(places[4].Location.latitude, places[4].Location.longitude);

            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
            builder.Target(location2);
            builder.Zoom(12);
            //builder.Bearing(155);
            //builder.Tilt(65);
            CameraPosition cameraPosition = builder.Build();
            CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            map.MoveCamera(cameraUpdate);
        }
Ejemplo n.º 12
0
        public async void OnMapReady(GoogleMap googleMap)
        {
            _gettingMap = false;
            // TODO TO HELP DEBUG auto download paris to help dev on performances 
            //var contractToTest = "Paris";
            //var contractService = SimpleIoc.Default.GetInstance<IContractService>();
            //var contract = contractService.GetCountries().First(country => country.Contracts.Any(c => c.Name == contractToTest)).Contracts.First(c => c.Name == contractToTest);
            //await SimpleIoc.Default.GetInstance<ContractsViewModel>().AddOrRemoveContract(contract);
            _contractService = SimpleIoc.Default.GetInstance<IContractService>();
            _contractService.ContractRefreshed += OnContractRefreshed;
            _contractService.StationRefreshed += OnStationRefreshed;

            // set the initial visual state of the bike/parking buttons
            SwitchModeStationParkingVisualState();

            _map = googleMap;
            _maxZoom = _map.MaxZoomLevel;

            LoadPreviousTile();

            //Setup and customize your Google Map
            _map.UiSettings.CompassEnabled = true;
            _map.UiSettings.MyLocationButtonEnabled = false;
            _map.UiSettings.MapToolbarEnabled = false;
            _map.MyLocationEnabled = true;

            // add padding to prevent action bar to hide the position button
            //var dp = (int)(48 * Resources.DisplayMetrics.Xdpi / Resources.DisplayMetrics.Density);
            //_map.SetPadding(0, dp, 0, 0);
            //_map.vie
            //View locationButton = suppormanagerObj.getView().findViewById(2);
            //var rlp = (RelativeLayout.LayoutParams)locationButton.getLayoutParams(); 
            //// position on right bottom 
            //rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0); rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); 

            // Initialize the camera position
            SetViewPoint(await GetStartingCameraPosition(), false);

            // Initialize the marker with the stations
            _clusterManager = new ClusterManager(this, _map);
            _clusterRender = new StationRenderer(this, _map, _clusterManager);
            _clusterManager.SetRenderer(_clusterRender);

            _map.SetOnCameraChangeListener(_clusterManager);
            // this disable the rest of the event handlers
            // so there is no way to distinct a click on a cluster and a marker 
            _map.MarkerClick += _map_MarkerClick;
            //_map.SetOnMarkerClickListener(new OnMarkerClickListener());
            //_clusterManager.SetOnClusterClickListener(this);
            //_clusterManager.SetOnClusterItemClickListener(this);

            // check if the app contains a least one city, otherwise, tells the user to download one
            MainViewModel.MainPageLoadedCommand.Execute(null);

            // On long click, display the address on a info window
            Observable.FromEventPattern<GoogleMap.MapLongClickEventArgs>(_map, "MapLongClick")
                .Subscribe(e =>
                {
                    AddPlaceMarker(e.EventArgs.Point, null, null);
                    SelectItem(e.EventArgs.Point);
                    //IList<Address> addresses = new List<Address>();
                    //try
                    //{
                    //    // Convert latitude and longitude to an address (GeoCoder)
                    //    addresses = await (new Geocoder(this).GetFromLocationAsync(currentMarkerPosition.Latitude, currentMarkerPosition.Longitude, 1));
                    //}
                    //catch (Exception ex)
                    //{
                    //    Log.Debug("MyActivity", "Geocoder crashed: " + ex.Message);
                    //}
                    //return new AddressesFromLocationDTO { Addresses = addresses, Location = FormatLatLng(e.EventArgs.Point) };

                });
            _map.MapClick += _map_MapClick;


            if (_parameterLat != 0 && _parameterLon != 0)
            {
                ShowIntentLocation();
            }
            else
            {
                // center the map on last user location
                GetPreviousLastUserLocation();
            }





            // Initialize the behavior when long clicking somewhere on the map
            //_map.MapLongClick += async (sender, e) =>
            //{
            //    // On long click, display the address on a info window
            //    if (longClickMarker != null)
            //    {
            //        // Remove a previously created marker
            //        longClickMarker.Remove();
            //    }

            //    IList<Address> addresses = new List<Address>();
            //    currentMarkerPosition = e.Point;
            //    var latLongString = $"(latitude: { Math.Round(currentMarkerPosition.Latitude)}, longitude: { Math.Round(currentMarkerPosition.Longitude, 4)})";
            //    try
            //    {

            //        // Resolve the addresses (can throw an exception)
            //        var task = new Geocoder(this).GetFromLocationAsync(currentMarkerPosition.Latitude, currentMarkerPosition.Longitude, 1);
            //        AddressesFromLocationStream.OnNext(new AddressesFromLocationDTO { AddressesTask = task, Location = currentMarkerPosition });
            //    }
            //    catch (Exception)
            //    {
            //        // Ignore
            //    }
            //    finally
            //    {
            //        AddressesFromLocationStream.OnNext(new AddressesFromLocationDTO { Addresses = addresses, Location = currentMarkerPosition });
            //    }
            //};


            _contractService = SimpleIoc.Default.GetInstance<IContractService>();
            var mapObserver = Observable.FromEventPattern(_map, "CameraChange");
            TaskCompletionSource<bool> tcs;
            mapObserver
                .Do((e) =>
                {
                    if (_map.CameraPosition.Zoom > _maxZoom)
                    {
                        _map.MoveCamera(CameraUpdateFactory.ZoomTo(_maxZoom));
                    }
                    cts.Cancel();
                    cts = new CancellationTokenSource();
                }).Throttle(throttleTime)
                .Select(async x =>
                {
                    var stations = _contractService.GetStations();
                    // some services can provide wrong values in lat or lon... just take care of it
                    foreach (var station in stations.Where(s => s.Location == null))
                    {
                        station.Location = new LatLng(station.Latitude, station.Longitude);
                    }
                    LatLngBounds bounds = null;
                    tcs = new TaskCompletionSource<bool>();
                    RunOnUiThread(() =>
                    {
                        try
                        {
                            // can return null
                            bounds = _map.Projection.VisibleRegion.LatLngBounds;
                        }
                        catch
                        {
                        }
                        tcs.SetResult(true);
                    });

                    await tcs.Task;


                    var collection = new AddRemoveCollection();
                    if (bounds != null)
                    {
                        // extends slightly the bound view
                        // to provide a better experience
                        //bounds = MapHelper.extendLimits(bounds, 1);
                        collection.ToRemove = Items.Where(t => !bounds.Contains((LatLng)t.Location)).ToList();
                        collection.ToAdd = stations.Where(t => !Items.Contains(t)
                        && bounds.Contains((LatLng)t.Location)).Take(MAX_CONTROLS).ToList();
                        if (Items.Count > MAX_CONTROLS + collection.ToRemove.Count)
                            collection.ToAdd.Clear();

                    }
                    // precalculate the items offset (that deffer well calculation)
                    //foreach (var velib in collection.ToAdd)
                    //{
                    //    velib.GetOffsetLocation2(leftCornerLocation, zoomLevel);
                    //}
                    return collection;
                })
                .Switch()
                .Subscribe(x =>
                {
                    if (x == null)
                        return;


                    RunOnUiThread(() =>
                    {
                        RefreshView(x, cts.Token);
                    });

                });
        }
Ejemplo n.º 13
0
        void GenerateLoc( Location location )
        {
            map = mapFrag.Map;

            if (map != null) {
                if (map.MapType != GoogleMap.MapTypeHybrid) {
                    // Setup map.
                    map.MapType = GoogleMap.MapTypeHybrid;
                    map.UiSettings.ZoomControlsEnabled = true;
                    map.UiSettings.CompassEnabled = true;

                    // Setup camera position
                    LatLng myLoc = new LatLng(location.Latitude, location.Longitude);
                    CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                    builder.Target(myLoc);
                    builder.Zoom(18);
                    builder.Bearing(155);
                    builder.Tilt(65);
                    CameraPosition cameraPosition = builder.Build();
                    CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                    map.MoveCamera (cameraUpdate);

                    // Setup user position
                    MarkerOptions YourPos = new MarkerOptions ();
                    YourPos.SetPosition (new LatLng (location.Latitude, location.Longitude));
                    YourPos.SetTitle ("You");
                    UserPos = map.AddMarker (YourPos);

                    // Setup destination
                    MarkerOptions UWaterloo = new MarkerOptions ();
                    UWaterloo.SetPosition (new LatLng (43.4688995, -80.54));
                    UWaterloo.SetTitle ("University of Waterloo");
                    map.AddMarker (UWaterloo);
                } else {
                    // Mark your position.
                    UserPos.Position = new LatLng (location.Latitude, location.Longitude);
                }
            }
        }
Ejemplo n.º 14
0
		void CargamosMarcadores ()
		{
			if (mMap == null) 
			{
				mMap = _mapFragment.Map;
				if (mMap != null)
				{
					//Relizamos un ciclo para cargar todas las ciudades en nuestro mapa y le asignamos un puntero de color azul
					foreach (Ciudad_Marca ciudad in MisCiudades) 
					{
						ciudad.Marcador=mMap.AddMarker(new MarkerOptions()
						                               .SetPosition(ciudad.Ubicacion)
						                               .SetTitle(ciudad.Nombre)
						                               .SetSnippet(ciudad.Descripcion)
						                               .InvokeIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueAzure)));
					}

					mMap.SetOnMapLongClickListener (this);

					mMap.SetOnMarkerDragListener(this);

					//Le indicamos que deve de cargar un ventana de información personalizada 
					mMap.SetInfoWindowAdapter (new CustomInfoWindowAdapter (this,MisCiudades));

					//Ubicamos la cámara en un posición que se puedan ver las marcas 
					mMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng ( 21.12806,-101.689163), 6));

				}

			}
		}
Ejemplo n.º 15
0
        public void OnMapReady(GoogleMap map)
        {
            googleMap = map;
            googleMap.UiSettings.CompassEnabled = false;
            googleMap.UiSettings.MyLocationButtonEnabled = false;
            googleMap.UiSettings.MapToolbarEnabled = false;

            if (googleMap == null)
                return;

            googleMap.Clear ();

            try {
                MapsInitializer.Initialize (this);
            } catch (GooglePlayServicesNotAvailableException e) {
                Console.WriteLine ("Google Play Services not available:" + e);
                return;
            }

            if (assignment == null)
                return;

            var markerOptions = GetMarkerOptionsForAssignment (assignment);
            googleMap.AddMarker (markerOptions).ShowInfoWindow ();
            googleMap.CameraPosition.Target = markerOptions.Position;

            googleMap.MoveCamera (CameraUpdateFactory.NewLatLngZoom (markerOptions.Position, 15f));
        }
Ejemplo n.º 16
0
		public void OnMapReady (GoogleMap googleMap)
		{
			this.map = googleMap;
			MapsInitializer.Initialize (Activity.ApplicationContext);

			// Default map initialization
			googleMap.MyLocationEnabled = true;
			googleMap.UiSettings.MyLocationButtonEnabled = false;

			googleMap.MarkerClick += HandleMarkerClick;
			googleMap.MapClick += HandleMapClick;
			var oldPosition = PreviousCameraPosition;
			if (oldPosition != null)
				googleMap.MoveCamera (CameraUpdateFactory.NewCameraPosition (oldPosition));
		}
        public void OnMapReady(GoogleMap googleMap)
        {
            map = googleMap;
            MapsInitializer.Initialize (Activity.ApplicationContext);

            map.MapClick += HandleMapClick;
            map.MarkerClick += HandleMapMarkerClick;

            map.UiSettings.CompassEnabled = false;
            map.UiSettings.MyLocationButtonEnabled = false;
            map.UiSettings.MapToolbarEnabled = false;

            var markerLatLong = new LatLng (Place.Geometry.Location.Latitude, Place.Geometry.Location.Longitude);
            var markerOptions = new MarkerOptions ();
            markerOptions.SetTitle (Place.Name);
            markerOptions.SetPosition (markerLatLong);

            map.AddMarker (markerOptions);
            map.MoveCamera (CameraUpdateFactory.NewLatLng (markerLatLong));
        }
Ejemplo n.º 18
0
        public void OnMapReady(GoogleMap googleMap)
        {
            mMap = googleMap;
			double lat = 13.7310;
			double lng = -89.1610;
			if (!this.geolocator.IsGeolocationAvailable || !this.geolocator.IsGeolocationEnabled) {
				alert.SetMessage ("Internet o GPS estan desactivados");
				alert.Show ();
				LatLng latlng = new LatLng (lat, lng);
				CameraUpdate marca_camera = CameraUpdateFactory.NewLatLngZoom (latlng, 12);
				mMap.MoveCamera (marca_camera);
			} else {
				this.geolocator.GetPositionAsync (timeout: 10000).ContinueWith (t => {
					lat = t.Result.Latitude;
					lng = t.Result.Longitude;
					LatLng latlng = new LatLng (lat, lng);
					CameraUpdate marca_camera = CameraUpdateFactory.NewLatLngZoom (latlng, 12);
					mMap.MoveCamera (marca_camera);
				}, TaskScheduler.FromCurrentSynchronizationContext ());
			}
            //MarkerOptions marca = new MarkerOptions()
            //    .SetPosition(latlng)
            //    .SetTitle("El Salvador")
            //    .SetSnippet("San Salvador")
            //    .Draggable(true);
            mMap.MarkerDragEnd +=mMap_MarkerDragEnd;
            //mMap.MarkerClick +=mMap_MarkerClick;
            mMap.MarkerDrag += mMap_MarkerDrag;
            mMap.SetInfoWindowAdapter(this);
            mMap.SetOnInfoWindowClickListener(this);
        }
 public void OnMapReady (GoogleMap googleMap)
 {
     map = googleMap;
     map.MoveCamera (CameraUpdateFactory.NewLatLngZoom (new LatLng (37.614631, -122.385153), 18));
 }
Ejemplo n.º 20
0
		public void OnMapReady (GoogleMap googleMap)
		{
			Android.Gms.Maps.Model.LatLng latLng = new Android.Gms.Maps.Model.LatLng (50.618, 26.257);

			map = googleMap;
			CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom (latLng, 10); 
			map.MoveCamera (camera);


			GetFiles ();


	//		MarkerOptions options = new MarkerOptions ()

	//			.SetPosition (latLng)
		//		.SetTitle ("My First Title")
		//		.SetSnippet ("My First Snippet")
	//			.Draggable (true);

	//		map.AddMarker (options);


			//map.MarkerClick += Map_MarkerClick;

	//		map.MarkerDragEnd += Map_MarkerDragEnd;

	//		map.SetInfoWindowAdapter (this);

	//		map.SetOnInfoWindowClickListener (this);


		}
        public void OnMapReady(GoogleMap googleMap)
        {
            gMap = googleMap;

            LatLng latlng = new LatLng(40.776408, -73.970755);
            LatLng latlng2 = new LatLng(41,-73);



            CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom(latlng, 10);
            gMap.MoveCamera(camera);




            MarkerOptions options = new MarkerOptions()
                .SetPosition(latlng)
                .SetTitle("New York")
                .SetSnippet("AKA: The Big Apple")
                .Draggable(true);


            gMap.AddMarker(options);



            //Marker2
            gMap.AddMarker(new MarkerOptions()
                .SetPosition(latlng2)
                .SetTitle("Marker2")
                .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue))
                );

            gMap.MarkerClick += gMap_Marker_Click;
            gMap.MarkerDragEnd += gMap_MarkerDragEnd;
            
        }
Ejemplo n.º 22
0
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			mapView = base.OnCreateView (inflater, container, savedInstanceState);

			// Save ScreenController for later use
			ctrl = ((GameController)this.Activity);

			RelativeLayout view = new RelativeLayout(ctrl);
			view.AddView(mapView, new RelativeLayout.LayoutParams(-1, -1));

//			var view = inflater.Inflate(Resource.Layout.ScreenMap, container, false);
//
//			mapView = new MapView(ctrl);
//			mapView.OnCreate(savedInstanceState);
//
			// Set all relevant data for map

			_zoom = (float)Main.Prefs.GetDouble("MapZoom", 16);

			_map = this.Map;
			_map.MapType = GoogleMap.MapTypeNormal;
			_map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(Main.GPS.Location.Latitude, Main.GPS.Location.Longitude), _zoom));
			_map.MyLocationEnabled = true;
			_map.BuildingsEnabled = true;
			_map.UiSettings.ZoomControlsEnabled = false;
			_map.UiSettings.MyLocationButtonEnabled = false;
			_map.UiSettings.CompassEnabled = false;
			_map.UiSettings.TiltGesturesEnabled = false;
			_map.UiSettings.RotateGesturesEnabled = false;
			_map.MapClick += OnMapClick;

			// Create tile layers
			_osmTileLayer = new OsmTileProvider("http://a.tile.openstreetmap.org/{0}/{1}/{2}.png");
			_ocmTileLayer = new OsmTileProvider("http://c.tile.opencyclemap.org/cycle/{0}/{1}/{2}.png");

			// Set selected map type
			SetMapType(Main.Prefs.GetInt("map_source", 0));

			// Create the zones the first time
			CreateZones();

			// Create layout for map buttons
			layoutButtons = new RelativeLayout(ctrl);

			// Button for center menu
			var lp = new RelativeLayout.LayoutParams(64, 64);
			lp.SetMargins(16, 16, 16, 8);
			lp.AddRule(LayoutRules.AlignParentLeft);
			lp.AddRule(LayoutRules.AlignParentTop);

			btnMapCenter = new ImageButton(ctrl);
			btnMapCenter.Id = 1;
			btnMapCenter.SetImageResource(Resource.Drawable.ic_button_center);
			btnMapCenter.SetBackgroundResource(Resource.Drawable.MapButton);
			btnMapCenter.Click += OnMapCenterButtonClick;

			layoutButtons.AddView(btnMapCenter, lp);

			// Button for the orientation: north up or always in direction
			lp = new RelativeLayout.LayoutParams(64, 64);
			lp.SetMargins(16, 8, 16, 16);
			lp.AddRule(LayoutRules.Below, btnMapCenter.Id);
			lp.AddRule(LayoutRules.AlignParentLeft);

			btnMapOrientation = new ImageButton(ctrl);
			if (Main.Prefs.GetBool ("MapOrientationNorth", true))
				btnMapOrientation.SetImageResource (Resource.Drawable.ic_button_orientation_north);
			else
				btnMapOrientation.SetImageResource (Resource.Drawable.ic_button_orientation);
			btnMapOrientation.SetBackgroundResource(Resource.Drawable.MapButton);
			btnMapOrientation.Click += OnMapOrientationButtonClick;

			layoutButtons.AddView(btnMapOrientation, lp);

			// Button for selecting the map type
			lp = new RelativeLayout.LayoutParams(64, 64);
			lp.SetMargins(16, 16, 16, 8);
			lp.AddRule(LayoutRules.AlignParentTop);
			lp.AddRule(LayoutRules.AlignParentRight);

			btnMapType = new ImageButton(ctrl);
			btnMapType.SetImageResource(Resource.Drawable.ic_button_layer);
			btnMapType.SetBackgroundResource(Resource.Drawable.MapButton);
			btnMapType.Click += OnMapTypeButtonClick;

			layoutButtons.AddView(btnMapType, lp);

			view.AddView(layoutButtons);

			return view;
		}
Ejemplo n.º 23
0
                public void OnMapReady( GoogleMap map )
                {
                    // sanity checks in case loading the map fails (Google Play can error)
                    if ( map != null )
                    {
                        Map = map;

                        // because google can actually give me a valid map that isn't actually ready.
                        try
                        {
                            // For privacy, turn off the map toolbar, which prevents people from getting specific driving directions
                            // to neighborhood group houses.
                            Map.UiSettings.MapToolbarEnabled = false;
                            Map.SetOnMarkerClickListener( this );

                            // set the map to a default position
                            // additionally, set the default position for the map to whatever specified area.
                            Android.Gms.Maps.Model.LatLng defaultPos = new Android.Gms.Maps.Model.LatLng( ConnectConfig.GroupFinder_DefaultLatitude, ConnectConfig.GroupFinder_DefaultLongitude );

                            CameraUpdate camPos = CameraUpdateFactory.NewLatLngZoom( defaultPos, ConnectConfig.GroupFinder_DefaultScale_Android );
                            map.MoveCamera( camPos );

                            // see if there's an address for this person that we can automatically use.
                            if ( RockMobileUser.Instance.HasFullAddress( ) == true )
                            {
                                // if they don't already have any value, use their address
                                if ( string.IsNullOrEmpty( StreetValue ) == true &&
                                     string.IsNullOrEmpty( CityValue ) == true &&
                                     string.IsNullOrEmpty( StateValue ) == true &&
                                     string.IsNullOrEmpty( ZipValue ) == true )
                                {
                                    SearchPage.SetAddress( RockMobileUser.Instance.Street1( ), RockMobileUser.Instance.City( ), RockMobileUser.Instance.State( ), RockMobileUser.Instance.Zip( ) );    
                                }
                                else
                                {
                                    // otherwise use what they last had.
                                    SearchPage.SetAddress( StreetValue, CityValue, StateValue, ZipValue );
                                }
                            }
                            else
                            {
                                // otherwise, if there are values from a previous session, use those.
                                SearchPage.SetAddress( StreetValue, CityValue, string.IsNullOrEmpty( StateValue ) ? ConnectStrings.GroupFinder_DefaultState : StateValue, ZipValue );
                            }
                        }
                        catch
                        {
                        }
                    }
                }
		protected override async void OnCreate (Bundle bundle)
		{
			//RequestWindowFeature(WindowFeatures.NoTitle);
			base.OnCreate (bundle);

			//CREAMOS EL OBJETO QUE VA A LEER/ESCRIBIR LAS PREFERENCIAS DEL USUARIO
			var prefs = this.GetSharedPreferences("RunningAssistant.preferences", FileCreationMode.Private);

			//ASIGNAMOS EL DICCIONARIO

			valores = new ContentValues ();
			source = 1;

			negocioid = Intent.GetStringExtra ("id");

			//CREAMOS EL OBJETO DEL OBJETO (lel) que va a editar las preferencias
			var editor = prefs.Edit ();
			userid = prefs.GetString("id", null);

			//SETEAMOS LA VISTA A CONTROLAR
			SetContentView(Resource.Layout.perfil_premium);

			imgnegocioprev = FindViewById<GridLayout> (Resource.Id.imgnegocioprev);
			masimagenesnegocio = FindViewById<TextView> (Resource.Id.masimagenesnegocio);
			imagennegocio = FindViewById <Button> (Resource.Id.imagennegocio);
			imagencamaranegocio = FindViewById<Button> (Resource.Id.imagencamaranegocio);
			enviarimgneg = FindViewById<Button> (Resource.Id.enviarimgneg);
			LinearLayout containernegocio = FindViewById<LinearLayout> (Resource.Id.containernegocio);
			LinearLayout waitlayout = FindViewById <LinearLayout> (Resource.Id.waitlayout);

			ubicacionbtn = FindViewById<Button> (Resource.Id.ubicacionbtn);
			descripcionbtn = FindViewById<Button> (Resource.Id.descripcionbtn);
			contactobtn = FindViewById<Button> (Resource.Id.contactobtn);

			ubicacionlayout = FindViewById<LinearLayout> (Resource.Id.ubicacionlayout);
			descripcionlayout = FindViewById<LinearLayout> (Resource.Id.descripcionlayout);
			contactolayout = FindViewById<LinearLayout> (Resource.Id.contactolayout);

			callnow = FindViewById<Button> (Resource.Id.callnow);

		



			mToolbar = FindViewById<SupportToolBar> (Resource.Id.toolbar);
			mScrollView = FindViewById<ScrollView> (Resource.Id.scrollView);

			SetSupportActionBar (mToolbar);
			//ESTA ES LA FLECHA PARA ATRÁS
			SupportActionBar.SetHomeAsUpIndicator (Resource.Drawable.ic_arrow_back);
			SupportActionBar.SetDisplayHomeAsUpEnabled (true);
			//SupportActionBar.SetHomeButtonEnabled (true);

			layoutdejaimagenes = FindViewById<LinearLayout> (Resource.Id.layoutdejaimagenes);

			Point size = new Point ();
			Display display = WindowManager.DefaultDisplay;
			display.GetSize (size);
			mScreenHeight = size.Y;

			mScrollView.ViewTreeObserver.AddOnScrollChangedListener (this);

			//despues del show del action var, vamos a obtener el negocio

			SupportActionBar.Title = Intent.GetStringExtra("nombre");

			portada = FindViewById<ImageView> (Resource.Id.coverneg);

			TextView abiertocerrado = FindViewById<TextView>(Resource.Id.abiertocerrado);

			bounce = AnimationUtils.LoadAnimation (Application.Context, Resource.Animation.bounce);
			flip = AnimationUtils.LoadAnimation (Application.Context, Resource.Animation.flip);
			floatbounce = AnimationUtils.LoadAnimation (Application.Context, Resource.Animation.floatbounce);

			idres=Intent.GetStringExtra ("id");
			titulores = Intent.GetStringExtra ("nombre");

			//BOTONES DE RESEÑA
			Button enviarrev = FindViewById<Button> (Resource.Id.enviarrev);
			Button imagenrev = FindViewById<Button> (Resource.Id.imagenrev);
			Button imagenrev2 = FindViewById<Button> (Resource.Id.imagenrev2);
			Button imagencamara = FindViewById<Button> (Resource.Id.imagencamara);


			masimagenes = FindViewById<TextView> (Resource.Id.masimagenes);

			imgUri = null;
			apath = "";


			revItems = new List<Review>();

			//fuente
			Typeface font = Typeface.CreateFromAsset(Assets, "Fonts/fa.ttf");


			//COORDINATOR LAYOUT:
			var fab = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition);

			Button addimg = FindViewById<Button> (Resource.Id.addimg);
			Button addcomment = FindViewById<Button> (Resource.Id.addcomment);
			Button addtip = FindViewById<Button> (Resource.Id.addtip);
			Button enviarmensaje = FindViewById<Button> (Resource.Id.enviarmensaje);
			Button addlike = FindViewById<Button> (Resource.Id.addlike);
			fossbytes = new List<byte[]>();

			deleteimgnegocio = FindViewById<Button> (Resource.Id.deleteimgnegocio);

			addimg.SetTypeface(font, TypefaceStyle.Normal);
			addcomment.SetTypeface(font, TypefaceStyle.Normal);
			addtip.SetTypeface(font, TypefaceStyle.Normal);
			enviarmensaje.SetTypeface(font, TypefaceStyle.Normal);
			addlike.SetTypeface(font, TypefaceStyle.Normal);

			TextView corazonlikes = FindViewById<TextView> (Resource.Id.corazonlikes);

			TextView alikes = FindViewById<TextView> (Resource.Id.alikes);
			TextView likes = FindViewById<TextView> (Resource.Id.likes);
			TextView gustalikes = FindViewById<TextView> (Resource.Id.gustalikes);


			corazonlikes.SetTypeface(font, TypefaceStyle.Normal);
			alikes.SetTypeface(font, TypefaceStyle.Normal);
			likes.SetTypeface(font, TypefaceStyle.Normal);
			gustalikes.SetTypeface(font, TypefaceStyle.Normal);
			callnow.SetTypeface(font, TypefaceStyle.Normal);


			LinearLayout layoutdiascontainer = FindViewById<LinearLayout> (Resource.Id.layoutdiascontainer);
			//layoutdiascontainer.Animate().TranslationY(0);

			ScrollView scrollview = FindViewById<ScrollView> (Resource.Id.scrollView);

			ProgressBar waitpb = FindViewById<ProgressBar> (Resource.Id.waitpb);

			deleteimgrev = FindViewById<Button> (Resource.Id.deleteimgrev);


			try{
				negocio = await plifserver.FetchWeatherAsync ("http://plif.mx/mobile/get_negocio?id="+Intent.GetStringExtra("id")+"&uid="+userid);
				objeto = negocio["respuesta"][0]["Data"];

				Log.Debug (tag, "La ruta es: "+objeto["ruta"]);



				if(negocio["respuesta"][0]["0"]["has_like"]=="1"){
					haslike=true;
				}else{
					haslike=false;
				}

				if (haslike) {
					addlike.Text = GetString (Resource.String.heart);
				} else {
					addlike.Text = GetString (Resource.String.heartempty);
				}

				numlikes=objeto["likes"];


				if (objeto["ruta"] == null || objeto["ruta"] == "" || objeto["ruta"] == "null") {
					//pon la imagen por defecto
					portada.SetImageResource (Resource.Drawable.dcover);
					Log.Debug (tag, "No hay ruta!");
				} else {
					//TENEMOS QUE VERIFICAR SI LA IMAGEN ES DE GOOGLE O DE NOSOTROS!!!
					string ruta=objeto["ruta"];
					string first=ruta[0].ToString();

					if(first=="u" || first=="U"){
						//Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show ();
						ruta=extra+ruta;
					}else{
						//no hagas nada, la imagen es de google
					}

					Koush.UrlImageViewHelper.SetUrlDrawable (portada, ruta, Resource.Drawable.dcover);

				}//TERMINA SI LA IMAGEN NO ES NULL

				//Ponemos el titulo
				TextView titulo = FindViewById<TextView> (Resource.Id.titulo);
				titulo.Text=Intent.GetStringExtra("nombre");
				TextView numestrellas = FindViewById<TextView> (Resource.Id.numestrellas);

				//Ponemos las estrellas
				ImageView estrellas = FindViewById<ImageView> (Resource.Id.estrellas);

				switch (Intent.GetStringExtra("calificacion")) {

				case "0":
				case "":
				case "null":
				case null:
					numestrellas.Text="0.0";
					break;

				case "1":
					numestrellas.Text="1.0";
					break;

				case "2":
					numestrellas.Text="2.0";
					break;
				case "3":
					numestrellas.Text="3.0";
					break;
				
				case "4":
					numestrellas.Text="4.0";
					break;

				case "5":
					numestrellas.Text="5.0";
					break;


				default:
					numestrellas.Text="0.0";
					break;
				}

				//categoria y subcategoria
				TextView categoria = FindViewById<TextView> (Resource.Id.categoria);
				TextView subcategoria = FindViewById<TextView> (Resource.Id.subcategoria);
				TextView guioncat = FindViewById<TextView> (Resource.Id.guioncat);

				categoria.Text=objeto["categoria"];

				if(objeto["propietario"]==null || objeto["propietario"]=="null"){
					propietario="0";
				}else{
					propietario=objeto["propietario"];
				}

				if(objeto["subcategoria"]=="" || objeto["subcategoria"]==null || objeto["subcategoria"]=="null"){
					subcategoria.Text="";
					guioncat.Text="";
				}else{
					subcategoria.Text=objeto["subcategoria"];
				}

				//likes
				likes.Text=objeto["likes"]+" Personas";

				//mapa?
				try{
					mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
					map = mapFrag.Map;

					LatLng location = new LatLng(objeto["geo_lat"], objeto["geo_long"]);
					CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
					builder.Target(location);
					builder.Zoom(16);
					//builder.Bearing(155);
					//builder.Tilt(65);
					CameraPosition cameraPosition = builder.Build();
					CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);



					if (map != null)
					{
						map.MapType = GoogleMap.MapTypeNormal;

						MarkerOptions markerOpt1 = new MarkerOptions();
						markerOpt1.SetPosition(new LatLng(objeto["geo_lat"], objeto["geo_long"]));
						markerOpt1.SetTitle(objeto["titulo"]);
						markerOpt1.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.pliflocation3));
						markerOpt1.Draggable(true);
						map.AddMarker(markerOpt1);
						map.MoveCamera(cameraUpdate);




					}
				}catch(Exception ex){
					Log.Debug (tag, "GMAPS ERROR:"+ex);
				}


				//direccion
				TextView callenum = FindViewById<TextView> (Resource.Id.callenum);
				callenum.Text=objeto["geo_calle"]+" "+objeto["geo_numero"];
				TextView colonia = FindViewById<TextView> (Resource.Id.colonia);
				colonia.Text=objeto["geo_colonia"];
				TextView regpais = FindViewById<TextView> (Resource.Id.regpais);
				regpais.Text=objeto["geo_estado"]+", "+objeto["geo_pais"];

				//acerca de este negocio
				TextView mapmarker1 = FindViewById<TextView> (Resource.Id.sobreeste);
				mapmarker1.SetTypeface(font, TypefaceStyle.Normal);

				TextView descripcion = FindViewById<TextView> (Resource.Id.descripcion);
				string desc=objeto["descripcion"];

				descripcion.Text=System.Net.WebUtility.HtmlDecode(desc);
				descripcion.Visibility=ViewStates.Gone;

				WebView descweb = FindViewById<WebView> (Resource.Id.descweb);
				descweb.Settings.JavaScriptEnabled=true;
				string div1="<div style=\"color: #FFFFFF\">";
				string div2="</div>";
				descweb.LoadDataWithBaseURL("", div1+desc+div2, "text/html", "UTF-8", "");
				descweb.SetBackgroundColor(Color.ParseColor("#343A41"));

				//telefono
				TextView webico =FindViewById<TextView> (Resource.Id.webico);
				TextView telico =FindViewById<TextView> (Resource.Id.telico);

				telefono= FindViewById<TextView> (Resource.Id.telefono);
				telico.SetTypeface(font, TypefaceStyle.Normal);
				telefono.Text= objeto["telefono"]+" ";


				//webpage
				TextView web = FindViewById<TextView> (Resource.Id.pagweb);
				webico.SetTypeface(font, TypefaceStyle.Normal);
				web.Text=objeto["website"]+" ";

				//Horarios
				TextView horarios=FindViewById<TextView> (Resource.Id.horarios);
				horarios.SetTypeface(font, TypefaceStyle.Normal);

				abiertocerrado = FindViewById<TextView>(Resource.Id.abiertocerrado);

				LinearLayout lunescontainer = FindViewById<LinearLayout> (Resource.Id.lunescontainer);
				TextView lunes = FindViewById<TextView>(Resource.Id.lunes);
				TextView luneshora = FindViewById<TextView>(Resource.Id.luneshora);

				LinearLayout martescontainer = FindViewById<LinearLayout> (Resource.Id.martescontainer);
				TextView martes = FindViewById<TextView>(Resource.Id.martes);
				TextView marteshora = FindViewById<TextView>(Resource.Id.marteshora);

				LinearLayout miercolescontainer = FindViewById<LinearLayout> (Resource.Id.miercolescontainer);
				TextView miercoles = FindViewById<TextView>(Resource.Id.miercoles);
				TextView miercoleshora = FindViewById<TextView>(Resource.Id.miercoleshora);

				LinearLayout juevescontainer = FindViewById<LinearLayout> (Resource.Id.juevescontainer);
				TextView jueves = FindViewById<TextView>(Resource.Id.jueves);
				TextView jueveshora = FindViewById<TextView>(Resource.Id.jueveshora);

				LinearLayout viernescontainer = FindViewById<LinearLayout> (Resource.Id.viernescontainer);
				TextView viernes = FindViewById<TextView>(Resource.Id.viernes);
				TextView vierneshora = FindViewById<TextView>(Resource.Id.vierneshora);

				LinearLayout sabadocontainer = FindViewById<LinearLayout> (Resource.Id.sabadocontainer);
				TextView sabado = FindViewById<TextView>(Resource.Id.sabado);
				TextView sabadohora = FindViewById<TextView>(Resource.Id.sabadohora);

				LinearLayout domingocontainer = FindViewById<LinearLayout> (Resource.Id.domingocontainer);
				TextView domingo = FindViewById<TextView>(Resource.Id.domingo);
				TextView domingohora = FindViewById<TextView>(Resource.Id.domingohora);

				//poner los horarios donde corresponde
				if(objeto["lunes_a"]=="" || objeto["lunes_c"]==""){
					lunescontainer.Visibility=ViewStates.Gone;
				}else{
					if(objeto["lunes_a"]=="Cerrado" || objeto["lunes_c"]=="Cerrado"){
						luneshora.Text="Cerrado";
					}else{
						luneshora.Text=objeto["lunes_a"]+" - "+objeto["lunes_c"];
					}

				}


				if(objeto["martes_a"]=="" || objeto["martes_c"]==""){
					martescontainer.Visibility=ViewStates.Gone;
				}else{
					if(objeto["martes_a"]=="Cerrado" || objeto["martes_c"]=="Cerrado"){
						marteshora.Text="Cerrado";
					}else{
						marteshora.Text=objeto["martes_a"]+" - "+objeto["martes_c"];
					}

				}

				if(objeto["miercoles_a"]=="" || objeto["miercoles_c"]==""){
					miercolescontainer.Visibility=ViewStates.Gone;
				}else{
					if(objeto["miercoles_a"]=="Cerrado" || objeto["miercoles_c"]=="Cerrado"){
						miercoleshora.Text="Cerrado";
					}else{
						miercoleshora.Text=objeto["miercoles_a"]+" - "+objeto["miercoles_c"];
					}

				}

				if(objeto["jueves_a"]=="" || objeto["jueves_c"]==""){
					juevescontainer.Visibility=ViewStates.Gone;
				}else{
					if(objeto["jueves_a"]=="Cerrado" || objeto["jueves_c"]=="Cerrado"){
						jueveshora.Text="Cerrado";
					}else{
						jueveshora.Text=objeto["jueves_a"]+" - "+objeto["jueves_c"];
					}

				}

				if(objeto["viernes_a"]=="" || objeto["viernes_c"]==""){
					viernescontainer.Visibility=ViewStates.Gone;
				}else{
					if(objeto["viernes_a"]=="Cerrado" || objeto["viernes_c"]=="Cerrado"){
						vierneshora.Text="Cerrado";
					}else{
						vierneshora.Text=objeto["viernes_a"]+" - "+objeto["viernes_c"];
					}

				}

				if(objeto["sabado_a"]=="" || objeto["sabado_c"]==""){
					sabadocontainer.Visibility=ViewStates.Gone;
				}else{
					if(objeto["sabado_a"]=="Cerrado" || objeto["sabado_c"]=="Cerrado"){
						sabadohora.Text="Cerrado";
					}else{
						sabadohora.Text=objeto["sabado_a"]+" - "+objeto["sabado_c"];
					}

				}

				if(objeto["domingo_a"]=="" || objeto["domingo_c"]==""){
					domingocontainer.Visibility=ViewStates.Gone;
				}else{
					if(objeto["domingo_a"]=="Cerrado" || objeto["domingo_c"]=="Cerrado"){
						domingohora.Text="Cerrado";
					}else{
						domingohora.Text=objeto["domingo_a"]+" - "+objeto["domingo_c"];
					}

				}







				//vemos que dia es hoy y lo ponemos en verde
				DateTime localDate = DateTime.Now;
				int dia=(int)localDate.DayOfWeek; 
				//1 es lunes, 7 es domingo y así

				string hoy_abre="";
				string hoy_cierra="";

				switch(dia){
				case 1:
					lunes.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					luneshora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					hoy_abre = objeto ["lunes_a"];
					hoy_cierra = objeto ["lunes_c"];
					break;

				case 2:
					martes.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					marteshora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					hoy_abre = objeto ["martes_a"];
					hoy_cierra = objeto ["martes_c"];
					break;

				case 3:
					miercoles.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					miercoleshora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					hoy_abre = objeto ["miercoles_a"];
					hoy_cierra = objeto ["miercoles_c"];
					break;

				case 4:
					jueves.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					jueveshora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					hoy_abre = objeto ["jueves_a"];
					hoy_cierra = objeto ["jueves_c"];
					break;

				case 5:
					viernes.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					vierneshora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					hoy_abre = objeto ["viernes_a"];
					hoy_cierra = objeto ["viernes_c"];
					break;

				case 6:
					sabado.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					sabadohora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					hoy_abre = objeto ["sabado_a"];
					hoy_cierra = objeto ["sabado_c"];
					break;

				case 7:
					domingo.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					domingohora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
					hoy_abre = objeto ["domingo_a"];
					hoy_cierra = objeto ["domingo_c"];
					break;

				default:
					hoy_abre = "cerrado";
					hoy_cierra = "cerrado";
					break;

				}

				if(hoy_abre == "Cerrado" || hoy_cierra=="Cerrado"){
					abiertocerrado.Text="Cerrado por el dia de hoy.";
					abiertocerrado.SetTextColor(Android.Graphics.Color.ParseColor("#C41200"));
				}else{

					if(hoy_abre == "" || hoy_cierra==""){
						abiertocerrado.Text="No disponemos de los horarios para el dia de hoy.";
						abiertocerrado.SetTextColor(Android.Graphics.Color.ParseColor("#C41200"));
					}else{
						//TODO AQUI
						//AQUI HAY QUE VER SI ESTÁ ABIERTO O CERRADO
						DateTime ahora = DateTime.Now;
						DateTime abre = Convert.ToDateTime(hoy_abre);
						DateTime cierra = Convert.ToDateTime(hoy_cierra);
						DateTime cierra2 = DateTime.Now;



						int diasig=DateTime.Compare(abre,cierra);
						//Toast.MakeText (Application.Context, "Cierra primero: "+cierra.ToString(), ToastLength.Long).Show ();

						if(diasig>0){
							//sumale un dia a la hora de cierre
							//Toast.MakeText (Application.Context, "si es mayor!: "+diasig, ToastLength.Long).Show ();
							cierra2=cierra.AddDays(1);
						}else{
							cierra2=cierra;
							//no hagas nada
						}

						int f1=DateTime.Compare(abre, ahora);
						int f2=DateTime.Compare(ahora,cierra2);

						if(f1<0 && f2<0){
							//abierto
							abiertocerrado.Text="Abierto justo ahora!";
							abiertocerrado.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
						}else{
							//cerrado
							abiertocerrado.Text="Cerrado ahora";
							abiertocerrado.SetTextColor(Android.Graphics.Color.ParseColor("#C41200"));
						}

					}

				}

				TextView revs_tit= FindViewById<TextView> (Resource.Id.revs_tit);
				revs_tit.SetTypeface(font, TypefaceStyle.Normal);
				containernegocio.Visibility=ViewStates.Visible;
				waitlayout.Visibility=ViewStates.Gone;

				ImageView imgface = FindViewById<ImageView> (Resource.Id.imageface);
				ImageView imgtwitter = FindViewById<ImageView> (Resource.Id.imagetwitter);
				ImageView imggoogle = FindViewById<ImageView> (Resource.Id.imagegoogle);
				ImageView imgplif = FindViewById<ImageView> (Resource.Id.imageplif);

				if (objeto ["facebook"] == "") {
					imgface.Visibility = ViewStates.Gone;
				}

				if (objeto ["twitter"] == "") {
					imgtwitter.Visibility = ViewStates.Gone;
				}

				if (objeto ["google"] == "") {
					imggoogle.Visibility = ViewStates.Gone;
				}


				imgface.Click += (object sender, EventArgs e) => {

					Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(objeto["facebook"]));
					StartActivity(intent);

				};

				imgtwitter.Click += (object sender, EventArgs e) => {
					Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(objeto["twitter"]));
					StartActivity(intent);

				};

				imggoogle.Click += (object sender, EventArgs e) => {
					Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(objeto["google"]));
					StartActivity(intent);

				};

				imgplif.Click += (object sender, EventArgs e) => {
					Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("http://www.plif.mx/negocio/"+objeto["id"]));
					StartActivity(intent);

				};






			}
			catch(Exception ex){
				Log.Debug (tag, "ERROR FETCHING DATA: "+ex);
				Toast.MakeText (Application.Context, "Ocurrió un error al recuperar la información del negocio", ToastLength.Long).Show ();
				Finish ();
			}

			//aqui en un nuevo try catch, cargamos los comentarios

			ProgressBar waitrv = FindViewById<ProgressBar> (Resource.Id.waitrv);
			try{

				ReviewsObj=await plifserver.FetchWeatherAsync("http://plif.mx/mobile/get_neg_reviews?nid="+Intent.GetStringExtra("id")+"&uid="+userid);
				//Aqui vamos a cargar los reviews con ayuda del adapter

				LinearLayout reviewscont = FindViewById<LinearLayout> (Resource.Id.reviewscont);
				LayoutInflater inflater = LayoutInflater.From(this);

				/*
				for(int i=0; i<=5; i++){
					View view = inflater.Inflate(Resource.Layout.listview_comentarios, reviewscont, false);
					TextView revlikes = view.FindViewById<TextView> (Resource.Id.user_corazonlikes);
					revlikes.SetTypeface(font, TypefaceStyle.Normal);
					reviewscont.AddView(view);
				
				
				}*/

				foreach(JsonObject data in ReviewsObj){
					View row = inflater.Inflate(Resource.Layout.listview_comentarios, reviewscont, false);
					ReviewDetalles holder=null;
					LinearDetalles preholder=null;
					/*TextView revlikes = view.FindViewById<TextView> (Resource.Id.user_corazonlikes);
					revlikes.SetTypeface(font, TypefaceStyle.Normal);*/

					LinearLayout fondo_coment = row.FindViewById<LinearLayout> (Resource.Id.fondo_coment);
					fondo_coment.SetBackgroundResource(Resource.Drawable.fondoinfopremium);


					//EMPIEZA
					//ESTE SETEA LA IMAGEN
					ImageView imagen = row.FindViewById<ImageView> (Resource.Id.user_imagen);

					if (data["i"]["ruta"] == null || data["i"]["ruta"] == "" || data["i"]["ruta"] == "null") {
						//pon la imagen por defecto
						imagen.SetImageResource (Resource.Drawable.noprof);
					} else {
						//TENEMOS QUE VERIFICAR SI LA IMAGEN ES DE GOOGLE O DE NOSOTROS!!!
						string extra="http://plif.mx/";
						string ruta=data["i"]["ruta"];
						string first=ruta[0].ToString();

						if(first=="u" || first=="U"){
							ruta=extra+ruta;
						}else{
							//no hagas nada, la imagen es de google
						}

						Koush.UrlImageViewHelper.SetUrlDrawable (imagen, ruta, Resource.Drawable.bolaplace);

					}//TERMINA SI LA IMAGEN NO ES NULA

					//Ponemos el nombre
					TextView nombre = row.FindViewById<TextView> (Resource.Id.user_nombre);
					nombre.Text = data["u"]["nombre"]+" "+data["u"]["apellidos"];

					nombre.SetTextColor(Color.ParseColor("#FFFFFF"));

					//ESTE SETEA LAS ESTRELLAS DE LA CALIFICACION
					ImageView cali = row.FindViewById<ImageView> (Resource.Id.user_calificacion);

					string cal = data["cm"]["calificacion"];

					switch (cal) {

					case "0":
						cali.SetImageResource (Resource.Drawable.e0);
						break;

					case "":
						cali.SetImageResource (Resource.Drawable.e0);
						break;

					case "null":
						cali.SetImageResource (Resource.Drawable.e0);
						break;

					case null:
						cali.SetImageResource (Resource.Drawable.e0);
						break;

					case "1":
						cali.SetImageResource (Resource.Drawable.e1);
						break;

					case "2":
						cali.SetImageResource (Resource.Drawable.e2);
						break;

					case "3":
						cali.SetImageResource (Resource.Drawable.e3);
						break;

					case "4":
						cali.SetImageResource (Resource.Drawable.e4);
						break;

					case "5":
						cali.SetImageResource (Resource.Drawable.e5);
						break;



					default:
						cali.SetImageResource (Resource.Drawable.e0);
						break;
					}

					//Ponemos el comentario
					TextView comentario = row.FindViewById<TextView> (Resource.Id.user_comentario);
					comentario.Text = data["cm"]["comentario"];

					comentario.SetTextColor(Color.ParseColor("#FFFFFF"));

					//Ponemos la fecha y la hora
					TextView fechahora = row.FindViewById<TextView> (Resource.Id.user_fechahora);
					string fc=data["cm"]["fecha"];
					DateTime dt = System.Convert.ToDateTime(fc);   
					fechahora.Text = dt.ToString ("dd/MM/yyyy H:mm");

					fechahora.SetTextColor(Color.ParseColor("#FFFFFF"));

					//ponemos los likes que tiene
					TextView likescom = row.FindViewById<TextView> (Resource.Id.user_numlikes);
					likescom.Text = " "+data["cm"]["num_likes"];
					likescom.SetTextColor(Color.ParseColor("#FFFFFF"));
					bool haslike = false;
					//averiguamos si el usuario le ha dado like

					try{
						string ulk=" ";
						if(data["user_likes"]["user_likes"]!= null & data["user_likes"]["user_likes"]!= "null"){
							ulk=data["user_likes"]["user_likes"];
							string[] words;
							words = ulk.Split(' ');

							foreach (string word in words)
							{
								if (word == userid) {
									haslike = true;
								}
							}
						}else{
							//no hagas nada!
							Log.Debug("Split","Los likes son nulos");
						}
					}catch(Exception ex){
						Log.Debug("Split","Fue null: "+ex);
					}

					corazonlike = row.FindViewById<TextView> (Resource.Id.user_corazonlikes);
					string hl="";

					if (haslike) {
						corazonlike.Text = GetString(Resource.String.heart);
						hl="si";

					} else {
						corazonlike.Text = GetString (Resource.String.heartempty);
						hl="no";
					}

					//Typeface font = Typeface.CreateFromAsset(mContext.Assets, "Fonts/fa.ttf");
					corazonlike.SetTypeface(font, TypefaceStyle.Normal);





					holder = new ReviewDetalles(data["cm"]["id"],hl,likescom);

					corazonlike.SetTag(Resource.String.lel,holder);



					LinearLayout layoutlike = row.FindViewById<LinearLayout> (Resource.Id.layoutlike);
					preholder=new LinearDetalles(corazonlike);
					layoutlike.SetTag(Resource.String.lel,preholder);



					//TERMINA
					reviewscont.AddView(row);
				};



				/*
				 * 
				foreach(JsonObject data in ReviewsObj){
					revItems.Add(
						new Review(){
							ReviewId=data["cm"]["id"],
							ReviewnegId=data["cm"]["negocio_id"],
							ReviewNombre=data["u"]["nombre"]+" "+data["u"]["apellidos"],
							ReviewEmail=data["u"]["autor_email"],
							ReviewComentario=data["cm"]["comentario"],
							ReviewCalificacion=data["cm"]["calificacion"],
							ReviewFecha=data["cm"]["fecha"],
							ReviewLikes=data["cm"]["num_likes"],
							ReviewautorId=data["u"]["id"],
							ReviewRuta=data["i"]["ruta"],		
					        ReviewLikesUsers=data["user_likes"]["user_likes"]	
						}
					);

					Log.Debug("AñadirReviews","Añadida!");


				}
*/
				//MyReviewsAdapter rev_adapter = new MyReviewsAdapter(Application.Context, revItems);
				//ListView revslista = FindViewById<ListView> (Resource.Id.revslista);
				//revslista.Adapter=rev_adapter;
				waitrv.Visibility=ViewStates.Gone;
				//revslista.Visibility=ViewStates.Visible;



			}catch(Exception ex){
				Log.Debug("ErrorTodo", ex.ToString());
				waitrv.Visibility=ViewStates.Gone;
				//var fab = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition);
				Snackbar
					.Make (fab, "Ooops! Ocurrió un error al recuperar las reseñas. Inténtalo nuevamente!", Snackbar.LengthLong)
					.SetAction ("Ok", (view) => {  })
					.Show ();				
			}

			try{

				//Traemos la galeria de imagenes
				TextView fotos_tit = FindViewById<TextView> (Resource.Id.fotos_tit);
				fotos_tit.SetTypeface(font, TypefaceStyle.Normal);

				Utils utils = new Utils(this);
				JsonValue contenedorimg = await utils.getFilePaths("http://plif.mx/mobile/get_img_neg?id="+Intent.GetStringExtra("id")+"&prev");

				LinearLayout fotosprevcontain = FindViewById<LinearLayout> (Resource.Id.fotosprevcontain);
				LayoutInflater inflater2 = LayoutInflater.From(this);

				string extra="http://plif.mx/admin/";
				string rutaa="";
				string first="";
				View rowimg = inflater2.Inflate(Resource.Layout.img_layout, fotosprevcontain, false);

				int numfotos=0;

				try{
					rutaa=contenedorimg[0]["imagenes"]["ruta"];
					first=rutaa[0].ToString();

					if(first=="u" || first=="U"){
						//Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show ();
						rutaa=extra+rutaa;
					}else{
						//no hagas nada, la imagen es de google
					}

					Log.Debug ("GaleriaAdapter", "Procesando: "+rutaa);

					ImageView cont = rowimg.FindViewById<ImageView> (Resource.Id.img_galeria1);
					Koush.UrlImageViewHelper.SetUrlDrawable (cont, rutaa, Resource.Drawable.bola);
					numfotos++;
				}
				catch(Exception ex){
					ImageView cont = rowimg.FindViewById<ImageView> (Resource.Id.img_galeria1);
					cont.Visibility=ViewStates.Gone;
					Log.Debug("imgscont","no hay imagen uno");


				}

				////LA QUE SIGUE!!!
				try{
					rutaa=contenedorimg[1]["imagenes"]["ruta"];
					first=rutaa[0].ToString();
					if(first=="u" || first=="U"){
						//Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show ();
						rutaa=extra+rutaa;
					}else{
						//no hagas nada, la imagen es de google
					}

					Log.Debug ("GaleriaAdapter", "Procesando: "+rutaa);

					ImageView cont2 = rowimg.FindViewById<ImageView> (Resource.Id.img_galeria2);
					Koush.UrlImageViewHelper.SetUrlDrawable (cont2, rutaa, Resource.Drawable.bola);
					numfotos++;
				}
				catch(Exception ex){
					ImageView cont = rowimg.FindViewById<ImageView> (Resource.Id.img_galeria2);
					cont.Visibility=ViewStates.Gone;
					Log.Debug("imgscont","no hay imagen dos");

				}

				////LA ULTIMA!!!
				try{
					rutaa=contenedorimg[2]["imagenes"]["ruta"];
					first=rutaa[0].ToString();
					if(first=="u" || first=="U"){
						//Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show ();
						rutaa=extra+rutaa;
					}else{
						//no hagas nada, la imagen es de google
					}

					Log.Debug ("GaleriaAdapter", "Procesando: "+rutaa);

					ImageView cont3 = rowimg.FindViewById<ImageView> (Resource.Id.img_galeria3);
					Koush.UrlImageViewHelper.SetUrlDrawable (cont3, rutaa, Resource.Drawable.bola);
					numfotos++;
				}
				catch(Exception ex){
					ImageView cont = rowimg.FindViewById<ImageView> (Resource.Id.img_galeria3);
					cont.Visibility=ViewStates.Gone;
					Log.Debug("imgscont","no hay imagen tres");

				}



				fotosprevcontain.AddView(rowimg);

				fullfotos= FindViewById<TextView> (Resource.Id.fullfotos);

				if(numfotos>0){
					fullfotos.Visibility=ViewStates.Visible;
				}





			}catch(Exception ex){
				Log.Debug("ErrorLista", ex.ToString());
				var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition);
				Snackbar
					.Make (fabee, "Ooops! Ocurrió un error al recuperar las imágenes. Inténtalo nuevamente!", Snackbar.LengthLong)
					.SetAction ("Ok", (view) => {  })
					.Show ();	

			}

			EditText nombrerev = FindViewById<EditText> (Resource.Id.nombrerev);
			EditText emailrev = FindViewById<EditText> (Resource.Id.emailrev);
			commentrev = FindViewById<EditText> (Resource.Id.commentrev);

			nombrerev.Text=prefs.GetString("nombre", null);
			emailrev.Text=prefs.GetString("email", null);

			//nombrerev.EditableText = false;
			//emailrev.EditableText = false;
			nombrerev.Enabled = false;
			emailrev.Enabled = false;

			ImageButton e1 = FindViewById<ImageButton> (Resource.Id.estrella1);
			ImageButton e2 = FindViewById<ImageButton> (Resource.Id.estrella2);
			ImageButton e3 = FindViewById<ImageButton> (Resource.Id.estrella3);
			ImageButton e4 = FindViewById<ImageButton> (Resource.Id.estrella4);
			ImageButton e5 = FindViewById<ImageButton> (Resource.Id.estrella5);

			TextView califspan = FindViewById<TextView> (Resource.Id.califspan);

			callnow.Click += (object sender, EventArgs e) => {
				Intent intent = new Intent(Intent.ActionCall, Android.Net.Uri.Parse("tel:" + telefono.Text));
				StartActivity(intent);
			};

			ubicacionbtn.Click += (object sender, EventArgs e) => {
				ubicacionlayout.Visibility=ViewStates.Visible;
				descripcionlayout.Visibility=ViewStates.Gone;
				contactolayout.Visibility=ViewStates.Gone;

				ubicacionbtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnpressprem);
				descripcionbtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnprem);
				contactobtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnprem);
			};

			descripcionbtn.Click += (object sender, EventArgs e) => {
				ubicacionlayout.Visibility=ViewStates.Gone;
				descripcionlayout.Visibility=ViewStates.Visible;
				contactolayout.Visibility=ViewStates.Gone;

				ubicacionbtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnprem);
				descripcionbtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnpressprem);
				contactobtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnprem);
				
			};

			contactobtn.Click += (object sender, EventArgs e) => {
				ubicacionlayout.Visibility=ViewStates.Gone;
				descripcionlayout.Visibility=ViewStates.Gone;
				contactolayout.Visibility=ViewStates.Visible;

				ubicacionbtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnprem);
				descripcionbtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnprem);
				contactobtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnpressprem);

				
			};

			addcomentbtn = FindViewById<Button> (Resource.Id.addcomment);

			enviarmensaje.Click += (object sender, EventArgs e) => {
				var enviarmsj = new Intent (this, typeof(EnviarMensaje));
				enviarmsj.PutExtra("negocioid",idres);
				enviarmsj.PutExtra("titulo", titulores);
				enviarmsj.PutExtra("propietario",propietario);
				StartActivity (enviarmsj);
			};


			addcomentbtn.Click += (sender, e) => {
				enviarrev.Focusable=true;
				enviarrev.FocusableInTouchMode=true;
				if(enviarrev.RequestFocus()){
					Log.Debug("BotonArribaReseña", "It dit it!");
					enviarrev.ClearFocus();
					enviarrev.FocusableInTouchMode=false;
				}

			};

			e1.Click += delegate(object sender, EventArgs e) {

				califspan.StartAnimation(flip);
				califspan.Text="1.0";
				calificacion=1;
				e1.SetImageResource(Resource.Drawable.estrellafull);
				e2.SetImageResource(Resource.Drawable.estrellaempty);
				e3.SetImageResource(Resource.Drawable.estrellaempty);
				e4.SetImageResource(Resource.Drawable.estrellaempty);
				e5.SetImageResource(Resource.Drawable.estrellaempty);
			};

			e2.Click += delegate(object sender, EventArgs e) {

				califspan.StartAnimation(flip);
				califspan.Text="2.0";
				calificacion=2;
				e1.SetImageResource(Resource.Drawable.estrellafull);
				e2.SetImageResource(Resource.Drawable.estrellafull);
				e3.SetImageResource(Resource.Drawable.estrellaempty);
				e4.SetImageResource(Resource.Drawable.estrellaempty);
				e5.SetImageResource(Resource.Drawable.estrellaempty);
			};

			e3.Click += delegate(object sender, EventArgs e) {

				califspan.StartAnimation(flip);
				califspan.Text="3.0";
				calificacion=3;
				e1.SetImageResource(Resource.Drawable.estrellafull);
				e2.SetImageResource(Resource.Drawable.estrellafull);
				e3.SetImageResource(Resource.Drawable.estrellafull);
				e4.SetImageResource(Resource.Drawable.estrellaempty);
				e5.SetImageResource(Resource.Drawable.estrellaempty);
			};

			e4.Click += delegate(object sender, EventArgs e) {

				califspan.StartAnimation(flip);
				califspan.Text="4.0";
				calificacion=4;
				e1.SetImageResource(Resource.Drawable.estrellafull);
				e2.SetImageResource(Resource.Drawable.estrellafull);
				e3.SetImageResource(Resource.Drawable.estrellafull);
				e4.SetImageResource(Resource.Drawable.estrellafull);
				e5.SetImageResource(Resource.Drawable.estrellaempty);
			};

			e5.Click += delegate(object sender, EventArgs e) {

				califspan.StartAnimation(flip);
				califspan.Text="5.0";
				calificacion=5;
				e1.SetImageResource(Resource.Drawable.estrellafull);
				e2.SetImageResource(Resource.Drawable.estrellafull);
				e3.SetImageResource(Resource.Drawable.estrellafull);
				e4.SetImageResource(Resource.Drawable.estrellafull);
				e5.SetImageResource(Resource.Drawable.estrellafull);
			};

			e5.PerformClick ();


			//nenenenenenene
			addimg.Click += async (object sender, EventArgs e) => {
				layoutdejaimagenes.Visibility=ViewStates.Visible;
			};

			deleteimgrev.Click += async (sender, e) => {
				GridLayout imgcomprev = FindViewById<GridLayout> (Resource.Id.imgcomprev);
				LinearLayout imgcontainercomprev = FindViewById<LinearLayout> (Resource.Id.imgcontainercomprev);
				Log.Debug("DELETEBUTTON","Inician las layouts");
				if(imgcomprev.ChildCount>0){
					imgcomprev.RemoveAllViews();
				}


				Log.Debug("DELETEBUTTON","vistas removidas");

				if(imagencomentario!=null){
					imagencomentario.Recycle();
					imagencomentario=null;
				}

				Log.Debug("DELETEBUTTON","reciclado");

				//deleteimgrev.Visibility=ViewStates.Gone;
				Log.Debug("DELETEBUTTON","se oculta boton borrar (deprecated)");
				imgcontainercomprev.Visibility=ViewStates.Gone;
				Log.Debug("DELETEBUTTON","se oculta el contenedor de subir imagenes");
				imagenrev = FindViewById<Button> (Resource.Id.imagenrev);
				imagenrev.Visibility=ViewStates.Visible;
				Log.Debug("DELETEBUTTON","se muestra el boton añadir");

				fossbytes.Clear();
				Log.Debug("DELETEBUTTON","El Arraylist de bytes se resetea");

				imgcount=0;
				Log.Debug("DELETEBUTTON","se resetea el contador de cuantas imagenes se subieron");
				masimagenes.Text="Carga 3 imágenes más!";
				Log.Debug("DELETEBUTTON","Reseteamos el texto de las imagenes");


			};

			deleteimgnegocio.Click += async (sender, e) => {
				//LinearLayout imgcomprev = FindViewById<LinearLayout> (Resource.Id.imgcomprev);
				//LinearLayout imgcontainercomprev = FindViewById<LinearLayout> (Resource.Id.imgcontainercomprev);
				Log.Debug("DELETEBUTTON","Inician las layouts");
				if(imgnegocioprev.ChildCount>0){
					imgnegocioprev.RemoveAllViews();
				}


				Log.Debug("DELETEBUTTON","vistas removidas");

				if(imagencomentario!=null){
					imagencomentario.Recycle();
					imagencomentario=null;
				}

				Log.Debug("DELETEBUTTON","reciclado");
				//deleteimgrev.Visibility=ViewStates.Gone;
				Log.Debug("DELETEBUTTON","se oculta boton borrar (deprecated)");
				layoutdejaimagenes.Visibility=ViewStates.Gone;
				Log.Debug("DELETEBUTTON","se oculta el contenedor de subir imagenes");

				fossbytes.Clear();
				Log.Debug("DELETEBUTTON","El Arraylist de bytes se resetea");

				imgcount=0;
				Log.Debug("DELETEBUTTON","se resetea el contador de cuantas imagenes se subieron");
				masimagenesnegocio.Text="Carga 10 imágenes más!";
				Log.Debug("DELETEBUTTON","Reseteamos el texto de las imagenes");
			};

			imagenrev.Click += async (object sender, EventArgs e) => {

				LinearLayout imgcontainercomprev = FindViewById<LinearLayout> (Resource.Id.imgcontainercomprev);
				imgcontainercomprev.Visibility=ViewStates.Visible;
				imagenrev.Visibility=ViewStates.Gone;

			};

			imagennegocio.Click += async (object sender, EventArgs e) => {
				source=1;
				ProcesarImagenes(imgnegocioprev, 10, masimagenesnegocio);
			};

			imagencamaranegocio.Click += async (object sender, EventArgs e) => {
				source=2;
				ProcesarImagenes(imgnegocioprev, 10, masimagenesnegocio);
			};

			imagenrev2.Click += async (object sender, EventArgs e) => {
				source=1;
				GridLayout imgcomprev = FindViewById<GridLayout> (Resource.Id.imgcomprev);
				ProcesarImagenes(imgcomprev,3,masimagenes);

			};//imagenrev click

			imagencamara.Click += async (sender, e) => {
				source=2;
				GridLayout imgcomprev = FindViewById<GridLayout> (Resource.Id.imgcomprev);
				ProcesarImagenes(imgcomprev,3,masimagenes);
			};

			enviarimgneg.Click += async (object sender, EventArgs e) => {
				if(imgcount>0){

					diccionario = new Dictionary<string, string>();
					diccionario.Add("negocio", idres); 
					diccionario.Add("description", "Foto en "+titulores); 
					diccionario.Add("autor", prefs.GetString("id", null));


					//LIMPIAMOS LA PANTALLA Y DESHABILITAMOS LOS BOTONES
					ProgressBar waitnegociors=FindViewById<ProgressBar>(Resource.Id.waitnegociors);
					waitnegociors.Visibility=ViewStates.Visible;

					TextView subiendofotos = FindViewById<TextView> (Resource.Id.subiendofotos);
					subiendofotos.Visibility=ViewStates.Visible;
					//deleteimgrev.PerformClick();

					//se deshabilitan ambos botones
					//enviarrev.Enabled=false;
					//imagenrev.Enabled=false;



					//LinearLayout imgcontainercomprev = FindViewById<LinearLayout> (Resource.Id.imgcontainercomprev); 
					layoutdejaimagenes.Visibility=ViewStates.Gone;
					Log.Debug("EnviarImagen","se oculta el contenedor de subir imagenes");
					imagenrev = FindViewById<Button> (Resource.Id.imagenrev);
					imagenrev.Visibility=ViewStates.Visible;
					Log.Debug("EnviarImagenes","se muestra el boton añadir");
					masimagenesnegocio.Text="Carga 10 imágenes más!";
					Log.Debug("EnviarImagenes","Reseteamos el texto de las imagenes");


					int countbytes=fossbytes.Count;
					if(fossbytes!=null && countbytes>0){
						Log.Debug ("EnviarImagenes", "Si hay imágenes byte en el array!");
						Log.Debug("CONVERTIR","Elementos convertidos a Byte: "+countbytes);

					}


					string resp = await plifserver.PostMultiPartForm ("http://plif.mx/pages/UploadImg/0", fossbytes, "nada", "file[]", "image/jpeg", diccionario, false);
					Log.Debug("SUBIRIMAGENES",resp);
					waitnegociors.Visibility=ViewStates.Gone;
					subiendofotos.Visibility=ViewStates.Gone;
					deleteimgnegocio.PerformClick();

					var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition);
					Snackbar
						.Make (fabee, "Hemos recibido tus fotos. Gracias por ser parte de Plif!", Snackbar.LengthLong)
						.SetAction ("Ok", (view) => {  })
						.Show ();	

				}else{
					var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition);
					Snackbar
						.Make (fabee, "Selecciona al menos una imágen!", Snackbar.LengthLong)
						.SetAction ("Ok", (view) => {  })
						.Show ();		
				}

			};

			enviarrev.Click += async (object sender, EventArgs e) => {
				if(calificacion==0){
					var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition);
					Snackbar
						.Make (fabee, "Por favor califica al negocio!", Snackbar.LengthLong)
						.SetAction ("Ok", (view) => {  })
						.Show ();	
				}else{
					if(commentrev.Text==""){
						var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition);
						Snackbar
							.Make (fabee, "Por favor escribe un comentario!", Snackbar.LengthLong)
							.SetAction ("Ok", (view) => {  })
							.Show ();	
					}else{
						//Aqui mero!!!!



						diccionario = new Dictionary<string, string>();
						diccionario.Add("comentario", commentrev.Text); 
						diccionario.Add("autor", prefs.GetString("id", null));
						diccionario.Add("calificacion", calificacion.ToString());
						diccionario.Add("negocio", idres);
						diccionario.Add("titulo", titulores);
						Log.Debug("EnviarComentario","Clickeo");

						//LIMPIAMOS LA PANTALLA Y DESHABILITAMOS LOS BOTONES
						ProgressBar waitrs=FindViewById<ProgressBar>(Resource.Id.waitrs);
						waitrs.Visibility=ViewStates.Visible;
						//deleteimgrev.PerformClick();

						//se deshabilitan ambos botones
						enviarrev.Enabled=false;
						imagenrev.Enabled=false;

						LinearLayout imgcontainercomprev = FindViewById<LinearLayout> (Resource.Id.imgcontainercomprev); 
						imgcontainercomprev.Visibility=ViewStates.Gone;
						Log.Debug("EnviarComentario","se oculta el contenedor de subir imagenes");
						imagenrev = FindViewById<Button> (Resource.Id.imagenrev);
						imagenrev.Visibility=ViewStates.Visible;
						Log.Debug("EnviarComentario","se muestra el boton añadir");
						masimagenes.Text="Carga 3 imágenes más!";
						Log.Debug("EnviarComentario","Reseteamos el texto de las imagenes");

						string filename="";
						int countbytes=fossbytes.Count;
						if(fossbytes!=null && countbytes>0){
							Log.Debug ("EnviarComentario", "Si hay imágenes byte en el array!");
							Log.Debug("CONVERTIR","Elementos convertidos a Byte: "+countbytes);

						}

						//AQUI LO ENVIAMOS, EL PRIMER PARAMETRO ES LA PÁGINA, EL SEGUNDO ES LA IMAGEN CODIFICADA EN BITS, EL TERCERO ES EL NOMBRE DEL PARÁMETRO QUE RECIBE PHP, EL CUARTO ES EL MIMETYPE DE LA IMAGEN, Y EL ULTIMO ES EL DICCTIONARY CON TODOS LOS DEMÁS VALORES STRING
						string resp = await plifserver.PostMultiPartForm ("http://plif.mx/comentario_negocio", fossbytes, filename, "file[]", "image/jpeg", diccionario, false);

						//deleteimgrev.PerformClick();
						enviarrev.Enabled=true;
						imagenrev.Enabled=true;
						waitrs.Visibility=ViewStates.Gone;
						calificacion=0;
						commentrev.Text="";

						califspan.StartAnimation(flip);
						califspan.Text="0.0";
						calificacion=0;
						e1.SetImageResource(Resource.Drawable.estrellaempty);
						e2.SetImageResource(Resource.Drawable.estrellaempty);
						e3.SetImageResource(Resource.Drawable.estrellaempty);
						e4.SetImageResource(Resource.Drawable.estrellaempty);
						e5.SetImageResource(Resource.Drawable.estrellaempty);

						Log.Debug("MULTIPARTRESPONSE",resp);
						deleteimgrev.PerformClick();

						var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition);
						Snackbar
							.Make (fabee, "Tu reseña ha sido enviada. ¡Gracias por ser parte de Plif!", Snackbar.LengthLong)
							.SetAction ("Ok", (view) => {  })
							.Show ();	

					}
				}

			};


			fullfotos.Click += delegate(object sender, EventArgs e) {
				var galeriaimg = new Intent (this, typeof(GaleriaImagenes));
				galeriaimg.PutExtra("negocioid",idres);

				/*negocio.PutExtra("id",negItems [e.Position].NegocioId);
				negocio.PutExtra("nombre",negItems [e.Position].NegocioName);
				negocio.PutExtra("direccion",negItems [e.Position].NegocioDir);
				negocio.PutExtra("categoria",negItems [e.Position].NegocioCat);
				negocio.PutExtra("calificacion",negItems [e.Position].NegocioCal);*/
				StartActivity (galeriaimg);
				//StartActivity(typeof(GaleriaImagenes));
				/*
				var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition);
				Snackbar
					.Make (fabee, "El lunes se lo pongo!", Snackbar.LengthLong)
					.SetAction ("Ok", (view) => {  })
					.Show ();	
					*/
			};



			abiertocerrado.Click += delegate {
				if(!horariovisible){
					//layoutdiascontainer.Animate().TranslationY(300);
					layoutdiascontainer.Visibility=ViewStates.Visible;
					//int val=GetX(layoutdiascontainer);
					//scrollview.ScrollTo(0,val);
					horariovisible=true;
				}else{
					//layoutdiascontainer.Animate().TranslationY(0);
					layoutdiascontainer.Visibility=ViewStates.Gone;
					horariovisible=false;
				}


			};

			addlike.Click += async (sender, e) => {

				if(!dandolike){
					dandolike=true;

				try{
					if(!haslike){
						haslike=true;
						addlike.StartAnimation(bounce);
						addlike.Text = GetString (Resource.String.heart);
						numlikes++;
						likes.Text=numlikes+" Personas";
						//JsonValue likeans=await plifserver.FetchWeatherAsync("http://plif.mx/mobile/like_neg_asset?nid="+Intent.GetStringExtra("id")+"&uid="+userid+"&case=1");
							string likestring="http://plif.mx/pages/LikeNegocio/"+negocioid+"/1?uid="+userid;
							Log.Debug("Like","La URL Es: "+likestring);
							JsonValue likeans=await plifserver.FetchWeatherAsync("http://plif.mx/pages/LikeNegocio/"+negocioid+"/1?uid="+userid);
						dandolike=false;

					}else{
						haslike=false;
						addlike.StartAnimation(bounce);
						addlike.Text = GetString (Resource.String.heartempty);
						numlikes--;
						likes.Text=numlikes+" Personas";
						//JsonValue likeans=await plifserver.FetchWeatherAsync("http://plif.mx/mobile/like_neg_asset?nid="+Intent.GetStringExtra("id")+"&uid="+userid+"&case=2");
							string likestring="http://plif.mx/pages/LikeNegocio/"+negocioid+"/2?uid="+userid;
							Log.Debug("Like","La URL Es: "+likestring);
							JsonValue likeans=await plifserver.FetchWeatherAsync(likestring);

						dandolike=false;

					}
				}catch(Exception ex){
					waitpb.Visibility=ViewStates.Gone;
					//var fab = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition);
					Snackbar
						.Make (fab, "Ooops! Ocurrió un error al intentar procesar tu solicitud. Inténtalo nuevamente!", Snackbar.LengthLong)
						.SetAction ("Ok", (view) => {  })
						.Show ();
				}

			}else{
					Log.Debug("AddLike","Like en proceso! Por favor espera!!");
				}

			};

			//REDES SOCIALES


		}
		private void SetupMapIfNeeded()
		{
			if (_map == null)
			{
				_map = _mapFragment.Map;
				if (_map != null)
				{
					MarkerOptions marker1 = new MarkerOptions();
					marker1.SetPosition(VimyRidge);
					marker1.SetTitle("Vimy Ridge");
					_map.AddMarker(marker1);

					MarkerOptions marker2 = new MarkerOptions();
					marker2.SetPosition(Passchendaele);
					marker2.SetTitle("Passchendaele");
					_map.AddMarker(marker2);

					// We create an instance of CameraUpdate, and move the map to it.
					CameraUpdate cameraUpdate = CameraUpdateFactory.NewLatLngZoom(VimyRidge, 15);
					_map.MoveCamera(cameraUpdate);
				}
			}
		}
		public async void OnMapReady(GoogleMap googleMap)
		{
			// disable the compass on the map
			googleMap.UiSettings.CompassEnabled = false;

			// disable the my location button
			googleMap.UiSettings.MyLocationButtonEnabled = false;

			// disable the map toolbar
			googleMap.UiSettings.MapToolbarEnabled = false;

			// prevent tap gestures (this will automatically open the external map application, which we don't want in this case)
			googleMap.MapClick += (sender, e) => {
				// an empty delegate, to prevent click events
			};

			// attempt to get the lat and lon for the address
			_GeocodedLocation = await GetPositionAsync();

			if (_GeocodedLocation != null)
			{
				// because we now have coordinates, show the get directions action image view, and wire up its click handler
				_GetDirectionsActionImageView.Visibility = ViewStates.Visible;

				// initialze the map
				MapsInitializer.Initialize(this);

				// display the map region that contains the point. (the zoom level has been defined on the map layout in AcquaintanceDetail.axml)
				googleMap.MoveCamera(CameraUpdateFactory.NewLatLng(_GeocodedLocation));

				// create a new pin
				var marker = new MarkerOptions();

				// set the pin's position
				marker.SetPosition(new LatLng(_GeocodedLocation.Latitude, _GeocodedLocation.Longitude));

				// add the pin to the map
				googleMap.AddMarker(marker);
			}
		}