Beispiel #1
0
        public void IniciarFragmentoMapa(int frame)
        {
            try
            {
                //Se obtiene el fragmento del mapa
                fragmentoMapa = SupportFragmentManager.FindFragmentByTag("map") as SupportMapFragment;
                //Si es null se va a crear
                if (fragmentoMapa == null)
                {
                    //Se agregan las opciones del mapa
                    GoogleMapOptions mapOptions = new GoogleMapOptions()
                                                  .InvokeMapType(GoogleMap.MapTypeSatellite)
                                                  .InvokeZoomControlsEnabled(true)
                                                  .InvokeCompassEnabled(true);

                    //Se crea la instancia del mapa, se agregan las opciones y se carga en el frame
                    Android.Support.V4.App.FragmentTransaction transaccion = SupportFragmentManager.BeginTransaction();
                    fragmentoMapa = SupportMapFragment.NewInstance(mapOptions);
                    transaccion.Add(frame, fragmentoMapa, "map");
                    transaccion.Commit();
                }
            }
            catch (Exception ex)
            {
                //Se guarda el detalle del error
                Logs.saveLogError("MainActivity.IniciarFragmentoMapa " + ex.Message + " " + ex.StackTrace);
            }
        }
        private async void InitComponent()
        {
            try
            {
                MapIcon = FindViewById <TextView>(Resource.Id.map_icon);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, MapIcon, IonIconsFonts.AndroidLocate);

                ListIcon = FindViewById <TextView>(Resource.Id.list_icon);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, ListIcon, IonIconsFonts.AndroidList);

                MapButton  = FindViewById <LinearLayout>(Resource.Id.map_button);
                ListButton = FindViewById <LinearLayout>(Resource.Id.list_button);

                SearchView = FindViewById <SearchView>(Resource.Id.searchView);
                SearchView.SetQuery("", false);
                SearchView.SetIconifiedByDefault(false);
                SearchView.OnActionViewExpanded();
                SearchView.Iconified = false;
                SearchView.ClearFocus();

                //Change text colors
                var editText = (EditText)SearchView.FindViewById(Resource.Id.search_src_text);
                editText.SetHintTextColor(Color.White);
                editText.SetTextColor(Color.White);
                editText.Hint = GetText(Resource.String.Lbl_SearchForPlace);

                //Change Color Icon Search
                ImageView searchViewIcon = (ImageView)SearchView.FindViewById(Resource.Id.search_mag_icon);
                searchViewIcon.SetColorFilter(Color.White);

                BtnSelect = FindViewById <FloatingActionButton>(Resource.Id.add_button);


                MAdapter            = new PlacesAdapter(this);
                MAdapter.ItemClick += MAdapterOnItemClick;

                var mapFrag = SupportMapFragment.NewInstance();
                SupportFragmentManager.BeginTransaction().Add(Resource.Id.map, mapFrag, mapFrag.Tag).Commit();
                mapFrag.GetMapAsync(this);

                if (!string.IsNullOrEmpty(UserDetails.Lat) || !string.IsNullOrEmpty(UserDetails.Lng))
                {
                    Lat = Convert.ToDouble(UserDetails.Lat);
                    Lng = Convert.ToDouble(UserDetails.Lng);

                    OnLocationChanged();
                }
                else
                {
                    await GetPosition();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #3
0
        void CreateMap()
        {
            _myMapFrag = SupportMapFragment.NewInstance();
            //FragmentTransaction tx = FragmentManager.BeginTransaction();

            var tx = ChildFragmentManager.BeginTransaction();

            tx.Add(Resource.Id.frameMap, _myMapFrag);
            tx.Commit();
        }
Beispiel #4
0
        private void InitViews()
        {
            Toolbar.InflateMenu(Resource.Menu.addPlace);
            var transaction  = SupportFragmentManager.BeginTransaction();
            var mMapFragment = SupportMapFragment.NewInstance();

            transaction.Add(Resource.Id.contentFramePlacesMap, mMapFragment);
            transaction.Add(Resource.Id.contentPlacesFrame, new PlaceListFragment());

            transaction.Commit();

            mMapFragment.GetMapAsync(this);
        }
Beispiel #5
0
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);
            // Capture the Map Fragment
            SupportMapFragment mapFragment = ChildFragmentManager.FindFragmentById(Resource.Id.gmap).JavaCast <SupportMapFragment>();

            if (mapFragment == null)
            {
                mapFragment = SupportMapFragment.NewInstance();
                mapFragment.GetMapAsync(this);
            }
            mapFragment.GetMapAsync(this);
        }
