package com.example.ar;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;

public class AccountRegistrationActivity2 extends Activity {
    private static String TAG = "AccountRegistration";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.page_two);

        final RadioGroup rg = (RadioGroup) findViewById(R.id.foundUs);
        rg.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup grp, int chkId) {
                for (int i = 0; i < rg.getChildCount(); i++) {
                    RadioButton rb = (RadioButton) rg.getChildAt(i);
                    if (rb.getId() == chkId)
                        rb.setTextColor(Color.GREEN);
                    else
                        rb.setTextColor(Color.BLACK);
                }
            }
        });

        Button next = (Button) findViewById(R.id.next);
        next.setOnClickListener(new OnClickListener() {
            public void onClick(View view) {
                RadioButton rb =
                        (RadioButton) findViewById(rg
                                .getCheckedRadioButtonId());

                Log.v(TAG, "Found Us: " + rb.getText());

                Intent i = new Intent();
                i.setClass(AccountRegistrationActivity2.this,
                        AccountRegistrationActivity3.class);
                startActivity(i);
            }
        });

        Button back = (Button) findViewById(R.id.back);
        back.setOnClickListener(new OnClickListener() {
            public void onClick(View view) {
                finish();
            }
        });
    }
}