package com.tcl.factory.view;

import android.content.Context;
import android.view.KeyEvent;

import com.tcl.factory.bsp.TV;
import com.tcl.factory.bsp.TVDefine;
import com.tcl.factory.def.DEFS;
import com.tcl.factory.thirdparty.ThirdParty;
import com.tcl.factory.utils.Debug;

public class DModeMainMenu extends SubMenu 
{
	public static  String MenuInfos_DModeMainMenu[][]={
		{"Design mode hotkey",""},
		{"Factory menu",""},
		{"Other",""},
		{"Service menu",""},
		{"Param setting",""},
		{"Hotel menu",""},
		{"Reset All",">"}
	};
	private Context mDModeUsbUpdateContext;
	public DModeMainMenu(Context context)
	{	
		mDModeUsbUpdateContext = context;
		super.menuInfos=MenuInfos_DModeMainMenu;
		super.menuLabel = "Main menu\\";
		super.setTAG();
		updateMenuInfos();
	}
	
	/* (non-Javadoc)
	 * 
	 */
	@Override
	public void KeyEvent(int keyCode,int pos)
	{
		switch(keyCode)
		{
		case KeyEvent.KEYCODE_DPAD_LEFT:
		case KeyEvent.KEYCODE_DPAD_RIGHT:
		{
			switch(pos)
			{
				case 0: super.StatusHandler(TVDefine.DMode) ;break;
				case 6: TV.writeV(TVDefine.ResetAll); break;
			}
		}
		break;
		default:
			break;
		}
	}
 
	
	/* (non-Javadoc)
	 * 
	 */
	@Override
	public void updateMenuInfos() 
	{
		// TODO Auto-generated method stub
		super.updateStatusInfo(TVDefine.DMode, 0);
	}
	
	/* @pos	the menu position that is selected
	 * Factory
	 */
	@Override
	public void enterSubMenu(int pos) 
	{
		// TODO Auto-generated method stub
		super.setMenuPosition(pos);
		
		switch(pos)
		{
		case 1:MainMenu.mSubMenu=new PModeMenu(); break;
		case 2:MainMenu.mSubMenu=new DModeOtherMenu(); break;
		case 3:MainMenu.mSubMenu=new DModeServerMenu(mDModeUsbUpdateContext); break;
		case 4:MainMenu.mSubMenu=new DModeParamSetting(); break;
		case 5:MainMenu.mSubMenu=new HotelMainMenu(mDModeUsbUpdateContext); break;			
		}
		Debug.v(TAG, "enterSubMenu : pos = " + pos);
	}
}
