Example #1
0
 public void SetProgram(GameObject listItem)
 {
     program        = listItem.GetComponent <ProgramContainer> ().GetProgram();
     titleText.text = ProgramParser.GetTitle(program);
     SetThumbnail();
     descriptionText.text = ProgramParser.GetDescription(program);
     SetOnDemand();
     SetCategory();
     ClearPublicationEvents();
     SetPublicationEvents();
 }
Example #2
0
        private void PopulateListView()
        {
            foreach (Program loopProgram in list.data)
            {
                surplusOffset++;
                if (loopProgram.type.ToLower() == category || category == "program")
                {
                    if (amountAddedToList < targetResultOffset)
                    {
                        //add item to scrollView
                        GameObject loopListItem = Instantiate(listItem, listViewContent.transform);
                        //add data container to item and set data on container
                        loopListItem.AddComponent <ProgramContainer> ().SetProgram(loopProgram);
                        //set item title
                        //Some Finnish titles aren't available: in that case, the english or swedish is used
                        loopListItem.transform.GetComponentInChildren <Text> ().text = ProgramParser.GetTitle(loopProgram);

                        //store item
                        listItems.Add(loopListItem);
                        amountAddedToList++;
                    }
                    else
                    {
                        //once desired amount of results are added, stop this function
                        Debug.Log(amountAddedToList + " added to listview");
                        currentOffset += surplusOffset;
                        return;
                    }
                }
            }

            Debug.Log(amountAddedToList + " added to listview");
            currentOffset += surplusOffset;

            //if all results have been added, stop trying to add more
            if (list.meta.count < targetResultOffset)
            {
                return;
            }

            //add another round of results to reach desired amount
            if (amountAddedToList < targetResultOffset)
            {
                AddResults();
            }
        }