From 914de0c7b515320cda0d6c597c01691e255462ee Mon Sep 17 00:00:00 2001 From: bspeice Date: Mon, 2 Dec 2013 18:44:17 -0500 Subject: [PATCH] Registration now pushing to server correctly --- res/layout/activity_registration.xml | 48 ++++++------------- res/values/strings.xml | 4 +- .../uncc/gameday/activities/Registration.java | 36 +++++++++++++- 3 files changed, 51 insertions(+), 37 deletions(-) diff --git a/res/layout/activity_registration.xml b/res/layout/activity_registration.xml index 1bd5895..b1526c8 100644 --- a/res/layout/activity_registration.xml +++ b/res/layout/activity_registration.xml @@ -11,24 +11,24 @@ tools:ignore="Overdraw" > + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/black" /> @@ -37,7 +37,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" - android:layout_below="@+id/studentOrganization" + android:layout_below="@+id/studentLastName" android:layout_marginTop="40dp" android:text="@string/section_number" android:textColor="@color/black" @@ -55,11 +55,11 @@ android:textAppearance="?android:attr/textAppearanceSmall" /> - - - - diff --git a/res/values/strings.xml b/res/values/strings.xml index 3558709..d779f10 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -20,8 +20,8 @@ GamedayPreferences uncc-gameday.no-ip.org Student Check-In - Student Name: - Organization Name: + First Name: + Last Name: Section: Row: Broadcast Information diff --git a/src/com/uncc/gameday/activities/Registration.java b/src/com/uncc/gameday/activities/Registration.java index 984e6ca..aa4a3a3 100644 --- a/src/com/uncc/gameday/activities/Registration.java +++ b/src/com/uncc/gameday/activities/Registration.java @@ -1,6 +1,7 @@ package com.uncc.gameday.activities; import android.app.AlertDialog; +import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; @@ -9,6 +10,8 @@ import android.widget.Button; import android.widget.TextView; import com.uncc.gameday.R; +import com.uncc.gameday.registration.Attendee; +import com.uncc.gameday.registration.RegistrationClient; /** * The Class Registration. @@ -33,7 +36,13 @@ public class Registration extends MenuActivity { } public void onClick(View v) { - RSVPListener listener = new RSVPListener(); + Attendee a = new Attendee(); + a.setFirstName(((TextView)findViewById(R.id.editStudentFirstName)).getText().toString()); + a.setLastName(((TextView)findViewById(R.id.editStudentLastName)).getText().toString()); + a.setSection(((TextView)findViewById(R.id.editSectionNumber)).getText().toString()); + a.setRow(Integer.parseInt(((TextView)findViewById(R.id.editRowNumber)).getText().toString())); + + RSVPListener listener = new RSVPListener(this, a); AlertDialog ad = new AlertDialog.Builder(this) .setMessage("Are you ready to register with UNCC GAME DAY?") @@ -67,10 +76,19 @@ public class Registration extends MenuActivity { private class RSVPListener implements OnClickListener { + private Context c; + private Attendee a; + + public RSVPListener(Context c, Attendee a) { + this.c = c; + this.a = a; + } + public void onClick(DialogInterface dialog, int which) { switch(which){ case DialogInterface.BUTTON_POSITIVE: // yes + new RegisterThread(a, c).start(); t.setText("Your registration has been accepted. Welcome!"); break; case DialogInterface.BUTTON_NEGATIVE: // no @@ -85,4 +103,20 @@ public class Registration extends MenuActivity { } } } + + private class RegisterThread extends Thread { + + Attendee a; + Context c; + + public RegisterThread(Attendee a, Context c) { + this.a = a; + this.c = c; + } + + public void run() { + RegistrationClient client = new RegistrationClient(c); + client.registerAttendee(a); + } + } }