Beispiel #6
0
        /// <summary>
        ///   All we do here is add a SupportMapFragment to the Activity.
        /// </summary>
        private void InitMap()
        {
            var mapOptions = new GoogleMapOptions()
                             .InvokeMapType(GoogleMap.MapTypeSatellite)
                             .InvokeZoomControlsEnabled(false)
                             .InvokeCompassEnabled(true);

            var fragTx      = SupportFragmentManager.BeginTransaction();
            var mapFragment = SupportMapFragment.NewInstance(mapOptions);

            fragTx.Add(Resource.Id.mapWithOverlay, mapFragment, "map");
            fragTx.Commit();
        }
Beispiel #7
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.MapFragment, container, false);

            // Setup maps fragment
            mapFragment = SupportMapFragment.NewInstance();
            mapFragment.GetMapAsync(this);

            //FragmentTransaction fragmentTransaction = FragmentManager.BeginTransaction();
            //fragmentTransaction.Replace(Resource.Id.MapFragment_Map, mapFragment);
            //fragmentTransaction.Commit();

            return(view);
        }
Beispiel #8
0
        private void InitComponent()
        {
            try
            {
                ToolbarLayout       = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsingToolbar);
                ToolbarLayout.Title = "";
                AppBarLayout        = FindViewById <AppBarLayout>(Resource.Id.appbar_ptwo);
                TxtName             = FindViewById <TextView>(Resource.Id.tvName_ptwo);

                TxtGoing = FindViewById <TextView>(Resource.Id.GoingTextview);

                TxtInterested = FindViewById <TextView>(Resource.Id.InterestedTextview);
                TxtStartDate  = FindViewById <TextView>(Resource.Id.txtStartDate);
                TxtEndDate    = FindViewById <TextView>(Resource.Id.txtEndDate);


                TxtLocation        = FindViewById <TextView>(Resource.Id.LocationTextview);
                TxtDescription     = FindViewById <TextView>(Resource.Id.tv_about);
                TxtDescriptionText = FindViewById <SuperTextView>(Resource.Id.tv_aboutdescUser);

                ImageEventCover = FindViewById <ImageView>(Resource.Id.EventCover);

                BtnGo         = FindViewById <Button>(Resource.Id.ButtonGoing);
                BtnInterested = FindViewById <Button>(Resource.Id.ButtonIntersted);

                FloatingActionButtonView            = FindViewById <FloatingActionButton>(Resource.Id.floatingActionButtonView);
                FloatingActionButtonView.Visibility = ViewStates.Visible;

                MainRecyclerView = FindViewById <WRecyclerView>(Resource.Id.newsfeedRecyler);
                BtnMore          = (ImageButton)FindViewById(Resource.Id.morebutton);

                SwipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
                SwipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight);
                SwipeRefreshLayout.Refreshing = false;
                SwipeRefreshLayout.Enabled    = false;
                SwipeRefreshLayout.SetProgressBackgroundColorSchemeColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#424242") : Color.ParseColor("#f7f7f7"));

                AppBarLayout.AddOnOffsetChangedListener(this);

                var mapFrag = SupportMapFragment.NewInstance();
                SupportFragmentManager.BeginTransaction().Add(Resource.Id.map, mapFrag, mapFrag.Tag).Commit();
                mapFrag.GetMapAsync(this);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #9
0
        public void Initialize()
        {
            LatLng southwest = new LatLng(30, 118);

            CameraPosition.Builder builder        = new CameraPosition.Builder();
            CameraPosition         cameraPosition =
                builder.Target(southwest).Zoom(2).Bearing(2.0f).Tilt(2.5f).Build();
            HuaweiMapOptions huaweiMapOptions = new HuaweiMapOptions().InvokeCamera(cameraPosition);

            mSupportMapFragment = SupportMapFragment.NewInstance(huaweiMapOptions);
            mSupportMapFragment.GetMapAsync(this);
            AndroidX.Fragment.App.FragmentManager     fragmentManager     = SupportFragmentManager;
            AndroidX.Fragment.App.FragmentTransaction fragmentTransaction = fragmentManager.BeginTransaction();
            fragmentTransaction.Add(Resource.Id.frame_supportmapcode, mSupportMapFragment);
            fragmentTransaction.Commit();
        }
