mirror of
https://github.com/KeymonSoft/Gabinete-Roit.git
synced 2026-04-20 20:59:18 +00:00
Commit inicial
This commit is contained in:
110
B4XMainPage.bas
Normal file
110
B4XMainPage.bas
Normal file
@@ -0,0 +1,110 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=9.85
|
||||
@EndOfDesignText@
|
||||
#Region Shared Files
|
||||
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
|
||||
'###########################################################################################################
|
||||
'###################### PULL #############################################################
|
||||
'Ctrl + click ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=git&Args=pull
|
||||
'###########################################################################################################
|
||||
'###################### PUSH #############################################################
|
||||
'Ctrl + click ide://run?file=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe&Args=github&Args=..\..\
|
||||
'###########################################################################################################
|
||||
'###################### PUSH TORTOISE GIT #########################################################
|
||||
'Ctrl + click ide://run?file=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe&Args=TortoiseGitProc&Args=/command:commit&Args=/path:"./../../"&Args=/closeonend:2
|
||||
'###########################################################################################################
|
||||
#End Region
|
||||
|
||||
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
|
||||
|
||||
Sub Class_Globals
|
||||
Public Root As B4XView
|
||||
Private xui As XUI
|
||||
Dim timer As Timer
|
||||
' Clases
|
||||
Public login As login
|
||||
Dim principal As C_principal
|
||||
Dim supervisor As C_supervisor
|
||||
Public updateAvailable As C_UpdateAvailable
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize
|
||||
' B4XPages.GetManager.LogEvents = True
|
||||
|
||||
End Sub
|
||||
|
||||
'This event will be called once, before the page becomes visible.
|
||||
Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Root = Root1
|
||||
Root.LoadLayout("MainPage")
|
||||
B4XPages.GetManager.TransitionAnimationDuration = 0
|
||||
login.Initialize
|
||||
B4XPages.AddPageAndCreate("login",login.Initialize)
|
||||
timer.Initialize("Timerconteo",1000)
|
||||
timer.Enabled = True
|
||||
principal.Initialize
|
||||
B4XPages.AddPage("Principal", principal)
|
||||
supervisor.Initialize
|
||||
B4XPages.AddPage("Supervisor", supervisor)
|
||||
updateAvailable.Initialize
|
||||
B4XPages.AddPage("updateAvailable", updateAvailable)
|
||||
' auxiliar.Initialize
|
||||
' B4XPages.AddPage("Auxiliar", auxiliar)
|
||||
' tecnico.Initialize
|
||||
' B4XPages.AddPage("Tecnico", tecnico)
|
||||
' salida.Initialize
|
||||
' B4XPages.AddPage("Salida",salida)
|
||||
|
||||
' Tracker
|
||||
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
|
||||
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
|
||||
If Result Then
|
||||
StartService(Tracker)
|
||||
Log("Start Tracker")
|
||||
Else
|
||||
ToastMessageShow("No permission", True)
|
||||
End If
|
||||
|
||||
CheckAndRequestNotificationPermission
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub B4XPage_Appear
|
||||
Wait For (CheckAndRequestNotificationPermission) Complete (HasPermission As Boolean)
|
||||
If HasPermission Then
|
||||
Log("Con permisos de notificación")
|
||||
Else
|
||||
ToastMessageShow("No permission to show notification", True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'Make sure that targetSdkVersion >= 33
|
||||
Private Sub CheckAndRequestNotificationPermission As ResumableSub
|
||||
Dim p As Phone
|
||||
If p.SdkVersion < 33 Then Return True
|
||||
Dim ctxt As JavaObject
|
||||
ctxt.InitializeContext
|
||||
Dim targetSdkVersion As Int = ctxt.RunMethodJO("getApplicationInfo", Null).GetField("targetSdkVersion")
|
||||
If targetSdkVersion < 33 Then Return True
|
||||
Dim NotificationsManager As JavaObject = ctxt.RunMethod("getSystemService", Array("notification"))
|
||||
Dim NotificationsEnabled As Boolean = NotificationsManager.RunMethod("areNotificationsEnabled", Null)
|
||||
If NotificationsEnabled Then Return True
|
||||
Dim rp As RuntimePermissions
|
||||
rp.CheckAndRequest(rp.PERMISSION_POST_NOTIFICATIONS)
|
||||
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean) 'change to Activity_PermissionResult if non-B4XPages.
|
||||
Return Result
|
||||
End Sub
|
||||
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Sub Timerconteo_tick
|
||||
B4x_Transition.PrepareTransition_FadeOut(xui, Root.Width, Root.Height, Root, login.Root)
|
||||
B4XPages.ShowPageAndRemovePreviousPages("login")
|
||||
timer.Enabled = False
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user