예제 #1
0
        private void SetUpMap()
        {
            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeHybrid)
                                              .InvokeZoomControlsEnabled(true)
                                              .InvokeCompassEnabled(true);

                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();

                var mapReadyCallback = new MyOnMapReady();
                mapReadyCallback.MapReady += (sender, args) =>
                {
                    _gettingMap = false;
                    _map        = ((MyOnMapReady)sender).Map;

                    MoveCamera();
                };

                _gettingMap = true;

                _mapFragment.GetMapAsync(mapReadyCallback);
            }
        }
예제 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            //this.OverridePendingTransition(Resource.Animation.SlideInRight, Resource.Animation.SlideOutLeft);
            this.Window.AddFlags(WindowManagerFlags.Fullscreen);

            /*ActionBar.SetDisplayHomeAsUpEnabled(false);
            *  ActionBar.SetDisplayShowHomeEnabled(false);*/

            var par = (RelativeLayout.LayoutParams)_btnClose.LayoutParameters;

            par.AddRule(LayoutRules.AlignParentRight, 0);
            par.AddRule(LayoutRules.AlignParentLeft);

            _btnClose.LayoutParameters = par;

            _Mappa = JsonConvert.DeserializeObject <Mappa>(Intent.GetStringExtra("mappa"));           //(Mappa)ActivitiesBringe.GetObject();

            _MapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_MapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(false)
                                              .InvokeCompassEnabled(true);

                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _MapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(_contentView.Id, _MapFragment, "map");
                fragTx.Commit();
            }

            SetupMapIfNeeded();
        }
예제 #3
0
        public static MapFragment AddMapFragmentToLayout(this AppCompatActivity activity, int resourceId, string tag = "map_frag",
                                                         IOnMapReadyCallback onMapReadyCallback = null)
        {
            var options = new GoogleMapOptions();

            options.InvokeMapType(GoogleMap.MapTypeHybrid)
            .InvokeCompassEnabled(true);

            var mapFrag = MapFragment.NewInstance(options);

            activity.FragmentManager.BeginTransaction()
            .Add(resourceId, mapFrag, tag)
            .Commit();

            if (onMapReadyCallback == null)
            {
                if (activity is IOnMapReadyCallback callback)
                {
                    mapFrag.GetMapAsync(callback);
                }
                else
                {
                    throw new
                          ArgumentException("If the onMapReadyCallback is null, then the activity must implement the interface IOnMapReadyCallback.",
                                            nameof(activity));
                }
            }
            else
            {
                mapFrag.GetMapAsync(onMapReadyCallback);
            }

            return(mapFrag);
        }
예제 #4
0
        /// <summary>
        /// Loads all of the needed elements
        /// </summary>
        /// <param name="savedInstanceState"></param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                Forms.Init(this, savedInstanceState);
                Xamarin.Essentials.Platform.Init(this, savedInstanceState);

                SetContentView(Resource.Layout.activity_main);

                finalOrder = new FinalOrder();

                fusedLocationProviderClient = LocationServices.GetFusedLocationProviderClient(this);
                var location = fusedLocationProviderClient.GetLastLocationAsync();

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

                mapFragment.GetMapAsync(this);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
예제 #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                SetContentView(Resource.Layout.Passenger);
                Platform.Init(this, savedInstanceState);

                SetContentView(Resource.Layout.Map_layout);
                mapFragment = FragmentManager.FindFragmentByTag("passengermap") as MapFragment;
                if (mapFragment == null)
                {
                    GoogleMapOptions Options = new GoogleMapOptions()
                                               .InvokeRotateGesturesEnabled(true);
                    mapFragment = MapFragment.NewInstance(Options);
                    FragmentManager.BeginTransaction().Add(Resource.Id.map, mapFragment).Commit();
                }

                mapFragment.GetMapAsync(this);


                // Create your application here

                //AddMarker(await GetLocation());
            }
            catch (Exception)
            {
                Toast.MakeText(this, "Error occured", ToastLength.Long).Show();
                var intent = new Intent(this, typeof(MainPage));
                StartActivity(intent);
            }
        }
예제 #6
0
        // Initialize the map
        private void SetUpMap()
        {
            MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);

            // Call GetMapAsync Method for map deployment in this activity
            mapFragment.GetMapAsync(this);
        }
예제 #7
0
 public void OnLocationChanged(Location location)
 {
     ViewModel.Latitude  = location.Latitude;
     ViewModel.Longitude = location.Longitude;
     ViewModel.Altitude  = location.Altitude;
     MapFragment.GetMapAsync(this);
 }
예제 #8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
            GoogleMap   map         = mapFragment.Map;

            // TODO: move this to a listener instead
            map.MyLocationEnabled = true;

            var location = map.MyLocation;

            if (location == null)
            {
                LocationManager locationManager = (LocationManager)GetSystemService(Service.LocationService);
                Criteria        criteria        = new Criteria();
                String          provider        = locationManager.GetBestProvider(criteria, true);
                location = locationManager.GetLastKnownLocation(provider);
            }
            if (location != null)
            {
                // TODO: get marker from Parse
                var latlong = new LatLng(location.Latitude, location.Longitude);
                map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(latlong, 16));

                MarkerOptions markerOption = new MarkerOptions();
                markerOption.SetPosition(latlong);
                markerOption.SetTitle("Ganteng");
                markerOption.InvokeIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.Icon));
                map.AddMarker(markerOption);
            }
        }
예제 #9
0
        protected override void OnResume()
        {
            base.OnResume();
            LocationManager = GetSystemService(LocationService) as LocationManager;
            const string provider = LocationManager.GpsProvider;

            try
            {
                if (LocationManager.IsProviderEnabled(provider))
                {
                    LocationManager.RequestLocationUpdates(provider, 500, 1, this);
                }
                var location = LocationManager.GetLastKnownLocation(LocationManager.NetworkProvider);
                if (location == null)
                {
                    App.LogOutLn("No Location received", GetType().Name);
                }
                else
                {
                    ViewModel.Latitude  = location.Latitude;
                    ViewModel.Longitude = location.Longitude;
                    ViewModel.Altitude  = location.Altitude;
                }
            }
            catch (Exception e)
            {
                App.LogOutLn(e.Message, GetType().Name);
            }
            MapFragment.GetMapAsync(this);
        }
예제 #10
0
        public void OnMapReady(GoogleMap map)
        {
            var mapOptions = new GoogleMapOptions()
                             .InvokeMapType(GoogleMap.MapTypeNormal)
                             .InvokeZoomControlsEnabled(false)
                             .InvokeCompassEnabled(true);

            var fragTx = FragmentManager.BeginTransaction();

            _mapFragment = MapFragment.NewInstance(mapOptions);
            fragTx.Add(Resource.Id.map_fragment_container, _mapFragment, "map");
            fragTx.Commit();

            var location = new LatLng(ViewModel.Latitude ?? 0, ViewModel.Longitude ?? 0);
            var builder  = CameraPosition.InvokeBuilder();

            builder.Target(location);
            builder.Zoom(18);

            var cameraPosition = builder.Build();
            var cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            map.MoveCamera(cameraUpdate);

            var markerOpt1 = new MarkerOptions();

            markerOpt1.SetPosition(location);
            markerOpt1.SetTitle(ViewModel.Title);
            map.AddMarker(markerOpt1);
        }
예제 #11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_home);

            StaticMenu.id_page = 1;

            home_container = FindViewById <RelativeLayout>(Resource.Id.home_container);
            s_user         = FindViewById <TextView>(Resource.Id.s_user);

            s_user.Text = StaticUser.FirstName + " " + StaticUser.LastName;

            MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.fragmentMap);

            mapFragment.GetMapAsync(this);

            BuildLocationRequest();
            BuildLocationCallBack();

            fusedLocationProviderClient = LocationServices.GetFusedLocationProviderClient(this);

            //ResetUser();
            fusedLocationProviderClient.RequestLocationUpdates(locationRequest,
                                                               locationCallback, Looper.MyLooper());

            //Task.Delay(1000).ContinueWith(t =>
            //{
            //	OnMapReady(_googleMap);
            //}, TaskScheduler.FromCurrentSynchronizationContext());
        }
예제 #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            SetContentView(Resource.Layout.update_layout);
            base.OnCreate(savedInstanceState);

            fname  = FindViewById <EditText>(Resource.Id.txt_first_name_up);
            lname  = FindViewById <EditText>(Resource.Id.txt_last_name_up);
            Phnum  = FindViewById <EditText>(Resource.Id.txt_phone_number_up);
            Adress = FindViewById <EditText>(Resource.Id.txt_address_up);
            Ctr    = FindViewById <EditText>(Resource.Id.txt_country_up);
            Mail   = FindViewById <EditText>(Resource.Id.txt_email_address_up);

            //Get Api
            string url            = "https://10.0.2.2:5001/api/Users/1";
            string result         = "";
            var    httpWebRequest = new HttpWebRequest(new Uri(url));

            httpWebRequest.ServerCertificateValidationCallback = delegate { return(true); };
            httpWebRequest.ContentType = "application/json";
            httpWebRequest.Method      = "Get";

            HttpWebResponse response = (HttpWebResponse)httpWebRequest.GetResponse();

            using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
            {
                result = reader.ReadToEnd();
            }

            User user = new User();

            user = Newtonsoft.Json.JsonConvert.DeserializeObject <User>(result);

            fname.Text  = user.FirstName;
            lname.Text  = user.LastName;
            Phnum.Text  = user.PhoneNumber;
            Adress.Text = user.Address;
            Ctr.Text    = user.Country;
            Mail.Text   = user.EmailAddress;

            Button btn_Share = FindViewById <Button>(Resource.Id.btn_share);

            btn_Share.Click += Btn_Share_Click;

            Button btn_Send = FindViewById <Button>(Resource.Id.btn_send);

            btn_Send.Click += Btn_Send_Click;

            Button btn_connect = FindViewById <Button>(Resource.Id.btn_connection);

            btn_connect.Click += Btn_connect_Click;

            //Map
            var mapFrag = MapFragment.NewInstance();// mapOptions);

            FragmentManager.BeginTransaction()
            .Add(Resource.Id.map_Fragtag, mapFrag, "map_fragment")
            .Commit();

            mapFrag.GetMapAsync(this);
        }
