package com.example.pat01;



import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.content.Intent;


public class MainActivity extends Activity {

	@Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        
        ActionBar actionBar = getActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
       
        actionBar.setDisplayShowTitleEnabled(true);
        
        Tab tab = actionBar.newTab()
        		.setText("Android")
        		.setTabListener(new CustomTabListener<Tab1Fragment>(this, "android", Tab1Fragment.class))
        		;
        
        actionBar.addTab(tab);
        
        
        /** Creating APPLE Tab */
        tab = actionBar.newTab()
        		.setText("Apple")
        		.setTabListener(new CustomTabListener<Tab2Fragment>(this, "apple", Tab2Fragment.class))
        		;

        
        actionBar.addTab(tab);            
        
        
    }

	@Override
    public boolean onCreateOptionsMenu(Menu menu) {
    	MenuInflater inflater = getMenuInflater();
    	inflater.inflate(R.menu.items, menu);
    	return super.onCreateOptionsMenu(menu);
    }
    
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
    	
    	super.onOptionsItemSelected(item);
    	
    	switch(item.getItemId()){
	    	case R.id.phone:
	    		Toast.makeText(getBaseContext(), "You selected Phone", Toast.LENGTH_SHORT).show();
	    		break;
	    	
	    	case R.id.computer:
	    		Toast.makeText(getBaseContext(), "You selected Computer", Toast.LENGTH_SHORT).show();
	    		break;
	    		
	    	case R.id.gamepad:
	    		Toast.makeText(getBaseContext(), "You selected Gamepad", Toast.LENGTH_SHORT).show();
	    		break;
	    		
	    	case R.id.camera:
	    		Toast.makeText(getBaseContext(), "You selected Camera", Toast.LENGTH_SHORT).show();
	    		  Intent productIntent = new Intent(this,vue2.class);
	              startActivity(productIntent);
	             // return true;
	    		break;
	    		
	    	case R.id.video:
	    		Toast.makeText(getBaseContext(), "You selected Video", Toast.LENGTH_SHORT).show();
	    		break;
	    		
	    	case R.id.email:
	    		Toast.makeText(getBaseContext(), "You selected EMail", Toast.LENGTH_SHORT).show();
	    		break;
	    		
    	}
    	
    	return true;
    	
    }
	  
}	 