protected override void OnCreate(Bundle savedInstanceState) 
        {
            base.OnCreate(savedInstanceState);

            SetContentView (Resource.Layout.raw_mapview_demo);

            mapView = FindViewById<MapView> (Resource.Id.map);
            mapView.OnCreate (savedInstanceState);

            mapView.GetMapAsync(this);
        }
Beispiel #2
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);
            _pickupAddressEditText     = view.FindViewById <EditText>(Resource.Id.pickupLocationAddressEditText);
            _whereToGoButton           = view.FindViewById <Button>(Resource.Id.whereToGoButton);
            _pickupAddressLoading      = view.FindViewById <ProgressBar>(Resource.Id.pickupAddressLoading);
            _estimatedTimeTimeTextView = view.FindViewById <TextView>(Resource.Id.estimatedTimeTextView);
            _centeredAnimatableDot     = view.FindViewById <ImageView>(Resource.Id.centeredAnimatableDot);
            _requestView = view.FindViewById <RelativeLayout>(Resource.Id.requestView);

            _mapView = view.FindViewById <MapView>(Resource.Id.mapView);
            _mapView.OnCreate(savedInstanceState);
            _mapView.OnResume();
            _mapView.GetMapAsync(this);

            _pickupAddressEditText.SetCommand(nameof(EditText.Click), ViewModel.TripLocationViewModel.NavigateToPickupSearch);
            _whereToGoButton.SetCommand(nameof(Button.Click), ViewModel.TripLocationViewModel.NavigateToWhereTo);
        }
