Log.e("events","invlaid event index selected during InitUI(), eventIndex: "+eventIndex+", size"+Events.eventInfos.size()+". Ensure that you are not clearing/overwiting the events list while viewing an event.");
if(!hasEvent()){
Log.e("events","invlaid event index selected during InitUI(), (groupIndex, eventIndex): ("+eventGroup+","+eventIndex+"), total event size"+Events.eventInfos.size()+". Ensure that you are not clearing/overwiting the events list while viewing an event.");
onBackPressed();
return;
}
//Link up variables with UI elements from the layout xml
@@ -160,7 +178,7 @@ public class EventDetailActivity extends AppCompatActivity {
privatevoidLoadEventImage(booleanisRefreshing)
{
//Image loading and masking. the posterMask is a small arrow image but we use the layout margin to add some transparent 'padding' to the top of the scrollview
publicstaticList<EventInfo>eventInfos=newArrayList<EventInfo>();//This is a list of ALL events as received from the api, we will not use this directly
publicstaticList<List<EventInfo>>sortedEvents=newArrayList<List<EventInfo>>(4);//A list of lists which has been sorted according to the EventGroup configuration
publicstaticboolean[]invertEventGroupSorting=newboolean[]{false,false,false,true};//used to invert date sorting for the event groups
//Use this class to use the correct indexes for the event group for the sortedEvents list
publicstaticfinalclassEventGroup{
publicstaticfinalintHIDDEN_EVENTS=0;
publicstaticfinalintALL_EVENTS=1;
publicstaticfinalintCLOSED_EVENTS=2;
publicstaticfinalintPAST_EVENTS=3;
}
//Defines for how many days after the ad start date the new tag is visible for
publicstaticfinalintDAYS_NEW_TAG_ACTIVE=3;
/**
* Update the event infos with the data received from the api. This is just for updating information about the event NOT the signup
...
...
@@ -22,6 +39,8 @@ public final class Events {
publicstaticvoidUpdateEventInfos(JSONArrayjson)
{
eventInfos.clear();
sortedEvents.clear();
for(inti=0;i<json.length();i++)
{
try{
...
...
@@ -30,6 +49,37 @@ public final class Events {
e.printStackTrace();
}
}
if(!eventInfos.isEmpty()){
//sort so first elem has an advertising start date furthest in the future