Example #1
0
        public void OnTabUnselected(ActionBar.Tab tab, FragmentTransaction ft)
        {
            var h = TabUnselected;

            if (h != null)
            {
                h(tab, new ActionBar.TabEventArgs(ft));
            }
        }
        protected override void OnCreate(Bundle savedInstance)
        {
            base.OnCreate(savedInstance);
            SetContentView(R.Layouts.ItemDetailActivity_Layout);

            var itemID = Intent.GetLongExtra("itemID", 0);
            var itemName = Intent.GetStringExtra("itemName");

            this.ActionBar.SetTitle(itemName);
            this.ActionBar.NavigationMode = ActionBar.NAVIGATION_MODE_TABS;

            detailsFragment = new ItemDetailsTabFragment(null);
            detailsTab = this.ActionBar.NewTab();
            detailsTab.SetText("Details");
            detailsTab.SetTabListener(this);
            detailsTab.SetTag(detailsFragment);
            this.ActionBar.AddTab(detailsTab);

            stocksFragment = new ItemStationStockTabFragment(null);
            stockTab = this.ActionBar.NewTab();
            stockTab.SetText("Stock");
            stockTab.SetTabListener(this);
            stockTab.SetTag(stocksFragment);
            this.ActionBar.AddTab(stockTab);

            producersFragment = new ItemProducersTabFragment(null);
            producersTab = this.ActionBar.NewTab();
            producersTab.SetText("Production");
            producersTab.SetTabListener(this);
            producersTab.SetTag(producersFragment);
            this.ActionBar.AddTab(producersTab);

            if (itemID == 0)
            {
                Android.Widget.Toast.MakeText(this, "Item ID Error!", Android.Widget.Toast.LENGTH_LONG).Show();
            }

            var itemDetail = LastNonConfigurationInstance as Item;
            if ((itemDetail != null) && (itemDetail.ItemID == itemID))
            {
                _savedInstance = itemDetail;
                PopulateItemDetail(itemDetail);
            }
            else
            {
                RefreshItemDetail(itemID);
            }
        }
			protected override void OnCreate (Bundle savedInstanceState) {
				base.OnCreate(savedInstanceState);
				base.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;
				brickController = BrickController.Instance;
				settings = RemoteSettings.Instance;
				SetContentView(Resource.Layout.tab);

				ActionBar actionBar = this.ActionBar;
				//actionBar.SetDisplayShowTitleEnabled (false);
				//actionBar.SetDisplayShowHomeEnabled (false);
				actionBar.NavigationMode = ActionBarNavigationMode.Tabs;
				
				vehicleTab = actionBar.NewTab ().SetText ("Vehicle");
				sensorTab = actionBar.NewTab ().SetText ("Sensor");
				motorTab = actionBar.NewTab ().SetText ("Motor");
				fileTab = actionBar.NewTab().SetText("Files");
				mailboxTab = actionBar.NewTab ().SetText ("Mailbox");
				
				vehicleFragment = new VehicleFragment();
				fileFragment = new FileListFragment();
				sensorFragment = new SensorFragment();
				Fragment empty = new Fragment ();

				vehicleTab.SetTabListener (new MyTabsListener(vehicleFragment)); 
				sensorTab.SetTabListener (new MyTabsListener(sensorFragment)); 
				motorTab.SetTabListener(new MyTabsListener(empty )); 
				fileTab.SetTabListener(new MyTabsListener(fileFragment)); 
				mailboxTab.SetTabListener (new MyTabsListener(empty));
				
				settings.Initialize(GetSharedPreferences ("RemoteSettings", 0));
				
				actionBar.AddTab(vehicleTab);
				actionBar.AddTab(sensorTab);
				//actionBar.AddTab(motorTab);
				actionBar.AddTab(fileTab);
				//actionBar.AddTab(mailboxTab);
				if(!hasSubscribed){
					brickController.NewBrick += delegate(MonoBrick.NXT.Brick<MonoBrick.NXT.Sensor, MonoBrick.NXT.Sensor, MonoBrick.NXT.Sensor, MonoBrick.NXT.Sensor> nxt) {
						nxt.Connection.Disconnected += OnDisconnected;
						nxt.Connection.Connected += OnConnected;
					};
					brickController.BrickException += OnBrickException;
					brickController.ThreadNotStarted += OnThreadOnstarted;
					hasSubscribed = true;
				}
			}
