package com.jpcom.games.chess;

import com.jpcom.games.chess.touch.TouchRotateActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class StartGame extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Button b = (Button) findViewById(R.id.button1);
        b.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent =new Intent(StartGame.this, SettingsActivity.class);
				startActivity(intent);
			}
		});
        View v= (View) findViewById(R.id.mainid);
        registerForContextMenu(v);
        
    }

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// TODO Auto-generated method stub
//		Button b = (Button) findViewById(R.id.button1);
//		b.setText("Stop");
//		return super.onCreateOptionsMenu(menu);
		MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.startmenu, menu);
	    return true;
	}

	
	@Override
	public void onCreateContextMenu(ContextMenu menu, View v,
			ContextMenuInfo menuInfo) {
		// TODO Auto-generated method stub
		super.onCreateContextMenu(menu, v, menuInfo);
		  MenuInflater inflater = getMenuInflater();
		  inflater.inflate(R.menu.startmenu, menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
//		TextView tv = (TextView) findViewById(R.id.hello);
//		tv.setText("pressed 2 ...");
		
		//newMainScreen();
		
		
		switch (item.getItemId()) {
	    case R.id.item1:
//	        newMainScreen();
	    	Toast.makeText(this, "Димон, ты ОЧЕНЬ крут !!!", Toast.LENGTH_LONG).show();
	        return true;
	    case R.id.startMenu:
	    	//Toast.makeText(this, "You pressed the icon!", Toast.LENGTH_LONG).show();
	    	newMainScreen();
	    case R.id.touch:
	    	//Toast.makeText(this, "You pressed the icon!", Toast.LENGTH_LONG).show();
	    	newTouchScreen();
//	        showHelp();
	        return true;
//	    default:
//	        return super.onOptionsItemSelected(item);
	        
		}    
		return true;
		}	

	
	private void newMainScreen() {
		// TODO Auto-generated method stub
		Intent intent =new Intent(StartGame.this, MainScreen.class);
		startActivity(intent);
	}
	private void newTouchScreen() {
		// TODO Auto-generated method stub
		Intent intent =new Intent(StartGame.this, TouchRotateActivity.class);
		startActivity(intent);
	}
	
    
    
    
}