package com.view;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class WelcomePage extends Activity {
	Button login;
	Button scan;
	ImageView background;
	
	private static final int LOGIN_MENU_ITEM=Menu.FIRST;
	
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.welcomepage);
//		login=(Button)findViewById(R.id.login_in_wel);
//		scan=(Button)findViewById(R.id.scan_in_wel);
		
//		login.setOnClickListener(click_login);
//		scan.setOnClickListener(click_scan);
		if(this.getResources().getConfiguration().orientation!=Configuration.ORIENTATION_LANDSCAPE)
		{
			this.getWindow().setBackgroundDrawableResource(R.drawable.bg4);
		}
	}

	
	
	
	public void onStart()
	{
		super.onStart();
	}
	
	public boolean onCreateOptionsMenu(Menu menu)
	{
		super.onCreateOptionsMenu(menu);
		
		menu.add(Menu.NONE,this.LOGIN_MENU_ITEM,Menu.NONE,"Login");
	//	setShortcut('0','l');
		return true;
	}
	
	public boolean onOptionsItemSelected(MenuItem item)
	{
		switch(item.getItemId())
		{
		case WelcomePage.LOGIN_MENU_ITEM:
			LoginWindow.requestUpdate(this);
			return true;
		}
		
		return super.onOptionsItemSelected(item);
	}
	
	protected void onActivityResult(int requestCode, int resultCode, Intent data)
	{
		if(requestCode==LoginWindow.REQ_LOGIN_UPDATE && resultCode==RESULT_OK)
		{
			Intent intent=new Intent(WelcomePage.this,UserMainPage.class);
			startActivity(intent);
		}
	}

}
