package fishrungames.bashgid;

import android.app.Activity;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.support.v4.widget.DrawerLayout;
import android.widget.ArrayAdapter;
import android.widget.TextView;


public class MainActivity extends ActionBarActivity {

	
	static MainActivity instance = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
  
        setContentView(R.layout.activity_main); 
     
        getSupportActionBar().hide();
        
        getSupportFragmentManager().beginTransaction().add(R.id.fragment_proto_container, new WelcomeFragment()).commit();
        
        instance = this;
    
    }
    
    public static MainActivity getInstance()
    {
		return instance;
    	
    }
    
    
    public void OnSelectEnglish(View view)
	{
		OpenMainScreen();
	}
	
	public void OnSelectRussian(View view)
	{
		OpenMainScreen();
	}
	
	public void OnSelectChinese(View view)
	{
		OpenMainScreen();
	}
	
	public void OnSelectSemiDetails(Integer pos)
	{
		getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, new SemiDetailsFragment()).addToBackStack(null).commit();
	}
	
	public void OpenMainScreen()
	{

		//getSupportActionBar().show();
		
		getSupportFragmentManager().beginTransaction().replace(R.id.fragment_proto_container, new MainFragment()).commit();

		getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, new MainPageFragment()).commit();

		
	}
    

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    	
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }


}