예제 #13
0
        private async void AutoComplete()
        {
            OnPrepareOptionsMenu(actionBarMenu);
            actionBarMenu.FindItem(Resource.Id.action_add_to_fav).SetVisible(false);

            try
            {
                MapFragment mapFragment = FragmentManager.FindFragmentByTag <MapFragment>("MAP_FRAGMENT");

                // just dont autocomplete
                if (mapFragment.MyLocation == null)
                {
                    return;
                }

                List <Prediction> predictions = await PlacesService.GetSearchQueryPredictions(
                    searchTextView.Text, mapFragment.MyLocation);

                AWidget.ArrayAdapter adapter = new AWidget.ArrayAdapter <string>(
                    this, Android.Resource.Layout.SimpleDropDownItem1Line, predictions.Select(x => x.description).ToArray());

                searchTextView.Adapter = adapter;
                adapter.NotifyDataSetChanged();
            }
            catch (ApiCallException)
            {
            }
            catch (QueryAutoCompleteException)
            {
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here

            SetContentView(Resource.Layout.Locations);
            //initializing components
            set_location = FindViewById <Button>(Resource.Id.btn_set_1);
            //srch_button = FindViewById<Button>(Resource.Id.btn_srch_1);
            //srch_text = FindViewById<EditText>(Resource.Id.search_text);
            loader = FindViewById <LoadingView>(Resource.Id.loading_view);


            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            map1 = MapFragment.NewInstance();
            var ft = FragmentManager.BeginTransaction();

            ft.Add(Resource.Id.map_placeholder, map1).Commit();
            map1.GetMapAsync(this);

            imgsearchicon = (Button)FindViewById(Resource.Id.btnsearchimg);



            //setting on click events
            set_location.Click  += Set_location_Click;
            imgsearchicon.Click += Imgsearchicon_Click;
        }
예제 #15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            txtTimeZone = FindViewById<TextView>(Resource.Id.txtUserAddress);

            //Check if location enabled
            if (!LocManager.IsProviderEnabled(LocationManager.GpsProvider))
            {
                ShowLocationDisableAlert();
            }

            //register location update service
            ERoadApp.Current.LocationServiceConnected += (object sender, ServiceConnectedEventArgs e) =>
            {
                ERoadApp.Current.LocationService.LocationChanged += HandleLocationChanged;
                ERoadApp.Current.LocationService.ProviderDisabled += HandleProviderDisabled;
                ERoadApp.Current.LocationService.ProviderEnabled += HandleProviderEnabled;
                ERoadApp.Current.LocationService.StatusChanged += HandleStatusChanged;
            };
            //Start service
            ERoadApp.StartLocationService();

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

        }
예제 #16
0
파일: MainActivity.cs 프로젝트: wsabor/AX
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

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

            if (map != null)
            {
                LatLng location = new LatLng(-23.549852, -46.633935);

                CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                builder.Target(location);
                builder.Zoom(16);

                CameraPosition cameraPosition = builder.Build();
                CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

                map.MoveCamera(cameraUpdate);

                map.MyLocationEnabled = true;


                MarkerOptions markerOpt1 = new MarkerOptions();
                markerOpt1.SetPosition(new LatLng(-23.550368, -46.631725));
                markerOpt1.SetTitle("Ponto Central");
                map.AddMarker(markerOpt1);
            }
        }
예제 #17
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            spinner = FindViewById <Spinner>(Resource.Id.spinner);
            MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);

            mapFragment.GetMapAsync(this);


            spinner.ItemSelected += Spinner_ItemSelected;


            locationManager = (LocationManager)GetSystemService(Context.LocationService);
            provider        = locationManager.GetBestProvider(new Criteria(), false);

            Location location = locationManager.GetLastKnownLocation(provider);

            if (location == null)
            {
                System.Diagnostics.Debug.WriteLine("No Location");
            }
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            View v = inflater.Inflate(Resource.Layout.fragment_agencydetail, container, false);

            TextView Name        = v.FindViewById <TextView>(Resource.Id.Aname);
            TextView Phonenumber = v.FindViewById <TextView>(Resource.Id.APhonenumber);
            TextView AEmail      = v.FindViewById <TextView>(Resource.Id.Aemail);
            TextView Alocation   = v.FindViewById <TextView>(Resource.Id.Alocation);

            Name.Text        = agencies[0].agencyname;
            Phonenumber.Text = agencies[0].agencyphonenumber;
            AEmail.Text      = agencies[0].agencyemail;
            Alocation.Text   = agencies[0].agencylocation;


            var mapFrag = MapFragment.NewInstance();

            ChildFragmentManager.BeginTransaction()
            .Add(Resource.Id.mapAFrgContainer, mapFrag, "map")
            .Commit();

            mapFrag.GetMapAsync(this);


            Button btnShare = v.FindViewById <Button>(Resource.Id.btnAShare);
            Button btnSMS   = v.FindViewById <Button>(Resource.Id.btnASMS);
            Button btnShow  = v.FindViewById <Button>(Resource.Id.btnAShow);

            btnShare.Click += BtnShare_Click;
            btnSMS.Click   += BtnSMS_Click;
            btnShow.Click  += BtnShow_Click;

            return(v);
        }
예제 #19
0
        async void drawMark(string type, GeoPoint point)
        {
            MapFragment mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);

            Android.Gms.Maps.GoogleMap map = mapFrag.Map;
            Marker        marker;
            MarkerOptions markerOptions;

            switch (type)
            {
            case "origin":
                markerOptions = new MarkerOptions();
                markerOptions.SetPosition(new LatLng(point.latitude, point.longitude));
                markerOptions.SetTitle("Origin");
                marker = map.AddMarker(markerOptions);
                marker.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.car));
                break;

            case "finalDestionation":
                markerOptions = new MarkerOptions();
                markerOptions.SetPosition(new LatLng(point.latitude, point.longitude));
                markerOptions.SetTitle("Final Destination");
                marker = map.AddMarker(markerOptions);
                marker.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.CheckeredFlag));
                break;

            case "pitStop":
                markerOptions = new MarkerOptions();
                markerOptions.SetPosition(new LatLng(point.latitude, point.longitude));
                markerOptions.SetTitle("Final Destination");
                marker = map.AddMarker(markerOptions);
                break;
            }
        }
예제 #20
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_task_list);

            s_order         = FindViewById <EditText>(Resource.Id.s_order);
            s_task          = FindViewById <EditText>(Resource.Id.s_task);
            btn_abort_order = FindViewById <Button>(Resource.Id.btn_abort_order);
            btn_performed   = FindViewById <Button>(Resource.Id.btn_performed);

            MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.fragmentMap);

            mapFragment.GetMapAsync(this);

            s_order.Focusable     = false;
            s_order.LongClickable = false;
            s_task.Focusable      = false;
            s_task.LongClickable  = false;

            BuildLocationRequest();
            BuildLocationCallBack();

            fusedLocationProviderClient = LocationServices.GetFusedLocationProviderClient(this);

            //ResetUser();
            fusedLocationProviderClient.RequestLocationUpdates(locationRequest,
                                                               locationCallback, Looper.MyLooper());
        }
예제 #21
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            permissionHelper            = new MappingPermissionsHelper(this);
            getLocationPermissionsAsync = permissionHelper.CheckAndRequestPermissions();

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            mapFragment = FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;

            mapFragment.GetMapAsync(this);

            if (GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(this) == 0)
            {
                apiClient = new GoogleApiClient.Builder(this)
                            .AddConnectionCallbacks(this)
                            .AddOnConnectionFailedListener(this)
                            .AddApi(LocationServices.API)
                            // Uncomment to test the error recovery code.
                            //.AddApi(PlusClass.API)
                            //.AddScope(PlusClass.ScopePlusLogin)
                            .Build();
            }
        }
예제 #22
0
        private async void ShowRouteToPlace(Place place)
        {
            ProgressDialog pleaseWaitDialog = new ProgressDialog(this);

            pleaseWaitDialog.SetMessage(GetString(Resource.String.please_wait));
            pleaseWaitDialog.SetCancelable(false);
            pleaseWaitDialog.Show();

            try
            {
                MapFragment mapFragment = FragmentManager.FindFragmentByTag <MapFragment>("MAP_FRAGMENT");

                nearestPlace = place;
                Route route = await DirectionsService.GetShortestRoute(
                    mapFragment.MyLocation, place.geometry.location);

                mapFragment.DrawRouteToPlace(route, nearestPlace);
            }
            catch (ApiCallException)
            {
            }
            catch (DirectionsException)
            {
            }
            finally
            {
                pleaseWaitDialog.Cancel();
            }
        }
