4/10/23 - Actualización en el manifiesto y en el diseño.

- Se modifico la declaracion de la libreria ReplyAuto para que incluya "android:exported="true"", esta modificación es necesaria para Android 12+
- Se cambian tamaños y posicion de paneles para que se adapten a la pantalla del movil (pantalla principal).
This commit is contained in:
2023-10-04 20:28:32 -06:00
parent 52bb35dbdc
commit adab335f3e
7 changed files with 104 additions and 89 deletions

View File

@@ -187,6 +187,7 @@ Sub Class_Globals
Private admin As BluetoothAdmin
Public BluetoothState, ConnectionState As Boolean
Private ion As Object
Private p_centrado As Panel
End Sub
'You can add more parameters here.
@@ -202,9 +203,9 @@ Private Sub B4XPage_Created (Root1 As B4XView)
'load the layout to Root
Root.LoadLayout("principal")
EJECUTANDO=1
Dim ruta As String
' Dim ruta As String
img2.Visible =False
ruta = File.DirInternal
' ruta = File.DirInternal
DateTime.DateFormat = "MM/dd/yyyy"
fecha=DateTime.Date(DateTime.Now)
c=Starter.db.ExecQuery2("select CAT_CO_CONFIGURACION from CAT_CODIGOS where CAT_CO_PONDERACION =1 AND CAT_CO_ACCION = ?", Array As String("SERVER"))
@@ -260,66 +261,23 @@ Private Sub B4XPage_Created (Root1 As B4XView)
End If
kh.Initialize(Me, "kh")
kh.RD_Init
Log("XXXXXXXXXXXXXXXXXXXXXXXXX REVISAMOS PERMISOS DE BT - APPEAR -")
StartBluetooth
Log("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
End Sub
Private Sub StartBluetooth
If admin.IsEnabled = False Then
Wait For (EnableBluetooth) Complete (Success As Boolean)
If Success = False Then
ToastMessageShow("Failed to enable bluetooth", True)
End If
End If
BluetoothState = admin.IsEnabled
StateChanged
End Sub
Private Sub StateChanged
' btnSearchForDevices.Enabled = BluetoothState
' btnAllowConnection.Enabled = BluetoothState
' ChatPage1.btnSend.Enabled = ConnectionState
End Sub
Private Sub EnableBluetooth As ResumableSub
ToastMessageShow("Enabling Bluetooth adapter...", False)
Dim ph As Phone
If ph.SdkVersion >= 31 Then
Log(31)
rp.CheckAndRequest("android.permission.BLUETOOTH_CONNECT")
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
Log(Result)
If Result = False Then Return False
If ph.SdkVersion >= 33 Then
Log(33)
Dim in As Intent
in.Initialize("android.bluetooth.adapter.action.REQUEST_ENABLE", "")
StartActivityForResult(in)
Wait For ion_Event (MethodName As String, Args() As Object)
Return admin.IsEnabled
End If
End If
Return admin.Enable
End Sub
Private Sub StartActivityForResult(i As Intent)
Dim jo As JavaObject = GetBA
ion = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "ion", Null)
jo.RunMethod("startActivityForResult", Array As Object(ion, i))
End Sub
Sub GetBA As Object
Dim jo As JavaObject = Me
Return jo.RunMethod("getBA", Null)
P_RESUMEN.Top = 0 : P_RESUMEN.Left = 0 'Panel Resumen
Panel5.Top = 0 : Panel5.Left = 0 ' Panel Resumen Acumualado
p_downloadPDF.Top = 0 : p_downloadPDF.left = 0
P1.Width = GetDeviceLayoutValues.Width
P1.Height = GetDeviceLayoutValues.Height
P1.Top = 0 : P1.left = 0 'Panel de cargar dia
Subs.centraPanel(p_centrado, Root.Width) 'Panel de cargar dia 2
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Sub B4XPage_Appear
Log("XXXXXXXXXXXXXXXXXXXXXXXXX REVISAMOS PERMISOS DE BT - APPEAR -")
StartBluetooth
Log("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
If Not(kh.CheckNotificationAccess) Then
Msgbox2Async($"Se necesita acceso a las notificaciones, haga clic en "Aceptar" y en la siguiente pantalla permita el acceso a la aplicación "${Application.LabelName}"."$, "Permisos necesarios", "Aceptar", "Cancelar", "", Null, True)
Msgbox2Async($"Se necesita acceso a las notificaciones, haga clic en "Aceptar" y en la siguiente pantalla permita el acceso a la aplicación "${Application.LabelName}"."$, "Permisos necesarios", "Aceptar", "", "", Null, True)
Wait For Msgbox_Result (resultado As Int)
If resultado = DialogResponse.POSITIVE Then
Dim In As Intent
@@ -599,8 +557,6 @@ Sub cargar_Click
Btn_CheckList.Visible=False
' P1.Visible = True
' P1.BringToFront
P1.Width = GetDeviceLayoutValues.Width
P1.Height = GetDeviceLayoutValues.Height
Subs.panelVisible(P1, 0, 0)
trabajar.Visible = False
B_PROXIMA.Visible =False
@@ -892,8 +848,6 @@ Sub cargar_Click
trabajar.Visible=False
inv.Visible = False
If Starter.marcaCel <> "LGE" Then ToastMessageShow("Se Actualizarán los datos. Este proceso podria tardar hasta un minuto, gracias" , True)
End If
End Sub
@@ -904,7 +858,7 @@ Sub JobDone(Job As HttpJob)
If Job.Success = False Then
If logger Then LogColor("** " & Job.Tag & " Error: " & Job.ErrorMessage, Colors.Red) ' Mod by CHV - 211116
If Job.ErrorMessage = "STREAM" Then
contador_strem = contador_strem +1
contador_strem = contador_strem + 1
If CARGA = "SUBIR" Then
PB1.Progress = PB1.Progress + 1
If PB1.Progress > 100 Then
@@ -1354,7 +1308,7 @@ Sub JobDone(Job As HttpJob)
PB2.Progress = 100
S_CP.Text = "LISTO"
End If
Listo3 =1
Listo3 = 1
If Listo1 =1 And Listo2 =1 And Listo3 = 1 And Listo4 = 1 Then
B4XPage_Appear
img2.Visible=False
@@ -1912,6 +1866,18 @@ Sub JobDone(Job As HttpJob)
Next
Starter.db.TransactionSuccessful
Starter.db.EndTransaction
If PB2.Progress = 0 Then
PB2.Progress = 30
S_CP.Text = "CARGANDO"
ELSE If PB2.Progress = 30 Then
PB2.Progress = 60
ELSE IF PB2.Progress = 60 Then
PB2.Progress = 80
ELSE IF PB2.Progress = 80 Then
PB2.Progress = 100
S_CP.Text = "LISTO"
End If
' c=skmt.ExecQuery("select CAT_GP_CLASIF, COUNT(*) AS CUANTOS from CAT_GUNAPROD GROUP BY CAT_GP_CLASIF order by CAT_GP_CLASIF asc")
' c.Position=0
' skmt.ExecNonQuery("DELETE FROM COUNT_GUNAPROD")
@@ -1940,6 +1906,8 @@ Sub JobDone(Job As HttpJob)
''' FIN CARGA PEDIDO DOE
End If
If PB2.Progress = 100 Then S_CP.Text = "LISTO"
Job.Release
End Sub
@@ -3139,4 +3107,54 @@ End Sub
Private Sub Resumen_LongClick
ToastMessageShow("Enviamos UTR", True)
CallSubDelayed(Starter, "ENVIA_ULTIMA_GPS")
End Sub
End Sub
Private Sub StartBluetooth
If admin.IsEnabled = False Then
Wait For (EnableBluetooth) Complete (Success As Boolean)
If Success = False Then
ToastMessageShow("Failed to enable bluetooth", True)
End If
End If
BluetoothState = admin.IsEnabled
StateChanged
End Sub
Private Sub StateChanged
' btnSearchForDevices.Enabled = BluetoothState
' btnAllowConnection.Enabled = BluetoothState
' ChatPage1.btnSend.Enabled = ConnectionState
End Sub
Private Sub EnableBluetooth As ResumableSub
ToastMessageShow("Enabling Bluetooth adapter...", False)
Dim ph As Phone
If ph.SdkVersion >= 31 Then
Log(31)
rp.CheckAndRequest("android.permission.BLUETOOTH_CONNECT")
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
Log(Result)
If Result = False Then Return False
If ph.SdkVersion >= 33 Then
Log(33)
Dim in As Intent
in.Initialize("android.bluetooth.adapter.action.REQUEST_ENABLE", "")
StartActivityForResult(in)
Wait For ion_Event (MethodName As String, Args() As Object)
Return admin.IsEnabled
End If
End If
Return admin.Enable
End Sub
Private Sub StartActivityForResult(i As Intent)
Dim jo As JavaObject = GetBA
ion = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "ion", Null)
jo.RunMethod("startActivityForResult", Array As Object(ion, i))
End Sub
Sub GetBA As Object
Dim jo As JavaObject = Me
Return jo.RunMethod("getBA", Null)
End Sub