Example #1
0
        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);
            }
        }
Example #2
0
		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);

			}
		}