Example #4
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			firstCreate = true;
			handler = new Handler ();
			prefs = new PreferenceManager (this);

			circlesFragment = new CirclesFragment ();
			statsFragment = new StatsFragment ();

			SetContentView (Resource.Layout.Main);

			pager = FindViewById<Android.Support.V4.View.ViewPager> (Resource.Id.mainPager);
			pager.Adapter = new StaticFragmentPagerAdapter (SupportFragmentManager, circlesFragment, statsFragment);

			background = new DynamicGradientDrawable (Resources.GetColor (Resource.Color.top_shade_1),
			                                          Resources.GetColor (Resource.Color.bottom_shade_1),
			                                          Resources.GetColor (Resource.Color.top_shade_2),
			                                          Resources.GetColor (Resource.Color.bottom_shade_2));
			pager.SetBackgroundDrawable (background);
			pager.PageScrolled += HandlePageScrolled;
			pager.OverScrollMode = OverScrollMode.Never;
			if (prefs.FirstTimeAround)
				pager.Touch += DiscardTouchEventHandler;

			circlesTab = ActionBar.NewTab ().SetIcon (Resource.Drawable.ic_tab_circles);
			statsTab = ActionBar.NewTab ().SetIcon (Resource.Drawable.ic_tab_stats);
			circlesTab.TabSelected += (sender, e) => pager.SetCurrentItem (0, true);
			statsTab.TabSelected += (sender, e) => pager.SetCurrentItem (1, true);
			ActionBar.AddTab (circlesTab);
			ActionBar.AddTab (statsTab);
			pager.PageSelected += (sender, e) => ActionBar.SetSelectedNavigationItem (e.Position);

			circlesFragment.CirclesReady += OnCirclesReady;
		}
        //tab selected handler
        void TabOnTabSelected(object sender, ActionBar.TabEventArgs tabEventArgs)
        {
            tab1 = (ActionBar.Tab)sender;
            ListView listViewLayViewTournamentInfo = FindViewById<ListView>(Resource.Id.listViewLayViewTournamentInfo);

            switch (tab1.Position)
            {
                case 0:
                    listViewLayViewTournamentInfo.Adapter = new TournamentInfoListAdapter(this, itemsInfo);
                    listViewLayViewTournamentInfo.ItemClick -= ListViewLayViewTournamentInfo_ItemClick;
                    listViewLayViewTournamentInfo.ItemLongClick -= ListViewLayViewTournamentInfo_ItemLongClick;
                    listViewLayViewTournamentInfo.ItemClick += ListViewLayViewTournamentInfo_ItemClick;
                    listViewLayViewTournamentInfo.ItemLongClick += ListViewLayViewTournamentInfo_ItemLongClick;
                    break;
                case 1:
                    listViewLayViewTournamentInfo.Adapter = new MatchInfoListAdapter(this, itemsMatches);
                    listViewLayViewTournamentInfo.ItemClick -= ListViewLayViewTournamentInfo_ItemClick;
                    listViewLayViewTournamentInfo.ItemLongClick -= ListViewLayViewTournamentInfo_ItemLongClick;
                    listViewLayViewTournamentInfo.ItemClick += ListViewLayViewTournamentInfo_ItemClick;
                    listViewLayViewTournamentInfo.ItemLongClick += ListViewLayViewTournamentInfo_ItemLongClick;
                    gVar.lastViewTournamentInfoTabSelected = ActionBar.SelectedNavigationIndex;
                    break;
                case 2:
                    listViewLayViewTournamentInfo.Adapter = new ParticipantInfoListAdapter(this, itemsParticipants);
                    listViewLayViewTournamentInfo.ItemLongClick -= ListViewLayViewTournamentInfo_ItemLongClick;
                    listViewLayViewTournamentInfo.ItemClick += ListViewLayViewTournamentInfo_ItemClick;
                    listViewLayViewTournamentInfo.ItemLongClick += ListViewLayViewTournamentInfo_ItemLongClick;
                    gVar.lastViewTournamentInfoTabSelected = ActionBar.SelectedNavigationIndex;
                    break;
                case 3:
                    listViewLayViewTournamentInfo.Adapter = new FinalRankListAdapter(this, itemsParticipants);
                    listViewLayViewTournamentInfo.ItemClick -= ListViewLayViewTournamentInfo_ItemClick;
                    listViewLayViewTournamentInfo.ItemLongClick -= ListViewLayViewTournamentInfo_ItemLongClick;
                    listViewLayViewTournamentInfo.ItemClick += ListViewLayViewTournamentInfo_ItemClick;
                    listViewLayViewTournamentInfo.ItemLongClick += ListViewLayViewTournamentInfo_ItemLongClick;
                    gVar.lastViewTournamentInfoTabSelected = ActionBar.SelectedNavigationIndex;
                    break;
            }
        }
