mirror of
https://github.com/KeymonSoft/Android_durakelo.git
synced 2026-04-17 19:37:03 +00:00
Commit inicial
This commit is contained in:
128
foto.bas
Normal file
128
foto.bas
Normal file
@@ -0,0 +1,128 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
|
||||
#End Region
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Dim ruta As String
|
||||
Dim g As GPS
|
||||
Private frontCamera As Boolean = False
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
Dim camera1 As Camera
|
||||
Dim btnTakePicture As Button
|
||||
Dim Panel1 As Panel
|
||||
Dim skmt As SQL
|
||||
Dim c As Cursor
|
||||
Dim cuenta As String
|
||||
' Dim lat_gps As String
|
||||
' Dim lon_gps As String
|
||||
Private camEx As CameraExClass
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
|
||||
If(FirstTime) Then
|
||||
g.Initialize("GPS")
|
||||
End If
|
||||
|
||||
Activity.LoadLayout("foto")
|
||||
btnTakePicture.Enabled = False
|
||||
camera1.Initialize(Panel1, "Camera1")
|
||||
ruta = File.DirInternal
|
||||
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c=skmt.ExecQuery("select cuenta from cuentaa")
|
||||
c.Position = 0
|
||||
cuenta = c.GetString("CUENTA")
|
||||
End Sub
|
||||
Sub Camera1_Ready (Success As Boolean)
|
||||
If Success Then
|
||||
|
||||
camera1.StartPreview
|
||||
|
||||
btnTakePicture.Enabled = True
|
||||
Else
|
||||
ToastMessageShow("No se puede abrir la camara.", True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
If g.GPSEnabled=False Then
|
||||
ToastMessageShow("Habilitar el GPS", True)
|
||||
StartActivity(g.LocationSettingsIntent)
|
||||
Else
|
||||
g.Start(0,0)
|
||||
End If
|
||||
btnTakePicture.Enabled = False
|
||||
camera1.Initialize(Panel1, "Camera1")
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
camera1.Release
|
||||
End Sub
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
|
||||
'lat_gps=Location1.ConvertToSeconds(Location1.Latitude)
|
||||
'lon_gps=Location1.ConvertToSeconds(Location1.Longitude)
|
||||
'btnTakePicture.Enabled = True
|
||||
's.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE,HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, lat_gps, lon_gps))
|
||||
End Sub
|
||||
|
||||
|
||||
Sub Camera1_PictureTaken (Data() As Byte)
|
||||
camera1.StartPreview
|
||||
'Dim out As OutputStream
|
||||
c=skmt.ExecQuery("select cuenta from cuentaa")
|
||||
c.Position = 0
|
||||
cuenta = c.GetString("CUENTA")
|
||||
Dim sDate,sTime As String
|
||||
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
skmt.ExecNonQuery2("INSERT INTO HIST_VISITAS (HIST_VI_IMAGEN, HIST_VI_CREDITO,HIST_VI_DTEVISITA, HIST_VI_LONGITUD, HIST_VI_LATITUD) VALUES(?,?,?,?,?) ", Array As Object (Data, cuenta,sDate & sTime, Main.lon_gps,Main.lat_gps))
|
||||
|
||||
'out = File.OpenOutput(File.DirRootExternal, "1.jpg", False)
|
||||
'out.WriteBytes(Data, 0, Data.Length)
|
||||
'out.Close
|
||||
'ToastMessageShow("Gestion Salvada ", True)
|
||||
|
||||
btnTakePicture.Enabled = True
|
||||
'CallSubDelayed(seleccion,"seleccion")
|
||||
StartActivity(fila)
|
||||
End Sub
|
||||
|
||||
Sub btnTakePicture_Click
|
||||
btnTakePicture.Enabled = False
|
||||
camera1.TakePicture
|
||||
'camera1.TakePicture
|
||||
|
||||
End Sub
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
StartActivity(seleccion)
|
||||
'Return True
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
Return False
|
||||
End Sub
|
||||
Reference in New Issue
Block a user