Registration now pushing to server correctly

This commit is contained in:
bspeice 2013-12-02 18:44:17 -05:00
parent 16099dba25
commit 914de0c7b5
3 changed files with 51 additions and 37 deletions

View File

@ -11,24 +11,24 @@
tools:ignore="Overdraw" >
<TextView
android:id="@+id/studentName"
android:id="@+id/studentFirstName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:text="@string/student_name"
android:text="@string/student_first_name"
android:textAllCaps="false"
android:textColor="@color/black"
android:textAppearance="?android:attr/textAppearanceSmall" />
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/black" />
<TextView
android:id="@+id/studentOrganization"
android:id="@+id/studentLastName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/studentName"
android:layout_below="@+id/studentFirstName"
android:layout_marginTop="40dp"
android:text="@string/organization_check_in"
android:text="@string/student_last_name"
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" />
<EditText
android:id="@+id/editStudentName"
android:id="@+id/editStudentFirstName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/studentName"
android:layout_below="@+id/studentFirstName"
android:ems="10"
android:inputType="textPersonName"
android:textColor="@color/black"
@ -70,11 +70,11 @@
</EditText>
<EditText
android:id="@+id/editOrganizationName"
android:id="@+id/editStudentLastName"
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:ems="10"
android:inputType="text"
android:textColor="@color/black"
@ -100,32 +100,12 @@
android:inputType="number"
android:textColor="@color/black" />
<TextView
android:id="@+id/addComment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editRowNumber"
android:layout_below="@+id/editRowNumber"
android:layout_marginTop="14dp"
android:text="@string/registration_comments"
android:textColor="@color/black" />
<EditText
android:id="@+id/editComments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/addComment"
android:layout_below="@+id/addComment"
android:ems="10"
android:inputType="textMultiLine"
android:textColor="@color/black" />
<CheckBox
android:id="@+id/checkBoxBroadcastInfo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editComments"
android:layout_below="@+id/editComments"
android:layout_alignLeft="@+id/editRowNumber"
android:layout_below="@+id/editRowNumber"
android:layout_marginTop="20dp"
android:text="@string/check_box_broadcast"
android:textColor="@color/black" />

View File

@ -20,8 +20,8 @@
<string name="preferences_file">GamedayPreferences</string>
<string name="server_hostname">uncc-gameday.no-ip.org</string>
<string name="student_check_in">Student Check-In</string>
<string name="student_name">Student Name:</string>
<string name="student_organization">Organization Name:</string>
<string name="student_first_name">First Name:</string>
<string name="student_last_name">Last Name:</string>
<string name="section_number">Section:</string>
<string name="row_number">Row:</string>
<string name="check_box_broadcast">Broadcast Information</string>

View File

@ -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);
}
}
}