Beispiel #10
0
        private void InitMapFragment()
        {
            _mapFragment = SupportFragmentManager.FindFragmentByTag("map") as SupportMapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeSatellite)
                                              .InvokeZoomControlsEnabled(false)
                                              .InvokeCompassEnabled(true);

                FragmentTransaction fragTx = SupportFragmentManager.BeginTransaction();
                _mapFragment = SupportMapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.mapWithOverlay, _mapFragment, "map");
                fragTx.Commit();
            }
        }
Beispiel #11
0
        public override void OnResume()
        {
            base.OnResume();
            var myPlaces = Activity.FindViewById <TextView>(Resource.Id.textViewMyPlaces);

            if (myPlaces != null)
            {
                myPlaces.Text = Strings.MY_PLACES;
            }
            var mMapFragment = SupportMapFragment.NewInstance();
            FragmentTransaction fragmentTransaction =
                FragmentManager.BeginTransaction();

            fragmentTransaction.Add(Resource.Id.contentFrameMyMap, mMapFragment);
            fragmentTransaction.Commit();
            mMapFragment.GetMapAsync(this);
        }
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            if (container == null)
            {
                return(null);
            }

            var view = inflater.Inflate(Resource.Layout.frag_map, null);

            _myMapFrag = SupportMapFragment.NewInstance();
            FragmentTransaction fragTrans = ChildFragmentManager.BeginTransaction();

            fragTrans.Add(Resource.Id.map, _myMapFrag);
            fragTrans.Commit();

            return(view);
        }
Beispiel #13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SupportMapFragment mapFrag = SupportMapFragment.NewInstance();
            var tx = SupportFragmentManager.BeginTransaction();

            tx.Add(Resource.Id.main, mapFrag);
            tx.Commit();

            GoogleMap map = mapFrag.Map;

            if (map != null)
            {
            }

            SetContentView(Resource.Layout.mapview);
        }
Beispiel #14
0
        private void BottomNavigationView_NavigationItemSelected(object sender, BottomNavigationView.NavigationItemSelectedEventArgs e)
        {
            //This Method is executed when user selectes any item from the BottomNavigationView
            switch (e.Item.ItemId)
            {
            case Resource.Id.list:

                SetAddressList();
                SupportFragmentManager.BeginTransaction().Replace(Resource.Id.frameLayout1, new ListFragment()).Commit();
                break;

            case Resource.Id.map:
                var map = SupportMapFragment.NewInstance();
                SupportFragmentManager.BeginTransaction().Replace(Resource.Id.frameLayout1, map, "map").Commit();
                map.GetMapAsync(this);
                break;
            }
        }
        private void SetUpMap()
        {
            SupportMapFragment mapFrag = Activity.SupportFragmentManager.FindFragmentById(Resource.Id.map) as SupportMapFragment;

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

                FragmentTransaction fragTx = Activity.SupportFragmentManager.BeginTransaction();
                mapFrag = SupportMapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, mapFrag, "map");
                fragTx.Commit();
            }

            mapFrag.GetMapAsync(this);
        }
Beispiel #16
0
        private void InitMapFragment()
        {
            _mapFragment = SupportFragmentManager.FindFragmentByTag("map") as SupportMapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(true)
                                              .InvokeMapToolbarEnabled(true)
                                              .InvokeZoomGesturesEnabled(true)
                                              .InvokeRotateGesturesEnabled(true)
                                              .InvokeCompassEnabled(true);

                var fragTx = SupportFragmentManager.BeginTransaction();
                _mapFragment = SupportMapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();
            }
        }
Beispiel #17
0
        private void CreateMapFragmentIfNeeded()
        {
            _mapFragment = ChildFragmentManager.FindFragmentByTag("MapFragment") as SupportMapFragment;

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

                _mapFragment = SupportMapFragment.NewInstance(mapOptions);
                var transaction = ChildFragmentManager.BeginTransaction();
                transaction.Add(Resource.Id.MapFrame, _mapFragment, "MapFragment");
                transaction.Commit();
            }
            _mapFragment.GetMapAsync(this);
        }
