--[[
ģƣprompt
ģ鹦ܣʾ򴰿
ģ޸ʱ䣺2017.08.14
]]

module(...,package.seeall)

--appidid
--str1,str2,str3ʾ3ַ
--callback,callbackparaʾ򴰿ڹرպĻصԼصĲ
local appid,str1,str2,str3,callback,callbackpara

local pos = 
{
	{24},--ʾ1ַʱY
	{10,37},--ʾ2ַʱÿַӦY
	{4,24,44},--ʾ3ַʱÿַӦY
}

--[[
refresh
  ˢ´
  
ֵ
]]
local function refresh()
	disp.clear()
	if str3 then
		disp.puttext(str3,lcd.getxpos(str3),pos[3][3])
	end
	if str2 then
		disp.puttext(str2,lcd.getxpos(str2),pos[str3 and 3 or 2][2])
	end
	if str1 then
		disp.puttext(str1,lcd.getxpos(str1),pos[str3 and 3 or (str2 and 2 or 1)][1])
	end
	disp.update()
end

--[[
close
  رʾ򴰿
  
ֵ
]]
local function close()
	if not appid then return end
	sys.timer_stop(close)
	if callback then callback(callbackpara) end
	uiwin.remove(appid)
	appid = nil
end

--ڵϢ
local app = {
	onupdate = refresh,
}

--[[
open
  ʾ򴰿
  
		s1stringͣʾĵ1ַ
		s2stringͣʾĵ2ַΪջnil
		s3stringͣʾĵ3ַΪջnil
		cbfunctionͣʾرʱĻصΪnil
		cbparaʾرʱصĲΪnil
		prdnumberͣʾԶرյĳʱʱ䣬λ룬Ĭ3000
ֵ
]]
function open(s1,s2,s3,cb,cbpara,prd)
	str1,str2,str3,callback,callbackpara = s1,s2,s3,cb,cbpara
	appid = uiwin.add(app)
	sys.timer_start(close,prd or 3000)
end