Beispiel #3
0
                public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
                {
                    if (container == null)
                    {
                        // Currently in a layout without a container, so no reason to create our view.
                        return(null);
                    }

                    GroupEntries   = new List <MobileAppApi.GroupSearchResult>();
                    MarkerList     = new List <Android.Gms.Maps.Model.Marker>();
                    SourceLocation = new MobileAppApi.GroupSearchResult();

                    // limit the address to 90% of the screen so it doesn't conflict with the progress bar.
                    Point displaySize = new Point( );

                    Activity.WindowManager.DefaultDisplay.GetSize(displaySize);
                    //float fixedWidth = displaySize.X / 4.0f;

                    // catch any exceptions thrown, as they'll be related to no map API key
                    try
                    {
                        MapView = new Android.Gms.Maps.MapView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                        MapView.LayoutParameters        = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                        MapView.LayoutParameters.Height = (int)(displaySize.Y * .50f);
                        MapView.GetMapAsync(this);
                        MapView.SetBackgroundColor(Color.Black);

                        MapView.OnCreate(savedInstanceState);
                    }
                    catch
                    {
                        MapView = null;
                        Rock.Mobile.Util.Debug.WriteLine("GOOGLE MAPS: Unable to create. Verify you have a valid API KEY.");
                    }

                    NumRequestedGroups = 10;


                    SearchAddressButton = new Button(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    SearchAddressButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                    ControlStyling.StyleButton(SearchAddressButton, ConnectStrings.GroupFinder_SearchButtonLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
                    SearchAddressButton.Click += (object sender, EventArgs e) =>
                    {
                        SearchPage.Show( );
                    };


                    // setup the linear layout containing the "Your Neighborhood is: Horizon" text
                    SearchLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    SearchLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                    SearchLayout.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color));
                    SearchLayout.SetGravity(GravityFlags.Center);

                    SearchResultPrefix = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    SearchResultPrefix.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                    SearchResultPrefix.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Regular), TypefaceStyle.Normal);
                    SearchResultPrefix.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize);
                    SearchResultPrefix.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor));
                    SearchResultPrefix.Text = ConnectStrings.GroupFinder_NoGroupsFound;

                    SearchResultNeighborhood = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    SearchResultNeighborhood.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                    SearchResultNeighborhood.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Regular), TypefaceStyle.Normal);
                    SearchResultNeighborhood.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize);
                    SearchResultNeighborhood.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor));
                    SearchResultNeighborhood.Text = "";


                    Seperator = new View(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    Seperator.LayoutParameters        = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 0);
                    Seperator.LayoutParameters.Height = 2;
                    Seperator.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor));

                    ListView = new ListView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    ListView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                    ListView.ItemClick       += (object sender, AdapterView.ItemClickEventArgs e) =>
                    {
                        OnClick(e.Position, 0);
                    };
                    ListView.SetOnTouchListener(this);
                    ListView.Adapter = new GroupArrayAdapter(this);

                    View view = inflater.Inflate(Resource.Layout.Connect_GroupFinder, container, false);

                    view.SetOnTouchListener(this);

                    view.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color));

                    LinearLayout groupLayout = view.FindViewById <LinearLayout>(Resource.Id.groupFrame) as LinearLayout;

                    // setup the address layout, which has the address text, padding, and finally the progress bar.
                    if (MapView != null)
                    {
                        ((LinearLayout)groupLayout).AddView(MapView);
                    }

                    ((LinearLayout)groupLayout).AddView(SearchAddressButton);

                    ((LinearLayout)groupLayout).AddView(SearchLayout);
                    ((LinearLayout)SearchLayout).AddView(SearchResultPrefix);
                    ((LinearLayout)SearchLayout).AddView(SearchResultNeighborhood);

                    ((LinearLayout)groupLayout).AddView(Seperator);
                    ((LinearLayout)groupLayout).AddView(ListView);

                    BlockerView = new UIBlockerView(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));

                    SearchPage = new UIGroupFinderSearch();
                    SearchPage.Create(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels),
                                      // Search Neighborhood Groups
                                      delegate
                    {
                        SearchPage.Hide(true);
                        GetInitialGroups(PrivateGeneralConfig.GroupType_Neighborhood_GroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text);
                    },

                                      // Search Next Gen Groups
                                      delegate
                    {
                        SearchPage.Hide(true);
                        GetInitialGroups(PrivateGeneralConfig.GroupType_NextGenGroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text);
                    },

                                      // Search Young Adult Groups
                                      delegate
                    {
                        SearchPage.Hide(true);
                        GetInitialGroups(PrivateGeneralConfig.GroupType_YoungAdultsGroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text);
                    });
                    SearchPage.SetTitle(ConnectStrings.GroupFinder_SearchPageHeader, ConnectStrings.GroupFinder_SearchPageDetails);
                    SearchPage.LayoutChanged(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));
                    SearchPage.Hide(false);

                    // if we should automatically show the search page...
                    if (ShowSearchOnAppear == true)
                    {
                        // don't allow them to tap the address button until we reveal the search page.
                        SearchAddressButton.Enabled = false;

                        // wait a couple seconds before revealing the search page.
                        System.Timers.Timer timer = new System.Timers.Timer();
                        timer.AutoReset = false;
                        timer.Interval  = 1000;
                        timer.Elapsed  += (object sender, System.Timers.ElapsedEventArgs e) =>
                        {
                            Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                            {
                                SearchAddressButton.Enabled = true;
                                SearchPage.Show( );
                            });
                        };
                        timer.Start( );
                    }
                    else
                    {
                        // otherwise, just allow the seach button
                        SearchAddressButton.Enabled = true;
                    }

                    // hook into the search page as its listener
                    ((View)SearchPage.View.PlatformNativeObject).SetOnTouchListener(this);
                    ((EditText)SearchPage.Street.PlatformNativeObject).SetOnEditorActionListener(this);
                    ((EditText)SearchPage.City.PlatformNativeObject).SetOnEditorActionListener(this);
                    ((EditText)SearchPage.State.PlatformNativeObject).SetOnEditorActionListener(this);
                    ((EditText)SearchPage.ZipCode.PlatformNativeObject).SetOnEditorActionListener(this);
                    return(view);
                }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Create your application here
			SetContentView (Resource.Layout.MapViewLayout);

			assignmentMapViewLayout = FindViewById<LinearLayout> (Resource.Id.mapViewAssignmentLayout);
			assignmentMapViewLayout.Click += (sender, e) => {
				var intent = new Intent (this, typeof(SummaryActivity));
				var tabActivity = (AssignmentTabActivity)Parent;
				tabActivity.MapData = null;
				assignmentViewModel.SelectedAssignment = assignmentViewModel.ActiveAssignment;
				menuViewModel.MenuIndex = Constants.Navigation.IndexOf ("Map");
				StartActivity (intent);
			};
	    
			mapView = FindViewById<MapView> (Resource.Id.googleMapsView);
			mapView.OnCreate (bundle);
			mapView.GetMapAsync (this);

			//View containing the active assignment
			var view = new View (this);
			LayoutInflater inflator = (LayoutInflater)GetSystemService (Context.LayoutInflaterService);
			view = inflator.Inflate (Resource.Layout.AssignmentItemLayout, null);
			assignmentMapViewLayout.AddView (view);
			view.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
			view.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.active_assignment_selector));
			number = view.FindViewById<TextView> (Resource.Id.assignmentItemNumber);
			job = view.FindViewById<TextView> (Resource.Id.assignmentJob);
			name = view.FindViewById<TextView> (Resource.Id.assignmentName);
			phone = view.FindViewById<TextView> (Resource.Id.assignmentPhone);
			address = view.FindViewById<TextView> (Resource.Id.assignmentAddress);
			buttonLayout = view.FindViewById<LinearLayout> (Resource.Id.assignmentButtonLayout);
			timerLayout = view.FindViewById<LinearLayout> (Resource.Id.assignmentTimerLayout);
			activeSpinner = view.FindViewById<Spinner> (Resource.Id.assignmentStatus);
			spinnerImage = view.FindViewById<ImageView> (Resource.Id.assignmentStatusImage);
			timer = view.FindViewById<ToggleButton> (Resource.Id.assignmentTimer);
			timerText = view.FindViewById<TextView> (Resource.Id.assignmentTimerText);
			phoneButton = view.FindViewById<RelativeLayout> (Resource.Id.assignmentPhoneLayout);
			mapButton = view.FindViewById<RelativeLayout> (Resource.Id.assignmentAddressLayout);

			phoneButton.Click += (sender, e) => {
				Extensions.MakePhoneCall (this, phone.Text);
			};

			mapButton.Click += (sender, e) => {
				var intent = new Intent (this, typeof(SummaryActivity));
				var tabActivity = (AssignmentTabActivity)Parent;
				tabActivity.MapData = null;
				assignmentViewModel.SelectedAssignment = assignmentViewModel.ActiveAssignment;
				menuViewModel.MenuIndex = 0;
				StartActivity (intent);
			};

			assignmentViewModel.LoadTimerEntryAsync ().ContinueWith (_ => {
				RunOnUiThread (() => {
					timer.Checked = assignmentViewModel.Recording;
				});
			});

			timer.CheckedChange += (sender, e) => {
				if (e.IsChecked != assignmentViewModel.Recording) {
					if (assignmentViewModel.Recording)
						assignmentViewModel.PauseAsync ();
					else
						assignmentViewModel.RecordAsync ();
				}
			};

			activeSpinner.ItemSelected += (sender, e) => {

				if (assignment == null)
					return;
				
				var selected = assignmentViewModel.AvailableStatuses.ElementAtOrDefault (e.Position);
				if (selected != assignment.Status) {
					switch (selected) {
					case AssignmentStatus.Hold:
						assignment.Status = selected;
						assignmentViewModel.SaveAssignmentAsync (assignment).ContinueWith (_ => {
							RunOnUiThread (() => {
								SetAssignment (false);
								UpdateLocations ();
							});
						});
						break;
					case AssignmentStatus.Complete:
						var intent = new Intent (this, typeof(SummaryActivity));
						menuViewModel.MenuIndex = Constants.Navigation.IndexOf (Constants.Confirmations);
						StartActivity (intent);
						break;
					default:
						break;
					}
				}
			};
		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.MapFragmentLayout);

            mapView = FindViewById<MapView> (Resource.Id.fragmentMapView);
            mapView.OnCreate (bundle);
            mapView.GetMapAsync (this);
        }
                public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
                {
                    if (container == null)
                    {
                        // Currently in a layout without a container, so no reason to create our view.
                        return null;
                    }

                    GroupEntries = new List<GroupFinder.GroupEntry>();
                    MarkerList = new List<Android.Gms.Maps.Model.Marker>();
                    SourceLocation = new GroupFinder.GroupEntry();

                    // limit the address to 90% of the screen so it doesn't conflict with the progress bar.
                    Point displaySize = new Point( );
                    Activity.WindowManager.DefaultDisplay.GetSize( displaySize );
                    //float fixedWidth = displaySize.X / 4.0f;

                    // catch any exceptions thrown, as they'll be related to no map API key
                    try
                    {
                        MapView = new Android.Gms.Maps.MapView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                        MapView.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                        MapView.LayoutParameters.Height = (int) (displaySize.Y * .50f);
                        MapView.GetMapAsync( this );
                        MapView.SetBackgroundColor( Color.Black );

                        MapView.OnCreate( savedInstanceState );
                    }
                    catch
                    {
                        MapView = null;
                        Rock.Mobile.Util.Debug.WriteLine( "GOOGLE MAPS: Unable to create. Verify you have a valid API KEY." );
                    }


                    SearchAddressButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SearchAddressButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
                    ControlStyling.StyleButton( SearchAddressButton, ConnectStrings.GroupFinder_SearchButtonLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize );
                    SearchAddressButton.Click += (object sender, EventArgs e ) =>
                    {
                            SearchPage.Show( );
                    };


                    // setup the linear layout containing the "Your Neighborhood is: Horizon" text
                    SearchLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SearchLayout.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
                    SearchLayout.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );
                    SearchLayout.SetGravity( GravityFlags.Center );

                    SearchResultPrefix = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SearchResultPrefix.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    SearchResultPrefix.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
                    SearchResultPrefix.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    SearchResultPrefix.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                    SearchResultPrefix.Text = ConnectStrings.GroupFinder_NoGroupsFound;

                    SearchResultNeighborhood = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SearchResultNeighborhood.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    SearchResultNeighborhood.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
                    SearchResultNeighborhood.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    SearchResultNeighborhood.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) );
                    SearchResultNeighborhood.Text = "";


                    Seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
                    Seperator.LayoutParameters.Height = 2;
                    Seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );

                    ListView = new ListView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    ListView.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                    ListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e ) =>
                        {
                            OnClick( e.Position, 0 );
                        };
                    ListView.SetOnTouchListener( this );
                    ListView.Adapter = new GroupArrayAdapter( this );

                    View view = inflater.Inflate(Resource.Layout.Connect_GroupFinder, container, false);
                    view.SetOnTouchListener( this );

                    view.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );

                    LinearLayout groupLayout = view.FindViewById<LinearLayout>( Resource.Id.groupFrame ) as LinearLayout;

                    // setup the address layout, which has the address text, padding, and finally the progress bar.
                    if ( MapView != null )
                    {
                        ( (LinearLayout)groupLayout ).AddView( MapView );
                    }

                    ((LinearLayout)groupLayout).AddView( SearchAddressButton );

                    ((LinearLayout)groupLayout).AddView( SearchLayout );
                    ((LinearLayout)SearchLayout).AddView( SearchResultPrefix );
                    ((LinearLayout)SearchLayout).AddView( SearchResultNeighborhood );

                    ((LinearLayout)groupLayout).AddView( Seperator );
                    ((LinearLayout)groupLayout).AddView( ListView );

                    BlockerView = new UIBlockerView( view, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ) );

                    SearchPage = new UIGroupFinderSearch();
                    SearchPage.Create( view, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ), 
                        delegate
                        {
                            SearchPage.Hide( true );
                            GetGroups( SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text );
                        } );
                    SearchPage.SetTitle( ConnectStrings.GroupFinder_SearchPageHeader, ConnectStrings.GroupFinder_SearchPageDetails );
                    SearchPage.LayoutChanged( new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ) );
                    SearchPage.Hide( false );

                    // if we should automatically show the search page...
                    if ( ShowSearchOnAppear == true )
                    {
                        // don't allow them to tap the address button until we reveal the search page.
                        SearchAddressButton.Enabled = false;

                        // wait a couple seconds before revealing the search page.
                        System.Timers.Timer timer = new System.Timers.Timer();
                        timer.AutoReset = false;
                        timer.Interval = 1000;
                        timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e ) =>
                        {
                            Rock.Mobile.Threading.Util.PerformOnUIThread( delegate
                                {
                                    SearchAddressButton.Enabled = true;
                                    SearchPage.Show( );
                                } );
                        };
                        timer.Start( );
                    }
                    else
                    {
                        // otherwise, just allow the seach button
                        SearchAddressButton.Enabled = true;
                    }

                    // hook into the search page as its listener
                    ((View)SearchPage.View.PlatformNativeObject).SetOnTouchListener( this );
                    ((EditText)SearchPage.Street.PlatformNativeObject).SetOnEditorActionListener( this );
                    ((EditText)SearchPage.City.PlatformNativeObject).SetOnEditorActionListener( this );
                    ((EditText)SearchPage.State.PlatformNativeObject).SetOnEditorActionListener( this );
                    ((EditText)SearchPage.ZipCode.PlatformNativeObject).SetOnEditorActionListener( this );
                    return view;
                }
        protected override void OnElementChanged(ElementChangedEventArgs<View> e)
        {
            base.OnElementChanged (e);
            MapView mapView1 = (MapView)this.Control;

            if (e.OldElement != null) {
                var formsMap = e.OldElement as LiteMap;
                ((ObservableCollection<Pin>)formsMap.Pins).CollectionChanged -= OnCollectionChanged;
                this.Map.MoveToRegionRequested -= this.MoveToRegionRequested;
            }

            if (e.NewElement != null) {
                this.Map.MoveToRegionRequested += this.MoveToRegionRequested;

                var options = new GoogleMapOptions ();
                options.InvokeLiteMode (true);

                MapView mapView2 = new MapView (this.Context, options);
                mapView2.OnCreate (LiteMapRenderer.bundle);
                mapView2.OnResume ();

                this.SetNativeControl (mapView2);

                mapView2.GetMapAsync (this);

                if (e.NewElement != null) {
                    var formsMap = e.NewElement as LiteMap;
                    ((ObservableCollection<Pin>)formsMap.Pins).CollectionChanged += OnCollectionChanged;
                }
            }
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			#if DEBUG
			Xamarin.Insights.Initialize("ef02f98fd6fb47ce8624862ab7625b933b6fb21d", this);
			#else
			Xamarin.Insights.Initialize ("8da86f8b3300aa58f3dc9bbef455d0427bb29086", this);
			#endif

			mapView = FindViewById<MapView> (Resource.Id.map);
			mapView.OnCreate (bundle);

			mapView.Visibility = ViewStates.Invisible;
			viewModel = new CoffeeFilterViewModel ();
			ServiceContainer.Register<CoffeeFilterViewModel> (viewModel);
			adapter = new PlacesPagerAdapter (SupportFragmentManager, viewModel);
			pager = FindViewById<ViewPager> (Resource.Id.pager);
			pager.Adapter = adapter;
			progressBar = FindViewById<ImageView> (Resource.Id.progressBar);
			errorImage = FindViewById<ImageView> (Resource.Id.error);
			coffeeProgress = (AnimationDrawable)progressBar.Background;
			progressBar.Visibility = ViewStates.Gone;

			pager.PageSelected += (sender, e) => UpdateMap (e.Position);
			pager.PageScrollStateChanged += (sender, e) => {
				if (e.State == (int)ScrollState.TouchScroll)
					refresher.Enabled = false;
				else
					refresher.Enabled = true;
			};

			refresher = FindViewById<SwipeRefreshLayout> (Resource.Id.refresher);
			refresher.SetColorSchemeColors (Resource.Color.accent);
			refresher.Refresh += (sender, args) => {
				RefreshData (true);
				refresher.PostDelayed (() => {
					refresher.Refreshing = false;
				}, 250);
			};

			SupportActionBar.SetDisplayHomeAsUpEnabled (false);
			SupportActionBar.SetHomeButtonEnabled (false);
			mapView.GetMapAsync (this);
			CheckGooglePlayServices ();

			// No savedInstanceState, so it is the first launch of this activity
			if (bundle == null && AppInviteReferral.HasReferral(Intent)) {
				// In this case the referral data is in the intent launching the MainActivity,
				// which means this user already had the app installed. We do not have to
				// register the Broadcast Receiver to listen for Play Store Install information
				LaunchDeepLinkActivity(Intent);

			}
		}