Beispiel #18
0
        public async void SetMap()
        {
            await LoadLocation();

            var mapFragment = SupportMapFragment.NewInstance();

            var resource = Activity.FindViewById <FrameLayout>(Resource.Id.map);

            if (resource != null)
            {
                var r = ChildFragmentManager.BeginTransaction();
                r.Add(Resource.Id.map, mapFragment, "map");
                r.Commit();

                using (var handler = new Handler(Looper.MainLooper))
                    handler.Post(() =>
                    {
                        mapFragment.GetMapAsync(this);
                    });
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // It isn't possible to set a fragment's id programmatically so we set a tag instead and
            // search for it using that.
            var mapFragment = (SupportMapFragment)
                              SupportFragmentManager.FindFragmentByTag(MAP_FRAGMENT_TAG);

            // We only create a fragment if it doesn't already exist.
            if (mapFragment == null)
            {
                // To programmatically add the map, we first create a SupportMapFragment.
                mapFragment = SupportMapFragment.NewInstance();

                // Then we add it using a FragmentTransaction.
                var fragmentTransaction =
                    SupportFragmentManager.BeginTransaction();
                fragmentTransaction.Add(Android.Resource.Id.Content, mapFragment, MAP_FRAGMENT_TAG);
                fragmentTransaction.Commit();
            }
            mapFragment.GetMapAsync(this);
        }
Beispiel #20
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var rutaView = inflater.Inflate(Resource.Layout.FrgRutaViaje, container, false);

            _mapFragment = FragmentManager.FindFragmentByTag("MapRuta") as SupportMapFragment;

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

                var fragTx = FragmentManager.BeginTransaction();
                _mapFragment = SupportMapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.MapRuta, _mapFragment, "MapRuta");
                fragTx.Commit();
            }

            _mapFragment.GetMapAsync(this);

            return(rutaView);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            var view = new PostingDetailsView(this.Activity);

            view.PostingTitle.Text = Posting.PostTitle;

            if (Posting.ImageLink != "-1")
            {
                view.CurrentImage = Posting.ImageLink;
            }

            imageHelper = new ListingImageDownloader(Posting.Link, Posting.ImageLink);
            var connected = imageHelper.GetAllImagesAsync();

            if (!connected)
            {
                var builder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity);

                builder.SetTitle("No internet connection")
                .SetMessage("Please connect and try again")
                .SetPositiveButton("Ok", delegate
                {
                    Console.WriteLine("Not connected");
                });

                builder.Create().Show();
            }

            imageHelper.loadingComplete += (sender, e) =>
            {
                if (imageHelper.PostingImagesFound)
                {
                    view.SetImageCollection(imageHelper.images);
                }

                if (imageHelper.PostingBodyAdded)
                {
                    view.PostingDescription.Text = imageHelper.postingDescription;
                }

                if (imageHelper.PostingMapFound)
                {
                    SupportMapFragment _myMapFragment = SupportMapFragment.NewInstance();
                    view.mapFrame.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                                   Convert.ToInt16(Activity.Resources.DisplayMetrics.HeightPixels * 0.5));
                    var tx = Activity.SupportFragmentManager.BeginTransaction();
                    tx.Replace(view.mapFrame.Id, _myMapFragment);
                    tx.Commit();

                    SetUpGoogleMap(_myMapFragment);

                    this.MapReady += (s, ev) =>
                    {
                        if (map != null)
                        {
                            //To initialize the map
                            map.MapType = GoogleMap.MapTypeNormal;          //select the map type
                            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                            builder.Target(imageHelper.postingCoordinates); //Target to some location hardcoded
                            builder.Zoom(10);                               //Zoom multiplier
                            CameraPosition cameraPosition = builder.Build();
                            CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                            //map.AnimateCamera(cameraUpdate);
                            map.MoveCamera(cameraUpdate);

                            MarkerOptions markerOpt1 = new MarkerOptions();
                            markerOpt1.SetPosition(imageHelper.postingCoordinates);
                            markerOpt1.SetTitle("Here's your listing!");
                            map.AddMarker(markerOpt1);
                        }
                    };
                }
            };

            view.ImageClick += (sender, e) =>
            {
                view.CurrentImage = imageHelper.images.ElementAt(e.Index);
            };

            view.PostingDescription.Text = Posting.Description;
            view.PostingDate.Text        = "Listed: " + Posting.Date.ToShortDateString() + " at " + Posting.Date.ToShortTimeString();
            view.WebLink.Text            = "Original Listing";

            view.WebLink.Click += (sender, e) =>
            {
                var             transaction     = Activity.SupportFragmentManager.BeginTransaction();
                WebviewFragment webviewFragment = new WebviewFragment();
                webviewFragment.Link = Posting.Link;

                transaction.Replace(Resource.Id.frameLayout, webviewFragment);
                transaction.AddToBackStack(null);
                transaction.Commit();
            };

            view.PostingImage.Click += (sender, e) =>
            {
                var transaction = Activity.SupportFragmentManager.BeginTransaction();
                ImageZoomFragment zoomFragment = new ImageZoomFragment();
                zoomFragment.ImageUrl = view.CurrentImage;

                transaction.Replace(Resource.Id.frameLayout, zoomFragment);
                transaction.AddToBackStack(null);
                transaction.Commit();
            };

            ((MainActivity)this.Activity).OptionItemSelected += OnOptionItemSelected;

            ScrollView viewContainer = new ScrollView(this.Activity);

            viewContainer.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);

            viewContainer.AddView(view);
            return(viewContainer);
        }
