Android = {}

function question (mess)
  System.message(mess, 1)
  return System.buttonPressed(0)
end

--heure
function Android:Heure(HX,HY)
 if System.getTime(5) == "pm" and System.getTime(1) ~= "12" then
  H = System.getTime(1) + 12
 elseif System.getTime(1) < 10 then
  H = "0"..System.getTime(1)
 else
  H = System.getTime(1)
 end

 if System.getTime(2) < 10 then
  M = "0"..System.getTime(2)
 else
  M = System.getTime(2)
 end
screen:fontPrint(font,HX, HY,H..":"..M,Noir)
end
--fin
--date
function Android:Date(DX,DY)
screen:fontPrint(font,DX,DY,System.getDate(1).." "..System.getDate(2).." "..System.getDate(3),Noir)
end
--fin
--souris
function Android:Souris()
-- PAD
if math.abs(pad:analogY()) > sens_cur then
 cury = cury + pad:analogY() / sens_cur
end
if math.abs(pad:analogX()) > sens_cur then
 curx = curx + pad:analogX() / sens_cur
end
-- FLECHES
if y_menu == 218 and Options == false then
 if pad:up() then
  cury = cury - 4
 end
 if pad:down() then
  cury = cury + 4
 end
 if pad:left() then
  curx = curx - 4
 end
 if pad:right() then
  curx = curx + 4
 end
end
-- FIN
if curx > 479 then
 curx = 479 
elseif curx < 0 then
 curx = 0
end
if cury > 271 then
 cury = 271
elseif cury < 0 then
 cury = 0
end
screen:blit(curx,cury,souris)
end
--fin
--barre
function Android:Barre()
 screen:blit(0,0,bar)
 Android:Heure(425,18)
 Android:Bat(400,4)
end
--fin
--batterie
function Android:Bat(batx,baty)
 bat=System.powerGetBatteryLifePercent()
 charge=System.powerIsBatteryCharging()
 if bat == 100 and charge ~=1 then
  screen:blit(batx,baty,bat100)
 elseif bat >80 and bat <= 100 and charge == 0 then
  screen:blit(batx,baty,bat80)
 elseif bat >60 and bat <= 80 and charge == 0 then
  screen:blit(batx,baty,bat60)
 elseif bat >40 and bat <= 60 and charge == 0 then
  screen:blit(batx,baty,bat40)
 elseif bat >20 and bat <= 40 and charge == 0 then
  screen:blit(batx,baty,bat20)
 elseif charge == 1 then
  screen:blit(batx,baty,batcharg)
 end
end
--fin
--Options
function Android:Options()
 screen:blit(0,206,option_norm)
 if option_selecteur == 1 then
  screen:blit(2,208,option_sele,2,2,93,72)
 elseif option_selecteur == 2 then
  screen:blit(96,208,option_sele,96,2,93,72)
  if pad:cross() and not oldpad:cross() then
   dofile("APPS/Parametres/wall.lua")
  end
 elseif option_selecteur == 3 then
  screen:blit(190,208,option_sele,190,2,93,72)
 elseif option_selecteur == 4 then
  screen:blit(284,208,option_sele,284,2,93,72)
  if pad:cross() and not oldpad:cross() then
   y_notif = 26
  end
 elseif option_selecteur == 5 then
  screen:blit(378,208,option_sele,378,2,100,72)
  if pad:cross() and not oldpad:cross() then
    dofile("APPS/Parametres/script.lua")
  end
 end
 if pad:right() and not oldpad:right() and option_selecteur < 5 then
  option_selecteur = option_selecteur + 1
 end
 if pad:left() and not oldpad:left() and option_selecteur > 1 then
  option_selecteur = option_selecteur - 1
 end
end
--fin
function Android:Quitter()
dofile("system/bureau.lua")
end
function Android:Redemarrer()
System.runeboot("ms0:/psp/game/Android/eboot.pbp")
end
function Android:Color()
return Color.new(math.random(0,255),math.random(0,255),math.random(0,255))
end
--Net
function Android:Net(www)
System.webbrowser("ms0:/psp/game/Android/NET",www)
end
function Android:Google(x)
Android:Net("www.google.fr/search?q="..x)
end
timer = Timer.new()
timer:start()
function Android:animatedPng(x,y,file,width,height,speed)
temps = minuteur:time()
if temps == speed/10 then
  screen:blit(x,y,file,0,0,height,width/10)
end
if temps == speed*2/10 then
  screen:blit(x,y,file,0,0,height,width/10)
end
if temps == speed*3/10 then
  screen:blit(x,y,file,0,0,height,width/10)
end
if temps >= speed then
  timer:stop()
  timer:reset(0)
  timer:start()
end
end