예제 #23
0
        public void OnLocationChanged(Location location)
        {
            _currentLocation = location;
            if (_currentLocation == null)
            {
                Toast.MakeText(this, "current location not available", ToastLength.Short).Show();
            }
            else
            {
                _locationText = string.Format("{0:f6},{1:f6}", _currentLocation.Latitude, _currentLocation.Longitude);
                latitude      = _currentLocation.Latitude;
                longitude     = _currentLocation.Longitude;

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

                map.SetOnInfoWindowClickListener(this);

                mountainsRepository = new MountainsService();
                mMountains          = mountainsRepository.GetAllMountains();

                foreach (Mountain item in mMountains)
                {
                    marker = map.AddMarker(new MarkerOptions()
                                           .SetPosition(new LatLng(item.Lat, item.Lng))
                                           .SetTitle(item.MtName)
                                           .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueYellow)));
                }
            }
        }
예제 #24
0
        //Marker _firstMarker;
        //Marker _secondMarker;
        //Marker _thirdMarker;

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Maps);

            _pDialog = new ProgressDialog(this);
            _pDialog.Indeterminate = true;
            _pDialog.SetProgressStyle(ProgressDialogStyle.Spinner);
            _pDialog.SetMessage("Chargement...");
            _pDialog.SetCancelable(true);
            _pDialog.Show();

            _locationManager = GetSystemService(Context.LocationService) as LocationManager;

            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeSatellite)
                                              .InvokeZoomControlsEnabled(false)
                                              .InvokeCompassEnabled(true);

                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();
            }
            _mapFragment.GetMapAsync(this);
        }
예제 #25
0
        public async void LoadMapLayout()
        {
            await System.Threading.Tasks.Task.Run(() =>
            {
                this.RunOnUiThread(() =>
                {
                    if (CheckConnection.IsInternet())
                    {
                        GetPlaceInfo(Name, LatLon.Split(",")[0], LatLon.Split(",")[1]);
                        foodiPlaces = GetPlaces();

                        placeAdapter = new FoodiPlaceAdapter(foodiPlaces, this);
                        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);
                        radLvFoodiPlaces.SetLayoutManager(linearLayoutManager);
                        radLvFoodiPlaces.SetAdapter(placeAdapter);

                        FoodiPlacesClickListenner foodiPlacesClickListenner = new FoodiPlacesClickListenner(this, placeAdapter);
                        radLvFoodiPlaces.AddItemClickListener(foodiPlacesClickListenner);
                        mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
                        mapFragment.GetMapAsync(this);

                        DisplayCustomRatingBar(ratingBar);
                    }
                    else
                    {
                        Toast.MakeText(this, "No Internet Connected!", ToastLength.Long).Show();
                    }
                });
            });
        }
예제 #26
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Map);

            // Create your application here
            ImageButton img_Back = FindViewById <ImageButton>(Resource.Id.imageButton_Back);

            img_Back.Click += Img_Back_Click;
            MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);

            mapFragment.GetMapAsync(this);
            locationManager = (LocationManager)GetSystemService(Context.LocationService);
            provider        = locationManager.GetBestProvider(new Criteria(), false);

            Location location = locationManager.GetLastKnownLocation(provider);

            if (location == null)
            {
                System.Diagnostics.Debug.WriteLine("ERROR");
            }
            //
            FnProcessOnMap();
        }
예제 #27
0
        protected override void OnStart()
        {
            base.OnStart();

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

            this.map = mapFrag.Map;
            if (this.map != null)
            {
                // The GoogleMap object is ready to go.
                if (this.cameraUpdate == null)
                {
                    InitMapInRegion();
                }
                this.map.MarkerClick  += OnMapMarkerClick;
                this.map.MapClick     += OnMapClick;
                this.map.MapLongClick += MapLongClick;

                // Clean Map to ensure to load new items created at Tools
                ClearMap();

                // Load Markers
                InitMarkers();
            }
        }
예제 #28
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.LocationSelector);

            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;

            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions().InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(true)
                                              .InvokeCompassEnabled(true);

                var fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.AddToBackStack("LocationSelectorMap");
                fragTx.Commit();
            }

            _mapFragment.GetMapAsync(this);

            _locationManager = GetSystemService(LocationService) as LocationManager;

            _saveButton = (Button)FindViewById(Resource.Id.saveButton);
            _saveButton.BringToFront();

            _saveButton.Click += delegate(object sender, EventArgs e) {
                this.ChargingLocation = _marker.Position;
                this.Finish();
            };
        }
예제 #29
0
        /// <summary>
        /// Initiates a map fragment
        /// </summary>
        private void InitMapFragment()
        {
            _locationManager = (LocationManager)GetSystemService(LocationService);

            Criteria criteriaForLocationService = new Criteria
            {
                Accuracy = Accuracy.Fine
            };
            IList <string> acceptableLocationProviders = _locationManager.GetProviders(criteriaForLocationService, true);

            if (acceptableLocationProviders.Any())
            {
                _locationProvider = acceptableLocationProviders.First();
            }
            else
            {
                _locationProvider = string.Empty;
            }

            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(true)
                                              .InvokeCompassEnabled(true);

                Android.App.FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.MapFragment, _mapFragment, "map");
                fragTx.Commit();
            }
        }
예제 #30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Map);

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

            map = mapFrag.Map;

            if (map != null)
            {
                MarkerOptions opt1 = new MarkerOptions();

                double lat     = Convert.ToDouble(Intent.GetStringExtra("Latitude"));
                double lng     = Convert.ToDouble(Intent.GetStringExtra("Longitude"));
                string address = Intent.GetStringExtra("Address");

                LatLng location = new LatLng(lat, lng);
                opt1.SetPosition(location);
                opt1.SetTitle(address);
                map.AddMarker(opt1);

                CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                builder.Target(location);
                builder.Zoom(15);

                CameraPosition cameraPosition = builder.Build();
                CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

                map.MoveCamera(cameraUpdate);
            }
        }
예제 #31
0
        private static bool VerifyNoUnicode(MapFragment fragment)
        {
            int x = 0, y = 0;

            foreach (var character in fragment.Map)
            {
                switch (character)
                {
                case '\r':
                    continue;

                case '\n':
                    x = 0;
                    y++;
                    continue;
                }

                if (character != (byte)character)
                {
                    throw new InvalidOperationException($"Invalid character '{character}' at {x},{y}");
                }

                x++;
            }

            return(true);
        }
예제 #32
0
		protected override void OnResume ()
		{
			base.OnResume ();

			// Get a handle on the map element
			_mapFragment = FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;
			_map = _mapFragment.Map;

			// Set the map type 
			_map.MapType = GoogleMap.MapTypeNormal;

			// show user location
			_map.MyLocationEnabled = true;

			// setup a location manager
			_locationManager = GetSystemService(Context.LocationService) as LocationManager;

			// Add points on the map
			MarkerOptions marker1 = new MarkerOptions()
				.SetPosition(Location_Xamarin)
				.SetTitle("Xamarin")
				.InvokeIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue));
			_map.AddMarker(marker1);

			MarkerOptions marker2 = new MarkerOptions()
			    .SetPosition(Location_Atlanta)
			    .SetTitle("Atlanta, GA")
			    .InvokeIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed));
			_map.AddMarker(marker2);

			// Add custom marker images on the map
			AddMonkeyMarkersToMap();

			// Add custom arrow callout on map
			AddInitialNewYorkBarToMap();

			// Add custom overlay image on the map
			PositionChicagoGroundOverlay(Location_Chicago);

			// use a generic location provider instead
			Criteria locationCriteria = new Criteria();
			locationCriteria.Accuracy = Accuracy.Coarse;
			locationCriteria.PowerRequirement = Power.Medium;

			var locationProvider = _locationManager.GetBestProvider(locationCriteria, true);
			if (locationProvider != null)
			{
				_locationManager.RequestLocationUpdates(locationProvider, 2000, 1, this);
			} else
			{
				Log.Info("error", "Best provider is not available. Does the device have location services enabled?");
			}

			// TODO: Step 4a - attach map handler for marker touch
//            _map.MarkerClick += MapOnMarkerClick;

			// TODO: Step 4c - attach map handler for info window touch
//			_map.InfoWindowClick += HandleInfoWindowClick;
		}
예제 #33
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.Main);

            mapFragment = FragmentManager.FindFragmentById<MapFragment> (Resource.Id.mapfragment);
            mapFragment.Init (this, this);
        }
