public void SetCurrentCompiled(int id) { foreach (CompiledEventData e in _connection.Table <CompiledEventData>()) { CompiledEventData placeholder = e; //set to false first placeholder.isActive = false; _connection.Delete <CompiledEventData>(e.cID); _connection.Insert(placeholder); if (e.cID == id) { placeholder.isActive = true; _connection.Delete <CompiledEventData>(id); _connection.Insert(placeholder); } } }
//get compiled data for a single team based off of index in multi dimensional CompiledEventData list for an event public List <CompiledEventData> GetCompiledEventDataForIndex(int index) { CompiledEventData placeholder = new CompiledEventData(); List <CompiledEventData> result = new List <CompiledEventData>(); foreach (CompiledEventData c in _connection.Table <CompiledEventData>()) { if (c.isActive) { placeholder = c; } } foreach (CompiledEventData c in placeholder.compileData()[index]) { result.Add(c); } result.Reverse(); return(result); }
//read QR data and return it in a multidimensional list of matches grouped by team number public List <List <CompiledEventData> > compileData() { //how many properties are we looking for: const int dataLength = 17; CompiledEventData placeholder = new CompiledEventData(); //list before putting it in team order List <CompiledEventData> preOrder = new List <CompiledEventData>(); //get a substring for the raw data string matchData = rawData; int substringStart = 0; while (matchData.Length > 1) { int startIndex = 0; //give default values to the placeholder placeholder = new CompiledEventData(); placeholder.officialName = officialName; placeholder.cID = cID; placeholder.isActive = false; //set values which appear at the beginning of the QR string separated by commas List <int> matchCommas = AllIndexesOf(matchData, ",").ToList(); placeholder.teamNumber = int.Parse(matchData.Substring(0, matchCommas[0])); placeholder.matchNumber = int.Parse(matchData.Substring(matchCommas[0] + 1, matchCommas[1] - matchCommas[0] - 1)); //create substring of data after the commas matchData = matchData.Substring(matchCommas[1] + 1, dataLength); //interpret numerical values placeholder.result = int.Parse(matchData.Substring(startIndex, 1)); startIndex++; placeholder.position = int.Parse(matchData.Substring(startIndex, 1)); startIndex++; placeholder.isTable = Convert.ToBoolean(int.Parse(matchData.Substring(startIndex, 1))); startIndex++; placeholder.sandstormStartLevel = int.Parse(matchData.Substring(startIndex, 1)); startIndex++; placeholder.sandstormMode = int.Parse(matchData.Substring(startIndex, 1)); startIndex++; placeholder.sandstormHatch = Convert.ToBoolean(int.Parse(matchData.Substring(startIndex, 1))); startIndex++; placeholder.sandstormCargo = Convert.ToBoolean(int.Parse(matchData.Substring(startIndex, 1))); startIndex++; placeholder.sandstormLine = Convert.ToBoolean(int.Parse(matchData.Substring(startIndex, 1))); startIndex++; placeholder.cargo = Convert.ToBoolean(int.Parse(matchData.Substring(startIndex, 1))); startIndex++; placeholder.cargoWell = Convert.ToBoolean(int.Parse(matchData.Substring(startIndex, 1))); startIndex++; placeholder.cargoBarely = Convert.ToBoolean(int.Parse(matchData.Substring(startIndex, 1))); startIndex++; placeholder.hatch = Convert.ToBoolean(int.Parse(matchData.Substring(startIndex, 1))); startIndex++; placeholder.hatchWell = Convert.ToBoolean(int.Parse(matchData.Substring(startIndex, 1))); startIndex++; placeholder.hatchBarely = Convert.ToBoolean(int.Parse(matchData.Substring(startIndex, 1))); startIndex++; placeholder.climb = int.Parse(matchData.Substring(startIndex, 1)); startIndex++; placeholder.goodDrivers = Convert.ToBoolean(int.Parse(matchData.Substring(startIndex, 1))); startIndex++; placeholder.wouldRecommend = int.Parse(matchData.Substring(startIndex, 1)); startIndex++; //add the CompiledEventData preOrder.Add(placeholder); //move to the next team in the string substringStart += dataLength + matchCommas[1] + 1; matchData = rawData.Substring(substringStart); } //convert to an array to sort by team number CompiledEventData[] dataSorted = preOrder.ToArray(); Array.Sort(dataSorted, delegate(CompiledEventData data1, CompiledEventData data2) { return(data1.teamNumber.CompareTo(data2.teamNumber)); }); //create a list of the teams contained in the raw data List <int> uniqueTeams = new List <int>(); foreach (CompiledEventData data in dataSorted) { if (!uniqueTeams.Contains(data.teamNumber)) { uniqueTeams.Add(data.teamNumber); } } //create a multidimensional list to group that data List <List <CompiledEventData> > groupedData = new List <List <CompiledEventData> >(); groupedData.Add(new List <CompiledEventData>()); //starting first index int c = 0; foreach (CompiledEventData data in dataSorted) { //add all matches by one team to one index of the list if (data.teamNumber == uniqueTeams[c]) { groupedData[c].Add(data); } //go to the next index after all matches by that team are added else { c++; groupedData.Add(new List <CompiledEventData>()); groupedData[c].Add(data); } } //return the grouped data list return(groupedData); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.General_Compiled); //get controls from layout bDeleteData = FindViewById <Button>(Resource.Id.bDeleteData); bDeleteData.Click += ButtonClicked; gridTeams = FindViewById <GridView>(Resource.Id.gridViewTeam); gridTeams.ItemClick += gridClicked; textRecent = FindViewById <TextView>(Resource.Id.textEvent); viewDataHeight = FindViewById <LinearLayout>(Resource.Id.viewDataHeight); //get current compiled data currentCompiled = eData.GetCurrentCompiled(); SpannableString[] textDisp = new SpannableString[] { FormatString.setNormal("Viewing Data for Event: \n"), FormatString.setBold("'" + currentCompiled.officialName + "'"), FormatString.setNormal(" as of "), FormatString.setBold(currentCompiled.dateMod), FormatString.setNormal(" at "), FormatString.setBold(currentCompiled.timeMod) }; //set title display text textRecent.TextFormatted = TextUtils.ConcatFormatted(textDisp); //column titles properties = new string[] { "Team", "Recommend %", "Record", "Cargo/Hatch %", " Climb?\n(Lvl 2%/Lvl 3%)", "Good Drivers (%)", "'Table' %" }; //get general data for all teams List <int> teamNumbers = currentCompiled.getTeamNumbersArray(); List <int> recPerc = currentCompiled.getRecPercentArray(); List <string> record = currentCompiled.getWinRecordArray(); List <int> cargoPerc = currentCompiled.getCargoPercentArray(); List <int> hatchPerc = currentCompiled.getHatchPercentArray(); List <int> climbPerc2 = currentCompiled.getClimb2PercentArray(); List <int> climbPerc3 = currentCompiled.getClimb3PercentArray(); List <int> driversPerc = currentCompiled.getDriversPercentArray(); List <int> tablePerc = currentCompiled.getTablePercentArray(); List <int> winPerc = currentCompiled.getWinPercentArray(); List <SpannableString> display = new List <SpannableString>(); //format data in the right order for the grid based on values for (int i = 0; i < properties.Length; i++) { display.Add(FormatString.setBold(properties[i])); } for (int i = 0; i < currentCompiled.compileData().Count; i++) { //add the team number display.Add(FormatString.setBold(teamNumbers[i].ToString())); //recommendation percent if (recPerc[i] >= Constants.recommendThreshHigh) { display.Add(FormatString.setColorBold(recPerc[i].ToString() + "%", Constants.appGreen)); } else if (recPerc[i] <= Constants.recommendThreshLow) { display.Add(FormatString.setColorBold(recPerc[i].ToString() + "%", Constants.appRed)); } else { display.Add(FormatString.setNormal(recPerc[i].ToString() + "%")); } //win-loss-tie record if (winPerc[i] >= Constants.winThreshHigh) { display.Add(FormatString.setColorBold(record[i], Constants.appGreen)); } else if (winPerc[i] <= Constants.winThreshLow) { display.Add(FormatString.setColorBold(record[i], Constants.appRed)); } else { display.Add(FormatString.setNormal(record[i])); } //cargo/hatch percents if (cargoPerc[i] >= Constants.hatch_cargoThreshHigh) { display.Add(FormatString.setColorBold(cargoPerc[i].ToString() + "% / " + hatchPerc[i].ToString() + "%", Constants.appGreen)); } else if (cargoPerc[i] <= Constants.hatch_cargoThreshLow) { display.Add(FormatString.setColorBold(cargoPerc[i].ToString() + "% / " + hatchPerc[i].ToString() + "%", Constants.appRed)); } else { display.Add(FormatString.setNormal(cargoPerc[i].ToString() + "% / " + hatchPerc[i].ToString() + "%")); } //climbing percents List <SpannableString> climbDisplay = new List <SpannableString>(); if (climbPerc2[i] >= Constants.climb2Thresh) { climbDisplay.Add(FormatString.setColorBold(climbPerc2[i].ToString() + "% / ", Constants.appGreen)); } else { climbDisplay.Add(FormatString.setNormal(climbPerc2[i].ToString() + "% / ")); } if (climbPerc3[i] >= Constants.climb3Thresh) { climbDisplay.Add(FormatString.setColorBold(climbPerc3[i].ToString() + "%", Constants.appGreen)); } else { climbDisplay.Add(FormatString.setNormal(climbPerc3[i].ToString() + "%")); } display.Add(new SpannableString(TextUtils.ConcatFormatted(climbDisplay.ToArray()))); //driveteam percents if (driversPerc[i] >= Constants.driversThreshHigh) { display.Add(FormatString.setColorBold(driversPerc[i].ToString() + "%", Constants.appGreen)); } else if (driversPerc[i] <= Constants.driversThreshLow) { display.Add(FormatString.setColorBold(driversPerc[i].ToString() + "%", Constants.appRed)); } else { display.Add(FormatString.setNormal(driversPerc[i].ToString() + "%")); } //table percent if (tablePerc[i] >= Constants.tableTresh) { display.Add(FormatString.setColorBold(tablePerc[i].ToString() + "%", Constants.appRed)); } else { display.Add(FormatString.setColorBold(tablePerc[i].ToString() + "%", Constants.appGreen)); } } //display data in the grid ArrayAdapter gridAdapt = new ArrayAdapter <SpannableString>(this, Android.Resource.Layout.SimpleListItem1, display); gridTeams.Adapter = gridAdapt; float scale = this.Resources.DisplayMetrics.Density; FrameLayout.LayoutParams _params = new FrameLayout.LayoutParams((int)(1200 * scale), LinearLayout.LayoutParams.WrapContent); viewDataHeight.LayoutParameters = _params; }
private void ListViewClick(object sender, ItemClickEventArgs e) { selectedIndex = e.Position; selectedCompiled = eData.GetCompiledEventData(eData.CompiledIDList()[selectedIndex]); }
public void AddCompiledEventData(CompiledEventData putEventData) { _connection.Insert(putEventData); }
//create a new CompiledEventData private void compileData(object sender, EventArgs e) { try { bool isDuplicate = false; //get a list of already existing CompiledEventData items IEnumerable <CompiledEventData> currentData = eData.GetCompiledEventData(); foreach (CompiledEventData q in currentData) { if (q.cID == selectedEvent.eventID) { isDuplicate = true; break; } } //add data from the master device List <MatchData> scoutListArray = eData.GetMatchDataForEvent(selectedEvent.eventID); for (int i = 0; i < scoutListArray.Count; i++) { concatedQR += scoutListArray[i].teamNumber.ToString() + "," + scoutListArray[i].matchNumber.ToString() + "," + scoutListArray[i].result.ToString() + scoutListArray[i].position.ToString() + Convert.ToByte(scoutListArray[i].isTable).ToString() + scoutListArray[i].sandstormStartLevel.ToString() + scoutListArray[i].sandstormMode.ToString() + Convert.ToByte(scoutListArray[i].sandstormHatch).ToString() + Convert.ToByte(scoutListArray[i].sandstormCargo).ToString() + Convert.ToByte(scoutListArray[i].sandstormLine).ToString() + Convert.ToByte(scoutListArray[i].cargo).ToString() + Convert.ToByte(scoutListArray[i].cargoWell).ToString() + Convert.ToByte(scoutListArray[i].cargoBarely).ToString() + Convert.ToByte(scoutListArray[i].hatch).ToString() + Convert.ToByte(scoutListArray[i].hatchWell).ToString() + Convert.ToByte(scoutListArray[i].hatchBarely).ToString() + scoutListArray[i].climb.ToString() + Convert.ToByte(scoutListArray[i].goodDrivers).ToString() + scoutListArray[i].wouldRecommend.ToString(); } //make sure there is some data if (concatedQR != null) { //make sure it isnt a duplicate if (!isDuplicate) { //create a new compiled event data and add it to the database CompiledEventData newCompilation = new CompiledEventData(selectedEvent.eventName, selectedEvent.startDate, selectedEvent.endDate, concatedQR, false, selectedEvent.eventID); eData.AddCompiledEventData(newCompilation); Popup.Single("Alert", "Successfully generated data for event '" + selectedEvent.eventName + "'.", "OK", this); //StartActivity(typeof(MainActivity)); //Finish(); } //if it is a duplicate else { Popup.Single("Alert", "Data for this event has already been generated on this device. " + "Please delete it in 'View Data' from the home screen first if you want to generate new data", "OK", this); //reset, clear QR data, etc //this.Recreate(); concatedQR = null; } } //if the QR data is completely blank else { Popup.Single("Alert", "No data collected, please start over", "OK", this); //reset //this.Recreate(); concatedQR = null; } } catch { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog missingDetails = dialog.Create(); missingDetails.SetTitle("Alert"); missingDetails.SetMessage("No event selected"); ; missingDetails.SetButton("OK", (c, ev) => { }); missingDetails.Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Team_Details); //get controls from layout gridStats = FindViewById <GridView>(Resource.Id.gridViewStats); gridSandstorm = FindViewById <GridView>(Resource.Id.gridViewSandstorm); gridMatches = FindViewById <GridView>(Resource.Id.gridViewMatches); textTitle = FindViewById <TextView>(Resource.Id.textTeam); linearMatches = FindViewById <LinearLayout>(Resource.Id.linearMatches); //get current compiled data currentCompiled = eData.GetCurrentCompiled(); //put matches in order for team CompiledEventData[] compiledPreSort = eData.GetCompiledEventDataForIndex(eData.getTeamIndex().ID).ToArray(); Array.Sort(compiledPreSort, delegate(CompiledEventData data1, CompiledEventData data2) { return(data1.matchNumber.CompareTo(data2.matchNumber)); }); Array.Reverse(compiledPreSort); List <CompiledEventData> compiled = compiledPreSort.ToList(); int currentTeam = compiled[0].teamNumber; //display current team in the title textTitle.TextFormatted = TextUtils.ConcatFormatted(FormatString.setNormal("Viewing Stats for Team: '"), FormatString.setBold(currentTeam.ToString()), FormatString.setNormal("'")); //get team-specific details from compiled data int recPerc = currentCompiled.getRecPercentForTeam(currentTeam); string record = currentCompiled.getWinRecordForTeam(currentTeam); int cargoPerc = currentCompiled.getCargoPercentForTeam(currentTeam); int hatchPerc = currentCompiled.getHatchPercentForTeam(currentTeam); int climbPerc2 = currentCompiled.getClimb2PercentForTeam(currentTeam); int climbPerc3 = currentCompiled.getClimb3PercentForTeam(currentTeam); int driversPerc = currentCompiled.getDriversPercentForTeam(currentTeam); int tablePerc = currentCompiled.getTablePercentForTeam(currentTeam); int winPerc = currentCompiled.getWinPercentForTeam(currentTeam); int cargoSandstormPerc = currentCompiled.getCargoSandstormPercentForTeam(currentTeam); int hatchSandstormPerc = currentCompiled.getHabSandstormPercentForTeam(currentTeam); int habPerc = currentCompiled.getHabSandstormPercentForTeam(currentTeam); int autoPerc = currentCompiled.getAutoPercentForTeam(currentTeam); int teleopPerc = currentCompiled.getTeleopPercentForTeam(currentTeam); int nothingPerc = currentCompiled.getNothingPercentForTeam(currentTeam); //first two rows List <SpannableString> statsDisp = new List <SpannableString>() { FormatString.setNormal("Cargo / Hatch"), FormatString.setNormal("Climb Level 2 / Level 3"), FormatString.setNormal("Recommendation %"), FormatString.setBold(cargoPerc.ToString() + "% / " + hatchPerc.ToString() + "%"), FormatString.setBold(climbPerc2.ToString() + "% / " + climbPerc3.ToString() + "%"), FormatString.setBold(recPerc.ToString() + "%"), }; //third row (decide) //cargo or hatch bot if (cargoPerc >= Constants.hatch_cargoMin && hatchPerc >= Constants.hatch_cargoMin) { statsDisp.Add(FormatString.setColorBold("Both", Constants.appGreen)); } else if (cargoPerc >= Constants.hatch_cargoMin) { statsDisp.Add(FormatString.setColorBold("Cargo", Constants.appGreen)); } else if (hatchPerc >= Constants.hatch_cargoMin) { statsDisp.Add(FormatString.setColorBold("Hatch", Constants.appGreen)); } else { statsDisp.Add(FormatString.setColorBold("Neither", Constants.appRed)); } //what kind of climber if (climbPerc2 >= Constants.climb2Min && climbPerc3 >= Constants.climb3Min) { statsDisp.Add(FormatString.setColorBold("Level 2/3 Climber", Constants.appGreen)); } else if (climbPerc3 >= Constants.climb3Min) { statsDisp.Add(FormatString.setColorBold("Level 3 Climber", Constants.appGreen)); } else if (climbPerc2 >= Constants.climb2Min) { statsDisp.Add(FormatString.setColorBold("Level 2 Climber", Constants.appGreen)); } else { statsDisp.Add(FormatString.setColorBold("No reliable climber", Constants.appRed)); } //recommendation if (recPerc >= Constants.recommendThreshHigh) { statsDisp.Add(FormatString.setColorBold("Recommended", Constants.appGreen)); } else if (recPerc <= Constants.recommendThreshLow) { statsDisp.Add(FormatString.setColorBold("Not Recommended", Constants.appRed)); } else { statsDisp.Add(FormatString.setColorBold("Possible Recommend", Constants.appYellow)); } //display general stats in first grid box ArrayAdapter gridStatsAdapt = new ArrayAdapter <SpannableString>(this, Android.Resource.Layout.SimpleListItem1, statsDisp); gridStats.Adapter = gridStatsAdapt; //figure out which sandstorm mode they use the most often SpannableString primaryMode; if (autoPerc > teleopPerc && autoPerc > nothingPerc) { primaryMode = FormatString.setColorBold("Auto", Constants.appGreen); } else if (teleopPerc > autoPerc && teleopPerc > nothingPerc) { primaryMode = FormatString.setColorBold("Teleop w/Camera", Constants.appGreen); } else { primaryMode = FormatString.setColorBold("Nothing", Constants.appRed); } SpannableString cargo = FormatString.setColorBold("NO (" + cargoSandstormPerc.ToString() + "%) ", Constants.appRed); SpannableString hatch = FormatString.setColorBold("NO (" + hatchSandstormPerc.ToString() + "%) ", Constants.appRed); SpannableString hab = FormatString.setColorBold("NO (" + habPerc.ToString() + "%) ", Constants.appRed); if (cargoSandstormPerc >= Constants.sandstorm_Hatch_CargoThresh) { cargo = FormatString.setColorBold("YES (" + cargoSandstormPerc.ToString() + "%) ", Constants.appGreen); } if (hatchSandstormPerc >= Constants.sandstorm_Hatch_CargoThresh) { hatch = FormatString.setColorBold("YES (" + hatchSandstormPerc.ToString() + "%) ", Constants.appGreen); } if (habPerc >= Constants.sandstorm_Hatch_CargoThresh) { hab = FormatString.setColorBold("YES (" + habPerc.ToString() + "%) ", Constants.appGreen); } List <SpannableString> sandstormDisp = new List <SpannableString>() { FormatString.setBold("Primary Sandstorm Mode: "), primaryMode, FormatString.setBold("Cargo? "), cargo, FormatString.setBold("Hatch? "), hatch, FormatString.setBold("Crossed Hab Line? "), hab, }; //display sandstorm stats in the second grid ArrayAdapter gridSandstormAdapt = new ArrayAdapter <SpannableString>(this, Android.Resource.Layout.SimpleListItem1, sandstormDisp); gridSandstorm.Adapter = gridSandstormAdapt; //display a list of matches the team was in and the details from each one string[] properties = new string[] { "Result of Team's Alliance", "Position", "Table", "Started Off Level", "Sandstorm Mode", "Hatch in Sandstorm", "Cargo in Sandstorm", "Crossed Hab Line", "Can do Cargo", "Does Cargo Well", "Barely Does Cargo", "Can do Hatches", "Does Hatches Well", "Barely Does Hatches", "Climbing Level", "Good Driveteam", "Recommended" }; gridMatches.NumColumns = compiled.Count + 1; List <SpannableString> display = new List <SpannableString>(); compiled.Reverse(); //rows { display.Add(FormatString.setBold("Match Number:")); for (int i = 0; i < compiled.Count; i++) { display.Add(FormatString.setBold(compiled[i].matchNumber.ToString())); } int p = 0; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].result == 0) { display.Add(FormatString.setColor(compiled[j].getResult(), Constants.appGreen)); } else if (compiled[j].result == 1) { display.Add(FormatString.setColor(compiled[j].getResult(), Constants.appRed)); } else { display.Add(FormatString.setColor(compiled[j].getResult(), Constants.appYellow)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].position >= 3) { display.Add(FormatString.setColor(compiled[j].getPosition(), Constants.appBlue)); } else { display.Add(FormatString.setColor(compiled[j].getPosition(), Constants.appOrange)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].isTable) { display.Add(FormatString.setColorBold(compiled[j].isTable.ToString().ToUpper(), Constants.appRed)); } else { display.Add(FormatString.setColor(compiled[j].isTable.ToString().ToUpper(), Constants.appGreen)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].sandstormStartLevel == 1) { display.Add(FormatString.setNormal("Level " + compiled[j].sandstormStartLevel.ToString())); } else { display.Add(FormatString.setColor("Level " + compiled[j].sandstormStartLevel.ToString(), Constants.appGreen)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].sandstormMode == 0 || compiled[j].sandstormMode == 1) { display.Add(FormatString.setColor(compiled[j].getSandstormMode(), Constants.appGreen)); } else { display.Add(FormatString.setColor(compiled[j].getSandstormMode(), Constants.appRed)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].sandstormHatch) { display.Add(FormatString.setColor(compiled[j].sandstormHatch.ToString(), Constants.appGreen)); } else { display.Add(FormatString.setColor(compiled[j].sandstormHatch.ToString(), Constants.appRed)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].sandstormCargo) { display.Add(FormatString.setColor(compiled[j].sandstormCargo.ToString(), Constants.appGreen)); } else { display.Add(FormatString.setColor(compiled[j].sandstormCargo.ToString(), Constants.appRed)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].sandstormLine) { display.Add(FormatString.setColor(compiled[j].sandstormLine.ToString(), Constants.appGreen)); } else { display.Add(FormatString.setColor(compiled[j].sandstormLine.ToString(), Constants.appRed)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].cargo) { display.Add(FormatString.setColor(compiled[j].cargo.ToString(), Constants.appGreen)); } else { display.Add(FormatString.setColor(compiled[j].cargo.ToString(), Constants.appRed)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].cargoWell) { display.Add(FormatString.setColor(compiled[j].cargoWell.ToString(), Constants.appGreen)); } else { display.Add(FormatString.setColor(compiled[j].cargoWell.ToString(), Constants.appRed)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].cargoBarely) { display.Add(FormatString.setColor(compiled[j].cargoBarely.ToString(), Constants.appRed)); } else { display.Add(FormatString.setColor(compiled[j].cargoBarely.ToString(), Constants.appGreen)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].hatch) { display.Add(FormatString.setColor(compiled[j].hatch.ToString(), Constants.appGreen)); } else { display.Add(FormatString.setColor(compiled[j].hatch.ToString(), Constants.appRed)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].hatchWell) { display.Add(FormatString.setColor(compiled[j].hatchWell.ToString(), Constants.appGreen)); } else { display.Add(FormatString.setColor(compiled[j].hatchWell.ToString(), Constants.appRed)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].hatchBarely) { display.Add(FormatString.setColor(compiled[j].hatchBarely.ToString(), Constants.appRed)); } else { display.Add(FormatString.setColor(compiled[j].hatchBarely.ToString(), Constants.appGreen)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].climb == 3) { display.Add(FormatString.setColorBold(compiled[j].getClimb(), Constants.appGreen)); } else if (compiled[j].climb == 2) { display.Add(FormatString.setColor(compiled[j].getClimb(), Constants.appGreen)); } else { display.Add(FormatString.setColor(compiled[j].getClimb(), Constants.appRed)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].goodDrivers) { display.Add(FormatString.setColor(compiled[j].goodDrivers.ToString(), Constants.appGreen)); } else { display.Add(FormatString.setColor(compiled[j].goodDrivers.ToString(), Constants.appRed)); } } p++; display.Add(FormatString.setBold(properties[p])); for (int j = 0; j < compiled.Count; j++) { if (compiled[j].wouldRecommend == 0) { display.Add(FormatString.setColorBold(compiled[j].getRecommendation(), Constants.appGreen)); } else if (compiled[j].wouldRecommend == 1) { display.Add(FormatString.setColorBold(compiled[j].getRecommendation(), Constants.appRed)); } else { display.Add(FormatString.setColorBold(compiled[j].getRecommendation(), Constants.appYellow)); } } } //put matches in the third grid ArrayAdapter gridMatchesAdapt = new ArrayAdapter <SpannableString>(this, Android.Resource.Layout.SimpleListItem1, display); gridMatches.Adapter = gridMatchesAdapt; float scale = this.Resources.DisplayMetrics.Density; FrameLayout.LayoutParams _params = new FrameLayout.LayoutParams((int)(compiled.Count * 300 * scale), LinearLayout.LayoutParams.WrapContent); linearMatches.LayoutParameters = _params; }