protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.MainScreenActivityView); //this.Window.AddFlags(WindowManagerFlags.Fullscreen); PopulateTabs (); _tabHost = FindViewById<TabHost>(Resource.Id.tabHost1); //set selected tab if there is a topic (coming from a notification) try { string topic = Intent.GetStringExtra("topic"); if (topic != null) { _tabHost.SetCurrentTabByTag (topic); } } catch(Exception e) { } _refresher = FindViewById<SwipeRefreshLayout>(Resource.Id.refresher1); _refresher.Refresh += delegate { PopulateSermons(); PopulatePrayerRequests(); PopulateElders(); _refresher.Refreshing = false; }; _gestureListener = new GestureListener(); _gestureListener.LeftEvent += GestureRight; _gestureListener.RightEvent += GestureLeft; _gestureDetector = new GestureDetector(this, _gestureListener); }
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")); } }
public TabManager(FragmentActivity activity, TabHost tabHost, int containerId) { _activity = activity; _tabHost = tabHost; _containerId = containerId; _tabHost.SetOnTabChangedListener(this); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.home_dashboard); LocalActivityManager localActMgr = new LocalActivityManager (this, false); localActMgr.DispatchCreate (bundle); tabHost = FindViewById<TabHost> (Resource.Id.tabhost); tabHost.Setup (localActMgr); MApplication.getInstance().userDashboardType = (int)Constants.LISTTYPE.ALERTS; CreateTab(typeof(AlertActivity), "alerts", GetString(Resource.String.alerts_title), Resource.Drawable.ic_tab_alerts, 0); CreateTab(typeof(BookingRequestsActivity), "bookingrequests", GetString(Resource.String.booking_requests_title), Resource.Drawable.ic_tab_bookingrequests, 1); CreateTab(typeof(ConfirmedRequestsActivity), "confirmedbookings", GetString(Resource.String.confirmed_booking_title), Resource.Drawable.ic_tab_confirmedbookings, 2); CreateTab(typeof(PastBookingActivity), "pastbookings", GetString(Resource.String.past_booking_title), Resource.Drawable.ic_tab_pasthistory, 3); getNumBooking = new GetNumberBooking (this); getNumBooking.actionGetNumBooking = this; getNumBooking.getNumBookingRequest (); homeDashBoardActivity = this; popupNoticeAlert = new PopupNoticeInfomation (this); popupNoticeAlert.noticeDelegate = this; popupNoticeRequest = new PopupNoticeInfomation (this); popupNoticeRequest.noticeDelegate = this; popupNoticeConfirm = new PopupNoticeInfomation (this); popupNoticeConfirm.noticeDelegate = this; popupNoticePast = new PopupNoticeInfomation (this); popupNoticePast.noticeDelegate = this; TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostNotifyAlertChange, new TCSelector (reloadDashBoard)); }
void KeepMe() { var txt = new TextView(null); txt.Text = txt.Text; var iv = new ImageView(null); var obj = iv.Drawable; var prog = new ProgressBar(null); prog.Progress = prog.Progress; var cb = new RadioButton(null); cb.Checked = cb.Checked; var np = new NumberPicker(null); np.Value = np.Value; var rb = new RatingBar(null); rb.Rating = rb.Rating; var cv = new CalendarView(null); cv.Date = cv.Date; var th = new TabHost(null); th.CurrentTab = th.CurrentTab; var tp = new TimePicker(null); tp.CurrentHour = tp.CurrentHour; tp.CurrentMinute = tp.CurrentMinute; }
public void AddTab(TabHost.TabSpec tabSpec, Class clss, Bundle args) { tabSpec.SetContent(new DummyTabFactory(_context)); var tag = tabSpec.Tag; var info = new TabInfo(tag, clss, args); _tabs.Add(info); _tabHost.AddTab(tabSpec); NotifyDataSetChanged(); }
public TabsAdapter(FragmentActivity activity, TabHost tabHost, ViewPager pager) : base(activity.SupportFragmentManager) { _context = activity; _tabHost = tabHost; _viewPager = pager; _tabHost.SetOnTabChangedListener(this); _viewPager.Adapter = this; _viewPager.SetOnPageChangeListener(this); }
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 savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.activity_starred); ActivityHelper.SetupActionBar (new Java.Lang.String (Title), new Color (0)); mTabHost = FindViewById<TabHost> (Android.Resource.Id.TabHost); mTabWidget = FindViewById<TabWidget> (Android.Resource.Id.Tabs); mTabHost.Setup (); SetupSessionsTab (); SetupVendorsTab (); }
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); SetContentView (Resource.Layout.TabHostActivity); TabHost.TabSpec spec; Intent intent; _tabHost = FindViewById<TabHost>(Android.Resource.Id.TabHost); _tabHost.Setup(); CreateTab(typeof(SippsActivity), "Sipps", "", Resource.Drawable.dashboard_selector); CreateTab(typeof(PeekActivity), "Peek", "", Resource.Drawable.peek_selector); CreateTab(typeof(MeActivity), "Me", "", Resource.Drawable.me_selector); CreateTab(typeof(MoreActivity), "More", "", Resource.Drawable.more_selector); TabWidget.GetChildAt(0).SetBackgroundColor(Color.White); TabWidget.GetChildAt(1).SetBackgroundColor(Color.White); TabWidget.GetChildAt(2).SetBackgroundColor(Color.White); TabWidget.GetChildAt(3).SetBackgroundColor(Color.White); }
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")); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature (WindowFeatures.ActionBar); SetContentView(Resource.Layout.user_dashboard_layout); ActionBar.NavigationMode = ActionBarNavigationMode.Standard; ActionBar.SetTitle(Resource.String.dash_board_title); ActionBar.SetDisplayShowTitleEnabled (false); ActionBar.SetDisplayHomeAsUpEnabled(false); ActionBar.SetDisplayShowHomeEnabled (true); changeStatusPopup = new ChangeStatusPopup (this); changeStatusPopup.changeStatusDelegate = this; imgIconStatus = FindViewById<ImageView> (Resource.Id.imgIconStatus); tvStatus = FindViewById<TextView> (Resource.Id.tvExpertStatus); var llStatus = FindViewById<LinearLayout> (Resource.Id.llStatus); llStatus.Click += (sender, e) => { changeStatusPopup.ShowStatus(MApplication.getInstance().iExpertStatus); }; SetExpertStatus (); LocalActivityManager localActMgr = new LocalActivityManager (this, false); localActMgr.DispatchCreate (bundle); tabHost = FindViewById<TabHost> (Resource.Id.tabhost); tabHost.Setup (localActMgr); if (MApplication.getInstance ().isConsultant) { CreateTab(typeof(HomeDashBoard), "home", GetString(Resource.String.dash_board_title), Resource.Drawable.ic_tab_home, (int)TabHomeSpec.Home); CreateTab (typeof(MyProfileActivity), "my_profile", GetString(Resource.String.my_profile_title), Resource.Drawable.ic_tab_my_profile, (int)TabHomeSpec.Status); CreateTab (typeof(MyProfileActivity), "my_profile", GetString(Resource.String.my_profile_title), Resource.Drawable.ic_tab_my_profile, (int)TabHomeSpec.MyProfile); } else { llStatus.Visibility = ViewStates.Gone; CreateTab(typeof(HomeDashBoard), "home", GetString(Resource.String.dash_board_title), Resource.Drawable.ic_tab_home, (int)TabHome.Home); CreateTab(typeof(SearchResultActivity), "search", GetString(Resource.String.search_tab_title), Resource.Drawable.ic_tab_search, (int)TabHome.Search); CreateTab (typeof(ListFavoriteActivity), "list_favorite", GetString(Resource.String.favorites_title), Resource.Drawable.ic_tab_listfavorite, (int)TabHome.ListFavorite); CreateTab (typeof(MyProfileActivity), "my_profile", GetString(Resource.String.my_profile_title), Resource.Drawable.ic_tab_my_profile, (int)TabHome.MyProfile); } TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPushAvailabilityStatus, new TCSelector (OnPushAvailabilityStatus)); }
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")); } }
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(); }
public override Android.Views.View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle p2) { mRootView = (ViewGroup)inflater.Inflate (Resource.Layout.fragment_session_detail, null); mTabHost = mRootView.FindViewById<TabHost> (Android.Resource.Id.TabHost); mTabHost.Setup (); mTitle = mRootView.FindViewById<TextView> (Resource.Id.session_title); mSubtitle = mRootView.FindViewById<TextView> (Resource.Id.session_subtitle); mStarred = mRootView.FindViewById<CompoundButton> (Resource.Id.star_button); mStarred.CheckedChange += HandleCheckedChange; mStarred.Focusable = true; mStarred.Clickable = true; // Larger target triggers star toggle View starParent = mRootView.FindViewById<View> (Resource.Id.header_session); FractionalTouchDelegate.SetupDelegate (starParent, mStarred, new RectF (0.6f, 0f, 1f, 0.8f)); mAbstract = mRootView.FindViewById<TextView> (Resource.Id.session_abstract); mRequirements = mRootView.FindViewById<TextView> (Resource.Id.session_requirements); SetupSummaryTab (); SetupNotesTab (); SetupLinksTab (); return mRootView; }
private void SetIndicator(TabHost.TabSpec tabSpec, object item) { var viewModel = item as IViewModel; if (viewModel != null) viewModel.Settings.Metadata.AddOrUpdate(ViewModelConstants.StateNotNeeded, true); var templateId = _itemTemplateProvider.GetTemplateId(); var selector = _itemTemplateProvider.GetDataTemplateSelector(); if (templateId == null && selector == null) selector = EmptyTemplateSelector.Instance; object content = PlatformExtensions.GetContentView(TabHost, TabHost.Context, item, templateId, selector); if (content == EmptyTemplateSelector.EmptyView) { content = null; if (viewModel is IHasDisplayName) BindingServiceProvider.BindingProvider.CreateBindingsFromString(tabSpec, "Title DisplayName", null); else tabSpec.SetIndicator(item.ToStringSafe("(null)")); } var view = content as View; if (view == null) tabSpec.SetIndicator(content.ToStringSafe("(null)")); else tabSpec.SetIndicator(view); }
private void TabHostOnTabChanged(object sender, TabHost.TabChangeEventArgs args) { OnTabChanged(args.TabId); }
internal TabHostItemsSourceGenerator([NotNull] TabHost tabHost) { Should.NotBeNull(tabHost, "tabHost"); TabHost = tabHost; TabHost.Setup(); _tabToContent = new Dictionary<string, TabInfo>(); _tabFactory = new TabFactory(this); _itemTemplateProvider = new DataTemplateProvider(tabHost, AttachedMemberConstants.ItemTemplate, AttachedMemberConstants.ItemTemplateSelector); _contentTemplateProvider = new DataTemplateProvider(tabHost, AttachedMemberConstants.ContentTemplate, AttachedMemberConstants.ContentTemplateSelector); _selectedItemMember = BindingServiceProvider .MemberProvider .GetBindingMember(tabHost.GetType(), AttachedMemberConstants.SelectedItem, false, false); TryListenActivity(tabHost.Context); TabHost.TabChanged += TabHostOnTabChanged; }
public TabInfo(object item, TabHost.TabSpec tabSpec, object content) { Item = item; TabSpec = tabSpec; Content = content; }
public TabsAdapter(FragmentActivity activity, TabHost tabHost, ViewPager pager) : base(activity.GetSupportFragmentManager()) { mContext = activity; mTabHost = tabHost; mViewPager = pager; mTabHost.SetOnTabChangedListener(this); mViewPager.SetAdapter(this); mViewPager.SetOnPageChangeListener(this); }
public void AddTab(TabHost.TabSpec tabSpec, System.Type clss, Bundle args) { tabSpec.SetContent(new DummyTabFactory(mContext)); string tag = tabSpec.GetTag(); TabInfo info = new TabInfo(tag, clss, args); mTabs.Add(info); mTabHost.AddTab(tabSpec); NotifyDataSetChanged(); }
public void AddTab(TabHost.TabSpec tabSpec, Class clss, Bundle args) { tabSpec.SetContent(new DummyTabFactory(_activity)); var tag = tabSpec.Tag; var info = new TabInfo(tag, clss, args); // Check to see if we already have a fragment for this tab, probably // from a previously saved state. If so, deactivate it, because our // initial state is that a tab isn't shown. info.fragment = _activity.SupportFragmentManager.FindFragmentByTag(tag); if (info.fragment != null && !info.fragment.IsDetached) { var ft = _activity.SupportFragmentManager.BeginTransaction(); ft.Detach(info.fragment); ft.Commit(); } _tabs.Add(tag, info); _tabHost.AddTab(tabSpec); }
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; }
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; }
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; }
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; }
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; }