Ejemplo n.º 1
0
        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;
            }            
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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;

        }
Ejemplo n.º 4
0
        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;

        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
        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();
		}
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 8
0
        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;
        }