protected override void OnElementChanged(ElementChangedEventArgs<View> e) { base.OnElementChanged(e); var oldMapView = (MapView)Control; var mapView = new MapView(Context); mapView.OnCreate(s_bundle); mapView.OnResume(); SetNativeControl(mapView); var activity = Context as Activity; if (activity != null) { var metrics = new DisplayMetrics(); activity.WindowManager.DefaultDisplay.GetMetrics(metrics); foreach (var logic in _logics) logic.ScaledDensity = metrics.ScaledDensity; } if (e.OldElement != null) { var oldMapModel = (Map)e.OldElement; MessagingCenter.Unsubscribe<Map, MoveToRegionMessage>(this, MoveMessageName); #pragma warning disable 618 if (oldMapView.Map != null) { #pragma warning restore 618 #pragma warning disable 618 oldMapView.Map.SetOnCameraChangeListener(null); #pragma warning restore 618 } oldMapView.Dispose(); } var map = NativeMap; if (map != null) { map.SetOnCameraChangeListener(this); map.UiSettings.ZoomControlsEnabled = Map.HasZoomEnabled; map.UiSettings.ZoomGesturesEnabled = Map.HasZoomEnabled; map.UiSettings.ScrollGesturesEnabled = Map.HasScrollEnabled; map.MyLocationEnabled = map.UiSettings.MyLocationButtonEnabled = Map.IsShowingUser; SetMapType(); } #pragma warning disable 618 foreach (var logic in _logics) logic.Register(oldMapView?.Map, (Map)e.OldElement, NativeMap, Map); #pragma warning restore 618 MessagingCenter.Subscribe<Map, MoveToRegionMessage>(this, MoveMessageName, OnMoveToRegionMessage, Map); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var ignore = base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.location, container, false); _mapView = view.FindViewById<MapView>(Resource.Id.mapView); _mapView.OnCreate(savedInstanceState); return view; }
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); } }
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); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.SearchFragmentLayout, null); MapView = view.FindViewById<MapView>(Resource.Id.mapView); ShowPois = view.FindViewById<Button>(Resource.Id.getAllPois); FragmentContainer= view.FindViewById<FrameLayout>(Resource.Id.poisContainer); ProgressBar = view.FindViewById<ProgressBar>(Resource.Id.progressBar1); MapView.OnCreate(savedInstanceState); ShowPois.Click += OnClickEventHandler; return view; }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.View> e) { base.OnElementChanged(e); extendedMap = (ExtendedMap)Element; mapView = Control as MapView; map = mapView.Map; map.MarkerClick+= HandleMarkerClick; // Pin tıklanınca sağalta açılan menüyü engellemek için map.UiSettings.MapToolbarEnabled = true; map.UiSettings.MyLocationButtonEnabled = true; if (extendedMap.isOverlayNeeded) { LatLng southwest = new LatLng (extendedMap.sw.Latitude, extendedMap.sw.Longitude); LatLng northeast = new LatLng (extendedMap.ne.Latitude, extendedMap.ne.Longitude); LatLngBounds bounds = new LatLngBounds (southwest, northeast); string url = extendedMap.overlayURL;//"http://www.mgm.gov.tr/mobile/mblhrt/data/radar/MAX--_6100_P00.png"; Bitmap objBitmap = GetImageBitmapFromUrl (url); BitmapDescriptor objBitmapDescriptor = BitmapDescriptorFactory.FromBitmap (objBitmap); GroundOverlayOptions objGroundOverlayOptions = new GroundOverlayOptions ().PositionFromBounds (bounds)/*.Position (objMapPosition, 100000)*/.InvokeImage (objBitmapDescriptor); map.AddGroundOverlay (objGroundOverlayOptions); //For freeing memory objBitmap.Recycle (); } for (int i = 0; i < extendedMap.pinDatas.Count; i++) { var markerWithIcon = new MarkerOptions (); markerWithIcon.SetPosition (new LatLng (extendedMap.pinDatas[i].lat, extendedMap.pinDatas[i].lng)); markerWithIcon.SetTitle (i.ToString()); /*markerWithIcon.SetTitle ("aa"); markerWithIcon.SetSnippet ("bb");*/ int resID = Resources.GetIdentifier (extendedMap.pinDatas [i].icon, "drawable" , "com.app1001.bluemart"); //System.Diagnostics.Debug.WriteLine (resID); markerWithIcon.SetIcon(BitmapDescriptorFactory.FromResource(resID)); map.AddMarker (markerWithIcon); } //Add Pins //map.SetInfoWindowAdapter(this); map.UiSettings.RotateGesturesEnabled = false; }
protected override void OnElementChanged (ElementChangedEventArgs<View> e) { base.OnElementChanged (e); var oldMapView = (MapView)Control; var mapView = new MapView (Context); mapView.OnCreate (s_bundle); mapView.OnResume (); SetNativeControl (mapView); if (e.OldElement != null) { var oldMapModel = (Map) e.OldElement; ((ObservableCollection<Pin>)oldMapModel.Pins).CollectionChanged -= OnCollectionChanged; MessagingCenter.Unsubscribe<Map, MapSpan> (this, MoveMessageName); #pragma warning disable 618 if (oldMapView.Map != null) { #pragma warning restore 618 #pragma warning disable 618 oldMapView.Map.SetOnCameraChangeListener (null); #pragma warning restore 618 NativeMap.InfoWindowClick -= MapOnMarkerClick; } oldMapView.Dispose(); } var map = NativeMap; if (map != null) { map.SetOnCameraChangeListener (this); NativeMap.InfoWindowClick += MapOnMarkerClick; map.UiSettings.ZoomControlsEnabled = Map.HasZoomEnabled; map.UiSettings.ZoomGesturesEnabled = Map.HasZoomEnabled; map.UiSettings.ScrollGesturesEnabled = Map.HasScrollEnabled; map.MyLocationEnabled = map.UiSettings.MyLocationButtonEnabled = Map.IsShowingUser; SetMapType (); } MessagingCenter.Subscribe<Map, MapSpan> (this, MoveMessageName, OnMoveToRegionMessage, Map); var incc = Map.Pins as INotifyCollectionChanged; if (incc != null) incc.CollectionChanged += OnCollectionChanged; }
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); }
protected override void OnElementChanged(ElementChangedEventArgs<View> e) { base.OnElementChanged(e); if (e.OldElement == null) { _mapView = Control as MapView; _myMap = e.NewElement as MyMap; _map = _mapView.Map; if (!_isInitialized) { Initialize(); _isInitialized = true; } } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); HasOptionsMenu = true; var view = inflater.Inflate(Resource.Layout.fragment_current_trip, null); mapView = view.FindViewById<MapView>(Resource.Id.map); mapView.OnCreate(savedInstanceState); fab = view.FindViewById<FloatingActionButton>(Resource.Id.fab); time = view.FindViewById<TextView>(Resource.Id.text_time); distance = view.FindViewById<TextView>(Resource.Id.text_distance); distanceUnits = view.FindViewById<TextView>(Resource.Id.text_distance_units); consumption = view.FindViewById<TextView>(Resource.Id.text_consumption); consumptionUnits = view.FindViewById<TextView>(Resource.Id.text_consumption_units); load = view.FindViewById<TextView>(Resource.Id.text_load); stats = view.FindViewById<LinearLayout>(Resource.Id.stats); stats.Visibility = ViewStates.Invisible; return view; }
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; }
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; } } }; }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate (Resource.Layout.MapLayout, container, false); mapFragment = view.FindViewById<MapView> (Resource.Id.map); mapFragment.OnCreate (savedInstanceState); lastUpdateText = view.FindViewById<TextView> (Resource.Id.UpdateTimeText); SetupInfoPane (view); flashBar = new FlashBarController (view); streetViewFragment = pane.FindViewById<StreetViewPanoramaView> (Resource.Id.streetViewPanorama); streetViewFragment.OnCreate (savedInstanceState); return view; }
/// <summary> /// Raises the element changed event. /// </summary> /// <param name="e">E event.</param> protected override void OnElementChanged(ElementChangedEventArgs<View> e) { base.OnElementChanged(e); if (e.OldElement == null) { this.mapView = Control as MapView; this.mapView.GetMapAsync(this); this.myMap = e.NewElement as FieldMap; } }
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) { var view = inflater.Inflate (Resource.Layout.MapLayout, container, false); mapFragment = view.FindViewById<MapView> (Resource.Id.map); mapFragment.OnCreate (savedInstanceState); lastUpdateText = view.FindViewById<TextView> (Resource.Id.UpdateTimeText); SetupInfoPane (view); flashBar = new FlashBarController (view); streetViewFragment = view.FindViewById<StreetViewPanoramaView> (Resource.Id.streetViewPanorama); streetViewFragment.OnCreate (savedInstanceState); // For some reason, a recent version of GPS set their surfaceview to be drawn un-composited. FixupStreetViewSurface (streetViewFragment); return view; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { viewModel = ServiceContainer.Resolve<DetailsViewModel> (); var root = inflater.Inflate (Resource.Layout.fragment_details, container, false); mapFragment = root.FindViewById<MapView> (Resource.Id.map); mapFragment.OnCreate (savedInstanceState); var name = root.FindViewById<TextView> (Resource.Id.name); var reviews = root.FindViewById<TextView> (Resource.Id.rating); image = root.FindViewById<ImageView> (Resource.Id.image); var address = root.FindViewById<TextView> (Resource.Id.address); var priceHours = root.FindViewById<TextView> (Resource.Id.price_hours); var phone = root.FindViewById<TextView> (Resource.Id.phone_number); var website = root.FindViewById<TextView> (Resource.Id.website); var googlePlus = root.FindViewById<TextView> (Resource.Id.google_plus); var monday = root.FindViewById<TextView> (Resource.Id.monday); var tuesday = root.FindViewById<TextView> (Resource.Id.tuesday); var wednesday = root.FindViewById<TextView> (Resource.Id.wednesday); var thursday = root.FindViewById<TextView> (Resource.Id.thursday); var friday = root.FindViewById<TextView> (Resource.Id.friday); var saturday = root.FindViewById<TextView> (Resource.Id.saturday); var sunday = root.FindViewById<TextView> (Resource.Id.sunday); var allHours = root.FindViewById<LinearLayout> (Resource.Id.all_hours); var allWeb = root.FindViewById<LinearLayout> (Resource.Id.all_web); var distance = root.FindViewById<TextView> (Resource.Id.distance); mainScroll = root.FindViewById<FilterScrollView> (Resource.Id.main_scroll); if (Math.Abs (Position.Latitude) < double.Epsilon && Math.Abs (Position.Longitude) < double.Epsilon) distance.Text = string.Empty; else { var dis = Place.GetDistance (Position.Latitude, Position.Longitude, CultureInfo.CurrentCulture.Name != "en-US" ? CoffeeFilter.Shared.GeolocationUtils.DistanceUnit.Kilometers : CoffeeFilter.Shared.GeolocationUtils.DistanceUnit.Miles).ToString ("##.###", CultureInfo.CurrentUICulture); distance.Text = string.Format (Resources.GetString (Resource.String.distance_away), dis); } if (string.IsNullOrWhiteSpace (Place.Rating.ToString ())) reviews.Visibility = ViewStates.Gone; else reviews.Text = string.Format (Resources.GetString (Resource.String.based_on_review), Place.Rating, Place.UserRatingsCount); name.Text = Place.Name; phone.Text = Place.PhoneNumberFormatted; if (!string.IsNullOrWhiteSpace (phone.Text)) { phone.Clickable = true; phone.Click += (sender, e) => { try { #if !DEBUG Xamarin.Insights.Track ("Click", new Dictionary<string,string> { { "item", "phone" }, { "name", Place.Name }, }); #endif var intent = new Intent(Intent.ActionDial); var uri = Android.Net.Uri.Parse ("tel:" + (string.IsNullOrWhiteSpace (Place.InternationalPhoneNumber) ? phone.Text : Place.InternationalPhoneNumber)); intent.SetData(uri); intent.AddFlags(ActivityFlags.ClearWhenTaskReset); Activity.StartActivity(intent); } catch (Exception ex) { ex.Data ["call"] = "phone"; Xamarin.Insights.Report (ex); } }; } address.Text = viewModel.ShortAddress; priceHours.Text = viewModel.OpenHours; if (Place.HasImage) Koush.UrlImageViewHelper.SetUrlDrawable (image, Place.MainImage); if (Place.OpeningHours == null || Place.OpeningHours.WeekdayText.Count != 7) { allHours.Visibility = ViewStates.Gone; } else { monday.Text = GetTime (Place.OpeningHours.WeekdayText [0]); tuesday.Text = GetTime (Place.OpeningHours.WeekdayText [1]); wednesday.Text = GetTime (Place.OpeningHours.WeekdayText [2]); thursday.Text = GetTime (Place.OpeningHours.WeekdayText [3]); friday.Text = GetTime (Place.OpeningHours.WeekdayText [4]); saturday.Text = GetTime (Place.OpeningHours.WeekdayText [5]); sunday.Text = GetTime (Place.OpeningHours.WeekdayText [6]); } if (string.IsNullOrWhiteSpace (Place.Website) && string.IsNullOrWhiteSpace (Place.Url)) allWeb.Visibility = ViewStates.Gone; if (string.IsNullOrWhiteSpace (Place.Website)) { website.Visibility = ViewStates.Gone; root.FindViewById<TextView> (Resource.Id.website_header).Visibility = ViewStates.Gone; } else { website.Text = Place.Website; } if (string.IsNullOrWhiteSpace (Place.Url)) { googlePlus.Visibility = ViewStates.Gone; root.FindViewById<TextView> (Resource.Id.google_plus_header).Visibility = ViewStates.Gone; } else { googlePlus.Text = "plus.google.com"; } website.Clickable = true; website.Click += (sender, e) => { try { #if !DEBUG Xamarin.Insights.Track ("Click", new Dictionary<string,string> { { "item", "website" }, { "name", Place.Name }, }); #endif var intent = new Intent (Intent.ActionView); intent.SetData (Android.Net.Uri.Parse (Place.Website)); Activity.StartActivity (intent); } catch (Exception ex) { ex.Data ["call"] = "website"; Xamarin.Insights.Report (ex); } }; googlePlus.Clickable = true; googlePlus.Click += (sender, e) => { try { Xamarin.Insights.Track ("Click", new Dictionary<string,string> { { "item", "google plus" }, { "name", Place.Name }, }); var intent = new Intent (Intent.ActionView); intent.SetData (Android.Net.Uri.Parse (Place.Url)); Activity.StartActivity (intent); } catch (Exception ex) { ex.Data ["call"] = "google+"; Xamarin.Insights.Report (ex); } }; var panorama = root.FindViewById<Button> (Resource.Id.panorama); panorama.Click += (sender, e) => { var intent = new Intent (Activity, typeof(PanoramaActivity)); intent.PutExtra ("lat", (double)Place.Geometry.Location.Latitude); intent.PutExtra ("lng", (double)Place.Geometry.Location.Longitude); Activity.StartActivity (intent); }; if (!Place.HasImage) { var paddingLayout = root.FindViewById<LinearLayout> (Resource.Id.padding_layout); paddingLayout.SetPadding (0, 0, 0, 0); } return root; }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate (Resource.Layout.MapLayout, container, false); mapFragment = view.FindViewById<MapView> (Resource.Id.map); mapFragment.OnCreate (savedInstanceState); lastUpdateText = view.FindViewById<TextView> (Resource.Id.UpdateTimeText); pane = view.FindViewById<InfoPane> (Resource.Id.infoPane); pane.StateChanged += HandlePaneStateChanged; view.ViewTreeObserver.AddOnGlobalLayoutListener (this); flashBar = new FlashBarController (view); return view; }
protected override void OnElementChanged(ElementChangedEventArgs<View> e) { base.OnElementChanged(e); var oldMapView = (MapView)Control; var mapView = new MapView(Context); mapView.OnCreate(s_bundle); mapView.OnResume(); SetNativeControl(mapView); var activity = Context as Activity; if (activity != null) { var metrics = new DisplayMetrics(); activity.WindowManager.DefaultDisplay.GetMetrics(metrics); var realSize = new global::Android.Graphics.Point(); activity.WindowManager.DefaultDisplay.GetRealSize(realSize); var size = new global::Android.Graphics.Point(); activity.WindowManager.DefaultDisplay.GetSize(size); _scaledDensity = metrics.ScaledDensity; } if (e.OldElement != null) { var oldMapModel = (Map)e.OldElement; ((ObservableCollection<Pin>)oldMapModel.Pins).CollectionChanged -= OnPinCollectionChanged; ((ObservableCollection<Polyline>)oldMapModel.Polylines).CollectionChanged -= OnPolylineCollectionChanged; ((ObservableCollection<Polygon>)oldMapModel.Polygons).CollectionChanged -= OnPolygonCollectionChanged; ((ObservableCollection<Circle>)oldMapModel.Circles).CollectionChanged -= OnCircleCollectionChanged; MessagingCenter.Unsubscribe<Map, MoveToRegionMessage>(this, MoveMessageName); #pragma warning disable 618 if (oldMapView.Map != null) { #pragma warning restore 618 #pragma warning disable 618 oldMapView.Map.SetOnCameraChangeListener(null); #pragma warning restore 618 NativeMap.InfoWindowClick -= MapOnMarkerClick; NativeMap.PolylineClick -= MapOnPolylineClick; NativeMap.PolygonClick -= MapOnPolygonClick; //NativeMap.CircleClick -= MapOnCircleClick; // Circle click is not supported. } oldMapView.Dispose(); } var map = NativeMap; if (map != null) { map.SetOnCameraChangeListener(this); NativeMap.InfoWindowClick += MapOnMarkerClick; NativeMap.PolylineClick += MapOnPolylineClick; NativeMap.PolygonClick += MapOnPolygonClick; //NativeMap.CircleClick += MapOnCircleClick; // Circle click is not supported. map.UiSettings.ZoomControlsEnabled = Map.HasZoomEnabled; map.UiSettings.ZoomGesturesEnabled = Map.HasZoomEnabled; map.UiSettings.ScrollGesturesEnabled = Map.HasScrollEnabled; map.MyLocationEnabled = map.UiSettings.MyLocationButtonEnabled = Map.IsShowingUser; SetMapType(); } MessagingCenter.Subscribe<Map, MoveToRegionMessage>(this, MoveMessageName, OnMoveToRegionMessage, Map); var inccPin = Map.Pins as INotifyCollectionChanged; if (inccPin != null) inccPin.CollectionChanged += OnPinCollectionChanged; var inccPolyline = Map.Polylines as INotifyCollectionChanged; if (inccPolyline != null) inccPolyline.CollectionChanged += OnPolylineCollectionChanged; var inccPolygon = Map.Polygons as INotifyCollectionChanged; if (inccPolygon != null) inccPolygon.CollectionChanged += OnPolygonCollectionChanged; var inccCircle = Map.Circles as INotifyCollectionChanged; if (inccCircle != null) inccCircle.CollectionChanged += OnCircleCollectionChanged; }
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; } } }