예제 #34
0
        private void SetUpBindings()
        {
            this.SetUpRequestButton();

            mapFragment = this.FragmentManager.FindFragmentById<MapFragment>(Resource.Id.map);

            if (mapFragment.Map == null)
            {
                return;
            }

            var actualCurrentPositionMarker = this.AddNewMarkerToMap(mapFragment,
                new LatLng(0, 0),
                BitmapDescriptorFactory.FromResource(Resource.Drawable.pin));

            var actualVehicleAvailableMarker = this.AddNewMarkerToMap(mapFragment,
                new LatLng(0, 0),
                BitmapDescriptorFactory.FromResource(Resource.Drawable.carAvailable));

            var actualVehicleOccupiedMarker = this.AddNewMarkerToMap(mapFragment,
                new LatLng(0, 0),
                BitmapDescriptorFactory.FromResource(Resource.Drawable.carOccupied));

            var set = this.CreateBindingSet<VehicleDetailView, VehicleDetailViewModel>();

            set.Bind(this)
                .For(view => view.MapCenter)
                .To(vm => vm.CurrentVehicle)
                .WithConversion(new VehicleToLatLngConverter());

            set.Bind(actualCurrentPositionMarker)
                .For(marker => marker.Position)
                .To(vm => vm.CurrentLocation)
                .WithConversion(new LocationToLatLngConverter());

            set.Bind(actualVehicleAvailableMarker)
                .For(marker => marker.Position)
                .To(vm => vm.CurrentVehicle)
                .WithConversion(new VehicleToLatLngConverter());

            set.Bind(actualVehicleAvailableMarker)
                .For(marker => marker.Visible)
                .To(vm => vm.CurrentVehicle.VehicleStatus)
                .WithConversion(new VehicleStatusToBoolConverter(), true);

            set.Bind(actualVehicleOccupiedMarker)
                .For(marker => marker.Position)
                .To(vm => vm.CurrentVehicle)
                .WithConversion(new VehicleToLatLngConverter());

            set.Bind(actualVehicleOccupiedMarker)
                .For(marker => marker.Visible)
                .To(vm => vm.CurrentVehicle.VehicleStatus)
                .WithConversion(new VehicleStatusToBoolConverter());

            set.Apply();
        }
		public override void OnDestroyView ()
		{
			base.OnDestroyView ();

			if (_myMapFrag != null) 
			{
				FragmentManager.BeginTransaction ().Remove (_myMapFrag).Commit ();
				_myMapFrag = null;
			}
		}
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// add map fragment to frame layout
			var mapFragment = new MapFragment ();
			FragmentTransaction fragmentTx = this.FragmentManager.BeginTransaction();
			fragmentTx.Add (Resource.Id.linearLayout1, mapFragment);
			fragmentTx.Commit ();

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);
		}
예제 #37
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            // Start 'GPS'
            InitializeLocationManager ();

            // Setup 'Google Maps'
            mapFrag = (MapFragment) FragmentManager.FindFragmentById(Resource.Id.map);
            map = mapFrag.Map;
        }
예제 #38
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);
        }
예제 #39
0
        // gets the reference to the map instance
        private void SetUpMapIfNeeded()
        {
            mapFragment = FragmentManager.FindFragmentById<MapFragment>(Resource.Id.map9879468784687);
            if (Map == null)
            {
                // registers an event to the handler (implements the callback concept)
                mapReadyCallback.MapReady += (sender, args) =>
                {
                    Map = ((GMapHandler)sender).Map;
                    SetUpMap();
                };

                mapFragment.GetMapAsync(mapReadyCallback);
            }
        }
예제 #40
0
파일: MapActivity.cs 프로젝트: ppkdo/sipper
 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);
 }
		public override void OnResume ()
		{
			base.OnResume ();

			_myMapFrag = FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;
			_map = _myMapFrag.Map;//see GetMapAsync for a non-blocking solution

			_map.MapType = GoogleMap.MapTypeSatellite;

			MarkerOptions markerOp = new MarkerOptions()
				.SetPosition(LatLong_Van)
				.SetTitle("Vancouver")
				.SetSnippet("BC, Canada")
				.InvokeIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueGreen));
			_map.AddMarker(markerOp);
		}
        private void InitMapFragment()
        {
            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                    .InvokeMapType(GoogleMap.MapTypeSatellite)
                    .InvokeZoomControlsEnabled(false)
                    .InvokeCompassEnabled(true);

                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();
            }
        }
예제 #43
0
			public void createMapFragment()
			{
				_mapFragment = _outer.FragmentManager.FindFragmentByTag("map") as MapFragment;
				if (_mapFragment == null)
				{
					var mapOptions = new GoogleMapOptions()
						.InvokeMapType(GoogleMap.MapTypeNormal)
						.InvokeZoomControlsEnabled(false)
						.InvokeCompassEnabled(true);

					var fragTx = _outer.FragmentManager.BeginTransaction();
					_mapFragment = MapFragment.NewInstance(mapOptions);
					fragTx.Add(Resource.Id.map, _mapFragment, "map");
					fragTx.Commit();
				}
			}
예제 #44
0
		protected override void OnResume()
		{
			base.OnResume();

            _mapFragment = FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;
            _map = _mapFragment.Map;

//	         _map.MapType = GoogleMap.MapTypeNormal;
//	         _map.MapType = GoogleMap.MapTypeSatellite;
//	         _map.MapType = GoogleMap.MapTypeHybrid;
	         _map.MapType = GoogleMap.MapTypeTerrain;

	        _map.UiSettings.RotateGesturesEnabled = false;
	        _map.UiSettings.TiltGesturesEnabled = false;
	        _map.UiSettings.ScrollGesturesEnabled = false;
	        _map.UiSettings.ZoomControlsEnabled = false;
	        _map.UiSettings.ZoomGesturesEnabled = false;
		}
		protected override void OnResume ()
		{
			base.OnResume ();

			// Get a handle on the map element
			_mapFragment = FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;
			_map = _mapFragment.Map;

			_map.UiSettings.MyLocationButtonEnabled = true;
			_map.MyLocationEnabled = true;

			_locator = new Geolocator(this) {
				DesiredAccuracy = 1000
			};

			_locator.PositionChanged += OnLocationChanged;
			_locator.StartListening(2000, 1);
		}
예제 #46
0
        protected override void OnResume ()
        {
            base.OnResume ();

			// Get a handle on the map element
			_mapFragment = FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;
			_map = _mapFragment.Map;

			// TODO: Step 2a - show user location
//			 _map.UiSettings.MyLocationButtonEnabled = true;
//			 _map.MyLocationEnabled = true;

			// TODO: Step 2b - setup a location manager
//			 _locationManager = GetSystemService(Context.LocationService) as LocationManager;

			// TODO: Step 2d - use a GPS provider
//			string Provider = LocationManager.GpsProvider;
//			if(_locationManager.IsProviderEnabled(Provider))
//			{
//			    _locationManager.RequestLocationUpdates (Provider, 2000, 1, this);
//			} 
//			else 
//			{
//			    Log.Info("error", Provider + " is not available. Does the device have location services enabled?");
//			}

			// TODO: Step 2e - use a generic location provider instead
//			Criteria locationCriteria = new Criteria();
//			locationCriteria.Accuracy = Accuracy.Coarse;
//			locationCriteria.PowerRequirement = Power.Medium;
//
//			var locationProvider = _locationManager.GetBestProvider(locationCriteria, true);
//			if (locationProvider != null)
//			{
//			    _locationManager.RequestLocationUpdates(locationProvider, 2000, 1, this);
//			} else
//			{
//			    Log.Info("error", "Best provider is not available. Does the device have location services enabled?");
//			}
        }
예제 #47
0
		void Inicializa_MapFragment ()
		{
			//RECUPERAMOS NUESTRO FrameLayout Y LO CONVERTIMOS EN UN MapFragment
			_mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
			if (_mapFragment == null)
			{
				//Configuramos las opciones con las cuales se cargara nuestro mapa,
				// asignamos el tipo de mapa a mostrar
				// habilitamos los botones de zoom 
				// nos muestre el compas en el mapa
				GoogleMapOptions mapOptions = new GoogleMapOptions()
					.InvokeMapType(GoogleMap.MapTypeNormal)
						.InvokeZoomControlsEnabled(true)
						.InvokeCompassEnabled(true);

				//Realizamos la transaccion para cargar el MapFragment con las opciones que definimos
				var fragTx = FragmentManager.BeginTransaction();
				_mapFragment = MapFragment.NewInstance(mapOptions);
				fragTx.Add(Resource.Id.map, _mapFragment, "map");
				fragTx.Commit();
			}
		}
예제 #48
0
        protected override void OnResume ()
        {
            base.OnResume ();

			// Get a handle on the map element
			_mapFragment = FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;
			_map = _mapFragment.Map;

			#region Show Location
			// TODO: Step 2a - show user location
			 _map.MyLocationEnabled = true;

			_map.UiSettings.MyLocationButtonEnabled = true;
			#endregion

			#region Setup Location Manager

			// TODO: Step 2b - setup a location manager
			 _locationManager = GetSystemService(Context.LocationService) as LocationManager;

			#endregion

			#region Get Location Provider 

			// TODO: Step 2d - use a generic location provider
			Criteria locationCriteria = new Criteria();
			locationCriteria.Accuracy = Accuracy.Coarse;
			locationCriteria.PowerRequirement = Power.Medium;

			var locationProvider = _locationManager.GetBestProvider(locationCriteria, true);
			if (locationProvider != null)
			{
			    _locationManager.RequestLocationUpdates(locationProvider, 2000, 1, this);
			} 

			#endregion

        }
