#Region Project Attributes
#ApplicationLabel: SuperMySQL Pro
#VersionCode: 1
#VersionName: 1.0
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#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.
End Sub
#Extends: android.support.v7.app.AppCompatActivity
'Inline Java code to initialize the Menu
#If Java
public boolean _onCreateOptionsMenu(android.view.Menu menu) {
if (processBA.subExists("activity_createmenu")) {
processBA.raiseEvent2(null, true, "activity_createmenu", false, new de.amberhome.objects.appcompat.ACMenuWrapper(menu));
return true;
}
else
return false;
}
#End If
Sub Globals
Private BotonBorrar As Button
Private BotonModificar As Button
Private BotonNueva As Button
Private ListaConexiones As ListView
Private ItemSeleccionado As Int
Private lblLongClick As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
Activity.Title=" Super MySQL PRO"
StartService("MySQL")
End Sub
Sub Activity_Resume
Starter.Conections.Initialize
CargoConexiones
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ListaConexiones_ItemClick (Position As Int, Value As Object)
BotonBorrar.Visible=True
BotonModificar.Visible=True
ItemSeleccionado=Position
End Sub
Sub ListaConexiones_ItemLongClick (Position As Int, Value As Object)
End Sub
Sub BotonNueva_Click
MySQL.NuevaConec=True
StartActivity("NuevaConexion")
End Sub
Sub BotonModificar_Click
Dim Texto As String , valores As List, sf As StringFunctions
Try
sf.Initialize
MySQL.NuevaConec=False
Texto=ListaConexiones.GetItem(ItemSeleccionado)
valores=sf.Split(Texto,"|")
MySQL.MySQL_Nombre=valores.Get(0)
MySQL.MySQL_Server=valores.Get(1)
MySQL.MySQL_Port=valores.Get(2)
MySQL.MySQL_User=valores.Get(3)
MySQL.MySQL_Password=valores.Get(4)
StartActivity("NuevaConexion")
Catch
Log(LastException)
End Try
End Sub
Sub BotonBorrar_Click
End Sub
Public Sub CargoConexiones
Try
Dim sf As StringFunctions
Dim TextoEncriptado As String, Texto As String
Dim f As Funciones, Conexiones As List, i As Int, Valores As List
If File.Exists(MySQL.Carpeta,"regp5.smql")=True Then
' File.Delete(MySQL.Carpeta,"regp5.smql")
sf.Initialize
f.Initialize
TextoEncriptado=File.ReadString(MySQL.Carpeta,"regp5.smql")
Texto=f.Decrypt(TextoEncriptado)
Conexiones=sf.split(Texto,",")
Dim CDPressed,CDNormal As ColorDrawable
CDPressed.Initialize(Colors.Blue,0) ' Normal color
CDNormal.Initialize(Colors.Blue,0) 'Selected color
Dim SV As SLLVOnScroll
SV.Initialize(ListaConexiones,"ListaConexiones",CDPressed,CDNormal)
ListaConexiones.Clear
For i = 0 To Conexiones.Size-1
Valores.Initialize
Valores=sf.split(Conexiones.Get(i),"\|")
Starter.Conections.Put("Id-"&i,Conexiones.Get(i))
ListaConexiones.AddTwoLines2(Valores.Get(0),Valores.Get(1),i)
Next
If Conexiones.Size>0 Then lblLongClick.Visible=True
End If
Catch
Log(LastException)
End Try
End Sub