diff --git a/bin/AndroidManifest.xml b/bin/AndroidManifest.xml index ec0e8ad..ae5521c 100644 --- a/bin/AndroidManifest.xml +++ b/bin/AndroidManifest.xml @@ -27,6 +27,10 @@ android:name="com.uncc.gameday.activities.Registration" android:label="@string/title_activity_registration" > + + diff --git a/res/layout/activity_search_rsvp.xml b/res/layout/activity_search_rsvp.xml index 1397c28..f09aaa2 100644 --- a/res/layout/activity_search_rsvp.xml +++ b/res/layout/activity_search_rsvp.xml @@ -23,16 +23,13 @@ android:inputType="text" > - + android:layout_alignLeft="@+id/searchView1" + android:layout_below="@+id/searchView1" > + + \ No newline at end of file diff --git a/src/com/uncc/gameday/activities/Search.java b/src/com/uncc/gameday/activities/Search.java index cb196d2..3c825ff 100644 --- a/src/com/uncc/gameday/activities/Search.java +++ b/src/com/uncc/gameday/activities/Search.java @@ -1,5 +1,7 @@ package com.uncc.gameday.activities; +import java.util.Collections; +import java.util.Comparator; import java.util.List; import retrofit.RetrofitError; @@ -7,8 +9,9 @@ import retrofit.RetrofitError; import android.content.Context; import android.os.Bundle; import android.util.Log; +import android.widget.ArrayAdapter; +import android.widget.ListView; import android.widget.Toast; - import com.uncc.gameday.R; import com.uncc.gameday.registration.Attendee; import com.uncc.gameday.registration.RegistrationClient; @@ -40,7 +43,27 @@ public class Search extends MenuActivity { Toast.makeText(c, R.string.internet_down_error, Toast.LENGTH_SHORT).show(); Log.e("Search", e.getLocalizedMessage()); } - } - } + + //sorts RSVPList alphabetically by last name + Collections.sort(rsvpList, new Comparator() { + @Override + public int compare(Attendee a1, Attendee a2) { + String compareName = a1.getLastName(); + String thisName = a2.getLastName(); + return compareName.compareTo(thisName); + } + }); + //function to display RSVPList onto listView + runOnUiThread(new Runnable() { + @Override + public void run() { + ListView listView = (ListView)findViewById(R.id.RSVPListView); + ArrayAdapter adapter = + new ArrayAdapter(c,android.R.layout.simple_list_item_1, rsvpList); + listView.setAdapter(adapter); + } + }); + } +} } diff --git a/src/com/uncc/gameday/registration/Attendee.java b/src/com/uncc/gameday/registration/Attendee.java index f86385a..f186ad0 100644 --- a/src/com/uncc/gameday/registration/Attendee.java +++ b/src/com/uncc/gameday/registration/Attendee.java @@ -112,4 +112,8 @@ public class Attendee { public void setId(int id) { this.id = id; } + + public String toString() { + return this.getFirstName() + " " + this.getLastName() + ": Section " + getSection() + ", Row " + getRow(); +} }