Beispiel #22
0
        private void Init()
        {
            ViewModel.View = this;
            mViewPager     = FindViewById <ViewPager>(Resource.Id.viewPager);
            llStart        = FindViewById <LinearLayout>(Resource.Id.llStart);

            (FindViewById <TextView>(Resource.Id.tvRecenter)).Text =
                ViewModel.SharedTextSource.GetText("RecenterText");

            mViewPager.Visibility = ViewStates.Gone;

            // Check if Location Service on -> Start Visible
            if (CurrentLocation != null)
            {
                llStart.Visibility = ViewStates.Visible;
            }
            else
            {
                llStart.Visibility = ViewStates.Gone;
            }

            #region Google Maps

            bmArrow = BitmapFactory.DecodeResource(this.Resources, Resource.Drawable.blue_arrow);
            GoogleMapOptions mapOptions = new GoogleMapOptions()
                                          .InvokeMapType(GoogleMap.MapTypeNormal)
                                          .InvokeZoomControlsEnabled(true)
                                          .InvokeCompassEnabled(true);

            var fragTx       = SupportFragmentManager.BeginTransaction();
            var _mapFragment = SupportMapFragment.NewInstance(mapOptions);
            fragTx.Add(Resource.Id.map, _mapFragment, "map");
            fragTx.Commit();

            #endregion

            #region Subscrible Navigation

            mMapKitMessage = Mvx.Resolve <IMvxMessenger>().SubscribeOnMainThread <NavigateMapMessage>(
                message =>
            {
                if (message.Sender.GetType() != typeof(ParkingSummaryViewModel))
                {
                    return;
                }

                Destination = new LatLng(message.DestinationLat, message.DestinationLng);

                if (map != null && !IsDrawedStreet)
                {
                    // Set map move follow current location
                    ViewModel.IsShowReCenter = false;
                    // First instruction - Flag to estimate distance between current location and start location to change to next instruction.
                    IsFirstInstruction = true;

                    // Clear marker, line to draw new.
                    map.Clear();


                    //LatLng Destination = new LatLng(message.DestinationLat, message.DestinationLng);
                    // LatLng Destination = new LatLng(10.757915, 106.654325);

                    if (CurrentLocation != null)
                    {
                        DrawStreet(CurrentLocation, Destination);

                        if (ListSteps.Count != 0)
                        {
                            // If draw street success then show button Start.
                            llStart.Visibility = ViewStates.Visible;
                        }

                        // Set new Navigating if user re-draw street
                        ViewModel.IsNavigating = false;



                        // Marker Current Location
                        MarkerOptions CurrentLocationMarkerOptions = new MarkerOptions();
                        CurrentLocationMarkerOptions.SetPosition(CurrentLocation);
                        map.AddMarker(CurrentLocationMarkerOptions);

                        MarkerOptions toMarkerOptions = new MarkerOptions();
                        toMarkerOptions.SetPosition(toLatLng);
                        map.AddMarker(toMarkerOptions);
                    }
                }
            });

            #endregion

            #region Setup timer

            if (ViewModel.Status == ParkingStatus.Rented)
            {
                DecreaseTime();
            }
            else
            {
                FindViewById <TextViewWithFont>(Resource.Id.tvfTitle).Text = ViewModel.Title;
            }

            #endregion
        }