protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(R.Layouts.fragment_tabs_pager); mTabHost = (TabHost)FindViewById(global::Android.R.Id.Tabhost); mTabHost.Setup(); mViewPager = (ViewPager)FindViewById(R.Ids.pager); mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager); mTabsAdapter.AddTab(mTabHost.NewTabSpec("simple").SetIndicator("Simple"), typeof(FragmentStackSupport.CountingFragment), null); mTabsAdapter.AddTab(mTabHost.NewTabSpec("contacts").SetIndicator("Contacts"), typeof(LoaderCursorSupport.CursorLoaderListFragment), null); mTabsAdapter.AddTab(mTabHost.NewTabSpec("custom").SetIndicator("Custom"), typeof(LoaderCustomSupport.AppListFragment), null); mTabsAdapter.AddTab(mTabHost.NewTabSpec("throttle").SetIndicator("Throttle"), typeof(LoaderThrottleSupport.ThrottledLoaderListFragment), null); if (savedInstanceState != null) { mTabHost.SetCurrentTabByTag(savedInstanceState.GetString("tab")); } }
public void UpdateGarage() { if (fragments != null && fragments.Count > 0) { fragments.Clear(); } else { fragments = new List <Fragment>(); } for (int i = 0; i < presenter.userCars.Count; i++) { fragments.Add(new UserCarFragment(i)); } fragments.Add(new AddCarFragment()); if (fragments.Count == 1) { fab.Visibility = ViewStates.Gone; } else { fab.Visibility = ViewStates.Visible; } userCarListAdapter = new TabsAdapter(this.ChildFragmentManager, fragments); garageViewPager.Adapter = userCarListAdapter; garageViewPager.OffscreenPageLimit = garageViewPager.Adapter.Count; // garageViewPager.Adapter.Count; ci.SetViewPager(garageViewPager); //GarageViewPager_PageSelected(null, new ViewPager.PageSelectedEventArgs(0)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); adapter = new TabsAdapter(this, SupportFragmentManager); pager = FindViewById <ViewPager>(Resource.Id.viewpager); var tabs = FindViewById <TabLayout>(Resource.Id.tabs); pager.Adapter = adapter; tabs.SetupWithViewPager(pager); pager.OffscreenPageLimit = 3; pager.PageSelected += (sender, args) => { var fragment = adapter.InstantiateItem(pager, args.Position) as IFragmentVisible; fragment?.BecameVisible(); }; Toolbar.MenuItemClick += (sender, e) => { var intent = new Intent(this, typeof(AddItemActivity));; StartActivity(intent); }; SupportActionBar.SetDisplayHomeAsUpEnabled(false); SupportActionBar.SetHomeButtonEnabled(false); CreateNotificationChannel(); var button = FindViewById <Button>(Resource.Id.MyButton); button.Click += ButtonOnClick; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.main); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); if (toolbar != null) { SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(false); SupportActionBar.SetHomeButtonEnabled(false); } // Affiche une boîte de dialogue pour accorder l'autorisation d'accès au stockage var permissionSto = Manifest.Permission.WriteExternalStorage; var permissionCam = Manifest.Permission.Camera; if (ContextCompat.CheckSelfPermission(this, permissionSto) != Android.Content.PM.Permission.Granted || ContextCompat.CheckSelfPermission(this, permissionCam) != Android.Content.PM.Permission.Granted) { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.WriteExternalStorage, Manifest.Permission.Camera, Manifest.Permission.ReadExternalStorage }, 0); } adapter = new TabsAdapter(this, SupportFragmentManager); pager = FindViewById <ViewPager>(Resource.Id.pager); pager.Adapter = adapter; tabs = FindViewById <TabLayout>(Resource.Id.tabs); tabs.SetupWithViewPager(pager); pager.OffscreenPageLimit = 3; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); adapter = new TabsAdapter(this, SupportFragmentManager); pager = FindViewById <ViewPager>(Resource.Id.viewpager); var tabs = FindViewById <TabLayout>(Resource.Id.tabs); pager.Adapter = adapter; tabs.SetupWithViewPager(pager); pager.OffscreenPageLimit = 3; pager.PageSelected += (sender, args) => { var fragment = adapter.InstantiateItem(pager, args.Position) as IFragmentVisible; fragment?.BecameVisibleAsync(); }; // add event handler for menu item clickS. For now to select target language Toolbar.MenuItemClick += Toolbar_MenuItemClick; SupportActionBar.SetDisplayHomeAsUpEnabled(false); SupportActionBar.SetHomeButtonEnabled(false); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var data = Intent.GetStringExtra("data"); appPreferences = new AppPreferences(Application.Context); var item = Newtonsoft.Json.JsonConvert.DeserializeObject <Facility>(data); viewModel = new FacilityDetailViewModel(item); Bundle mybundle = new Bundle(); mybundle.PutString("data", Newtonsoft.Json.JsonConvert.SerializeObject(item)); adapter = new TabsAdapter(this, SupportFragmentManager, mybundle); pager = FindViewById <ViewPager>(Resource.Id.viewpager); var tabs = FindViewById <TabLayout>(Resource.Id.tabs); pager.Adapter = adapter; tabs.SetupWithViewPager(pager); pager.OffscreenPageLimit = 3; Toolbar.MenuItemClick += (sender, e) => { var itemTitle = e.Item.TitleFormatted; switch (itemTitle.ToString()) { case "Log Out": var intent = new Intent(this, typeof(LoginActivity)); appPreferences.SaveUserId("0"); StartActivity(intent); break; case "Submit": FacilityInformationFragment fragment = (FacilityInformationFragment)SupportFragmentManager.Fragments[1]; if (fragment != null) { fragment.SubmitFacility(); } break; case "Add": var buildingIntent = new Intent(this, typeof(AddBuildingActivity));; StartActivity(buildingIntent); break; } }; pager.PageSelected += (sender, args) => { var fragment = adapter.InstantiateItem(pager, args.Position) as IFragmentVisible; fragment?.BecameVisible(); }; SupportActionBar.Title = item.Name; SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); }
private void InitData() { fragments = new List <Fragment> { new OrderInfoFragment("Preorder"), new OrderPartsFragment(), new OrderLaborsFragment(), new OrderChatFragment() }; TabsAdapter adapter = new TabsAdapter(this.ChildFragmentManager, fragments); orderViewPager.Adapter = adapter; ci.SetViewPager(orderViewPager); }
private void InitPhone() { SetContentView(Resource.Layout.PhoneContainer); var adapter = new TabsAdapter(SupportFragmentManager); var viewPager = FindViewById<ViewPager>(Resource.Id.viewPager); viewPager.Adapter = adapter; viewPager.OffscreenPageLimit = 2; var tabLayout = FindViewById<TabLayout>(Resource.Id.tabLayout); tabLayout.SetupWithViewPager(viewPager); }
private void InitPhone() { SetContentView(Resource.Layout.PhoneContainer); var adapter = new TabsAdapter(SupportFragmentManager); var viewPager = FindViewById <ViewPager>(Resource.Id.viewPager); viewPager.Adapter = adapter; viewPager.OffscreenPageLimit = 2; var tabLayout = FindViewById <TabLayout>(Resource.Id.tabLayout); tabLayout.SetupWithViewPager(viewPager); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); adapter = new TabsAdapter(this, SupportFragmentManager); pager = FindViewById <ViewPager>(Resource.Id.pager); var tabs = FindViewById <TabLayout>(Resource.Id.tabs); pager.Adapter = adapter; tabs.SetupWithViewPager(pager); pager.OffscreenPageLimit = 3; SupportActionBar.SetDisplayHomeAsUpEnabled(false); SupportActionBar.SetHomeButtonEnabled(false); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); adapter = new TabsAdapter(this, SupportFragmentManager); pager = FindViewById<ViewPager>(Resource.Id.pager); var tabs = FindViewById<TabLayout>(Resource.Id.tabs); pager.Adapter = adapter; tabs.SetupWithViewPager(pager); pager.OffscreenPageLimit = 3; SupportActionBar.SetDisplayHomeAsUpEnabled(false); SupportActionBar.SetHomeButtonEnabled(false); }
private async void InitData() { try { //if (fragments != null && adapter != null) //{ // ordersViewPager.Adapter = adapter; // ci.SetViewPager(ordersViewPager); // ordersViewPager.Adapter.NotifyDataSetChanged(); // return; //} var orders = new List<string>(); fragments = new List<Fragment>(); //var taskList = new Task<string>[] { ClientAPI.GetAsync("Order"), ClientAPI.GetAsync("Order/Recommendation"), ClientAPI.GetAsync("Order/Raw"), ClientAPI.GetAsync("Order/Archive"), }; //var result = await Task.WhenAll(taskList); var orderList = await ClientAPI.GetAsync("Order"); orders.Add(orderList.Item2); orderList = await ClientAPI.GetAsync("PreOrder/All"); orders.Add(orderList.Item2); orderList = await ClientAPI.GetAsync("Order/Raw"); orders.Add(orderList.Item2); //var taskList = new List<Task<string>>(4) { ClientAPI.GetAsync("Order"), ClientAPI.GetAsync("Order/Recommendation"), ClientAPI.GetAsync("Order/Raw"), ClientAPI.GetAsync("Order/Archive") }; //var response = await Task.WhenAll(taskList); for (int i = 0; i < orders.Count; i++) { if (orders[i] == null) continue; var orderData = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(orders[i]); var orderListFragment = new OrderListFragment(orderData); fragments.Add(orderListFragment); } adapter = new TabsAdapter(this.FragmentManager, fragments); ordersViewPager.Adapter = adapter; ci.SetViewPager(ordersViewPager); } catch (JsonSerializationException ex) { AlertDialogs.SimpleAlertDialog(ex.ToString(), this.Context).Show(); return; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); MenuId = Resource.Menu.mainmenu; SetContentView(Resource.Layout.fragment_tabs); _tabHost = FindViewById <TabHost>(Android.Resource.Id.TabHost); _tabHost.Setup(); _viewPager = FindViewById <ViewPager>(Resource.Id.pager); _tabsAdapter = new TabsAdapter(this, _tabHost, _viewPager); LegacyBar = FindViewById <Library.Bar.LegacyBar>(Resource.Id.actionbar); LegacyBar.Title = "Look Fragments"; AddHomeAction(typeof(HomeActivity), Resource.Drawable.icon); var action = new MenuItemLegacyBarAction(this, Resource.Id.menu_search, Resource.Drawable.ic_action_search_dark, Resource.String.menu_string_search); LegacyBar.AddAction(action); TabHost.TabSpec spec = _tabHost.NewTabSpec("tv"); spec.SetIndicator("Tab 1", Resources.GetDrawable(Resource.Drawable.icon)); _tabsAdapter.AddTab(spec, Class.FromType(typeof(FramgmentTab1)), null); spec = _tabHost.NewTabSpec("tab2"); spec.SetIndicator("Tab 2", Resources.GetDrawable(Resource.Drawable.icon)); _tabsAdapter.AddTab(spec, Class.FromType(typeof(FramgmentTab2)), null); if (bundle != null) { _tabHost.SetCurrentTabByTag(bundle.GetString("tab")); } else { _tabHost.CurrentTab = 0; } }
public async override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); var tree = await LoadData(); fragments = new List <Fragment> { new TreeFragment(tree), new PartListFragment(), new PreOrderListFragment() }; var fragmentTitles = new List <Java.Lang.String>(fragments.Count) { new Java.Lang.String("Узлы"), new Java.Lang.String("Детали"), new Java.Lang.String("Предзаказ") }; TabsAdapter adapter = new TabsAdapter(this.ChildFragmentManager, fragments, fragmentTitles); viewPager.Adapter = adapter; viewPager.PageSelected += ViewPager_PageSelected; tabLayout.SetupWithViewPager(viewPager); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.fragment_usercar, container, false); presenter = (this.ParentFragment as GarageFragment).presenter; ViewInjector.Inject(this, view); StyleView(); garageCollapsingToolbar.Title = $"{presenter.userCars[carIndex]["Make"]} {presenter.userCars[carIndex]["Model"].ToString().ToUpper()}"; var userCarTabLayoutAdapter = new TabsAdapter(this.ChildFragmentManager, new List <Fragment> { new UserCarStatisticFragment(), new UserCarInfoFragment(carIndex) }, new List <Java.Lang.String> { new Java.Lang.String("ÑÒÀÒÈÑÒÈÊÀ"), new Java.Lang.String("ÈÍÔÎ") }); userCarInfoViewPager.Adapter = userCarTabLayoutAdapter; garageTabLayout.SetupWithViewPager(userCarInfoViewPager); return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView(Resource.Layout.fragment_tabs_pager); tabHost = FindViewById<TabHost>(Android.Resource.Id.TabHost); tabHost.Setup(); viewPager = FindViewById<ViewPager>(Resource.Id.pager); tabsAdapter = new TabsAdapter(this, tabHost, viewPager); tabsAdapter.AddTab(tabHost.NewTabSpec("simple").SetIndicator("Simple"), Java.Lang.Class.FromType(typeof(FragmentStackSupport.CountingFragment)), null); tabsAdapter.AddTab(tabHost.NewTabSpec("contacts").SetIndicator("Custom"), Java.Lang.Class.FromType(typeof(LoaderCursorSupport.CursorLoaderListFragment)), null); if (savedInstanceState != null) { tabHost.SetCurrentTabByTag(savedInstanceState.GetString("tab")); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.fragment_tabs_pager); tabHost = FindViewById <TabHost>(Android.Resource.Id.TabHost); tabHost.Setup(); viewPager = FindViewById <ViewPager>(Resource.Id.pager); tabsAdapter = new TabsAdapter(this, tabHost, viewPager); tabsAdapter.AddTab(tabHost.NewTabSpec("simple").SetIndicator("Simple"), Java.Lang.Class.FromType(typeof(FragmentStackSupport.CountingFragment)), null); tabsAdapter.AddTab(tabHost.NewTabSpec("contacts").SetIndicator("Custom"), Java.Lang.Class.FromType(typeof(LoaderCursorSupport.CursorLoaderListFragment)), null); if (savedInstanceState != null) { tabHost.SetCurrentTabByTag(savedInstanceState.GetString("tab")); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.main); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); if (toolbar != null) { SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(false); SupportActionBar.SetHomeButtonEnabled(false); } adapter = new TabsAdapter(this, SupportFragmentManager); pager = FindViewById <ViewPager>(Resource.Id.pager); var tabs = FindViewById <TabLayout>(Resource.Id.tabs); pager.Adapter = adapter; tabs.SetupWithViewPager(pager); pager.OffscreenPageLimit = 3; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var data = Intent.GetStringExtra("data"); var item = Newtonsoft.Json.JsonConvert.DeserializeObject <Facility>(data); viewModel = new FacilityDetailViewModel(item); Bundle mybundle = new Bundle(); mybundle.PutString("data", Newtonsoft.Json.JsonConvert.SerializeObject(item)); adapter = new TabsAdapter(this, SupportFragmentManager, mybundle); pager = FindViewById <ViewPager>(Resource.Id.viewpager); var tabs = FindViewById <TabLayout>(Resource.Id.tabs); pager.Adapter = adapter; tabs.SetupWithViewPager(pager); pager.OffscreenPageLimit = 3; Toolbar.MenuItemClick += (sender, e) => { var intent = new Intent(this, typeof(LoginActivity));; StartActivity(intent); }; pager.PageSelected += (sender, args) => { var fragment = adapter.InstantiateItem(pager, args.Position) as IFragmentVisible; fragment?.BecameVisible(); }; SupportActionBar.Title = item.Name; SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.fragment_tabs_pager); tabHost = FindViewById <TabHost>(Android.Resource.Id.TabHost); tabHost.Setup(); viewPager = FindViewById <ViewPager>(Resource.Id.pager); viewPager.OffscreenPageLimit = 5; tabsAdapter = new TabsAdapter(this, tabHost, viewPager); tabsAdapter.AddTab(tabHost.NewTabSpec("Goal").SetIndicator(string.Empty, Resources.GetDrawable(Resource.Drawable.target)), Java.Lang.Class.FromType(typeof(GoalFragment)), null); tabsAdapter.AddTab(tabHost.NewTabSpec("Activities").SetIndicator(string.Empty, Resources.GetDrawable(Resource.Drawable.activities)), Java.Lang.Class.FromType(typeof(ActivitiesFragment)), null); tabsAdapter.AddTab(tabHost.NewTabSpec("Contacts").SetIndicator(string.Empty, Resources.GetDrawable(Resource.Drawable.contacts)), Java.Lang.Class.FromType(typeof(ContactsFragment)), null); tabsAdapter.AddTab(tabHost.NewTabSpec("Report").SetIndicator(string.Empty, Resources.GetDrawable(Resource.Drawable.report)), Java.Lang.Class.FromType(typeof(ReportsFragment)), null); if (savedInstanceState != null) { tabHost.SetCurrentTabByTag(savedInstanceState.GetString(tabKeyString)); } }
private void InitTabsAdapter() { mTabsAdapter = new TabsAdapter(this, mViewPager, FragmentManager); mTabsAdapter.AddTab(typeof(InterfaceFragment), null); mTabsAdapter.NotifyDataSetChanged(); }