예제 #49
0
		protected override void OnResume()
		{
			base.OnResume();

			// TODO: Step 1c - Get a handle on the map element
			#region Find Map Fragment and get a refernce to the Google Map object

            _mapFragment = FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;
           
			_map = _mapFragment.Map;

			#endregion

			#region Set the Map Type

			// TODO: Step 1d - Set the map type 
//	         _map.MapType = GoogleMap.MapTypeNormal;
//	         _map.MapType = GoogleMap.MapTypeSatellite;
//	         _map.MapType = GoogleMap.MapTypeHybrid;
			_map.MapType = GoogleMap.MapTypeTerrain;

			#endregion

			#region Disable Interactions

			// TODO: Step 1e - disable interactions

	        _map.UiSettings.RotateGesturesEnabled = false;
	        _map.UiSettings.TiltGesturesEnabled = false;
	        _map.UiSettings.ScrollGesturesEnabled = false;
	        _map.UiSettings.ZoomControlsEnabled = false;
	        _map.UiSettings.ZoomGesturesEnabled = false; 




			#endregion
		}
예제 #50
0
		public LocationView (MainActivity activity) : base (activity)
		{
			this.activity = activity;
			MapsInitializer.Initialize (activity);

			GoogleMapOptions mapOptions = new GoogleMapOptions()
				.InvokeMapType(GoogleMap.MapTypeNormal)
				.InvokeZoomControlsEnabled(false)
				.InvokeCompassEnabled(true);
			


			mapFragment = MapFragment.NewInstance ();

			mapFragment = MapFragment.NewInstance(mapOptions);

			var ft = activity.FragmentManager.BeginTransaction ();
			Id = View.GenerateViewId();
			ft.Add (Id, mapFragment);
			ft.Commit ();

			DoMapStuff ();
		}
예제 #51
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.Map);

            // Create a map fragment for gmaps
            mapFrag = MapFragment.NewInstance ();
            var tx = FragmentManager.BeginTransaction ();
            tx.Add (Resource.Id.MapLayout, mapFrag);
            tx.Commit ();

            // Grab a ref to the location manager
            var locMgr = GetSystemService (Context.LocationService) as LocationManager;
            // use GPS for location rather than wifi/3G
            var provider = LocationManager.GpsProvider;

            if (locMgr.IsProviderEnabled (provider))
            {
                // grab GPS loc every 5000ms for 1+ meter changes, alert this class' ILocationListener
                locMgr.RequestLocationUpdates (provider, 3000, 1, this);
            }
            else
            {
                // no GPS
                throw new Exception ("ded");
            }

            // wait like an idiot till map is ready
            mapFrag.GetMapAsync(this);
        }
예제 #52
0
        private Marker AddNewMarkerToMap(MapFragment mapFragment, LatLng position, BitmapDescriptor icon)
        {
            var marker = new MarkerOptions();

            marker.SetPosition(position);
            marker.InvokeIcon(icon);

            var actualMarker = mapFragment.Map.AddMarker(marker);
            
            return actualMarker;
        }
예제 #53
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);
            mf = FragmentManager.FindFragmentById (Resource.Id.map) as MapFragment;
            mf.GetMapAsync(this);
            //_shareButton = FindViewById<Button> (Resource.Id.sharebutton);
            //_shareButton.Click += delegate {};
        }
		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


		}
예제 #55
0
        async public void DrawMap()
        {
            if  ( _stateClass._person != null)
            {


                _mapFragment = MapFragment.FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;
                _map = _mapFragment.Map;
                _map.Clear();

                // Set the map type 
                // show user location
                _map.MyLocationEnabled = true;

                // setup a location manager
                _locationManager = _mainActivity.GetSystemService (Context.LocationService) as LocationManager;

                // use a generic location provider instead
                Criteria locationCriteria = new Criteria();
                locationCriteria.Accuracy = Accuracy.Coarse;
                locationCriteria.PowerRequirement = Power.Medium;

                await System.Threading.Tasks.Task.Delay(0);

                var geoCoder = new Geocoder(_mainActivity);
             
                try
                {
                    Address address = this.GetAddressesFromLocation(_stateClass._person.Strasse,_stateClass._person.PLZ,_stateClass._person.Ort,_stateClass._person.Land);
                    MarkerOptions marker1 = new MarkerOptions();

                    if (address != null)
                    {

                        marker1.SetPosition(new LatLng(address.Latitude, address.Longitude));
                        marker1.SetTitle(_stateClass._person.Name + " - " + _stateClass._person.Strasse + " - " + _stateClass._person.Ort + "- " + _stateClass._person.Umsatz);
                        marker1.InvokeIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed));
                        _Marker =  _map.AddMarker(marker1);
                        _map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(new Android.Gms.Maps.Model.LatLng(address.Latitude, address.Longitude), 9.0f));

                    }
                    else
                    {
                        Android.Widget.Toast.MakeText(_mainActivity,_mainActivity.Resources.GetString(Resource.String.AddresseNichtGefunden), Android.Widget.ToastLength.Short).Show();
                    }

                    _map.MarkerClick +=  (object sender, GoogleMap.MarkerClickEventArgs markerClickEventArgs) => 
                        {
                            markerClickEventArgs.Handled = true;
                            Marker marker = markerClickEventArgs.Marker;
                            _map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(marker.Position, 13));
                            marker.ShowInfoWindow();
                        };
                }   

                catch(Exception ex)
                {
                    DataAccessLayer.ExceptionWriter.WriteLogFile(ex);
                }
            }
        }
예제 #56
0
		private void InitMapFragment ()
		{
			mapFragment = (MapFragment)FragmentManager.FindFragmentById (Resource.Id.map);

			// mapFragment.View.Visibility = ViewStates.Gone;
			map = mapFragment.Map;

			if (mode == "info") {
				if (mapFragment != null && mapFragment.View != null) {
					mapFragment.View.Visibility = ViewStates.Gone;
				}
			}

			if (map != null) {
				map.MapType = GoogleMap.MapTypeTerrain;
				map.UiSettings.ZoomControlsEnabled = true;
				map.UiSettings.CompassEnabled = true;
				map.UiSettings.ScrollGesturesEnabled = true;

				GoogleMapOptions mapOptions = new GoogleMapOptions ()
					.InvokeCamera (CameraPosition.FromLatLngZoom (UPC, 16))
					.InvokeScrollGesturesEnabled (true)
					.InvokeMapType (GoogleMap.MapTypeNormal)
					.InvokeZoomControlsEnabled (true)
					.InvokeCompassEnabled (true);

				FragmentTransaction fragTx = FragmentManager.BeginTransaction ();
				mapFragment = MapFragment.NewInstance (mapOptions);
				fragTx.Add (Resource.Id.map, mapFragment, "map");
				fragTx.Commit ();

				/*CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
				builder.Target(UPC);
				builder.Zoom(16);
				CameraPosition cameraPosition = builder.Build();
				CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);

				map.MoveCamera(cameraUpdate);*/

				MarkerOptions markerOptions = new MarkerOptions ();
				markerOptions.SetPosition (UPC);
				markerOptions.SetTitle ("CanchitApp");
				map.AddMarker (markerOptions);
			}
			/*_mapFragment = FragmentManager.FindFragmentByTag ("map") as MapFragment;
			if (_mapFragment == null) {
				GoogleMapOptions mapOptions = new GoogleMapOptions ()
					.InvokeCamera (CameraPosition.FromLatLngZoom (new LatLng (-12.103951800, -76.963278100), 16))
					.InvokeScrollGesturesEnabled (true)
					.InvokeMapType (GoogleMap.MapTypeNormal)
					.InvokeZoomControlsEnabled (true)
					.InvokeCompassEnabled (true);
				//	-12.103951800, -76.963278100

				FragmentTransaction fragTx = FragmentManager.BeginTransaction ();
				_mapFragment = MapFragment.NewInstance (mapOptions);
				fragTx.Add (Resource.Id.map, _mapFragment, "map");
				fragTx.Commit ();
			}*/
		}
예제 #57
0
		public void OnLocationChanged (Android.Locations.Location location)
		{
			currentLocation = location;
			if (map != null) {
				Console.WriteLine ("Latitude: " + location.Latitude.ToString ());
				Console.WriteLine ("Longitude: " + location.Longitude.ToString ());
				Console.WriteLine ("Provider: " + location.Provider.ToString ());

				MarkerOptions markerOptions = new MarkerOptions ();
				markerOptions.SetPosition (new LatLng (location.Latitude, location.Longitude));
				markerOptions.SetTitle ("CanchitApp");
				map.AddMarker (markerOptions);

				GoogleMapOptions mapOptions = new GoogleMapOptions ()
				.InvokeCamera (CameraPosition.FromLatLngZoom (new LatLng (location.Latitude, location.Longitude), 16))
				.InvokeScrollGesturesEnabled (true)
				.InvokeMapType (GoogleMap.MapTypeNormal)
				.InvokeZoomControlsEnabled (true)
				.InvokeCompassEnabled (true);

				FragmentTransaction fragTx = FragmentManager.BeginTransaction ();
				mapFragment = MapFragment.NewInstance (mapOptions);
				fragTx.Add (Resource.Id.map, mapFragment, "map");
				fragTx.Commit ();
			}
		}