Example #6
0
 public override void SelectTab(Tab tab)
 {
     if (tab != null)
     {
         this.SupportActionBar.SelectTab(((TabAdapter)tab).SupportTab);
     }
 }
Example #7
0
 public override void RemoveTab(Tab tab)
 {
     this.SupportActionBar.RemoveTab(((TabAdapter)tab).SupportTab);
 }
Example #8
0
 public override void AddTab(Tab tab, int position, bool setSelected)
 {
     this.SupportActionBar.AddTab(((TabAdapter)tab).SupportTab, position, setSelected);
 }
Example #9
0
 public override void AddTab(Tab tab, int position)
 {
     this.SupportActionBar.AddTab(((TabAdapter)tab).SupportTab, position);
 }
Example #10
0
        private void setMainTabbar()
        {
            // Now set the actionnbar with its tabs -> Kunden + Lieferanten + Interessenten + Artikeln
            ActionBar bar = ActionBar;

            if(_user.HasPermission(BusinessLayer.DAC_Object.Kunde, BusinessLayer.DAC_Permission.READ))
            {
                _tabKunden = this.ActionBar.NewTab ();
                _tabKunden.SetText(Resources.GetString(Resource.String.Kunden) );
                _tabKunden.SetIcon ( Resource.Drawable.ic_action_person);
                _tabKunden.SetTabListener (this);
                bar.AddTab (_tabKunden);
            }
            if (_user.HasPermission(BusinessLayer.DAC_Object.Lieferant, BusinessLayer.DAC_Permission.READ))
            {
                _tabLieferanten = this.ActionBar.NewTab();
                _tabLieferanten.SetText(Resources.GetString(Resource.String.Lieferanten));
                _tabLieferanten.SetIcon(Resource.Drawable.ic_action_lieferant);
                _tabLieferanten.SetTabListener(this);
                bar.AddTab(_tabLieferanten);
            }
            if (_user.HasPermission(BusinessLayer.DAC_Object.Interessent, BusinessLayer.DAC_Permission.READ))
            {
                _tabInteressenten = this.ActionBar.NewTab();
                _tabInteressenten.SetText(Resources.GetString(Resource.String.Interessenten));
                _tabInteressenten.SetIcon(Resource.Drawable.ic_action_Interessent);
                _tabInteressenten.SetTabListener(this);
                bar.AddTab(_tabInteressenten);
            }
            if (User.HasPermission(BusinessLayer.DAC_Object.Artikel, BusinessLayer.DAC_Permission.READ))
            {
                _tabArtikel = this.ActionBar.NewTab ();
                _tabArtikel.SetText (Resources.GetString(Resource.String.Artikeln) );
                _tabArtikel.SetIcon(Resource.Drawable.ic_action_article);
                _tabArtikel.SetTabListener (this);
                bar.AddTab (_tabArtikel);
            }

            var mActionBarView = LayoutInflater.Inflate (
                Resource.Layout.action_bar_custom, null);


            bar.CustomView = mActionBarView;
            bar.DisplayOptions = ActionBarDisplayOptions.ShowCustom | ActionBarDisplayOptions.UseLogo;
            bar.NavigationMode = ActionBarNavigationMode.Tabs;
            bar.SetDisplayShowHomeEnabled (true);
            ActionBar.SetHomeButtonEnabled(true);
        }