protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView(Resource.Layout.fragment_tabs); tabHost = FindViewById<TabHost>(Android.Resource.Id.TabHost); tabHost.Setup(); tabManager = new TabManager(this, tabHost, Resource.Id.realtabcontent); tabManager.AddTab(tabHost.NewTabSpec("simple").SetIndicator("Simple"), Java.Lang.Class.FromType(typeof(FragmentStackSupport.CountingFragment)), null); tabManager.AddTab(tabHost.NewTabSpec("contacts").SetIndicator("Custom"), Java.Lang.Class.FromType(typeof(LoaderCursorSupport.CursorLoaderListFragment)), null); /*tabManager.AddTab(tabHost.NewTabSpec("contacts").SetIndicator("Contacts"), LoaderCursorSupport.CursorLoaderListFragment.class, null); tabManager.AddTab(tabHost.NewTabSpec("custom").SetIndicator("Custom"), LoaderCustomSupport.AppListFragment.class, null); tabManager.AddTab(mttabHost.NewTabSpec("throttle").SetIndicator("Throttle"), LoaderThrottleSupport.ThrottledLoaderListFragment.class, null); */ if (savedInstanceState != null) { tabHost.SetCurrentTabByTag(savedInstanceState.GetString("tab")); } }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.AssignmentsTabsLayout); tabHost = FindViewById<TabHost> (Resource.Id.assingmentTabHost); //In order to use tabs outside of a TabActivity I have to use this local activity manager and dispatch create the savedInstanceState localManger = new LocalActivityManager (this, true); localManger.DispatchCreate (savedInstanceState); tabHost.Setup (localManger); TabHost.TabSpec assignmentsSpec = tabHost.NewTabSpec ("list"); Intent assignmentIntent = new Intent (this, typeof (AssignmentsActivity)); assignmentsSpec.SetContent (assignmentIntent); assignmentsSpec.SetIndicator ("list"); TabHost.TabSpec mapViewSpec = tabHost.NewTabSpec ("map"); Intent mapViewIntent = new Intent (this, typeof (MapViewActivity)); mapViewSpec.SetContent (mapViewIntent); mapViewSpec.SetIndicator ("map"); tabHost.AddTab (assignmentsSpec); tabHost.AddTab (mapViewSpec); tabHost.TabChanged += (sender, e) => { if (tabHost.CurrentTab == 0) { MapData = null; } }; try { if (savedInstanceState != null) { if (savedInstanceState.ContainsKey (Constants.CurrentTab)) { var currentTab = savedInstanceState.GetInt (Constants.CurrentTab, 0); tabHost.CurrentTab = currentTab; } else { tabHost.CurrentTab = 0; } if (savedInstanceState.ContainsKey ("mapData")) { MapData = (MapDataWrapper)savedInstanceState.GetSerializable ("mapData"); } else { MapData = null; } } else { MapData = null; tabHost.CurrentTab = 0; } } catch (Exception) { tabHost.CurrentTab = 0; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); MenuId = Resource.Menu.MainMenu; SetContentView(Resource.Layout.fragment_tabs); m_TabHost = FindViewById<TabHost>(Android.Resource.Id.TabHost); m_TabHost.Setup(); m_ViewPager = FindViewById<ViewPager>(Resource.Id.pager); m_TabsAdapter = new TabsAdapter(this, m_TabHost, m_ViewPager); ActionBar = FindViewById<ActionBar>(Resource.Id.actionbar); ActionBar.Title = "Look Fragments"; ActionBar.CurrentActivity = this; AddHomeAction(); var action = new MenuItemActionBarAction(this, this, Resource.Id.menu_search, Resource.Drawable.ic_action_search_dark, Resource.String.menu_string_search); ActionBar.AddAction(action); var spec = m_TabHost.NewTabSpec("tv"); spec.SetIndicator("Tab 1", Resources.GetDrawable(Resource.Drawable.ic_launcher)); m_TabsAdapter.AddTab(spec, Java.Lang.Class.FromType(typeof(FramgmentTab1)), null); spec = m_TabHost.NewTabSpec("tab2"); spec.SetIndicator("Tab 2", Resources.GetDrawable(Resource.Drawable.ic_launcher)); m_TabsAdapter.AddTab(spec, Java.Lang.Class.FromType(typeof(FramgmentTab2)), null); if (bundle != null) { m_TabHost.SetCurrentTabByTag(bundle.GetString("tab")); } else { m_TabHost.CurrentTab = 0; } }
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; } }
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")); } }
public void setTaHost(TabHost tabhost) { TabHost.TabSpec ts = tabhost.NewTabSpec("tag_1"); ts.SetIndicator("#Twitter"); ts.SetContent(new Intent(this, typeof(int_activity1))); tabhost.AddTab(ts); ts = tabhost.NewTabSpec("tag_2"); ts.SetIndicator("#Dribble"); ts.SetContent(new Intent(this, typeof(int_Activity2))); tabhost.AddTab(ts); ts = tabhost.NewTabSpec("tag_3"); ts.SetIndicator("#Android"); ts.SetContent(new Intent(this, typeof(int_Activity3))); tabhost.AddTab(ts); }
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 override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (view != null) { ViewGroup parent = (ViewGroup)view.Parent; if(parent != null) { parent.RemoveView (view); } } try { if ( layoutId == 0 || layoutId != UI.Resource.Layout.FrgMap) { layoutId = UI.Resource.Layout.FrgMap; } view = inflater.Inflate (layoutId,container,false); // if savedInstanceState is not null then the device has been rotated // So get out of this sub as quickly as possible if (savedInstanceState != null) return view; if (view != null) { tabHost = view.FindViewById<TabHost> (Resource.Id.historyTabHost); localManger = new LocalActivityManager (Activity, true); localManger.DispatchCreate (savedInstanceState); tabHost.Setup (localManger); var NormalMapIndicator = CreateTab ("Normal",Resource.Drawable.ic_action_map_dark); TabHost.TabSpec NormalMapTab = tabHost.NewTabSpec ("Normal"); NormalMapTab.SetIndicator (NormalMapIndicator); NormalMapTab.SetContent (new TabContent (new TextView (tabHost.Context))); var SatelliteMapIndicator = CreateTab (_activity.GetString(Resource.String.MapTypeSatellite),Resource.Drawable.ic_action_map_dark); TabHost.TabSpec SatelliteChartTab = tabHost.NewTabSpec ("Satellite"); SatelliteChartTab.SetIndicator (SatelliteMapIndicator); SatelliteChartTab.SetContent (new TabContent(new TextView(tabHost.Context))); var TerrainMapIndicator = CreateTab (_activity.GetString(Resource.String.MapTypeTerrain),Resource.Drawable.ic_action_map_dark); TabHost.TabSpec terrainMapTab = tabHost.NewTabSpec ("Terrain"); terrainMapTab.SetIndicator (TerrainMapIndicator); terrainMapTab.SetContent (new TabContent(new TextView(tabHost.Context))); var HybridMapIndicator = CreateTab (_activity.GetString(Resource.String.MapTypeHybrid),Resource.Drawable.ic_action_map_dark); TabHost.TabSpec HybridMapTab = tabHost.NewTabSpec ("Hybrid"); HybridMapTab.SetIndicator (HybridMapIndicator); HybridMapTab.SetContent (new TabContent(new TextView(tabHost.Context))); tabHost.AddTab (NormalMapTab); tabHost.AddTab (SatelliteChartTab); tabHost.AddTab (terrainMapTab); tabHost.AddTab (HybridMapTab); tabHost.TabChanged += (sender, e) => { switch (tabHost.CurrentTab) { case 0: // Normal Map has been clicked _map.MapType = GoogleMap.MapTypeNormal; break; case 1: // Satellite has been clicked _map.MapType = GoogleMap.MapTypeSatellite; break; case 2: // Terrain Map has been clicked _map.MapType = GoogleMap.MapTypeTerrain; break; case 3: // Hybrid Map has been clicked _map.MapType = GoogleMap.MapTypeHybrid; break; default: DataAccessLayer.ExceptionWriter.WriteLogFile("ERROR","Error in MainFragment Line 324: Just define the tab, bro"); break; } }; } } catch(Exception ex) { DataAccessLayer.ExceptionWriter.WriteLogFile(ex); } return view; }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (view != null) { ViewGroup parent = (ViewGroup)view.Parent; if(parent != null) { parent.RemoveView (view); } } try { if ( layoutId == 0) layoutId = UI.Resource.Layout.FrgChart; view = inflater.Inflate (layoutId,container,false); // if savedInstanceState is not null then the device has been rotated // So get out of this sub as quickly as possible if (savedInstanceState != null) return view; if (view != null) { tabHost = view.FindViewById<TabHost> (Resource.Id.historyTabHost); localManger = new LocalActivityManager (Activity, true); localManger.DispatchCreate (savedInstanceState); tabHost.Setup (localManger); var columnChartIndicator = CreateTab (_activity.GetString(Resource.String.ColumnChart),Resource.Drawable.ic_action_chart); TabHost.TabSpec columnChartTab = tabHost.NewTabSpec ("ColumnChart"); columnChartTab.SetIndicator (columnChartIndicator); columnChartTab.SetContent (new TabContent (new TextView (tabHost.Context))); var lineChartIndicator = CreateTab (_activity.GetString(Resource.String.LineChart),Resource.Drawable.ic_action_chart); TabHost.TabSpec lineChartTab = tabHost.NewTabSpec ("LineChart"); lineChartTab.SetIndicator (lineChartIndicator); lineChartTab.SetContent (new TabContent(new TextView(tabHost.Context))); tabHost.AddTab (columnChartTab); tabHost.AddTab (lineChartTab); tabHost.TabChanged += (sender, e) => { switch (tabHost.CurrentTab) { case 0: // ColumnChart has been clicked _stateFragment.RunColumnChart (); break; case 1: // LineChart has been clicked _stateFragment.RunLineChart (); break; default: DataAccessLayer.ExceptionWriter.WriteLogFile("ERROR","Error in MainFragment Line 324: Just define the tab, bro"); break; } }; } } catch(Exception ex) { DataAccessLayer.ExceptionWriter.WriteLogFile(ex); } return view; }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView (inflater, container, savedInstanceState); historyViewModel = ServiceContainer.Resolve<HistoryViewModel> (); menuViewModel = ServiceContainer.Resolve<MenuViewModel> (); var view = inflater.Inflate (Resource.Layout.HistoryFragmentLayout, null, true); searchText = view.FindViewById<EditText> (Resource.Id.historySearchText); searchText.TextChanged += (sender, e) => { if (historySearchAdapter != null) { historySearchAdapter.FilterItems (searchText.Text); historySearchAdapter.NotifyDataSetChanged (); } }; var clearSearch = view.FindViewById<ImageButton> (Resource.Id.historyClearSearch); clearSearch.Click += (sender, e) => searchText.Text = string.Empty; tabHost = view.FindViewById<TabHost> (Resource.Id.historyTabHost); historyListView = view.FindViewById<ListView> (Resource.Id.historyListView); localManger = new LocalActivityManager (Activity, true); localManger.DispatchCreate (savedInstanceState); tabHost.Setup (localManger); var dateIndicator = CreateTab ("DATE"); TabHost.TabSpec dateTab = tabHost.NewTabSpec ("Date"); dateTab.SetIndicator (dateIndicator); dateTab.SetContent (new TabContent (new TextView (tabHost.Context))); var callsIndicator = CreateTab ("CALLS"); TabHost.TabSpec callsTab = tabHost.NewTabSpec ("Calls"); callsTab.SetIndicator (callsIndicator); callsTab.SetContent (new TabContent(new TextView(tabHost.Context))); var assignmentIndicator = CreateTab ("ASSIGNMENTS"); TabHost.TabSpec assignments = tabHost.NewTabSpec ("Assignments"); assignments.SetIndicator (assignmentIndicator); assignments.SetContent (new TabContent (new TextView(tabHost.Context))); tabHost.AddTab (dateTab); tabHost.AddTab (callsTab); tabHost.AddTab (assignments); tabHost.TabChanged += (sender, e) => { if (History != null) { switch (tabHost.CurrentTab) { case 0: historySearchAdapter = new HistoryListAdapter (Activity, Resource.Layout.HistoryItemLayout, History.OrderBy (h => h.Date).ToList ()); break; case 1: historySearchAdapter = new HistoryListAdapter (Activity, Resource.Layout.HistoryItemLayout, History.Where (h => h.Type == AssignmentHistoryType.PhoneCall).ToList ()); break; default: historySearchAdapter = new HistoryListAdapter (Activity, Resource.Layout.HistoryItemLayout, History.Where (h => h.Type == AssignmentHistoryType.Assignment).ToList ()); break; } historySearchAdapter.Assignment = Assignment; historyListView.Adapter = historySearchAdapter; } }; if (History != null) { historySearchAdapter = new HistoryListAdapter (Activity, Resource.Layout.HistoryItemLayout, History.OrderBy (a => a.Date).ToList ()); historySearchAdapter.Assignment = Assignment; historyListView.Adapter = historySearchAdapter; } historyListView.ItemClick += (sender, e) => { var intent = new Intent (Activity, typeof (SummaryHistoryActivity)); historyViewModel.SelectedAssignmentHistory = History.ElementAtOrDefault (e.Position); menuViewModel.MenuIndex = 0; StartActivity (intent); }; return view; }
private void PopulateTabs() { _tabHost = FindViewById<TabHost> (Resource.Id.tabHost1); _tabHost.Setup (); var spec1 = _tabHost.NewTabSpec ("sermons"); spec1.SetContent (Resource.Id.sermonsLayout); spec1.SetIndicator ("Sermons"); var spec2 = _tabHost.NewTabSpec ("prayerRequests"); spec2.SetContent (Resource.Id.prayerRequestsLayout); spec2.SetIndicator ("Prayer Requests"); var spec3 = _tabHost.NewTabSpec ("elders"); spec3.SetContent (Resource.Id.eldersLayout); spec3.SetIndicator ("Elders"); _tabHost.AddTab (spec1); _tabHost.AddTab (spec2); _tabHost.AddTab (spec3); _tabHost.SetCurrentTabByTag ("prayerRequests"); for (int j = 0; j < _tabHost.TabWidget.ChildCount; j++) { TextView tv = (TextView)_tabHost.TabWidget.GetChildAt (j).FindViewById (Android.Resource.Id.Title); tv.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); } //PopulateSermons (); PopulatePrayerRequests(); PopulateElders(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); userID = Intent.GetStringExtra ("id") ?? "-1"; mainPrefs = GetSharedPreferences("loginPrefs",FileCreationMode.Private); mainEditor = mainPrefs.Edit (); serviceNumer = mainPrefs.GetInt ("service_size", -1); SetContentView (Resource.Layout.Main); tabHost = FindViewById<TabHost> (Android.Resource.Id.TabHost); tabHost.Setup (); for (int i = 1; i <= 2; i++) { TabHost.TabSpec tabSpec; tabSpec = tabHost.NewTabSpec("Tab " + i); tabSpec.SetIndicator("Tab " + i); tabSpec.SetContent(new FakeContent(this)); tabHost.AddTab(tabSpec); } tabHost.SetOnTabChangedListener(this); viewPager = FindViewById<ViewPager> (Resource.Id.view); var adaptor = new ServiceBeaconAdapter (SupportFragmentManager); adaptor.addFragmentView ((i, v, b) => { var view = i.Inflate (Resource.Layout.Page, v, false); var myText = view.FindViewById<TextView> (Resource.Id.textView1); myText.Text = myText.Text + "1"; return view; }); adaptor.addFragmentView((i,v,b) => { var view = i.Inflate(Resource.Layout.Page,v,false); var myText = view.FindViewById<TextView> (Resource.Id.textView1); myText.Text = myText.Text + "2"; return view; }); viewPager.Adapter = adaptor;//new ServiceBeaconAdapter (SupportFragmentManager); viewPager.SetOnPageChangeListener(this); beaconStatusLabel = FindViewById<TextView> (Resource.Id.beaconStatusLabel); beaconMgr.Bind (this); //myProcessedBeacons = new JavaDictionary<string,string>(); monitorNotifier.EnterRegionComplete += EnteredRegion; monitorNotifier.ExitRegionComplete += ExitedRegion; rangeNotifier.DidRangeBeaconsInRegionComplete += HandleBeaconsInRegion; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); userID = Intent.GetStringExtra ("id") ?? "-1"; mainPrefs = GetSharedPreferences("loginPrefs",FileCreationMode.Private); mainEditor = mainPrefs.Edit (); serviceNumer = mainPrefs.GetInt ("service_size", -1); categoryNumber = mainPrefs.GetInt ("category_size", 0); SetContentView (Resource.Layout.Main); tabHost = FindViewById<TabHost> (Android.Resource.Id.TabHost); tabHost.Setup (); for (int i = 0; i < categoryNumber; i++) { TabHost.TabSpec tabSpec; tabSpec = tabHost.NewTabSpec(mainPrefs.GetString ("ServiceCategoriesName_" + i, null).ToLower()); tabSpec.SetIndicator(mainPrefs.GetString ("ServiceCategoriesName_" + i, null).ToLower()); tabSpec.SetContent(new FakeContent(this)); tabHost.AddTab(tabSpec); } tabHost.SetOnTabChangedListener(this); setSelectedTabColor (); /*for(int i = 0; i < tabHost.TabWidget.ChildCount; i++) { View v = tabHost.TabWidget.GetChildTabViewAt(i); // Look for the title view to ensure this is an indicator and not a divider. v.SetBackgroundResource(Resource.Drawable.apptheme_tab_indicator_holo); }*/ viewPager = FindViewById<ViewPager> (Resource.Id.view); var adaptor = new ServiceBeaconAdapter (SupportFragmentManager); for (int i = 0; i < categoryNumber; i++) { adaptor.addFragmentView ((k, v, b) => { var view = k.Inflate (Resource.Layout.Page, v, false); var myText = view.FindViewById<TextView> (Resource.Id.textView1); myText.Text = mainPrefs.GetString ("ServiceCategoriesName_" + i, null).ToLower(); return view; }); } viewPager.Adapter = adaptor;//new ServiceBeaconAdapter (SupportFragmentManager); viewPager.SetOnPageChangeListener(this); beaconStatusLabel = FindViewById<TextView> (Resource.Id.beaconStatusLabel); beaconMgr.Bind (this); //myProcessedBeacons = new JavaDictionary<string,string>(); monitorNotifier.EnterRegionComplete += EnteredRegion; monitorNotifier.ExitRegionComplete += ExitedRegion; rangeNotifier.DidRangeBeaconsInRegionComplete += HandleBeaconsInRegion; }