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);
            }
        }
Example #2
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);
        }