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_marginBottom="15dp"
android:text="@string/button_register"
android:textColor="@color/black" />
android:textColor="@color/black"
android:onClick="onClick" />
</RelativeLayout>

View File

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