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); }
private static void Load(int count) { #if DEBUG Debug.WriteLine("TestLoading..."); #endif int?prev = null; int?lastResult = null; for (int i = 0; i < count + 1; i++) { var fragment = new TestFragment(); var num = getRandNum(); fragment.Number = num; if (prev.HasValue) { var response = num + prev; fragment.PreviousAnswer = response; fragment.CloseAnswers = CreateArtifacts(response.Value, prev.Value, num, lastResult); lastResult = response; } prev = num; sheet.TestFragments.Add(fragment); } #if DEBUG Debug.WriteLine($"{sheet.TestFragments.Count} Test Loaded..."); #endif }
public override Android.Support.V4.App.Fragment GetItem(int position) { var _itemPosition = items[position]; TestFragment f = new TestFragment(); f.setImageList(_itemPosition, position); return(f); }
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(); }
public override Fragment GetItem(int p0) { return(TestFragment.NewInstance(Content[p0 % Content.Length])); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Create UI _drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); // Init toolbar _toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); _toolbar.Title = this.Resources.GetString(Resource.String.app_name); SetSupportActionBar(_toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); //_toolbar. // Attach item selected handler to navigation view var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetCheckedItem(0); navigationView.Menu.GetItem(0).SetChecked(true); navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected; // Create ActionBarDrawerToggle button and add it to the toolbar var drawerToggle = new ActionBarDrawerToggle(this, _drawerLayout, _toolbar, Resource.String.open_drawer, Resource.String.close_drawer); _drawerLayout.SetDrawerListener(drawerToggle); // drawerToggle.SetHomeAsUpIndicator(null); drawerToggle.SyncState(); _loginFragment = new Login(); _homeFragment = new Home(); _settingsFragment = new SettingsPage(); _globalTimeLogFragment = new GlobalTimeLogList(); _timeLogDetailFragment = new TimeLogDetail(); _listOfProjectFragment = new ListOfProjects(); _taskDetailFragment = new TaskDetails(); _taskTimeLogDetailFragment = new TaskTimeLogList(); _listOfTasksFragment = new ListProjectTasks(""); _testFragment = new TestFragment(); //for testing //_currentFragment = _testFragment; // if logged in _currentFragment = _homeFragment; // else //CurrentFragment = ListOfProjectFragment; var fragmentTx = FragmentManager.BeginTransaction(); // The fragment will have the ID of Resource.Id.fragment_container. fragmentTx.Replace(Resource.Id.fragmentContainer, _currentFragment); // Commit the transaction. fragmentTx.Commit(); var apiService = new ApiTypes(); var service = new PDashServices(apiService); Ctrl = new Controller(service); // ... CheckForCrashes(); // checkForUpdates(); // FragmentManager.AddOnBackStackChangedListener(this); // shouldDisplayHomeUp(); }