Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            SampleData.DropData();
            SampleData.AddData();

            _fragments = new Android.Support.V4.App.Fragment[]
            {
                AllListsFragment.NewInstance(_repository),
                AllItemsFragment.NewInstance(_repository),
                TestFragment.NewInstance(_repository),
            };

            _tabNames = new[]
            {
                "Listy",
                "Wszystkie przedmioty",
                "Test"
            };

            _viewPager         = FindViewById <ViewPager>(Resource.Id.mainviewpager);
            _viewPager.Adapter =
                new MainActivityFragmentAdapter(SupportFragmentManager, _fragments, _tabNames);

            _toolbar       = FindViewById <Toolbar>(Resource.Id.toolbar);
            _toolbar.Title = "SSA";
            _toolbar.InflateMenu(Resource.Menu.top_menu);
            SetActionBar(_toolbar);
        }
Exemplo n.º 2
0
        protected override void OnResume()
        {
            Log.Debug("Database", Constants.DatabasePath);
            _fragments = new Android.Support.V4.App.Fragment[]
            {
                AllListsFragment.NewInstance(_repository),
                AllItemsFragment.NewInstance(_repository),
                TestFragment.NewInstance(_repository),
            };
            var currentItem = _viewPager.CurrentItem;

            _viewPager         = FindViewById <ViewPager>(Resource.Id.mainviewpager);
            _viewPager.Adapter =
                new MainActivityFragmentAdapter(SupportFragmentManager, _fragments, _tabNames);
            base.OnResume();
            _viewPager.SetCurrentItem(currentItem, false);

            ((AllItemsFragment)_fragments[1]).UpdateItems();
        }
Exemplo n.º 3
0
 public override Fragment GetItem(int p0)
 {
     return(TestFragment.NewInstance(Content[p0 % Content.Length]));
 }