}
boutonRetour.alpha = 1
boutonRetour.anchorX = 0
- boutonRetour.x = VW + boutonRetour.width
+ boutonRetour.x = SX - 2*boutonRetour.width
boutonRetour.y = border2.y + border2.height/2
ticket:insert( boutonRetour )
ticket.boutonRetour = boutonRetour
local labelObligatoire = display.newText( "*Obligatoires", 0, 0, "Dosis-Book", 14 )
labelObligatoire:setFillColor( 0, 0, 0, 1 )
labelObligatoire.anchorX = 0
- labelObligatoire.x = SX + 5
+ labelObligatoire.x = VW - labelObligatoire.width - 5
labelObligatoire.y = ticket.border2.y + ticket.border2.height/2
ticket:insert( labelObligatoire )
ticket.labelObligatoire = labelObligatoire
end
+local function photoIsTaken( event )
+
+ isPhotoTaken = true
+
+end
+
-- Initialisation des boutons de priorité du ticket
local function initPriorite()
-- fonction d'action du bouton de localiser
function boutonLocaliser:touch( event )
- if event.phase == "began" and isLocaliserActive then
+ -- on supprime tous les marqueurs déjà présents à chaque activation
+ map:removeAllMarkers()
- -- on supprime tous les marqueurs déjà présents à chaque activation
- map:removeAllMarkers()
+ -- on récupère la position de l'utilisateur
+ local location = map:getUserLocation()
- -- on récupère la position de l'utilisateur
- local location = map:getUserLocation()
+ -- on centre la map sur la position
+ map:setCenter( location.latitude, location.longitude, true )
+ -- on place le marqueur
+ map:addMarker( location.latitude, location.longitude )
- -- on centre la map sur la position
- map:setCenter( location.latitude, location.longitude, true )
- -- on place le marqueur
- map:addMarker( location.latitude, location.longitude )
+ -- on récupère les coordonnées pour l'envoi plus tard
+ coordT = ""..location.latitude..","..location.longitude
- -- on récupère les coordonnées pour l'envoi plus tard
- coordT = ""..location.latitude..","..location.longitude
+ if event.phase == "began" and isLocaliserActive then
local function mapAddressHandler( event )
labelAdresse.text = "Recherche de votre position .."
if event.isError then
- print( "mapView Error: " .. event.errorMessage )
labelAdresse.text = "Event.isError"
else
labelAdresse.text = "Recherche de votre position ..."
- print( "The specified location is in: " .. event.city .. ", " .. event.country )
number = event.streetDetail
street = event.street
postalCode = event.postalCode
-- on récupère l'adresse la plus proche des coordonnées GPS
local nearestAddress = map:nearestAddress( location.latitude, location.longitude, mapAddressHandler )
+ labelAdresse.text = adresseT
+
+ isAddressWritten = true
end
ticket:insert( iconGps )
ticket.iconGps = iconGps
- local function localize()
- ticket.boutonLocaliser:touch({phase = "began"})
- end
-
- -- on se localise dès l'arrivée sur le ticket
- timer.performWithDelay( 1000, localize )
-
end
-- Fin de la map et de tous ses composants
end
--- Initialisation du nombre de tickets restants
-
-local function initRestants()
-
-end
-
local function displayHint()
native.showAlert( "Hâlte-là !", "Veuillez renseigner les informations obligatoires.", { "D'accord :)", "D'accord :(" } )
print( "Response:", event.response )
photoName = event.response
- print("Upload de l'image terminé, on envoit les informations du ticket")
+ print("Upload de l'image terminé, on envoie les informations du ticket")
sendAll()
end
end
print(" On commence l'upload de l'image")
uploadImage()
else -- si la personne n'a pas pris de photo on envoie simplement les données relatives au ticket
+ print("sendall")
sendAll()
end
- if ticket.map then
-
- ticket.map:removeSelf()
- ticket.map = nil
+ ticket.map.x = 2*VW
- end
-
Runtime:dispatchEvent{ name = "MenuEvent", type = "accueil" }
native.showAlert( "Merci !", "Votre ticket a bien été envoyé.", { "De rien :)" } )
transition.to( ticket.boutonLocaliser, { time = 500, x = SX + VW - ticket.boutonLocaliser.width, transition = easing.outExpo } )
transition.to( ticket.descr, { time = 500, x = SX - 4, transition = easing.outExpo } )
transition.to( ticket.textDescr, { time = 550, x = SX + 10, transition = easing.outQuad } )
- transition.to( ticket.boutonRetour, { time = 750, x = VW - ticket.boutonRetour.width, transition = easing.outQuad } )
+ transition.to( ticket.boutonRetour, { time = 750, x = SX, transition = easing.outQuad } )
local k = SY + VH - ticket.border2.height
local l = SY + ticket.adresseBg.y + ticket.adresseBg.height
ticket.boutonEnvoyer:addEventListener( "touch", boutonEnvoyer )
Runtime:addEventListener( "MenuEvent", changeType )
+ Runtime:addEventListener( "photoTaken", photoIsTaken )
Runtime:addEventListener( "key", onKeyEvent )
-- on active le bouton retour un peu après pour éviter des conflits de chargement
ticket.boutonRetour:removeEventListener( "touch", boutonRetour )
Runtime:removeEventListener( "MenuEvent", changeType )
+ Runtime:removeEventListener( "photoTaken", photoIsTaken )
Runtime:removeEventListener( "key", onKeyEvent )
end
initMap()
initDescription()
initEnvoyer()
- initRestants()
initCircles()
ticket:disposeElements()