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

            try{
                viewModel = ServiceContainer.Resolve <DetailsViewModel> ();
            }
            catch {
                viewModel = new DetailsViewModel();
                ServiceContainer.RegisterScoped(viewModel);
            }
            adapter = new DetailsAdapter(this, SupportFragmentManager, viewModel);
            pager   = FindViewById <ViewPager> (Resource.Id.pager);
            var tabs = FindViewById <TabLayout> (Resource.Id.tabs);

            pager.Adapter = adapter;
            tabs.SetupWithViewPager(pager);
            pager.OffscreenPageLimit = 3;

            var layoutParameters = new Android.Support.V7.Widget.Toolbar.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent,
                (int)(GravityFlags.Top | GravityFlags.Right));

            var progressBar = new ProgressBar(this, null, Android.Resource.Attribute.ProgressBarStyleSmallTitle)
            {
                Indeterminate    = true,
                LayoutParameters = layoutParameters
            };

            SupportActionBar.SetDisplayShowCustomEnabled(true);

            SupportActionBar.CustomView = progressBar;
            SupportActionBar.Title      = viewModel.Place == null ? string.Empty : viewModel.Place.Name;

                        #if !DEBUG
            Xamarin.Insights.Track("AppNav", new Dictionary <string, string> {
                { "page", "details" },
                { "name", SupportActionBar.Title }
            });
                        #endif

            client = new GoogleApiClientBuilder(this)
                     .AddConnectionCallbacks(this)
                     .EnableAutoManage(this, 0, this)
                     .AddApi(AppInviteClass.API)
                     .Build();
        }
예제 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            try{
                viewModel = ServiceContainer.Resolve<DetailsViewModel> ();
            }
            catch{
                viewModel = new DetailsViewModel ();
                ServiceContainer.RegisterScoped (viewModel);
            }
            adapter = new DetailsAdapter (this, SupportFragmentManager, viewModel);
            pager = FindViewById<ViewPager> (Resource.Id.pager);
            var tabs = FindViewById<TabLayout> (Resource.Id.tabs);
            pager.Adapter = adapter;
            tabs.SetupWithViewPager (pager);
            pager.OffscreenPageLimit = 3;

            var layoutParameters = new Android.Support.V7.Widget.Toolbar.LayoutParams (
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent,
                (int)(GravityFlags.Top | GravityFlags.Right));

            var progressBar = new ProgressBar (this, null, Android.Resource.Attribute.ProgressBarStyleSmallTitle) {
                Indeterminate = true,
                LayoutParameters = layoutParameters
            };

            SupportActionBar.SetDisplayShowCustomEnabled (true);

            SupportActionBar.CustomView = progressBar;
            SupportActionBar.Title = viewModel.Place == null ? string.Empty : viewModel.Place.Name;

            #if !DEBUG
            Xamarin.Insights.Track ("AppNav", new Dictionary<string,string> {
                { "page", "details" },
                { "name", SupportActionBar.Title }
            });
            #endif

            client = new GoogleApiClientBuilder (this)
                .AddConnectionCallbacks (this)
                .EnableAutoManage (this, 0, this)
                .AddApi (AppInviteClass.API)
                .Build ();
        }