Exemplo n.º 1
0
        void PopulateItemDetail(Item itemDetail)
        {
            int iconid = Item.GetIconId(itemDetail.ResourceName, this);

            if (iconid > 0)
            {
                this.ActionBar.SetIcon(iconid);
            }
            detailsFragment = new ItemDetailsTabFragment(itemDetail);
            detailsTab.SetTag(detailsFragment);
            var transaction = this.FragmentManager.BeginTransaction();

            transaction.Replace(R.Ids.itemDetailFragmentContainer, detailsFragment);
            transaction.Commit();
            stocksFragment = new ItemStationStockTabFragment(itemDetail);
            stockTab.SetTag(stocksFragment);
            if (itemDetail.Producers.Count > 0)
            {
                producersFragment = new ItemProducersTabFragment(itemDetail);
                producersTab.SetTag(producersFragment);
            }
            else
            {
                this.ActionBar.RemoveTab(producersTab);
            }
            this.ActionBar.Title = itemDetail.Name;
            if (pd != null)
            {
                pd.Dismiss();
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
 void PopulateItemDetail(Item itemDetail)
 {
     int iconid = Item.GetIconId(itemDetail.ResourceName, this);
     if (iconid > 0)
     {
         this.ActionBar.SetIcon(iconid);
     }
     detailsFragment = new ItemDetailsTabFragment(itemDetail);
     detailsTab.SetTag(detailsFragment);
     var transaction = this.FragmentManager.BeginTransaction();
     transaction.Replace(R.Ids.itemDetailFragmentContainer, detailsFragment);
     transaction.Commit();
     stocksFragment = new ItemStationStockTabFragment(itemDetail);
     stockTab.SetTag(stocksFragment);
     if (itemDetail.Producers.Count > 0)
     {
         producersFragment = new ItemProducersTabFragment(itemDetail);
         producersTab.SetTag(producersFragment);
     }
     else
     {
         this.ActionBar.RemoveTab(producersTab);
     }
     this.ActionBar.Title = itemDetail.Name;
     if (pd != null)
     {
         pd.Dismiss();
     }
 }