private void CreateTab(StationInventories.StationInventory station) { StationInventoryAdapter adapter = new StationInventoryAdapter(this); adapter.Update(station); StationInventoryListFragment fragment = new StationInventoryListFragment(adapter, this); var tab = this.ActionBar.NewTab(); tab.SetText(station.Name); tab.SetTabListener(this); tab.SetTag(fragment); switch (station.Faction) { case Factions.SOLRAIN: tab.SetIcon(R.Drawables.solrain); break; case Factions.QUANTAR: tab.SetIcon(R.Drawables.quantar); break; case Factions.OCTAVIUS: tab.SetIcon(R.Drawables.octavius); break; case Factions.HYPERIAL: tab.SetIcon(R.Drawables.hyperial); break; case Factions.AMANANTH: tab.SetIcon(R.Drawables.amananth); break; case Factions.UNREGULATED: tab.SetIcon(R.Drawables.tri); break; } this.ActionBar.AddTab(tab); }
void PopulateStations(StationInventories stationInventories) { foreach (StationInventories.StationInventory station in stationInventories.Stations) { this.CreateTab(station); } if (pd != null) { pd.Dismiss(); } }
void ParseStationInventories(string httpRes) { var xml = XDocument.Parse(httpRes); { XElement root = xml.Root; StationInventories data = new StationInventories(root); _savedInstance = data; } RunOnUiThread(() => { PopulateStations(_savedInstance); }); }
protected override void OnCreate(Bundle savedInstance) { base.OnCreate(savedInstance); SetContentView(R.Layouts.StationInventoryActivity_Layout); this.ActionBar.NavigationMode = ActionBar.NAVIGATION_MODE_TABS; this.ActionBar.SetDisplayHomeAsUpEnabled(true); var stationInventories = LastNonConfigurationInstance as StationInventories; if (stationInventories != null) { PopulateStations(stationInventories); _savedInstance = stationInventories; } else { RefreshStations(); } }
void PopulateStations(StationInventories stationInventories) { foreach (StationInventories.StationInventory station in stationInventories.Stations) { this.CreateTab (station); } if (pd != null) { pd.Dismiss(); } }