package jp.co.csoft.trump.game.view;

import jp.co.csoft.trump.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;

public class FirstActivity extends Activity implements OnClickListener {
	private static final String TAG = FirstActivity.class.getSimpleName();
	private EditText _editName;
	private CheckBox _checkParent;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.first);        

        _editName = (EditText)findViewById( R.id.editName );
        _editName.setText("伊藤　義明");
        _checkParent = (CheckBox)findViewById( R.id.checkParent );
        Button btn = (Button)findViewById(R.id.buttonStart);  
        btn.setOnClickListener(this);  
    }

	public void onClick(View v) {
        Button b = (Button)v;  
        try {  
            if (b.getId() == R.id.buttonStart) {
				String name = _editName.getText().toString();
				boolean parent = _checkParent.isChecked();

                //Intent インスタンス生成  
                Intent intent = new Intent(FirstActivity.this, OrderActivity.class);
                intent.putExtra("name", name);
                intent.putExtra("parent", parent);
                //副画面を起動
                startActivity(intent);
                Log.i(TAG, "Start activity ok");  
            }  
        } catch (Exception e) {  
        }  
	}
}