Hello.
I made a torch by using the screen and the flashlight. It's a simple project, but I noticed it spends more than 500 Kb when it's installed on the device.
I use the AdvancedCamera lib just to switch the LED flashlight on. Maybe it's an important part of the problem. In spain we say: "It's like killing flyes by using a cannon".
Is there a way to avoid the inclusion of unused parts of a library?
Thanks a lot, and congratulations for an amazing tool.
I made a torch by using the screen and the flashlight. It's a simple project, but I noticed it spends more than 500 Kb when it's installed on the device.
B4X:
#Region Project Attributes
#ApplicationLabel: Melight
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: true
#IncludeTitle: false
#End Region
'Simple torch using the camera flash or the screen to provide light.
'I've commented it in english just to post a question (so forgive my bad english)
Sub Process_Globals
Dim LED As Boolean 'Whether is selected Flash or screen
End Sub
Sub Globals
Dim Control As Phone 'To set the maximum screen brightness
Dim Eventos As PhoneEvents 'To measure the battery left
Dim Camara As AdvancedCamera 'To swith the white LED on.
Dim Panel1 As Panel 'To manage the click event to toggle the light source
Dim Panel2 As Panel 'To let me initialize AdvancedCamera to use the flash light
Dim Label1 As Label 'To show the battery left
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1") 'It has just two panels and a label
AdaptaVistas 'Set the views' initial status
Dim Id As PhoneId
Eventos.InitializeWithPhoneState("Eventos",Id)
End Sub
Sub Activity_Resume
Camara.Initialize(Panel2,"Camara") 'Initializes the AdvancedCamera
Control.SetScreenBrightness(1) 'Sets the maximum screen brightness
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If LED Then Camara.FlashOff 'If the LED was on, switches it off
Camara.Release
Control.SetScreenBrightness(0) 'Sets the screen brightness low
End Sub
Sub Camara_Ready (Success As Boolean)
If Success Then
If LED Then Camara.FlashTorch 'If LED function is selected, switches the LED on
End If
End Sub
'To make the main panel full screen
Sub AdaptaVistas
Panel1.Height=100%y
Panel1.Width=100%x
LED=False
End Sub
'Changes the light's source
Sub Panel1_Click
If LED Then 'If the LED was ON
Panel1.Color=Colors.ARGB(255,255,255,255) ' switches the screen on
Camara.FlashOff ' and switches then LED off
Else 'If the LED was OFF
Panel1.Color=Colors.ARGB(0,0,0,0) ' switches the screen off
Camara.FlashTorch ' and switchess the LED on
End If
LED=Not(LED) 'Remembers the current selected light source
End Sub
'Shows the battery left
Sub Eventos_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
Label1.Text=Level
End Sub
I use the AdvancedCamera lib just to switch the LED flashlight on. Maybe it's an important part of the problem. In spain we say: "It's like killing flyes by using a cannon".
Is there a way to avoid the inclusion of unused parts of a library?
Thanks a lot, and congratulations for an amazing tool.