#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
Dim SourceImageRect, TouchImageViewRect As Rect
Dim Bitmap1 As Bitmap
End Sub
Sub Globals
Dim TouchImageView1 As TouchImageView
Dim SQLVariables2 As SQL
Dim CurVariables2 As Cursor
Dim SQueryVariables2 As String
Private PnlOrd As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("LytImagen")
If SQLVariables2.IsInitialized = False Then
SQLVariables2.Initialize(File.DirDefaultExternal, "l4pro.sql", False)
End If
SQueryVariables2 = "SELECT * FROM Variables"
CurVariables2 = SQLVariables2.ExecQuery(SQueryVariables2)
CurVariables2.Position = 0
Activity.Title = CurVariables2.GetString("TituloActivity")
TouchImageView1.Initialize("TouchImageView1")
Activity.AddView(TouchImageView1, 0, 0, 100%x, 100%y)
TouchImageView1.MinScale=0.5
TouchImageView1.MaxScale=6
TouchImageView1.TranslatePadding=128dip
TouchImageView1.Gravity=Gravity.FILL
Dim Bitmap1 As Bitmap
Bitmap1.Initialize(File.DirDefaultExternal,CurVariables2.GetString("UltimaImagen"))
TouchImageView1.SetBitmap(Bitmap1)
If FirstTime Then
SourceImageRect.INITIALIZE(0, 0, Bitmap1.WIDTH, Bitmap1.HEIGHT)
TouchImageViewRect.INITIALIZE(0, 0, TouchImageView1.WIDTH, TouchImageView1.HEIGHT)
End If
TouchImageView1.ScaleSrcRectToDestRect(SourceImageRect, TouchImageViewRect, "CENTER")
Activity.AddMenuItem("Enviar Servicio","Enviar_Servicio")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
TouchImageViewRect=TouchImageView1.GetDestRect
If UserClosed Then
SQLVariables2.Close
End If
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
Activity.Finish
End If
End Sub
Sub Enviar_Servicio_Click
Dim u As Uri
u.Parse("file://" & File.Combine(File.DirDefaultExternal,CurVariables2.GetString("UltimaImagen")))
Dim i As Intent
i.Initialize(i.ACTION_SEND, "")
i.SetType("*/*")
i.PutExtra("android.intent.extra.STREAM",u)
StartActivity(i)
End Sub