예제 #58
0
        public override void OnStart ()
        {
            base.OnStart ();


            if (_person != null)
            {
                _mapFragment = FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;
                if (_mapFragment == null)
                    return;
                _map = _mapFragment.Map;


                // Set the map type 
                _map.MapType = GoogleMap.MapTypeNormal;

                // show user location
                _map.MyLocationEnabled = true;

                // setup a location manager
                _locationManager = _activity.GetSystemService (Context.LocationService) as LocationManager;

                // use a generic location provider instead
                Criteria locationCriteria = new Criteria();
                locationCriteria.Accuracy = Accuracy.Coarse;
                locationCriteria.PowerRequirement = Power.Medium;

                var geoCoder = new Geocoder(_activity);

                try
                {
                    Address address = this.GetAddressesFromLocation(_person.Strasse,_person.PLZ,_person.Ort,_person.Land);
                    MarkerOptions marker1 = new MarkerOptions();

                    if (address != null)
                    {

                        marker1.SetPosition(new LatLng(address.Latitude, address.Longitude));
                        marker1.SetTitle(_person.Name + " - " + _person.Strasse + " - " + _person.Ort + "- " + _person.Umsatz);
                        marker1.InvokeIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed));
                        _Marker =  _map.AddMarker(marker1);
                        _map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(new Android.Gms.Maps.Model.LatLng(address.Latitude, address.Longitude), 9.0f));

                    }
                    else
                    {
                        Android.Widget.Toast.MakeText(_activity,_activity.Resources.GetString(Resource.String.AddresseNichtGefunden), Android.Widget.ToastLength.Short).Show();
                    }


                    _map.MarkerClick += MapOnMarkerClick;



                }   

                catch(Exception ex)
                {
                    DataAccessLayer.ExceptionWriter.WriteLogFile(ex);
                }




            }       
        }
		protected async override void OnCreate (Bundle savedInstanceState){
			base.OnCreate (savedInstanceState);
			var prefs = this.GetSharedPreferences ("RunningAssistant.preferences", FileCreationMode.Private);
			SetContentView (Resource.Layout.agregar_negocio);


			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);
			SupportActionBar.Title = "Añadir Negocio";

			mItems = new List<Categoria> ();
			fossbytes = new List<byte[]>();
			deleteimgnegocio = FindViewById<Button> (Resource.Id.deleteimgnegocio);

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

			FragmentMap = FindViewById<LinearLayout> (Resource.Id.fragmentmap);
			mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
			map = mapFrag.Map;

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

			mToolbar.SetBackgroundColor (Color.Argb (255, 51, 150, 209));
			string tag="ASIGNACION";
			//Asignacion de variables
			try{
			Log.Debug(tag, "asigna");
			nombre = FindViewById<EditText> (Resource.Id.nombre);
				Log.Debug(tag, "asigna");
			descripcion = FindViewById<EditText> (Resource.Id.descripcion);
				Log.Debug(tag, "asigna");
			sitioweb = FindViewById<EditText> (Resource.Id.sitioweb);
				Log.Debug(tag, "asigna");
			email = FindViewById<EditText> (Resource.Id.email);
				Log.Debug(tag, "asigna");
			telefono = FindViewById<EditText> (Resource.Id.telefonoedit);
				Log.Debug(tag, "asigna");
			pais = FindViewById<EditText> (Resource.Id.pais);
				Log.Debug(tag, "asigna");
			ciudad = FindViewById<EditText> (Resource.Id.ciudad);
				Log.Debug(tag, "asigna");
			colonia = FindViewById<EditText> (Resource.Id.colonia);
				Log.Debug(tag, "asigna");
			calle = FindViewById<EditText> (Resource.Id.calle);
				Log.Debug(tag, "asigna");
			numero = FindViewById<EditText> (Resource.Id.numero);
				Log.Debug(tag, "asigna");
			codigopostal = FindViewById<EditText> (Resource.Id.codigopostal);
				Log.Debug(tag, "asigna");
			referencias = FindViewById<EditText> (Resource.Id.referencias);
				Log.Debug(tag, "asigna");
			facebook = FindViewById<EditText> (Resource.Id.facebook);
				Log.Debug(tag, "asignaeste");
			twitter = FindViewById<EditText> (Resource.Id.twitter);
				Log.Debug(tag, "asignaultimo");
			whatsapp = FindViewById<EditText> (Resource.Id.whatsapp);
				Log.Debug(tag, "asignaultimoultimo");
				tagsnegocio = FindViewById<EditText> (Resource.Id.tagsnegocio);
				Log.Debug(tag, "pasó");

				//<!-- Dias de la semana -->
				Log.Debug(tag, "asigna");
				lunes_a = FindViewById<TextView> (Resource.Id.lunes_a);
				Log.Debug(tag, "asigna");
				lunes_c = FindViewById<TextView> (Resource.Id.lunes_c);
				Log.Debug(tag, "asigna");
				martes_a = FindViewById<TextView> (Resource.Id.martes_a);
				Log.Debug(tag, "asigna");
				martes_c = FindViewById<TextView> (Resource.Id.martes_c);
				Log.Debug(tag, "asigna");
				miercoles_a = FindViewById<TextView> (Resource.Id.miercoles_a);
				Log.Debug(tag, "asigna");
				miercoles_c = FindViewById<TextView> (Resource.Id.miercoles_c);
				Log.Debug(tag, "asigna");
				jueves_a = FindViewById<TextView> (Resource.Id.jueves_a);
				Log.Debug(tag, "asigna");
				jueves_c = FindViewById<TextView> (Resource.Id.jueves_c);
				Log.Debug(tag, "asigna");
				viernes_a = FindViewById<TextView> (Resource.Id.viernes_a);
				Log.Debug(tag, "asigna");
				viernes_c = FindViewById<TextView> (Resource.Id.viernes_c);
				Log.Debug(tag, "asigna");
				sabado_a = FindViewById<TextView> (Resource.Id.sabado_a);
				Log.Debug(tag, "asigna");
				sabado_c = FindViewById<TextView> (Resource.Id.sabado_c);
				Log.Debug(tag, "asigna");
				domingo_a = FindViewById<TextView> (Resource.Id.domingo_a);
				Log.Debug(tag, "asigna");
				domingo_c = FindViewById<TextView> (Resource.Id.domingo_c);
				Log.Debug(tag, "asigna");

			//<!-- Radio Groups -->
				Log.Debug(tag, "asigna");
			region = FindViewById<RadioGroup> (Resource.Id.region);
				Log.Debug(tag, "asigna");
			reservaciones = FindViewById<RadioGroup> (Resource.Id.reservaciones);
				Log.Debug(tag, "asigna");
			entregaadomicilio = FindViewById<RadioGroup> (Resource.Id.entregaadomicilio);
				Log.Debug(tag, "asigna");
			parallevar = FindViewById<RadioGroup> (Resource.Id.parallevar);
				Log.Debug(tag, "asigna");
			aceptatarjeta = FindViewById<RadioGroup> (Resource.Id.aceptatarjeta);
				Log.Debug(tag, "asigna");
			ambientefamiliar = FindViewById<RadioGroup> (Resource.Id.ambientefamiliar);
				Log.Debug(tag, "asigna");
			estacionamiento = FindViewById<RadioGroup> (Resource.Id.estacionamiento);
				Log.Debug(tag, "asigna");
			nivelruido = FindViewById<RadioGroup> (Resource.Id.nivelruido);
				Log.Debug(tag, "asigna");
			alcohol = FindViewById<RadioGroup> (Resource.Id.alcohol);
				Log.Debug(tag, "asigna");
			tienetv = FindViewById<RadioGroup> (Resource.Id.tienetv);
				Log.Debug(tag, "asigna");
			tienemeseros = FindViewById<RadioGroup> (Resource.Id.tienemeserios);
				Log.Debug(tag, "asigna");
			enviarnegocio = FindViewById<Button> (Resource.Id.enviarnegociop);
				imhere=FindViewById<Button> (Resource.Id.imhere);


		}catch(Exception ex){
				Log.Debug (tag, "f**k: "+ex);
			}


			//Se llena el Spinner de las categorías		
			try{
				categorias_array = await plifserver.FetchWeatherAsync("http://plif.mx/mobile/get_cats_neg");
				objeto = categorias_array["respuesta"];
				Log.Debug("AgregarNegocio", "Antes del Foreach");
				foreach(JsonObject data in objeto){
					
					Log.Debug("AgregarNegocio", "Entra Foreach: "+data["categorias"]["id"]+" "+data["categorias"]["nombre"]);
					mItems.Add(new Categoria(){
						Id = data["categorias"]["id"],
						Nombre = data["categorias"]["nombre"]
					});

					Log.Debug("AgregarNegocio", "Sale de Foreach");

				}


			}catch(Exception ex){
				Toast.MakeText (Application.Context, "Ocurrió un error al recuperar las categorías", ToastLength.Long).Show ();
				Log.Debug ("Foreach","ERRORRRR!!! "+ex.ToString());
			}

			//Se asignan las categorias al spinnes
			Spinner categ = FindViewById<Spinner> (Resource.Id.categorias);
			MyNegociosAdapter adapter_c = new MyNegociosAdapter (Application.Context, mItems);
			categ.Adapter = adapter_c;

			//Se crea el event handler para las categorías
			try{
			categ.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (c_spinner_ItemSelected);
			}catch(Exception ex){
				Log.Debug ("Handler","Lel, error: "+ex.ToString());
			}

			//ya aqui hacemos todo el desmadre

			enviarnegocio = FindViewById<Button> (Resource.Id.enviarnegociop);

			if (enviarnegocio == null) {
				Log.Debug (tag, "es nulo D:");
			}

			hour = DateTime.Now.Hour;
			minute = DateTime.Now.Minute;
			//AQUI PARA PONER LAS HORAS!!!!!

			//INICIA LUNES
			lunes_a.InputType = Android.Text.InputTypes.Null;
			lunes_c.InputType = Android.Text.InputTypes.Null;

			Android.Support.V7.Widget.SwitchCompat lunes_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.lunes_ac);

			lunes_ac.Click += (object sender, EventArgs e) => {
				if(lunes_ac.Checked==true){
					lunes_a.Text="";
					lunes_a.Enabled=true;

					lunes_c.Text="";
					lunes_c.Enabled=true;
				}else{
					lunes_a.Text="Cerrado";
					lunes_a.Enabled=false;

					lunes_c.Text="Cerrado";
					lunes_c.Enabled=false;
				}
			};

			lunes_ac.PerformClick ();


			lunes_a.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó lunes a");
				currenthour=lunes_a;
				ShowDialog(TIME_DIALOG_ID);
			};

			lunes_c.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó lunes c");
				currenthour=lunes_c;
				ShowDialog(TIME_DIALOG_ID);
			};
			//TERMINA LUNES

			//INICIA martes
			martes_a.InputType = Android.Text.InputTypes.Null;
			martes_c.InputType = Android.Text.InputTypes.Null;

			Android.Support.V7.Widget.SwitchCompat martes_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.martes_ac);

			martes_ac.Click += (object sender, EventArgs e) => {
				if(martes_ac.Checked==true){
					martes_a.Text="";
					martes_a.Enabled=true;

					martes_c.Text="";
					martes_c.Enabled=true;
				}else{
					martes_a.Text="Cerrado";
					martes_a.Enabled=false;

					martes_c.Text="Cerrado";
					martes_c.Enabled=false;
				}
			};

			martes_ac.PerformClick ();


			martes_a.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó martes a");
				currenthour=martes_a;
				ShowDialog(TIME_DIALOG_ID);
			};

			martes_c.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó martes c");
				currenthour=martes_c;
				ShowDialog(TIME_DIALOG_ID);
			};
			//TERMINA martes

			//INICIA miercoles
			miercoles_a.InputType = Android.Text.InputTypes.Null;
			miercoles_c.InputType = Android.Text.InputTypes.Null;

			Android.Support.V7.Widget.SwitchCompat miercoles_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.miercoles_ac);

			miercoles_ac.Click += (object sender, EventArgs e) => {
				if(miercoles_ac.Checked==true){
					miercoles_a.Text="";
					miercoles_a.Enabled=true;

					miercoles_c.Text="";
					miercoles_c.Enabled=true;
				}else{
					miercoles_a.Text="Cerrado";
					miercoles_a.Enabled=false;

					miercoles_c.Text="Cerrado";
					miercoles_c.Enabled=false;
				}
			};

			miercoles_ac.PerformClick ();


			miercoles_a.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó miercoles a");
				currenthour=miercoles_a;
				ShowDialog(TIME_DIALOG_ID);
			};

			miercoles_c.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó miercoles c");
				currenthour=miercoles_c;
				ShowDialog(TIME_DIALOG_ID);
			};
			//TERMINA miercoles

			//INICIA jueves
			jueves_a.InputType = Android.Text.InputTypes.Null;
			jueves_c.InputType = Android.Text.InputTypes.Null;

			Android.Support.V7.Widget.SwitchCompat jueves_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.jueves_ac);

			jueves_ac.Click += (object sender, EventArgs e) => {
				if(jueves_ac.Checked==true){
					jueves_a.Text="";
					jueves_a.Enabled=true;

					jueves_c.Text="";
					jueves_c.Enabled=true;
				}else{
					jueves_a.Text="Cerrado";
					jueves_a.Enabled=false;

					jueves_c.Text="Cerrado";
					jueves_c.Enabled=false;
				}
			};

			jueves_ac.PerformClick ();


			jueves_a.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó jueves a");
				currenthour=jueves_a;
				ShowDialog(TIME_DIALOG_ID);
			};

			jueves_c.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó jueves c");
				currenthour=jueves_c;
				ShowDialog(TIME_DIALOG_ID);
			};
			//TERMINA jueves

			//INICIA viernes
			viernes_a.InputType = Android.Text.InputTypes.Null;
			viernes_c.InputType = Android.Text.InputTypes.Null;

			Android.Support.V7.Widget.SwitchCompat viernes_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.viernes_ac);

			viernes_ac.Click += (object sender, EventArgs e) => {
				if(viernes_ac.Checked==true){
					viernes_a.Text="";
					viernes_a.Enabled=true;

					viernes_c.Text="";
					viernes_c.Enabled=true;
				}else{
					viernes_a.Text="Cerrado";
					viernes_a.Enabled=false;

					viernes_c.Text="Cerrado";
					viernes_c.Enabled=false;
				}
			};

			viernes_ac.PerformClick ();


			viernes_a.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó viernes a");
				currenthour=viernes_a;
				ShowDialog(TIME_DIALOG_ID);
			};

			viernes_c.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó viernes c");
				currenthour=viernes_c;
				ShowDialog(TIME_DIALOG_ID);
			};
			//TERMINA viernes

			//INICIA sabado
			sabado_a.InputType = Android.Text.InputTypes.Null;
			sabado_c.InputType = Android.Text.InputTypes.Null;

			Android.Support.V7.Widget.SwitchCompat sabado_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.sabado_ac);

			sabado_ac.Click += (object sender, EventArgs e) => {
				if(sabado_ac.Checked==true){
					sabado_a.Text="";
					sabado_a.Enabled=true;

					sabado_c.Text="";
					sabado_c.Enabled=true;
				}else{
					sabado_a.Text="Cerrado";
					sabado_a.Enabled=false;

					sabado_c.Text="Cerrado";
					sabado_c.Enabled=false;
				}
			};

			sabado_ac.PerformClick ();


			sabado_a.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó sabado a");
				currenthour=sabado_a;
				ShowDialog(TIME_DIALOG_ID);
			};

			sabado_c.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó sabado c");
				currenthour=sabado_c;
				ShowDialog(TIME_DIALOG_ID);
			};
			//TERMINA sabado

			//INICIA domingo
			domingo_a.InputType = Android.Text.InputTypes.Null;
			domingo_c.InputType = Android.Text.InputTypes.Null;

			Android.Support.V7.Widget.SwitchCompat domingo_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.domingo_ac);

			domingo_ac.Click += (object sender, EventArgs e) => {
				if(domingo_ac.Checked==true){
					domingo_a.Text="";
					domingo_a.Enabled=true;

					domingo_c.Text="";
					domingo_c.Enabled=true;
				}else{
					domingo_a.Text="Cerrado";
					domingo_a.Enabled=false;

					domingo_c.Text="Cerrado";
					domingo_c.Enabled=false;
				}
			};

			domingo_ac.PerformClick ();


			domingo_a.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó domingo a");
				currenthour=domingo_a;
				ShowDialog(TIME_DIALOG_ID);
			};

			domingo_c.Click += (object sender, EventArgs e) => {
				Log.Debug(tag,"Clickeó domingo c");
				currenthour=domingo_c;
				ShowDialog(TIME_DIALOG_ID);
			};
			//TERMINA domingo








			//TERMINA LO DE PARA PONER LAS HORAS


			imhere.Click += async (object sender, EventArgs e) => {
				Log.Debug(tag, "I am here!!");

				if(lat =="" && lng ==""){
					//aun no hay geo
					Log.Debug(tag,"Aun no hay geo");
                    Toast.MakeText (Application.Context, "Aún estamos localizando tu ubicación. Inténtalo en un momento!", ToastLength.Long).Show ();

				}else{
					geo_lat=lat;
					geo_long=lng;

					Geocoder geocoder = new Geocoder(Application.Context, Java.Util.Locale.Default);

					IList<Address> lista;
					lista = await geocoder.GetFromLocationAsync(Convert.ToDouble(lat), Convert.ToDouble(lng), 10);

					Address address = lista.FirstOrDefault();

					if(address!=null){
						StringBuilder deviceAddress = new StringBuilder();
			
						//Obtener calle y número
						string[] lines = Regex.Split(address.GetAddressLine(0), " ");
						string calle="";
						string colonia=address.GetAddressLine(1);

						for(int j=0; j<=lines.Length-2; j++ ){
							calle=calle+lines[j]+" ";
						}

						string numero=lines[lines.Length-1];

						string codigopostal="";

						string[] cpciudad=Regex.Split(address.GetAddressLine(2), " ");

						codigopostal=cpciudad[0];

						string preciudad="";

						for(int k=1; k<=cpciudad.Length-1; k++){
							preciudad=preciudad+cpciudad[k];
						}

						string[] getciudad=Regex.Split(preciudad, ",");

						string ciudad=getciudad[0];

						string paiss="Mexico";

					//	Toast.MakeText (Application.Context, "La calle es:  "+calle, ToastLength.Long).Show ();
						FindViewById<EditText> (Resource.Id.calle).Text=calle;

					//	Toast.MakeText (Application.Context, "El número es:  "+numero, ToastLength.Long).Show ();
						FindViewById<EditText> (Resource.Id.numero).Text=numero;

					//	Toast.MakeText (Application.Context, "La Colonia es:  "+colonia, ToastLength.Long).Show ();
						FindViewById<EditText> (Resource.Id.colonia).Text=colonia;


					//	Toast.MakeText (Application.Context, "El Codigo Postal es:  "+codigopostal, ToastLength.Long).Show ();
						FindViewById<EditText> (Resource.Id.codigopostal).Text=codigopostal;


					//	Toast.MakeText (Application.Context, "La ciudad es:  "+ciudad, ToastLength.Long).Show ();
						FindViewById<EditText> (Resource.Id.codigopostal).Text=codigopostal;


					//	Toast.MakeText (Application.Context, "El País es:  "+paiss, ToastLength.Long).Show ();
						FindViewById<EditText> (Resource.Id.pais).Text=paiss;

					}

				}

			};

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

			LinearLayout horarioscontainer = FindViewById<LinearLayout> (Resource.Id.horarioscontainer);
			TextView horariostext = FindViewById<TextView> (Resource.Id.horariostext);

			horariostext.Click += delegate {

				if(showinghorarios){
					horarioscontainer.Visibility=ViewStates.Gone;
					showinghorarios=false;
				}else{
					horarioscontainer.Visibility=ViewStates.Visible;
					showinghorarios=true;
				}
			};

			replicar.Click += delegate {
				string lunesa = lunes_a.Text; string lunesc = lunes_c.Text;

				martes_a.Text=lunesa;
				martes_c.Text=lunesc;

				miercoles_a.Text=lunesa;
				miercoles_c.Text=lunesc;

				jueves_a.Text=lunesa;
				jueves_c.Text=lunesc;

				viernes_a.Text=lunesa;
				viernes_c.Text=lunesc;

				sabado_a.Text=lunesa;
				sabado_c.Text=lunesc;

				domingo_a.Text=lunesa;
				domingo_c.Text=lunesc;



			};

			Log.Debug (tag,"Aquí iniciamos a poner los botones de las imagenes");

			GridLayout imgnegocioprev = FindViewById<GridLayout> (Resource.Id.imgnegocioprev);
			TextView masimagenesnegocio = FindViewById<TextView> (Resource.Id.masimagenesnegocio);

			//INICIAN BOTONES DE IMAGENES
			imagennegocio=FindViewById<Button> (Resource.Id.imagennegocio);

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

			};

			Log.Debug (tag,"pasamos el de imagen negocio");

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

			imagencamaranegocio.Click += async (object sender, EventArgs e) => {
				source=2;
				ProcesarImagenes(imgnegocioprev, 3, masimagenesnegocio);
			};
			//TERMINAN BOTONES DE IMAGENES
			Log.Debug (tag,"pasamos el de imagen camara negocio");

			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 3 imágenes más!";
				Log.Debug("DELETEBUTTON","Reseteamos el texto de las imagenes");
			};


			enviarnegocio.Click += async (object sender, EventArgs e) => {
				Log.Debug("boton","hizoclick");

				if(nombre.Text == "" || descripcion.Text == "" || sitioweb.Text == "" || email.Text == "" || telefono.Text == "" || pais.Text == "" || ciudad.Text == "" || colonia.Text == "" || calle.Text == "" || numero.Text == "" || codigopostal.Text == "" || referencias.Text == "" || facebook.Text == "" || twitter.Text == "" || whatsapp.Text=="" || tagsnegocio.Text==""){
					Toast.MakeText (Application.Context, "Te faltan algunos campos de llenar, por favor revísalos!", ToastLength.Long).Show ();
				}else{
				//Información completa.
					//http://plif.mx/AgregarNegociop?droid

					//Aqui nos quedamos. Hay que añadir también
					enviando=true;
					enviarnegocio.Visibility=ViewStates.Gone;
					ProgressBar enviandonegocio= FindViewById<ProgressBar> (Resource.Id.enviandonegocio);
					enviandonegocio.Visibility=ViewStates.Visible;

					Dictionary<string, string> diccionario = new Dictionary<string, string>();
					diccionario.Add("nombre_completo", prefs.GetString("nombre", null)); 
					diccionario.Add("email_user", prefs.GetString("email", null)); 
					diccionario.Add("id_user", prefs.GetString("id",null));

					diccionario.Add("nombre",nombre.Text);
					diccionario.Add("desc",descripcion.Text);

					int selectedregion = region.CheckedRadioButtonId;
					RadioButton nameregion = FindViewById<RadioButton> (selectedregion);
					string nameregiontext=nameregion.Text;


					switch(nameregiontext){
					case "Durango":
						//Toast.MakeText (Application.Context, "Region Durango", ToastLength.Long).Show ();
						diccionario.Add("estado","9");
						break;

					case "Torreón":
						//Toast.MakeText (Application.Context, "Region Torreon", ToastLength.Long).Show ();
						diccionario.Add("estado","3");
						break;

					case "Mazatlán":
						//Toast.MakeText (Application.Context, "Region Mazatlan", ToastLength.Long).Show ();
						diccionario.Add("estado","2");
						break;

					case "Zacatecas":
						//Toast.MakeText (Application.Context, "Region Zacatecas", ToastLength.Long).Show ();
						diccionario.Add("estado","4");
						break;

						default:
						//Toast.MakeText (Application.Context, "None of the above", ToastLength.Long).Show ();
						diccionario.Add("estado","0");
						break;

					}//switch región

					diccionario.Add("categoria",cat_id);
					diccionario.Add("ubicacion",ciudad.Text);
					diccionario.Add("email",email.Text);
					diccionario.Add("sitioweb",sitioweb.Text);
					diccionario.Add("telefono",telefono.Text);
					diccionario.Add("facebook",facebook.Text);
					diccionario.Add("twitter",twitter.Text);
					diccionario.Add("google",""); //No hay campo para google+
					diccionario.Add("pais",pais.Text);
					//diccionario.Add("ciudad","Durango"); //Todos van a ser Durango ahorita
					diccionario.Add("ciudad",ciudad.Text);
					diccionario.Add("geo_long",geo_long);
					diccionario.Add("geo_lat",geo_lat);
					diccionario.Add("cp",codigopostal.Text);
					diccionario.Add("colonia",codigopostal.Text);
					diccionario.Add("calle",calle.Text);
					diccionario.Add("numero",numero.Text);
					diccionario.Add("tags",tagsnegocio.Text);
					diccionario.Add("sub_categoria","0"); //aun no hay campo de subcategoría
					diccionario.Add("referencias",referencias.Text);

					//AÑADIMOS AL DICCIONARIO LOS HORARIOS:
					diccionario.Add("lunes_de",lunes_a.Text);
					diccionario.Add("lunes_a",lunes_c.Text);
					diccionario.Add("martes_de",martes_a.Text);
					diccionario.Add("martes_a",martes_c.Text);
					diccionario.Add("miercoles_de",miercoles_a.Text);
					diccionario.Add("miercoles_a",miercoles_c.Text);
					diccionario.Add("jueves_de",jueves_a.Text);
					diccionario.Add("jueves_a",jueves_c.Text);
					diccionario.Add("viernes_de",viernes_a.Text);
					diccionario.Add("viernes_a",viernes_c.Text);
					diccionario.Add("sabado_de",sabado_a.Text);
					diccionario.Add("sabado_a",sabado_c.Text);
					diccionario.Add("domingo_de",domingo_a.Text);
					diccionario.Add("domingo_a",domingo_c.Text);

					//AÑADIMOS AL DICCIONARIO LA INFORMACION ADICIONAL

					//acepta reservaciones
					diccionario.Add("reservation",FindViewById<RadioButton> (reservaciones.CheckedRadioButtonId).Text);

					//entrega a domicilio
					diccionario.Add("delivery",FindViewById<RadioButton> (entregaadomicilio.CheckedRadioButtonId).Text);

					//para llevar
					diccionario.Add("take-out",FindViewById<RadioButton> (parallevar.CheckedRadioButtonId).Text);

					//acepta tarjeta
					diccionario.Add("credit",FindViewById<RadioButton> (aceptatarjeta.CheckedRadioButtonId).Text);

					//familiar
					diccionario.Add("kids",FindViewById<RadioButton> (ambientefamiliar.CheckedRadioButtonId).Text);

					//estacionamiento
					diccionario.Add("parking",FindViewById<RadioButton> (estacionamiento.CheckedRadioButtonId).Text);

					//ruido
					diccionario.Add("noise",FindViewById<RadioButton> (nivelruido.CheckedRadioButtonId).Text);

					//alcohol
					diccionario.Add("alcohol",FindViewById<RadioButton> (alcohol.CheckedRadioButtonId).Text);

					//tiene tv
					diccionario.Add("tv",FindViewById<RadioButton> (tienetv.CheckedRadioButtonId).Text);

					//tiene meseros
					diccionario.Add("meseros",FindViewById<RadioButton> (tienemeseros.CheckedRadioButtonId).Text);

					//tiene wifi
					diccionario.Add("wi-fi","No"); //aun no hay campo de wifi


					//LIIISTO!!! LOS MANDAMOS POR POST CON EL MULTIPART

					string resp = await plifserver.PostMultiPartForm ("http://plif.mx/AgregarNegociop?droid", fossbytes, "nada", "file[]", "image/jpeg", diccionario, false);
					Log.Debug(tag,"Termina RESP!!!");
					//Log.Debug(tag,"La respuesta es: "+resp);
					Toast.MakeText (Application.Context, "Tu negocio ha sido enviado con éxito y en breve será revisado. ¡Gracias por formar parte de Plif!", ToastLength.Long).Show ();
					Finish();


				}


			};


		}
 private void checkGoogleMap()
 {
     mapFragment = (MapFragment)FragmentManager.FindFragmentById (Resource.Id.map);
     googleMap = mapFragment.Map;
 }