diff --git a/res/layout/activity_registration.xml b/res/layout/activity_registration.xml index 2d31e7c..1bd5895 100644 --- a/res/layout/activity_registration.xml +++ b/res/layout/activity_registration.xml @@ -138,6 +138,7 @@ android:layout_centerHorizontal="true" android:layout_marginBottom="15dp" android:text="@string/button_register" - android:textColor="@color/black" /> + android:textColor="@color/black" + android:onClick="onClick" /> diff --git a/src/com/uncc/gameday/activities/Registration.java b/src/com/uncc/gameday/activities/Registration.java index f14e3d8..a995731 100644 --- a/src/com/uncc/gameday/activities/Registration.java +++ b/src/com/uncc/gameday/activities/Registration.java @@ -4,7 +4,7 @@ import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; -import android.view.View.OnClickListener; +import android.content.DialogInterface.OnClickListener; import android.widget.Button; import android.widget.TextView; @@ -13,7 +13,7 @@ import com.uncc.gameday.R; /** * The Class Registration. */ -public class Registration extends MenuActivity implements android.content.DialogInterface.OnClickListener { +public class Registration extends MenuActivity { /* (non-Javadoc) * @see com.uncc.gameday.activities.MenuActivity#onCreate(android.os.Bundle) @@ -27,21 +27,20 @@ public class Registration extends MenuActivity implements android.content.Dialog protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_registration); - b=(Button)findViewById(R.id.buttonRegister); - b.setOnClickListener((OnClickListener) this); - t=(TextView)findViewById(R.id.buttonRegister); + //t=(TextView)findViewById(R.id.buttonRegister); } public void onClick(View v) { + RSVPListener listener = new RSVPListener(); AlertDialog ad = new AlertDialog.Builder(this) .setMessage("Are you ready to register with UNCC GAME DAY?") .setTitle("Confirmation") - .setPositiveButton("Yes", this) - .setNegativeButton("No", this) - .setNeutralButton("Edit", this) + .setPositiveButton("Yes", listener) + .setNegativeButton("No", listener) + .setNeutralButton("Edit", listener) .setCancelable(false) .create(); @@ -65,4 +64,25 @@ public class Registration extends MenuActivity implements android.content.Dialog break; } } + + private class RSVPListener implements OnClickListener { + + public void onClick(DialogInterface dialog, int which) { + + switch(which){ + case DialogInterface.BUTTON_POSITIVE: // yes + t.setText("Your registration has been accepted. Welcome!"); + break; + case DialogInterface.BUTTON_NEGATIVE: // no + t.setText("You may come back and register at amy time."); + break; + case DialogInterface.BUTTON_NEUTRAL: // neutral + t.setText("Please correct any errors and select REGISTER."); + break; + default: + // nothing + break; + } + } + } }