Registration activity now displays correctly, but is still having

errors.
This commit is contained in:
bspeice 2013-12-02 17:55:52 -05:00
parent 32ed9bcb53
commit 63f60806e5
2 changed files with 30 additions and 9 deletions

View File

@ -138,6 +138,7 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp" android:layout_marginBottom="15dp"
android:text="@string/button_register" android:text="@string/button_register"
android:textColor="@color/black" /> android:textColor="@color/black"
android:onClick="onClick" />
</RelativeLayout> </RelativeLayout>

View File

@ -4,7 +4,7 @@ import android.app.AlertDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
@ -13,7 +13,7 @@ import com.uncc.gameday.R;
/** /**
* The Class Registration. * The Class Registration.
*/ */
public class Registration extends MenuActivity implements android.content.DialogInterface.OnClickListener { public class Registration extends MenuActivity {
/* (non-Javadoc) /* (non-Javadoc)
* @see com.uncc.gameday.activities.MenuActivity#onCreate(android.os.Bundle) * @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) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration); 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) { public void onClick(View v) {
RSVPListener listener = new RSVPListener();
AlertDialog ad = new AlertDialog.Builder(this) AlertDialog ad = new AlertDialog.Builder(this)
.setMessage("Are you ready to register with UNCC GAME DAY?") .setMessage("Are you ready to register with UNCC GAME DAY?")
.setTitle("Confirmation") .setTitle("Confirmation")
.setPositiveButton("Yes", this) .setPositiveButton("Yes", listener)
.setNegativeButton("No", this) .setNegativeButton("No", listener)
.setNeutralButton("Edit", this) .setNeutralButton("Edit", listener)
.setCancelable(false) .setCancelable(false)
.create(); .create();
@ -65,4 +64,25 @@ public class Registration extends MenuActivity implements android.content.Dialog
break; 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;
}
}
}
} }