commit 28/12/2024 13_08

This commit is contained in:
2024-12-28 13:09:34 +01:00
commit 13090e8020
135 changed files with 7023 additions and 0 deletions

179
refusi/AnalogClock.bas Normal file
View File

@@ -0,0 +1,179 @@
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=13
@EndOfDesignText@
Sub Class_Globals
Private xui As XUI
Private pnlClock As Panel ' Pannello in cui disegnare l'orologio
Private cvsClock As B4XCanvas ' Canvas per disegnare l'orologio
Private clockDiameter As Float ' Diametro dell'orologio (in pixel)
Private centerX As Float ' Coordinata X del centro dell'orologio
Private centerY As Float ' Coordinata Y del centro dell'orologio
Private intervals As List ' Lista degli intervalli da disegnare
' Parametri di spessore
Private quadrantStrokeWidth As Float = 5dip
Private hourTickStrokeWidth As Float = 5dip
Private minuteTickStrokeWidth As Float = 2dip
Private intervalArcStrokeWidth As Float = 5dip
Private hourHandStrokeWidth As Float = 8dip
Private minuteHandStrokeWidth As Float = 5dip
End Sub
' Inizializza l'orologio
Public Sub Initialize(ParentPanel As Panel, PercentageOfWidth As Float)
pnlClock = ParentPanel
cvsClock.Initialize(pnlClock)
intervals.Initialize
SetClockSize(PercentageOfWidth)
End Sub
' Imposta la dimensione dell'orologio come percentuale della larghezza del pannello
Public Sub SetClockSize(PercentageOfWidth As Float)
clockDiameter = pnlClock.Width * PercentageOfWidth / 100
centerX = pnlClock.Width / 2
centerY = pnlClock.Height / 2
DrawClock
End Sub
' Imposta lo spessore delle varie linee
Public Sub SetStrokeWidths(quadrantWidth As Float, hourTickWidth As Float, minuteTickWidth As Float, intervalArcWidth As Float, hourHandWidth As Float, minuteHandWidth As Float)
quadrantStrokeWidth = quadrantWidth
hourTickStrokeWidth = hourTickWidth
minuteTickStrokeWidth = minuteTickWidth
intervalArcStrokeWidth = intervalArcWidth
hourHandStrokeWidth = hourHandWidth
minuteHandStrokeWidth = minuteHandWidth
DrawClock
End Sub
' Cancella il canvas riempiendolo con un colore specifico
Private Sub ClearCanvas(color As Int)
cvsClock.DrawRect(cvsClock.TargetRect, color, True, 0)
cvsClock.Invalidate
End Sub
' Disegna l'orologio
Public Sub DrawClock
cvsClock.Initialize(pnlClock)
' Cancella il canvas
ClearCanvas(Colors.White)
' Disegna il cerchio esterno
cvsClock.DrawCircle(centerX, centerY, clockDiameter / 2, Colors.Black, False, quadrantStrokeWidth)
' Disegna le tacche delle ore e dei minuti
DrawTicks
' Disegna gli intervalli
For Each interval As Map In intervals
DrawInterval(interval.Get("startHour"), interval.Get("startMinute"), interval.Get("endHour"), interval.Get("endMinute"), interval.Get("color"), interval.Get("radius"), interval.Get("strokeWidth"))
Next
' Disegna le lancette
Dim now As Long = DateTime.Now
Dim Hours As Int = DateTime.GetHour(now) Mod 12
Dim Minutes As Int = DateTime.GetMinute(now)
Dim Seconds As Int = DateTime.GetSecond(now)
' Lancetta ore
Dim HourAngle As Float = -90 + Hours * 30 + Minutes / 2
DrawHand(centerX, centerY, clockDiameter * 0.25, HourAngle, hourHandStrokeWidth, Colors.Black)
' Lancetta minuti
Dim MinuteAngle As Float = -90 + Minutes * 6
DrawHand(centerX, centerY, clockDiameter * 0.4, MinuteAngle, minuteHandStrokeWidth, Colors.Blue)
' Lancetta secondi
Dim SecondAngle As Float = -90 + Seconds * 6
DrawHand(centerX, centerY, clockDiameter * 0.45, SecondAngle, 2dip, Colors.Red)
' Aggiorna il pannello
pnlClock.Invalidate
End Sub
' Disegna una singola lancetta
Private Sub DrawHand(x As Float, y As Float, length As Float, angle As Float, width As Float, color As Int)
Dim endX As Float = x + length * CosD(angle)
Dim endY As Float = y + length * SinD(angle)
cvsClock.DrawLine(x, y, endX, endY, color, width)
End Sub
' Disegna le tacche delle ore e dei minuti
Private Sub DrawTicks
For i = 0 To 59
Dim angle As Float = -90 + i * 6
Dim startX As Float
Dim startY As Float
Dim endX As Float
Dim endY As Float
If i Mod 5 = 0 Then
' Tacca delle ore
startX = centerX + (clockDiameter / 2 - 20dip) * CosD(angle)
startY = centerY + (clockDiameter / 2 - 20dip) * SinD(angle)
endX = centerX + (clockDiameter / 2 - 5dip) * CosD(angle)
endY = centerY + (clockDiameter / 2 - 5dip) * SinD(angle)
cvsClock.DrawLine(startX, startY, endX, endY, Colors.Black, hourTickStrokeWidth)
Else
' Tacca dei minuti
startX = centerX + (clockDiameter / 2 - 10dip) * CosD(angle)
startY = centerY + (clockDiameter / 2 - 10dip) * SinD(angle)
endX = centerX + (clockDiameter / 2 - 5dip) * CosD(angle)
endY = centerY + (clockDiameter / 2 - 5dip) * SinD(angle)
cvsClock.DrawLine(startX, startY, endX, endY, Colors.Black, minuteTickStrokeWidth)
End If
Next
End Sub
' Aggiunge un intervallo da disegnare
Public Sub AddInterval(startHour As Int, startMinute As Int, endHour As Int, endMinute As Int, tipo As String)
Dim interval As Map
interval.Initialize
interval.Put("startHour", startHour)
interval.Put("startMinute", startMinute)
interval.Put("endHour", endHour)
interval.Put("endMinute", endMinute)
Select tipo.ToLowerCase
Case "mattino"
interval.Put("color", Colors.Blue)
interval.Put("radius", clockDiameter / 2 - 15dip)
interval.Put("strokeWidth", intervalArcStrokeWidth)
Case "pomeriggio"
interval.Put("color", Colors.Green)
interval.Put("radius", clockDiameter / 2 - 25dip)
interval.Put("strokeWidth", intervalArcStrokeWidth)
Case Else
Log("Tipo di intervallo non riconosciuto: " & tipo)
Return
End Select
intervals.Add(interval)
DrawClock
End Sub
' Disegna un intervallo sul quadrante
Private Sub DrawInterval(startHour As Int, startMinute As Int, endHour As Int, endMinute As Int, color As Int, radius As Float, strokeWidth As Float)
Dim startAngle As Float = (startHour Mod 12 + startMinute / 60) * 30 - 90
Dim endAngle As Float = (endHour Mod 12 + endMinute / 60) * 30 - 90
Dim sweepAngle As Float = endAngle - startAngle
If sweepAngle < 0 Then sweepAngle = sweepAngle + 360
Dim path As B4XPath
path.InitializeArc(centerX, centerY, radius, startAngle, sweepAngle)
cvsClock.DrawPath(path, color, False, strokeWidth)
End Sub
' Aggiorna l'orologio ogni secondo
Public Sub StartClock
Dim timer As Timer
timer.Initialize("timer", 1000)
timer.Enabled = True
End Sub
' Evento del timer per aggiornare l'orologio
Private Sub timer_Tick
DrawClock
End Sub

160
refusi/AnalogClock.bas.bak Normal file
View File

@@ -0,0 +1,160 @@
Sub Class_Globals
Private pnlClock As Panel ' Pannello in cui disegnare l'orologio
Private cvsClock As Canvas ' Canvas per disegnare l'orologio
Private clockDiameter As Float ' Diametro dell'orologio (in pixel)
Private centerX As Float ' Coordinata X del centro dell'orologio
Private centerY As Float ' Coordinata Y del centro dell'orologio
Private intervals As List ' Lista degli intervalli da disegnare
' Parametri di spessore
Private quadrantStrokeWidth As Float = 5dip
Private hourTickStrokeWidth As Float = 5dip
Private minuteTickStrokeWidth As Float = 2dip
Private intervalArcStrokeWidth As Float = 5dip
Private hourHandStrokeWidth As Float = 8dip
Private minuteHandStrokeWidth As Float = 5dip
End Sub
' Inizializza l'orologio
Public Sub Initialize(ParentPanel As Panel, PercentageOfWidth As Float)
pnlClock = ParentPanel
cvsClock.Initialize(pnlClock)
intervals.Initialize
SetClockSize(PercentageOfWidth)
End Sub
' Imposta la dimensione dell'orologio come percentuale della larghezza del pannello
Public Sub SetClockSize(PercentageOfWidth As Float)
clockDiameter = pnlClock.Width * PercentageOfWidth / 100
centerX = pnlClock.Width / 2
centerY = pnlClock.Height / 2
DrawClock
End Sub
' Imposta lo spessore delle varie linee
Public Sub SetStrokeWidths(quadrantWidth As Float, hourTickWidth As Float, minuteTickWidth As Float, intervalArcWidth As Float, hourHandWidth As Float, minuteHandWidth As Float)
quadrantStrokeWidth = quadrantWidth
hourTickStrokeWidth = hourTickWidth
minuteTickStrokeWidth = minuteTickWidth
intervalArcStrokeWidth = intervalArcWidth
hourHandStrokeWidth = hourHandWidth
minuteHandStrokeWidth = minuteHandWidth
DrawClock
End Sub
' Disegna l'orologio
Public Sub DrawClock
cvsClock.Initialize(pnlClock)
' Cancella il canvas
cvsClock.DrawColor(Colors.White)
' Disegna il cerchio esterno
cvsClock.DrawCircle(centerX, centerY, clockDiameter / 2, Colors.Black, False, quadrantStrokeWidth)
' Disegna le tacche delle ore e dei minuti
DrawTicks
' Disegna gli intervalli
For Each interval As Map In intervals
DrawInterval(interval.Get("startHour"), interval.Get("startMinute"), interval.Get("endHour"), interval.Get("endMinute"), interval.Get("color"), interval.Get("radius"), interval.Get("strokeWidth"))
Next
' Disegna le lancette
Dim now As Long = DateTime.Now
Dim Hours As Int = DateTime.GetHour(now) Mod 12
Dim Minutes As Int = DateTime.GetMinute(now)
Dim Seconds As Int = DateTime.GetSecond(now)
' Lancetta ore
Dim HourAngle As Float = -90 + Hours * 30 + Minutes / 2
DrawHand(centerX, centerY, clockDiameter * 0.25, HourAngle, hourHandStrokeWidth, Colors.Black)
' Lancetta minuti
Dim MinuteAngle As Float = -90 + Minutes * 6
DrawHand(centerX, centerY, clockDiameter * 0.4, MinuteAngle, minuteHandStrokeWidth, Colors.Blue)
' Lancetta secondi
Dim SecondAngle As Float = -90 + Seconds * 6
DrawHand(centerX, centerY, clockDiameter * 0.45, SecondAngle, 2dip, Colors.Red)
' Aggiorna il pannello
pnlClock.Invalidate
End Sub
' Disegna una singola lancetta
Private Sub DrawHand(x As Float, y As Float, length As Float, angle As Float, width As Float, color As Int)
Dim endX As Float = x + length * CosD(angle)
Dim endY As Float = y + length * SinD(angle)
cvsClock.DrawLine(x, y, endX, endY, color, width)
End Sub
' Disegna le tacche delle ore e dei minuti
Private Sub DrawTicks
For i = 0 To 59
Dim angle As Float = -90 + i * 6
Dim startX As Float
Dim startY As Float
Dim endX As Float
Dim endY As Float
If i Mod 5 = 0 Then
' Tacca delle ore
startX = centerX + (clockDiameter / 2 - 20dip) * CosD(angle)
startY = centerY + (clockDiameter / 2 - 20dip) * SinD(angle)
endX = centerX + (clockDiameter / 2 - 5dip) * CosD(angle)
endY = centerY + (clockDiameter / 2 - 5dip) * SinD(angle)
cvsClock.DrawLine(startX, startY, endX, endY, Colors.Black, hourTickStrokeWidth)
Else
' Tacca dei minuti
startX = centerX + (clockDiameter / 2 - 10dip) * CosD(angle)
startY = centerY + (clockDiameter / 2 - 10dip) * SinD(angle)
endX = centerX + (clockDiameter / 2 - 5dip) * CosD(angle)
endY = centerY + (clockDiameter / 2 - 5dip) * SinD(angle)
cvsClock.DrawLine(startX, startY, endX, endY, Colors.Black, minuteTickStrokeWidth)
End If
Next
End Sub
' Aggiunge un intervallo da disegnare
Public Sub AddInterval(startHour As Int, startMinute As Int, endHour As Int, endMinute As Int, tipo As String)
Dim interval As Map
interval.Initialize
interval.Put("startHour", startHour)
interval.Put("startMinute", startMinute)
interval.Put("endHour", endHour)
interval.Put("endMinute", endMinute)
Select tipo.ToLowerCase
Case "mattino"
interval.Put("color", Colors.Blue)
interval.Put("radius", clockDiameter / 2 - 15dip)
interval.Put("strokeWidth", intervalArcStrokeWidth)
Case "pomeriggio"
interval.Put("color", Colors.Green)
interval.Put("radius", clockDiameter / 2 - 25dip)
interval.Put("strokeWidth", intervalArcStrokeWidth)
Case Else
Log("Tipo di intervallo non riconosciuto: " & tipo)
Return
End Select
intervals.Add(interval)
DrawClock
End Sub
' Disegna un intervallo sul quadrante
Private Sub DrawInterval(startHour As Int, startMinute As Int, endHour As Int, endMinute As Int, color As Int, radius As Float, strokeWidth As Float)
Dim startAngle As Float = (startHour Mod 12 + startMinute / 60) * 30 - 90
Dim endAngle As Float = (endHour Mod 12 + endMinute / 60) * 30 - 90
Dim sweepAngle As Float = endAngle - startAngle
If sweepAngle < 0 Then sweepAngle = sweepAngle + 360
cvsClock.DrawArc(centerX - radius, centerY - radius, centerX + radius, centerY + radius, startAngle, sweepAngle, False, color, strokeWidth)
End Sub
' Aggiorna l'orologio ogni secondo
Public Sub StartClock
Dim timer As Timer
timer.Initialize("timer", 1000)
timer.Enabled = True
End Sub
' Evento del timer per aggiornare l'orologio
Private Sub timer_Tick
DrawClock
End Sub

143
refusi/AnalogClockX.bas Normal file
View File

@@ -0,0 +1,143 @@
Sub Class_Globals
Private pnlClock As Panel ' Pannello in cui disegnare l'orologio
Private cvsClock As Canvas ' Canvas per disegnare l'orologio
Private clockDiameter As Float ' Diametro dell'orologio (in pixel)
Private centerX As Float ' Coordinata X del centro dell'orologio
Private centerY As Float ' Coordinata Y del centro dell'orologio
Private intervals As List ' Lista degli intervalli da disegnare
End Sub
' Inizializza l'orologio
Public Sub Initialize(ParentPanel As Panel, PercentageOfWidth As Float)
pnlClock = ParentPanel
cvsClock.Initialize(pnlClock)
intervals.Initialize
SetClockSize(PercentageOfWidth)
End Sub
' Imposta la dimensione dell'orologio come percentuale della larghezza del pannello
Public Sub SetClockSize(PercentageOfWidth As Float)
clockDiameter = pnlClock.Width * PercentageOfWidth / 100
centerX = pnlClock.Width / 2
centerY = pnlClock.Height / 2
DrawClock
End Sub
' Disegna l'orologio
Public Sub DrawClock
cvsClock.Initialize(pnlClock)
' Cancella il canvas
cvsClock.DrawColor(Colors.White)
' Disegna il cerchio esterno
cvsClock.DrawCircle(centerX, centerY, clockDiameter / 2, Colors.Black, False, 5)
' Disegna le tacche delle ore e dei minuti
DrawTicks
' Disegna gli intervalli
For Each interval As Map In intervals
DrawInterval(interval.Get("startHour"), interval.Get("startMinute"), interval.Get("endHour"), interval.Get("endMinute"), interval.Get("color"), interval.Get("radius"))
Next
' Disegna le lancette
Dim now As Long = DateTime.Now
Dim Hours As Int = DateTime.GetHour(now) Mod 12
Dim Minutes As Int = DateTime.GetMinute(now)
Dim Seconds As Int = DateTime.GetSecond(now)
' Lancetta ore
Dim HourAngle As Float = -90 + Hours * 30 + Minutes / 2
DrawHand(centerX, centerY, clockDiameter * 0.25, HourAngle, 8, Colors.Black)
' Lancetta minuti
Dim MinuteAngle As Float = -90 + Minutes * 6
DrawHand(centerX, centerY, clockDiameter * 0.4, MinuteAngle, 5, Colors.Blue)
' Lancetta secondi
Dim SecondAngle As Float = -90 + Seconds * 6
DrawHand(centerX, centerY, clockDiameter * 0.45, SecondAngle, 2, Colors.Red)
' Aggiorna il pannello
pnlClock.Invalidate
End Sub
' Disegna una singola lancetta
Private Sub DrawHand(x As Float, y As Float, length As Float, angle As Float, width As Int, color As Int)
Dim endX As Float = x + length * CosD(angle)
Dim endY As Float = y + length * SinD(angle)
cvsClock.DrawLine(x, y, endX, endY, color, width)
End Sub
' Disegna le tacche delle ore e dei minuti
Private Sub DrawTicks
For i = 0 To 59
Dim angle As Float = -90 + i * 6
Dim startX As Float
Dim startY As Float
Dim endX As Float
Dim endY As Float
If i Mod 5 = 0 Then
' Tacca delle ore
startX = centerX + (clockDiameter / 2 - 20dip) * CosD(angle)
startY = centerY + (clockDiameter / 2 - 20dip) * SinD(angle)
endX = centerX + (clockDiameter / 2 - 5dip) * CosD(angle)
endY = centerY + (clockDiameter / 2 - 5dip) * SinD(angle)
cvsClock.DrawLine(startX, startY, endX, endY, Colors.Black, 5)
Else
' Tacca dei minuti
startX = centerX + (clockDiameter / 2 - 10dip) * CosD(angle)
startY = centerY + (clockDiameter / 2 - 10dip) * SinD(angle)
endX = centerX + (clockDiameter / 2 - 5dip) * CosD(angle)
endY = centerY + (clockDiameter / 2 - 5dip) * SinD(angle)
cvsClock.DrawLine(startX, startY, endX, endY, Colors.Black, 2)
End If
Next
End Sub
' Aggiunge un intervallo da disegnare
Public Sub AddInterval(startHour As Int, startMinute As Int, endHour As Int, endMinute As Int, tipo As String)
Dim interval As Map
interval.Initialize
interval.Put("startHour", startHour)
interval.Put("startMinute", startMinute)
interval.Put("endHour", endHour)
interval.Put("endMinute", endMinute)
Select tipo.ToLowerCase
Case "mattino"
interval.Put("color", Colors.Blue)
interval.Put("radius", clockDiameter / 2 - 15dip)
Case "pomeriggio"
interval.Put("color", Colors.Green)
interval.Put("radius", clockDiameter / 2 - 25dip)
Case Else
Log("Tipo di intervallo non riconosciuto: " & tipo)
Return
End Select
intervals.Add(interval)
DrawClock
End Sub
' Disegna un intervallo sul quadrante
Private Sub DrawInterval(startHour As Int, startMinute As Int, endHour As Int, endMinute As Int, color As Int, radius As Float)
Dim startAngle As Float = (startHour Mod 12 + startMinute / 60) * 30 - 90
Dim endAngle As Float = (endHour Mod 12 + endMinute / 60) * 30 - 90
Dim sweepAngle As Float = endAngle - startAngle
If sweepAngle < 0 Then sweepAngle = sweepAngle + 360
Dim path As Path
path.Initialize(centerX, centerY)
path.LineTo(centerX + radius * CosD(startAngle), centerY + radius * SinD(startAngle))
path.AddArc2(centerX - radius, centerY - radius, centerX + radius, centerY + radius, startAngle, sweepAngle)
path.LineTo(centerX, centerY)
path.Close
cvsClock.ClipPath(path)
cvsClock.DrawCircle(centerX, centerY, radius, color, True, 0)
cvsClock.RemoveClip
End Sub

View File

@@ -0,0 +1,67 @@
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=13
@EndOfDesignText@
Sub Class_Globals
Private pnlClock As Panel ' Pannello in cui disegnare l'orologio
Private cvsClock As Canvas ' Canvas per disegnare l'orologio
Private clockDiameter As Float ' Diametro dell'orologio (in pixel)
Private centerX As Float ' Coordinata X del centro dell'orologio
Private centerY As Float ' Coordinata Y del centro dell'orologio
End Sub
' Inizializza l'orologio
Public Sub Initialize(ParentPanel As Panel, PercentageOfWidth As Float)
pnlClock = ParentPanel
cvsClock.Initialize(pnlClock)
SetClockSize(PercentageOfWidth)
End Sub
' Imposta la dimensione dell'orologio come percentuale della larghezza del pannello
Public Sub SetClockSize(PercentageOfWidth As Float)
clockDiameter = pnlClock.Width * PercentageOfWidth / 100
centerX = pnlClock.Width / 2
centerY = pnlClock.Height / 2
DrawClock
End Sub
' Disegna l'orologio
Public Sub DrawClock
cvsClock.Initialize(pnlClock)
' Cancella il canvas
cvsClock.DrawColor(Colors.White)
' Disegna il cerchio esterno
cvsClock.DrawCircle(centerX, centerY, clockDiameter / 2, Colors.Black, False, 5)
' Disegna le lancette
Dim now As Long = DateTime.Now
Dim Hours As Int = DateTime.GetHour(now) Mod 12
Dim Minutes As Int = DateTime.GetMinute(now)
Dim Seconds As Int = DateTime.GetSecond(now)
' Lancetta ore
Dim HourAngle As Float = -90 + Hours * 30 + Minutes / 2
DrawHand(centerX, centerY, clockDiameter * 0.25, HourAngle, 8, Colors.Black)
' Lancetta minuti
Dim MinuteAngle As Float = -90 + Minutes * 6
DrawHand(centerX, centerY, clockDiameter * 0.4, MinuteAngle, 5, Colors.Blue)
' Lancetta secondi
Dim SecondAngle As Float = -90 + Seconds * 6
DrawHand(centerX, centerY, clockDiameter * 0.45, SecondAngle, 2, Colors.Red)
' Aggiorna il pannello
pnlClock.Invalidate
End Sub
' Disegna una singola lancetta
Private Sub DrawHand(x As Float, y As Float, length As Float, angle As Float, width As Int, color As Int)
Dim endX As Float = x + length * CosD(angle)
Dim endY As Float = y + length * SinD(angle)
cvsClock.DrawLine(x, y, endX, endY, color, width)
End Sub

BIN
refusi/Files/Immagine.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="b4a.example"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="internalOnly">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<application
android:name="androidx.multidex.MultiDexApplication"
android:icon="@drawable/icon"
android:label="Orologio Analogico"
android:theme="@style/LightTheme">
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".main"
android:label="Orologio Analogico"
android:screenOrientation="unspecified"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".starter"
android:exported="true">
</service>
<receiver
android:name=".starter$starter_BR"
android:exported="true">
</receiver>
</application>
</manifest>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,18 @@
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package b4a.example;
public final class R {
public static final class drawable {
public static final int icon=0x7f010000;
}
public static final class style {
public static final int LightTheme=0x7f020000;
public static final int LowerCaseMenu=0x7f020001;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name="LightTheme" parent="@android:style/Theme.Holo.Light">
</style>
</resources>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name="LightTheme" parent="@android:style/Theme.Material.Light">
<item name="android:actionMenuTextAppearance">@style/LowerCaseMenu</item>
</style>
<style name="LowerCaseMenu" parent="android:TextAppearance.Material.Widget.ActionBar.Menu">
<item name="android:textAllCaps">false</item>
</style>
</resources>

View File

@@ -0,0 +1,133 @@
b4a.example
0
1
analogclock
0
main,activity_create,1,0,48,73
,btnpause,,btnreset,,btnstart,,lblelapsedtime,,pnlclock,,myclock,,timer1
,btnpause,,btnreset,,btnstart,,lblelapsedtime,,pnlclock
analogclock,initialize,analogclock,setclocksize,analogclock,drawclock,analogclock,clearcanvas,analogclock,drawticks,analogclock,drawinterval,analogclock,drawhand
main,activity_pause,0,0,86,88
main,activity_resume,0,0,82,84
main,btnpause_click,0,0,169,171
,running
,running
main,btnreset_click,0,0,174,178
,running,,elapsedtime,,lblelapsedtime
,running,,elapsedtime
main,btnstart_click,0,0,157,166
,running,,timer1,,starttime,,elapsedtime
,running,,starttime
main,btnsync_click,0,0,181,183
,canvas1
,synchronizeclock,,drawclock,,drawhand
main,synchronizeclock,0,0,186,188
,canvas1
,drawclock,,drawhand
main,drawclock,0,0,91,120
,canvas1
,drawhand
main,drawhand,0,0,122,126
,canvas1
main,formatelapsedtime,0,0,147,154
main,globals,0,1,21,34
,lblelapsedtime
main,process_globals,0,1,13,19
,running,,starttime,,elapsedtime
,running,,starttime,,elapsedtime
main,timer1_tick,0,0,78,80
,myclock
analogclock,drawclock,analogclock,clearcanvas,analogclock,drawticks,analogclock,drawinterval,analogclock,drawhand
analogclock,initialize,0,0,21,26
,setclocksize,,drawclock,,clearcanvas,,drawticks,,drawinterval,,drawhand
analogclock,drawclock,0,0,54,91
,clearcanvas,,drawticks,,drawinterval,,drawhand
analogclock,addinterval,0,0,126,148
,drawclock,,clearcanvas,,drawticks,,drawinterval,,drawhand
analogclock,class_globals,0,0,1,18
analogclock,clearcanvas,0,0,48,51
analogclock,drawticks,0,0,100,123
analogclock,drawinterval,0,0,150,159
analogclock,drawhand,0,0,94,98
analogclock,setclocksize,0,0,29,34
,drawclock,,clearcanvas,,drawticks,,drawinterval,,drawhand
analogclock,setstrokewidths,0,0,37,45
,drawclock,,clearcanvas,,drawticks,,drawinterval,,drawhand
analogclock,startclock,0,0,163,167
analogclock,timer_tick,0,0,170,172
,drawclock,,clearcanvas,,drawticks,,drawinterval,,drawhand
starter,application_error,0,0,27,29
starter,process_globals,0,1,6,10
starter,service_create,0,0,12,16
starter,service_destroy,0,0,31,33
starter,service_start,0,0,18,20
starter,service_taskremoved,0,0,22,24

View File

@@ -0,0 +1,32 @@
package b4a.example;
import anywheresoftware.b4a.pc.PCBA;
import anywheresoftware.b4a.pc.RemoteObject;
public class analogclock {
public static RemoteObject myClass;
public analogclock() {
}
public static PCBA staticBA = new PCBA(null, analogclock.class);
public static RemoteObject __c = RemoteObject.declareNull("anywheresoftware.b4a.keywords.Common");
public static RemoteObject _xui = RemoteObject.declareNull("anywheresoftware.b4a.objects.B4XViewWrapper.XUI");
public static RemoteObject _pnlclock = RemoteObject.declareNull("anywheresoftware.b4a.objects.PanelWrapper");
public static RemoteObject _cvsclock = RemoteObject.declareNull("anywheresoftware.b4a.objects.B4XCanvas");
public static RemoteObject _clockdiameter = RemoteObject.createImmutable(0f);
public static RemoteObject _centerx = RemoteObject.createImmutable(0f);
public static RemoteObject _centery = RemoteObject.createImmutable(0f);
public static RemoteObject _intervals = RemoteObject.declareNull("anywheresoftware.b4a.objects.collections.List");
public static RemoteObject _quadrantstrokewidth = RemoteObject.createImmutable(0f);
public static RemoteObject _hourtickstrokewidth = RemoteObject.createImmutable(0f);
public static RemoteObject _minutetickstrokewidth = RemoteObject.createImmutable(0f);
public static RemoteObject _intervalarcstrokewidth = RemoteObject.createImmutable(0f);
public static RemoteObject _hourhandstrokewidth = RemoteObject.createImmutable(0f);
public static RemoteObject _minutehandstrokewidth = RemoteObject.createImmutable(0f);
public static b4a.example.main _main = null;
public static b4a.example.starter _starter = null;
public static Object[] GetGlobals(RemoteObject _ref) throws Exception {
return new Object[] {"centerX",_ref.getField(false, "_centerx"),"centerY",_ref.getField(false, "_centery"),"clockDiameter",_ref.getField(false, "_clockdiameter"),"cvsClock",_ref.getField(false, "_cvsclock"),"hourHandStrokeWidth",_ref.getField(false, "_hourhandstrokewidth"),"hourTickStrokeWidth",_ref.getField(false, "_hourtickstrokewidth"),"intervalArcStrokeWidth",_ref.getField(false, "_intervalarcstrokewidth"),"intervals",_ref.getField(false, "_intervals"),"minuteHandStrokeWidth",_ref.getField(false, "_minutehandstrokewidth"),"minuteTickStrokeWidth",_ref.getField(false, "_minutetickstrokewidth"),"pnlClock",_ref.getField(false, "_pnlclock"),"quadrantStrokeWidth",_ref.getField(false, "_quadrantstrokewidth"),"xui",_ref.getField(false, "_xui")};
}
}

View File

@@ -0,0 +1,544 @@
package b4a.example;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.pc.*;
public class analogclock_subs_0 {
public static RemoteObject _addinterval(RemoteObject __ref,RemoteObject _starthour,RemoteObject _startminute,RemoteObject _endhour,RemoteObject _endminute,RemoteObject _tipo) throws Exception{
try {
Debug.PushSubsStack("AddInterval (analogclock) ","analogclock",2,__ref.getField(false, "ba"),__ref,126);
if (RapidSub.canDelegate("addinterval")) { return __ref.runUserSub(false, "analogclock","addinterval", __ref, _starthour, _startminute, _endhour, _endminute, _tipo);}
RemoteObject _interval = RemoteObject.declareNull("anywheresoftware.b4a.objects.collections.Map");
Debug.locals.put("startHour", _starthour);
Debug.locals.put("startMinute", _startminute);
Debug.locals.put("endHour", _endhour);
Debug.locals.put("endMinute", _endminute);
Debug.locals.put("tipo", _tipo);
BA.debugLineNum = 126;BA.debugLine="Public Sub AddInterval(startHour As Int, startMinu";
Debug.ShouldStop(536870912);
BA.debugLineNum = 127;BA.debugLine="Dim interval As Map";
Debug.ShouldStop(1073741824);
_interval = RemoteObject.createNew ("anywheresoftware.b4a.objects.collections.Map");Debug.locals.put("interval", _interval);
BA.debugLineNum = 128;BA.debugLine="interval.Initialize";
Debug.ShouldStop(-2147483648);
_interval.runVoidMethod ("Initialize");
BA.debugLineNum = 129;BA.debugLine="interval.Put(\"startHour\", startHour)";
Debug.ShouldStop(1);
_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("startHour"))),(Object)((_starthour)));
BA.debugLineNum = 130;BA.debugLine="interval.Put(\"startMinute\", startMinute)";
Debug.ShouldStop(2);
_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("startMinute"))),(Object)((_startminute)));
BA.debugLineNum = 131;BA.debugLine="interval.Put(\"endHour\", endHour)";
Debug.ShouldStop(4);
_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("endHour"))),(Object)((_endhour)));
BA.debugLineNum = 132;BA.debugLine="interval.Put(\"endMinute\", endMinute)";
Debug.ShouldStop(8);
_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("endMinute"))),(Object)((_endminute)));
BA.debugLineNum = 133;BA.debugLine="Select tipo.ToLowerCase";
Debug.ShouldStop(16);
switch (BA.switchObjectToInt(_tipo.runMethod(true,"toLowerCase"),BA.ObjectToString("mattino"),BA.ObjectToString("pomeriggio"))) {
case 0: {
BA.debugLineNum = 135;BA.debugLine="interval.Put(\"color\", Colors.Blue)";
Debug.ShouldStop(64);
_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("color"))),(Object)((analogclock.__c.getField(false,"Colors").getField(true,"Blue"))));
BA.debugLineNum = 136;BA.debugLine="interval.Put(\"radius\", clockDiameter /";
Debug.ShouldStop(128);
_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("radius"))),(Object)((RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(2),analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 15)))}, "/-",1, 0))));
BA.debugLineNum = 137;BA.debugLine="interval.Put(\"strokeWidth\", intervalAr";
Debug.ShouldStop(256);
_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("strokeWidth"))),(Object)((__ref.getField(true,"_intervalarcstrokewidth" /*RemoteObject*/ ))));
break; }
case 1: {
BA.debugLineNum = 139;BA.debugLine="interval.Put(\"color\", Colors.Green)";
Debug.ShouldStop(1024);
_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("color"))),(Object)((analogclock.__c.getField(false,"Colors").getField(true,"Green"))));
BA.debugLineNum = 140;BA.debugLine="interval.Put(\"radius\", clockDiameter /";
Debug.ShouldStop(2048);
_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("radius"))),(Object)((RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(2),analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 25)))}, "/-",1, 0))));
BA.debugLineNum = 141;BA.debugLine="interval.Put(\"strokeWidth\", intervalAr";
Debug.ShouldStop(4096);
_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("strokeWidth"))),(Object)((__ref.getField(true,"_intervalarcstrokewidth" /*RemoteObject*/ ))));
break; }
default: {
BA.debugLineNum = 143;BA.debugLine="Log(\"Tipo di intervallo non riconosciu";
Debug.ShouldStop(16384);
analogclock.__c.runVoidMethod ("LogImpl","31769489",RemoteObject.concat(RemoteObject.createImmutable("Tipo di intervallo non riconosciuto: "),_tipo),0);
BA.debugLineNum = 144;BA.debugLine="Return";
Debug.ShouldStop(32768);
if (true) return RemoteObject.createImmutable("");
break; }
}
;
BA.debugLineNum = 146;BA.debugLine="intervals.Add(interval)";
Debug.ShouldStop(131072);
__ref.getField(false,"_intervals" /*RemoteObject*/ ).runVoidMethod ("Add",(Object)((_interval.getObject())));
BA.debugLineNum = 147;BA.debugLine="DrawClock";
Debug.ShouldStop(262144);
__ref.runClassMethod (b4a.example.analogclock.class, "_drawclock" /*RemoteObject*/ );
BA.debugLineNum = 148;BA.debugLine="End Sub";
Debug.ShouldStop(524288);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _class_globals(RemoteObject __ref) throws Exception{
//BA.debugLineNum = 1;BA.debugLine="Sub Class_Globals";
//BA.debugLineNum = 2;BA.debugLine="Private xui As XUI";
analogclock._xui = RemoteObject.createNew ("anywheresoftware.b4a.objects.B4XViewWrapper.XUI");__ref.setField("_xui",analogclock._xui);
//BA.debugLineNum = 4;BA.debugLine="Private pnlClock As Panel ' Pannello in c";
analogclock._pnlclock = RemoteObject.createNew ("anywheresoftware.b4a.objects.PanelWrapper");__ref.setField("_pnlclock",analogclock._pnlclock);
//BA.debugLineNum = 5;BA.debugLine="Private cvsClock As B4XCanvas ' Canvas per";
analogclock._cvsclock = RemoteObject.createNew ("anywheresoftware.b4a.objects.B4XCanvas");__ref.setField("_cvsclock",analogclock._cvsclock);
//BA.debugLineNum = 6;BA.debugLine="Private clockDiameter As Float ' Diametro dell";
analogclock._clockdiameter = RemoteObject.createImmutable(0f);__ref.setField("_clockdiameter",analogclock._clockdiameter);
//BA.debugLineNum = 7;BA.debugLine="Private centerX As Float ' Coordinata X";
analogclock._centerx = RemoteObject.createImmutable(0f);__ref.setField("_centerx",analogclock._centerx);
//BA.debugLineNum = 8;BA.debugLine="Private centerY As Float ' Coordinata Y";
analogclock._centery = RemoteObject.createImmutable(0f);__ref.setField("_centery",analogclock._centery);
//BA.debugLineNum = 9;BA.debugLine="Private intervals As List ' Lista degli i";
analogclock._intervals = RemoteObject.createNew ("anywheresoftware.b4a.objects.collections.List");__ref.setField("_intervals",analogclock._intervals);
//BA.debugLineNum = 12;BA.debugLine="Private quadrantStrokeWidth As Float = 5dip";
analogclock._quadrantstrokewidth = BA.numberCast(float.class, analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 5))));__ref.setField("_quadrantstrokewidth",analogclock._quadrantstrokewidth);
//BA.debugLineNum = 13;BA.debugLine="Private hourTickStrokeWidth As Float = 5dip";
analogclock._hourtickstrokewidth = BA.numberCast(float.class, analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 5))));__ref.setField("_hourtickstrokewidth",analogclock._hourtickstrokewidth);
//BA.debugLineNum = 14;BA.debugLine="Private minuteTickStrokeWidth As Float = 2dip";
analogclock._minutetickstrokewidth = BA.numberCast(float.class, analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 2))));__ref.setField("_minutetickstrokewidth",analogclock._minutetickstrokewidth);
//BA.debugLineNum = 15;BA.debugLine="Private intervalArcStrokeWidth As Float = 5dip";
analogclock._intervalarcstrokewidth = BA.numberCast(float.class, analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 5))));__ref.setField("_intervalarcstrokewidth",analogclock._intervalarcstrokewidth);
//BA.debugLineNum = 16;BA.debugLine="Private hourHandStrokeWidth As Float = 8dip";
analogclock._hourhandstrokewidth = BA.numberCast(float.class, analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 8))));__ref.setField("_hourhandstrokewidth",analogclock._hourhandstrokewidth);
//BA.debugLineNum = 17;BA.debugLine="Private minuteHandStrokeWidth As Float = 5dip";
analogclock._minutehandstrokewidth = BA.numberCast(float.class, analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 5))));__ref.setField("_minutehandstrokewidth",analogclock._minutehandstrokewidth);
//BA.debugLineNum = 18;BA.debugLine="End Sub";
return RemoteObject.createImmutable("");
}
public static RemoteObject _clearcanvas(RemoteObject __ref,RemoteObject _color) throws Exception{
try {
Debug.PushSubsStack("ClearCanvas (analogclock) ","analogclock",2,__ref.getField(false, "ba"),__ref,48);
if (RapidSub.canDelegate("clearcanvas")) { return __ref.runUserSub(false, "analogclock","clearcanvas", __ref, _color);}
Debug.locals.put("color", _color);
BA.debugLineNum = 48;BA.debugLine="Private Sub ClearCanvas(color As Int)";
Debug.ShouldStop(32768);
BA.debugLineNum = 49;BA.debugLine="cvsClock.DrawRect(cvsClock.TargetRect, color, Tru";
Debug.ShouldStop(65536);
__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runVoidMethod ("DrawRect",(Object)(__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runMethod(false,"getTargetRect")),(Object)(_color),(Object)(analogclock.__c.getField(true,"True")),(Object)(BA.numberCast(float.class, 0)));
BA.debugLineNum = 50;BA.debugLine="cvsClock.Invalidate";
Debug.ShouldStop(131072);
__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runVoidMethod ("Invalidate");
BA.debugLineNum = 51;BA.debugLine="End Sub";
Debug.ShouldStop(262144);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _drawclock(RemoteObject __ref) throws Exception{
try {
Debug.PushSubsStack("DrawClock (analogclock) ","analogclock",2,__ref.getField(false, "ba"),__ref,54);
if (RapidSub.canDelegate("drawclock")) { return __ref.runUserSub(false, "analogclock","drawclock", __ref);}
RemoteObject _interval = RemoteObject.declareNull("anywheresoftware.b4a.objects.collections.Map");
RemoteObject _now = RemoteObject.createImmutable(0L);
RemoteObject _hours = RemoteObject.createImmutable(0);
RemoteObject _minutes = RemoteObject.createImmutable(0);
RemoteObject _seconds = RemoteObject.createImmutable(0);
RemoteObject _hourangle = RemoteObject.createImmutable(0f);
RemoteObject _minuteangle = RemoteObject.createImmutable(0f);
RemoteObject _secondangle = RemoteObject.createImmutable(0f);
BA.debugLineNum = 54;BA.debugLine="Public Sub DrawClock";
Debug.ShouldStop(2097152);
BA.debugLineNum = 55;BA.debugLine="cvsClock.Initialize(pnlClock)";
Debug.ShouldStop(4194304);
__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runVoidMethod ("Initialize",RemoteObject.declareNull("anywheresoftware.b4a.AbsObjectWrapper").runMethod(false, "ConvertToWrapper", RemoteObject.createNew("anywheresoftware.b4a.objects.B4XViewWrapper"), __ref.getField(false,"_pnlclock" /*RemoteObject*/ ).getObject()));
BA.debugLineNum = 58;BA.debugLine="ClearCanvas(Colors.White)";
Debug.ShouldStop(33554432);
__ref.runClassMethod (b4a.example.analogclock.class, "_clearcanvas" /*RemoteObject*/ ,(Object)(analogclock.__c.getField(false,"Colors").getField(true,"White")));
BA.debugLineNum = 61;BA.debugLine="cvsClock.DrawCircle(centerX, centerY, clockDia";
Debug.ShouldStop(268435456);
__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runVoidMethod ("DrawCircle",(Object)(__ref.getField(true,"_centerx" /*RemoteObject*/ )),(Object)(__ref.getField(true,"_centery" /*RemoteObject*/ )),(Object)(BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(2)}, "/",0, 0))),(Object)(analogclock.__c.getField(false,"Colors").getField(true,"Black")),(Object)(analogclock.__c.getField(true,"False")),(Object)(__ref.getField(true,"_quadrantstrokewidth" /*RemoteObject*/ )));
BA.debugLineNum = 64;BA.debugLine="DrawTicks";
Debug.ShouldStop(-2147483648);
__ref.runClassMethod (b4a.example.analogclock.class, "_drawticks" /*RemoteObject*/ );
BA.debugLineNum = 67;BA.debugLine="For Each interval As Map In intervals";
Debug.ShouldStop(4);
_interval = RemoteObject.createNew ("anywheresoftware.b4a.objects.collections.Map");
{
final RemoteObject group5 = __ref.getField(false,"_intervals" /*RemoteObject*/ );
final int groupLen5 = group5.runMethod(true,"getSize").<Integer>get()
;int index5 = 0;
;
for (; index5 < groupLen5;index5++){
_interval = RemoteObject.declareNull("anywheresoftware.b4a.AbsObjectWrapper").runMethod(false, "ConvertToWrapper", RemoteObject.createNew("anywheresoftware.b4a.objects.collections.Map"), group5.runMethod(false,"Get",index5));Debug.locals.put("interval", _interval);
Debug.locals.put("interval", _interval);
BA.debugLineNum = 68;BA.debugLine="DrawInterval(interval.Get(\"startHour\"), in";
Debug.ShouldStop(8);
__ref.runClassMethod (b4a.example.analogclock.class, "_drawinterval" /*RemoteObject*/ ,(Object)(BA.numberCast(int.class, _interval.runMethod(false,"Get",(Object)((RemoteObject.createImmutable("startHour")))))),(Object)(BA.numberCast(int.class, _interval.runMethod(false,"Get",(Object)((RemoteObject.createImmutable("startMinute")))))),(Object)(BA.numberCast(int.class, _interval.runMethod(false,"Get",(Object)((RemoteObject.createImmutable("endHour")))))),(Object)(BA.numberCast(int.class, _interval.runMethod(false,"Get",(Object)((RemoteObject.createImmutable("endMinute")))))),(Object)(BA.numberCast(int.class, _interval.runMethod(false,"Get",(Object)((RemoteObject.createImmutable("color")))))),(Object)(BA.numberCast(float.class, _interval.runMethod(false,"Get",(Object)((RemoteObject.createImmutable("radius")))))),(Object)(BA.numberCast(float.class, _interval.runMethod(false,"Get",(Object)((RemoteObject.createImmutable("strokeWidth")))))));
}
}Debug.locals.put("interval", _interval);
;
BA.debugLineNum = 72;BA.debugLine="Dim now As Long = DateTime.Now";
Debug.ShouldStop(128);
_now = analogclock.__c.getField(false,"DateTime").runMethod(true,"getNow");Debug.locals.put("now", _now);Debug.locals.put("now", _now);
BA.debugLineNum = 73;BA.debugLine="Dim Hours As Int = DateTime.GetHour(now) Mod 1";
Debug.ShouldStop(256);
_hours = RemoteObject.solve(new RemoteObject[] {analogclock.__c.getField(false,"DateTime").runMethod(true,"GetHour",(Object)(_now)),RemoteObject.createImmutable(12)}, "%",0, 1);Debug.locals.put("Hours", _hours);Debug.locals.put("Hours", _hours);
BA.debugLineNum = 74;BA.debugLine="Dim Minutes As Int = DateTime.GetMinute(now)";
Debug.ShouldStop(512);
_minutes = analogclock.__c.getField(false,"DateTime").runMethod(true,"GetMinute",(Object)(_now));Debug.locals.put("Minutes", _minutes);Debug.locals.put("Minutes", _minutes);
BA.debugLineNum = 75;BA.debugLine="Dim Seconds As Int = DateTime.GetSecond(now)";
Debug.ShouldStop(1024);
_seconds = analogclock.__c.getField(false,"DateTime").runMethod(true,"GetSecond",(Object)(_now));Debug.locals.put("Seconds", _seconds);Debug.locals.put("Seconds", _seconds);
BA.debugLineNum = 78;BA.debugLine="Dim HourAngle As Float = -90 + Hours * 30 + Mi";
Debug.ShouldStop(8192);
_hourangle = BA.numberCast(float.class, -(double) (0 + 90)+(double) (0 + _hours.<Integer>get().intValue())*(double) (0 + 30)+(double) (0 + _minutes.<Integer>get().intValue())/(double)(double) (0 + 2));Debug.locals.put("HourAngle", _hourangle);Debug.locals.put("HourAngle", _hourangle);
BA.debugLineNum = 79;BA.debugLine="DrawHand(centerX, centerY, clockDiameter * 0.2";
Debug.ShouldStop(16384);
__ref.runClassMethod (b4a.example.analogclock.class, "_drawhand" /*RemoteObject*/ ,(Object)(__ref.getField(true,"_centerx" /*RemoteObject*/ )),(Object)(__ref.getField(true,"_centery" /*RemoteObject*/ )),(Object)(BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(0.25)}, "*",0, 0))),(Object)(_hourangle),(Object)(__ref.getField(true,"_hourhandstrokewidth" /*RemoteObject*/ )),(Object)(analogclock.__c.getField(false,"Colors").getField(true,"Black")));
BA.debugLineNum = 82;BA.debugLine="Dim MinuteAngle As Float = -90 + Minutes * 6";
Debug.ShouldStop(131072);
_minuteangle = BA.numberCast(float.class, -(double) (0 + 90)+(double) (0 + _minutes.<Integer>get().intValue())*(double) (0 + 6));Debug.locals.put("MinuteAngle", _minuteangle);Debug.locals.put("MinuteAngle", _minuteangle);
BA.debugLineNum = 83;BA.debugLine="DrawHand(centerX, centerY, clockDiameter * 0.4";
Debug.ShouldStop(262144);
__ref.runClassMethod (b4a.example.analogclock.class, "_drawhand" /*RemoteObject*/ ,(Object)(__ref.getField(true,"_centerx" /*RemoteObject*/ )),(Object)(__ref.getField(true,"_centery" /*RemoteObject*/ )),(Object)(BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(0.4)}, "*",0, 0))),(Object)(_minuteangle),(Object)(__ref.getField(true,"_minutehandstrokewidth" /*RemoteObject*/ )),(Object)(analogclock.__c.getField(false,"Colors").getField(true,"Blue")));
BA.debugLineNum = 86;BA.debugLine="Dim SecondAngle As Float = -90 + Seconds * 6";
Debug.ShouldStop(2097152);
_secondangle = BA.numberCast(float.class, -(double) (0 + 90)+(double) (0 + _seconds.<Integer>get().intValue())*(double) (0 + 6));Debug.locals.put("SecondAngle", _secondangle);Debug.locals.put("SecondAngle", _secondangle);
BA.debugLineNum = 87;BA.debugLine="DrawHand(centerX, centerY, clockDiameter * 0.4";
Debug.ShouldStop(4194304);
__ref.runClassMethod (b4a.example.analogclock.class, "_drawhand" /*RemoteObject*/ ,(Object)(__ref.getField(true,"_centerx" /*RemoteObject*/ )),(Object)(__ref.getField(true,"_centery" /*RemoteObject*/ )),(Object)(BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(0.45)}, "*",0, 0))),(Object)(_secondangle),(Object)(BA.numberCast(float.class, analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 2))))),(Object)(analogclock.__c.getField(false,"Colors").getField(true,"Red")));
BA.debugLineNum = 90;BA.debugLine="pnlClock.Invalidate";
Debug.ShouldStop(33554432);
__ref.getField(false,"_pnlclock" /*RemoteObject*/ ).runVoidMethod ("Invalidate");
BA.debugLineNum = 91;BA.debugLine="End Sub";
Debug.ShouldStop(67108864);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _drawhand(RemoteObject __ref,RemoteObject _x,RemoteObject _y,RemoteObject _length,RemoteObject _angle,RemoteObject _width,RemoteObject _color) throws Exception{
try {
Debug.PushSubsStack("DrawHand (analogclock) ","analogclock",2,__ref.getField(false, "ba"),__ref,94);
if (RapidSub.canDelegate("drawhand")) { return __ref.runUserSub(false, "analogclock","drawhand", __ref, _x, _y, _length, _angle, _width, _color);}
RemoteObject _endx = RemoteObject.createImmutable(0f);
RemoteObject _endy = RemoteObject.createImmutable(0f);
Debug.locals.put("x", _x);
Debug.locals.put("y", _y);
Debug.locals.put("length", _length);
Debug.locals.put("angle", _angle);
Debug.locals.put("width", _width);
Debug.locals.put("color", _color);
BA.debugLineNum = 94;BA.debugLine="Private Sub DrawHand(x As Float, y As Float, lengt";
Debug.ShouldStop(536870912);
BA.debugLineNum = 95;BA.debugLine="Dim endX As Float = x + length * CosD(angle)";
Debug.ShouldStop(1073741824);
_endx = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {_x,_length,analogclock.__c.runMethod(true,"CosD",(Object)(BA.numberCast(double.class, _angle)))}, "+*",1, 0));Debug.locals.put("endX", _endx);Debug.locals.put("endX", _endx);
BA.debugLineNum = 96;BA.debugLine="Dim endY As Float = y + length * SinD(angle)";
Debug.ShouldStop(-2147483648);
_endy = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {_y,_length,analogclock.__c.runMethod(true,"SinD",(Object)(BA.numberCast(double.class, _angle)))}, "+*",1, 0));Debug.locals.put("endY", _endy);Debug.locals.put("endY", _endy);
BA.debugLineNum = 97;BA.debugLine="cvsClock.DrawLine(x, y, endX, endY, color, wid";
Debug.ShouldStop(1);
__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runVoidMethod ("DrawLine",(Object)(_x),(Object)(_y),(Object)(_endx),(Object)(_endy),(Object)(_color),(Object)(_width));
BA.debugLineNum = 98;BA.debugLine="End Sub";
Debug.ShouldStop(2);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _drawinterval(RemoteObject __ref,RemoteObject _starthour,RemoteObject _startminute,RemoteObject _endhour,RemoteObject _endminute,RemoteObject _color,RemoteObject _radius,RemoteObject _strokewidth) throws Exception{
try {
Debug.PushSubsStack("DrawInterval (analogclock) ","analogclock",2,__ref.getField(false, "ba"),__ref,150);
if (RapidSub.canDelegate("drawinterval")) { return __ref.runUserSub(false, "analogclock","drawinterval", __ref, _starthour, _startminute, _endhour, _endminute, _color, _radius, _strokewidth);}
RemoteObject _startangle = RemoteObject.createImmutable(0f);
RemoteObject _endangle = RemoteObject.createImmutable(0f);
RemoteObject _sweepangle = RemoteObject.createImmutable(0f);
RemoteObject _path = RemoteObject.declareNull("anywheresoftware.b4a.objects.B4XCanvas.B4XPath");
Debug.locals.put("startHour", _starthour);
Debug.locals.put("startMinute", _startminute);
Debug.locals.put("endHour", _endhour);
Debug.locals.put("endMinute", _endminute);
Debug.locals.put("color", _color);
Debug.locals.put("radius", _radius);
Debug.locals.put("strokeWidth", _strokewidth);
BA.debugLineNum = 150;BA.debugLine="Private Sub DrawInterval(startHour As Int, startMi";
Debug.ShouldStop(2097152);
BA.debugLineNum = 151;BA.debugLine="Dim startAngle As Float = (startHour Mod 12 + sta";
Debug.ShouldStop(4194304);
_startangle = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {(RemoteObject.solve(new RemoteObject[] {_starthour,RemoteObject.createImmutable(12),_startminute,RemoteObject.createImmutable(60)}, "%+/",1, 0)),RemoteObject.createImmutable(30),RemoteObject.createImmutable(90)}, "*-",1, 0));Debug.locals.put("startAngle", _startangle);Debug.locals.put("startAngle", _startangle);
BA.debugLineNum = 152;BA.debugLine="Dim endAngle As Float = (endHour Mod 12 + endMinu";
Debug.ShouldStop(8388608);
_endangle = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {(RemoteObject.solve(new RemoteObject[] {_endhour,RemoteObject.createImmutable(12),_endminute,RemoteObject.createImmutable(60)}, "%+/",1, 0)),RemoteObject.createImmutable(30),RemoteObject.createImmutable(90)}, "*-",1, 0));Debug.locals.put("endAngle", _endangle);Debug.locals.put("endAngle", _endangle);
BA.debugLineNum = 153;BA.debugLine="Dim sweepAngle As Float = endAngle - startAngle";
Debug.ShouldStop(16777216);
_sweepangle = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {_endangle,_startangle}, "-",1, 0));Debug.locals.put("sweepAngle", _sweepangle);Debug.locals.put("sweepAngle", _sweepangle);
BA.debugLineNum = 154;BA.debugLine="If sweepAngle < 0 Then sweepAngle = sweepAngle +";
Debug.ShouldStop(33554432);
if (RemoteObject.solveBoolean("<",_sweepangle,BA.numberCast(double.class, 0))) {
_sweepangle = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {_sweepangle,RemoteObject.createImmutable(360)}, "+",1, 0));Debug.locals.put("sweepAngle", _sweepangle);};
BA.debugLineNum = 156;BA.debugLine="Dim path As B4XPath";
Debug.ShouldStop(134217728);
_path = RemoteObject.createNew ("anywheresoftware.b4a.objects.B4XCanvas.B4XPath");Debug.locals.put("path", _path);
BA.debugLineNum = 157;BA.debugLine="path.InitializeArc(centerX, centerY, radius, star";
Debug.ShouldStop(268435456);
_path.runVoidMethod ("InitializeArc",(Object)(__ref.getField(true,"_centerx" /*RemoteObject*/ )),(Object)(__ref.getField(true,"_centery" /*RemoteObject*/ )),(Object)(_radius),(Object)(_startangle),(Object)(_sweepangle));
BA.debugLineNum = 158;BA.debugLine="cvsClock.DrawPath(path, color, False, strokeWidth";
Debug.ShouldStop(536870912);
__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runVoidMethod ("DrawPath",(Object)(_path),(Object)(_color),(Object)(analogclock.__c.getField(true,"False")),(Object)(_strokewidth));
BA.debugLineNum = 159;BA.debugLine="End Sub";
Debug.ShouldStop(1073741824);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _drawticks(RemoteObject __ref) throws Exception{
try {
Debug.PushSubsStack("DrawTicks (analogclock) ","analogclock",2,__ref.getField(false, "ba"),__ref,100);
if (RapidSub.canDelegate("drawticks")) { return __ref.runUserSub(false, "analogclock","drawticks", __ref);}
int _i = 0;
RemoteObject _angle = RemoteObject.createImmutable(0f);
RemoteObject _startx = RemoteObject.createImmutable(0f);
RemoteObject _starty = RemoteObject.createImmutable(0f);
RemoteObject _endx = RemoteObject.createImmutable(0f);
RemoteObject _endy = RemoteObject.createImmutable(0f);
BA.debugLineNum = 100;BA.debugLine="Private Sub DrawTicks";
Debug.ShouldStop(8);
BA.debugLineNum = 101;BA.debugLine="For i = 0 To 59";
Debug.ShouldStop(16);
{
final int step1 = 1;
final int limit1 = 59;
_i = 0 ;
for (;(step1 > 0 && _i <= limit1) || (step1 < 0 && _i >= limit1) ;_i = ((int)(0 + _i + step1)) ) {
Debug.locals.put("i", _i);
BA.debugLineNum = 102;BA.debugLine="Dim angle As Float = -90 + i * 6";
Debug.ShouldStop(32);
_angle = BA.numberCast(float.class, -(double) (0 + 90)+(double) (0 + _i)*(double) (0 + 6));Debug.locals.put("angle", _angle);Debug.locals.put("angle", _angle);
BA.debugLineNum = 103;BA.debugLine="Dim startX As Float";
Debug.ShouldStop(64);
_startx = RemoteObject.createImmutable(0f);Debug.locals.put("startX", _startx);
BA.debugLineNum = 104;BA.debugLine="Dim startY As Float";
Debug.ShouldStop(128);
_starty = RemoteObject.createImmutable(0f);Debug.locals.put("startY", _starty);
BA.debugLineNum = 105;BA.debugLine="Dim endX As Float";
Debug.ShouldStop(256);
_endx = RemoteObject.createImmutable(0f);Debug.locals.put("endX", _endx);
BA.debugLineNum = 106;BA.debugLine="Dim endY As Float";
Debug.ShouldStop(512);
_endy = RemoteObject.createImmutable(0f);Debug.locals.put("endY", _endy);
BA.debugLineNum = 107;BA.debugLine="If i Mod 5 = 0 Then";
Debug.ShouldStop(1024);
if (RemoteObject.solveBoolean("=",RemoteObject.solve(new RemoteObject[] {RemoteObject.createImmutable(_i),RemoteObject.createImmutable(5)}, "%",0, 1),BA.numberCast(double.class, 0))) {
BA.debugLineNum = 109;BA.debugLine="startX = centerX + (clockDiameter / 2";
Debug.ShouldStop(4096);
_startx = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_centerx" /*RemoteObject*/ ),(RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(2),analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 20)))}, "/-",1, 0)),analogclock.__c.runMethod(true,"CosD",(Object)(BA.numberCast(double.class, _angle)))}, "+*",1, 0));Debug.locals.put("startX", _startx);
BA.debugLineNum = 110;BA.debugLine="startY = centerY + (clockDiameter / 2";
Debug.ShouldStop(8192);
_starty = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_centery" /*RemoteObject*/ ),(RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(2),analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 20)))}, "/-",1, 0)),analogclock.__c.runMethod(true,"SinD",(Object)(BA.numberCast(double.class, _angle)))}, "+*",1, 0));Debug.locals.put("startY", _starty);
BA.debugLineNum = 111;BA.debugLine="endX = centerX + (clockDiameter / 2 -";
Debug.ShouldStop(16384);
_endx = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_centerx" /*RemoteObject*/ ),(RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(2),analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 5)))}, "/-",1, 0)),analogclock.__c.runMethod(true,"CosD",(Object)(BA.numberCast(double.class, _angle)))}, "+*",1, 0));Debug.locals.put("endX", _endx);
BA.debugLineNum = 112;BA.debugLine="endY = centerY + (clockDiameter / 2 -";
Debug.ShouldStop(32768);
_endy = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_centery" /*RemoteObject*/ ),(RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(2),analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 5)))}, "/-",1, 0)),analogclock.__c.runMethod(true,"SinD",(Object)(BA.numberCast(double.class, _angle)))}, "+*",1, 0));Debug.locals.put("endY", _endy);
BA.debugLineNum = 113;BA.debugLine="cvsClock.DrawLine(startX, startY, endX";
Debug.ShouldStop(65536);
__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runVoidMethod ("DrawLine",(Object)(_startx),(Object)(_starty),(Object)(_endx),(Object)(_endy),(Object)(analogclock.__c.getField(false,"Colors").getField(true,"Black")),(Object)(__ref.getField(true,"_hourtickstrokewidth" /*RemoteObject*/ )));
}else {
BA.debugLineNum = 116;BA.debugLine="startX = centerX + (clockDiameter / 2";
Debug.ShouldStop(524288);
_startx = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_centerx" /*RemoteObject*/ ),(RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(2),analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 10)))}, "/-",1, 0)),analogclock.__c.runMethod(true,"CosD",(Object)(BA.numberCast(double.class, _angle)))}, "+*",1, 0));Debug.locals.put("startX", _startx);
BA.debugLineNum = 117;BA.debugLine="startY = centerY + (clockDiameter / 2";
Debug.ShouldStop(1048576);
_starty = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_centery" /*RemoteObject*/ ),(RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(2),analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 10)))}, "/-",1, 0)),analogclock.__c.runMethod(true,"SinD",(Object)(BA.numberCast(double.class, _angle)))}, "+*",1, 0));Debug.locals.put("startY", _starty);
BA.debugLineNum = 118;BA.debugLine="endX = centerX + (clockDiameter / 2 -";
Debug.ShouldStop(2097152);
_endx = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_centerx" /*RemoteObject*/ ),(RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(2),analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 5)))}, "/-",1, 0)),analogclock.__c.runMethod(true,"CosD",(Object)(BA.numberCast(double.class, _angle)))}, "+*",1, 0));Debug.locals.put("endX", _endx);
BA.debugLineNum = 119;BA.debugLine="endY = centerY + (clockDiameter / 2 -";
Debug.ShouldStop(4194304);
_endy = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_centery" /*RemoteObject*/ ),(RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(2),analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 5)))}, "/-",1, 0)),analogclock.__c.runMethod(true,"SinD",(Object)(BA.numberCast(double.class, _angle)))}, "+*",1, 0));Debug.locals.put("endY", _endy);
BA.debugLineNum = 120;BA.debugLine="cvsClock.DrawLine(startX, startY, endX";
Debug.ShouldStop(8388608);
__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runVoidMethod ("DrawLine",(Object)(_startx),(Object)(_starty),(Object)(_endx),(Object)(_endy),(Object)(analogclock.__c.getField(false,"Colors").getField(true,"Black")),(Object)(__ref.getField(true,"_minutetickstrokewidth" /*RemoteObject*/ )));
};
}
}Debug.locals.put("i", _i);
;
BA.debugLineNum = 123;BA.debugLine="End Sub";
Debug.ShouldStop(67108864);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _initialize(RemoteObject __ref,RemoteObject _ba,RemoteObject _parentpanel,RemoteObject _percentageofwidth) throws Exception{
try {
Debug.PushSubsStack("Initialize (analogclock) ","analogclock",2,__ref.getField(false, "ba"),__ref,21);
if (RapidSub.canDelegate("initialize")) { return __ref.runUserSub(false, "analogclock","initialize", __ref, _ba, _parentpanel, _percentageofwidth);}
__ref.runVoidMethodAndSync("innerInitializeHelper", _ba);
Debug.locals.put("ba", _ba);
Debug.locals.put("ParentPanel", _parentpanel);
Debug.locals.put("PercentageOfWidth", _percentageofwidth);
BA.debugLineNum = 21;BA.debugLine="Public Sub Initialize(ParentPanel As Panel, Percen";
Debug.ShouldStop(1048576);
BA.debugLineNum = 22;BA.debugLine="pnlClock = ParentPanel";
Debug.ShouldStop(2097152);
__ref.setField ("_pnlclock" /*RemoteObject*/ ,_parentpanel);
BA.debugLineNum = 23;BA.debugLine="cvsClock.Initialize(pnlClock)";
Debug.ShouldStop(4194304);
__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runVoidMethod ("Initialize",RemoteObject.declareNull("anywheresoftware.b4a.AbsObjectWrapper").runMethod(false, "ConvertToWrapper", RemoteObject.createNew("anywheresoftware.b4a.objects.B4XViewWrapper"), __ref.getField(false,"_pnlclock" /*RemoteObject*/ ).getObject()));
BA.debugLineNum = 24;BA.debugLine="intervals.Initialize";
Debug.ShouldStop(8388608);
__ref.getField(false,"_intervals" /*RemoteObject*/ ).runVoidMethod ("Initialize");
BA.debugLineNum = 25;BA.debugLine="SetClockSize(PercentageOfWidth)";
Debug.ShouldStop(16777216);
__ref.runClassMethod (b4a.example.analogclock.class, "_setclocksize" /*RemoteObject*/ ,(Object)(_percentageofwidth));
BA.debugLineNum = 26;BA.debugLine="End Sub";
Debug.ShouldStop(33554432);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _setclocksize(RemoteObject __ref,RemoteObject _percentageofwidth) throws Exception{
try {
Debug.PushSubsStack("SetClockSize (analogclock) ","analogclock",2,__ref.getField(false, "ba"),__ref,29);
if (RapidSub.canDelegate("setclocksize")) { return __ref.runUserSub(false, "analogclock","setclocksize", __ref, _percentageofwidth);}
Debug.locals.put("PercentageOfWidth", _percentageofwidth);
BA.debugLineNum = 29;BA.debugLine="Public Sub SetClockSize(PercentageOfWidth As Float";
Debug.ShouldStop(268435456);
BA.debugLineNum = 30;BA.debugLine="clockDiameter = pnlClock.Width * PercentageOfW";
Debug.ShouldStop(536870912);
__ref.setField ("_clockdiameter" /*RemoteObject*/ ,BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(false,"_pnlclock" /*RemoteObject*/ ).runMethod(true,"getWidth"),_percentageofwidth,RemoteObject.createImmutable(100)}, "*/",0, 0)));
BA.debugLineNum = 31;BA.debugLine="centerX = pnlClock.Width / 2";
Debug.ShouldStop(1073741824);
__ref.setField ("_centerx" /*RemoteObject*/ ,BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(false,"_pnlclock" /*RemoteObject*/ ).runMethod(true,"getWidth"),RemoteObject.createImmutable(2)}, "/",0, 0)));
BA.debugLineNum = 32;BA.debugLine="centerY = pnlClock.Height / 2";
Debug.ShouldStop(-2147483648);
__ref.setField ("_centery" /*RemoteObject*/ ,BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {__ref.getField(false,"_pnlclock" /*RemoteObject*/ ).runMethod(true,"getHeight"),RemoteObject.createImmutable(2)}, "/",0, 0)));
BA.debugLineNum = 33;BA.debugLine="DrawClock";
Debug.ShouldStop(1);
__ref.runClassMethod (b4a.example.analogclock.class, "_drawclock" /*RemoteObject*/ );
BA.debugLineNum = 34;BA.debugLine="End Sub";
Debug.ShouldStop(2);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _setstrokewidths(RemoteObject __ref,RemoteObject _quadrantwidth,RemoteObject _hourtickwidth,RemoteObject _minutetickwidth,RemoteObject _intervalarcwidth,RemoteObject _hourhandwidth,RemoteObject _minutehandwidth) throws Exception{
try {
Debug.PushSubsStack("SetStrokeWidths (analogclock) ","analogclock",2,__ref.getField(false, "ba"),__ref,37);
if (RapidSub.canDelegate("setstrokewidths")) { return __ref.runUserSub(false, "analogclock","setstrokewidths", __ref, _quadrantwidth, _hourtickwidth, _minutetickwidth, _intervalarcwidth, _hourhandwidth, _minutehandwidth);}
Debug.locals.put("quadrantWidth", _quadrantwidth);
Debug.locals.put("hourTickWidth", _hourtickwidth);
Debug.locals.put("minuteTickWidth", _minutetickwidth);
Debug.locals.put("intervalArcWidth", _intervalarcwidth);
Debug.locals.put("hourHandWidth", _hourhandwidth);
Debug.locals.put("minuteHandWidth", _minutehandwidth);
BA.debugLineNum = 37;BA.debugLine="Public Sub SetStrokeWidths(quadrantWidth As Float,";
Debug.ShouldStop(16);
BA.debugLineNum = 38;BA.debugLine="quadrantStrokeWidth = quadrantWidth";
Debug.ShouldStop(32);
__ref.setField ("_quadrantstrokewidth" /*RemoteObject*/ ,_quadrantwidth);
BA.debugLineNum = 39;BA.debugLine="hourTickStrokeWidth = hourTickWidth";
Debug.ShouldStop(64);
__ref.setField ("_hourtickstrokewidth" /*RemoteObject*/ ,_hourtickwidth);
BA.debugLineNum = 40;BA.debugLine="minuteTickStrokeWidth = minuteTickWidth";
Debug.ShouldStop(128);
__ref.setField ("_minutetickstrokewidth" /*RemoteObject*/ ,_minutetickwidth);
BA.debugLineNum = 41;BA.debugLine="intervalArcStrokeWidth = intervalArcWidth";
Debug.ShouldStop(256);
__ref.setField ("_intervalarcstrokewidth" /*RemoteObject*/ ,_intervalarcwidth);
BA.debugLineNum = 42;BA.debugLine="hourHandStrokeWidth = hourHandWidth";
Debug.ShouldStop(512);
__ref.setField ("_hourhandstrokewidth" /*RemoteObject*/ ,_hourhandwidth);
BA.debugLineNum = 43;BA.debugLine="minuteHandStrokeWidth = minuteHandWidth";
Debug.ShouldStop(1024);
__ref.setField ("_minutehandstrokewidth" /*RemoteObject*/ ,_minutehandwidth);
BA.debugLineNum = 44;BA.debugLine="DrawClock";
Debug.ShouldStop(2048);
__ref.runClassMethod (b4a.example.analogclock.class, "_drawclock" /*RemoteObject*/ );
BA.debugLineNum = 45;BA.debugLine="End Sub";
Debug.ShouldStop(4096);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _startclock(RemoteObject __ref) throws Exception{
try {
Debug.PushSubsStack("StartClock (analogclock) ","analogclock",2,__ref.getField(false, "ba"),__ref,163);
if (RapidSub.canDelegate("startclock")) { return __ref.runUserSub(false, "analogclock","startclock", __ref);}
RemoteObject _timer = RemoteObject.declareNull("anywheresoftware.b4a.objects.Timer");
BA.debugLineNum = 163;BA.debugLine="Public Sub StartClock";
Debug.ShouldStop(4);
BA.debugLineNum = 164;BA.debugLine="Dim timer As Timer";
Debug.ShouldStop(8);
_timer = RemoteObject.createNew ("anywheresoftware.b4a.objects.Timer");Debug.locals.put("timer", _timer);
BA.debugLineNum = 165;BA.debugLine="timer.Initialize(\"timer\", 1000)";
Debug.ShouldStop(16);
_timer.runVoidMethod ("Initialize",__ref.getField(false, "ba"),(Object)(BA.ObjectToString("timer")),(Object)(BA.numberCast(long.class, 1000)));
BA.debugLineNum = 166;BA.debugLine="timer.Enabled = True";
Debug.ShouldStop(32);
_timer.runMethod(true,"setEnabled",analogclock.__c.getField(true,"True"));
BA.debugLineNum = 167;BA.debugLine="End Sub";
Debug.ShouldStop(64);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _timer_tick(RemoteObject __ref) throws Exception{
try {
Debug.PushSubsStack("timer_Tick (analogclock) ","analogclock",2,__ref.getField(false, "ba"),__ref,170);
if (RapidSub.canDelegate("timer_tick")) { return __ref.runUserSub(false, "analogclock","timer_tick", __ref);}
BA.debugLineNum = 170;BA.debugLine="Private Sub timer_Tick";
Debug.ShouldStop(512);
BA.debugLineNum = 171;BA.debugLine="DrawClock";
Debug.ShouldStop(1024);
__ref.runClassMethod (b4a.example.analogclock.class, "_drawclock" /*RemoteObject*/ );
BA.debugLineNum = 172;BA.debugLine="End Sub";
Debug.ShouldStop(2048);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
}

View File

@@ -0,0 +1,75 @@
package b4a.example;
import java.io.IOException;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.pc.PCBA;
import anywheresoftware.b4a.pc.RDebug;
import anywheresoftware.b4a.pc.RemoteObject;
import anywheresoftware.b4a.pc.RDebug.IRemote;
import anywheresoftware.b4a.pc.Debug;
import anywheresoftware.b4a.pc.B4XTypes.B4XClass;
import anywheresoftware.b4a.pc.B4XTypes.DeviceClass;
public class main implements IRemote{
public static main mostCurrent;
public static RemoteObject processBA;
public static boolean processGlobalsRun;
public static RemoteObject myClass;
public static RemoteObject remoteMe;
public main() {
mostCurrent = this;
}
public RemoteObject getRemoteMe() {
return remoteMe;
}
public static void main (String[] args) throws Exception {
new RDebug(args[0], Integer.parseInt(args[1]), Integer.parseInt(args[2]), args[3]);
RDebug.INSTANCE.waitForTask();
}
static {
anywheresoftware.b4a.pc.RapidSub.moduleToObject.put(new B4XClass("main"), "b4a.example.main");
}
public boolean isSingleton() {
return true;
}
public static RemoteObject getObject() {
return myClass;
}
public RemoteObject activityBA;
public RemoteObject _activity;
private PCBA pcBA;
public PCBA create(Object[] args) throws ClassNotFoundException{
processBA = (RemoteObject) args[1];
activityBA = (RemoteObject) args[2];
_activity = (RemoteObject) args[3];
anywheresoftware.b4a.keywords.Common.Density = (Float)args[4];
remoteMe = (RemoteObject) args[5];
pcBA = new PCBA(this, main.class);
main_subs_0.initializeProcessGlobals();
return pcBA;
}
public static RemoteObject __c = RemoteObject.declareNull("anywheresoftware.b4a.keywords.Common");
public static RemoteObject _timer1 = RemoteObject.declareNull("anywheresoftware.b4a.objects.Timer");
public static RemoteObject _running = RemoteObject.createImmutable(false);
public static RemoteObject _starttime = RemoteObject.createImmutable(0L);
public static RemoteObject _elapsedtime = RemoteObject.createImmutable(0L);
public static RemoteObject _canvas1 = RemoteObject.declareNull("anywheresoftware.b4a.objects.drawable.CanvasWrapper");
public static RemoteObject _panel1 = RemoteObject.declareNull("anywheresoftware.b4a.objects.PanelWrapper");
public static RemoteObject _btnstart = RemoteObject.declareNull("anywheresoftware.b4a.objects.ButtonWrapper");
public static RemoteObject _btnpause = RemoteObject.declareNull("anywheresoftware.b4a.objects.ButtonWrapper");
public static RemoteObject _btnreset = RemoteObject.declareNull("anywheresoftware.b4a.objects.ButtonWrapper");
public static RemoteObject _btnsync = RemoteObject.declareNull("anywheresoftware.b4a.objects.ButtonWrapper");
public static RemoteObject _lblelapsedtime = RemoteObject.declareNull("anywheresoftware.b4a.objects.LabelWrapper");
public static RemoteObject _pnlclock = RemoteObject.declareNull("anywheresoftware.b4a.objects.PanelWrapper");
public static RemoteObject _myclock = RemoteObject.declareNull("b4a.example.analogclock");
public static b4a.example.starter _starter = null;
public Object[] GetGlobals() {
return new Object[] {"Activity",main.mostCurrent._activity,"BtnPause",main.mostCurrent._btnpause,"BtnReset",main.mostCurrent._btnreset,"BtnStart",main.mostCurrent._btnstart,"BtnSync",main.mostCurrent._btnsync,"Canvas1",main.mostCurrent._canvas1,"ElapsedTime",main._elapsedtime,"lblElapsedTime",main.mostCurrent._lblelapsedtime,"myClock",main.mostCurrent._myclock,"Panel1",main.mostCurrent._panel1,"pnlClock",main.mostCurrent._pnlclock,"Running",main._running,"Starter",Debug.moduleToString(b4a.example.starter.class),"StartTime",main._starttime,"Timer1",main._timer1};
}
}

View File

@@ -0,0 +1,408 @@
package b4a.example;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.pc.*;
public class main_subs_0 {
public static RemoteObject _activity_create(RemoteObject _firsttime) throws Exception{
try {
Debug.PushSubsStack("Activity_Create (main) ","main",0,main.mostCurrent.activityBA,main.mostCurrent,48);
if (RapidSub.canDelegate("activity_create")) { return b4a.example.main.remoteMe.runUserSub(false, "main","activity_create", _firsttime);}
Debug.locals.put("FirstTime", _firsttime);
BA.debugLineNum = 48;BA.debugLine="Sub Activity_Create(FirstTime As Boolean)";
Debug.ShouldStop(32768);
BA.debugLineNum = 49;BA.debugLine="Activity.LoadLayout(\"Main_Layout\")";
Debug.ShouldStop(65536);
main.mostCurrent._activity.runMethodAndSync(false,"LoadLayout",(Object)(RemoteObject.createImmutable("Main_Layout")),main.mostCurrent.activityBA);
BA.debugLineNum = 50;BA.debugLine="Log(\"Layout caricato correttamente.\")";
Debug.ShouldStop(131072);
main.mostCurrent.__c.runVoidMethod ("LogImpl","3131074",RemoteObject.createImmutable("Layout caricato correttamente."),0);
BA.debugLineNum = 53;BA.debugLine="myClock.Initialize(pnlClock, 50) ' L'orologio avr";
Debug.ShouldStop(1048576);
main.mostCurrent._myclock.runClassMethod (b4a.example.analogclock.class, "_initialize" /*RemoteObject*/ ,main.mostCurrent.activityBA,(Object)(main.mostCurrent._pnlclock),(Object)(BA.numberCast(float.class, 50)));
BA.debugLineNum = 56;BA.debugLine="Timer1.Initialize(\"Timer1\", 1000) ' Aggiornamento";
Debug.ShouldStop(8388608);
main._timer1.runVoidMethod ("Initialize",main.processBA,(Object)(BA.ObjectToString("Timer1")),(Object)(BA.numberCast(long.class, 1000)));
BA.debugLineNum = 57;BA.debugLine="Timer1.Enabled = True";
Debug.ShouldStop(16777216);
main._timer1.runMethod(true,"setEnabled",main.mostCurrent.__c.getField(true,"True"));
BA.debugLineNum = 73;BA.debugLine="End Sub";
Debug.ShouldStop(256);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _activity_pause(RemoteObject _userclosed) throws Exception{
try {
Debug.PushSubsStack("Activity_Pause (main) ","main",0,main.mostCurrent.activityBA,main.mostCurrent,86);
if (RapidSub.canDelegate("activity_pause")) { return b4a.example.main.remoteMe.runUserSub(false, "main","activity_pause", _userclosed);}
Debug.locals.put("UserClosed", _userclosed);
BA.debugLineNum = 86;BA.debugLine="Sub Activity_Pause (UserClosed As Boolean)";
Debug.ShouldStop(2097152);
BA.debugLineNum = 88;BA.debugLine="End Sub";
Debug.ShouldStop(8388608);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _activity_resume() throws Exception{
try {
Debug.PushSubsStack("Activity_Resume (main) ","main",0,main.mostCurrent.activityBA,main.mostCurrent,82);
if (RapidSub.canDelegate("activity_resume")) { return b4a.example.main.remoteMe.runUserSub(false, "main","activity_resume");}
BA.debugLineNum = 82;BA.debugLine="Sub Activity_Resume";
Debug.ShouldStop(131072);
BA.debugLineNum = 84;BA.debugLine="End Sub";
Debug.ShouldStop(524288);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _btnpause_click() throws Exception{
try {
Debug.PushSubsStack("BtnPause_Click (main) ","main",0,main.mostCurrent.activityBA,main.mostCurrent,169);
if (RapidSub.canDelegate("btnpause_click")) { return b4a.example.main.remoteMe.runUserSub(false, "main","btnpause_click");}
BA.debugLineNum = 169;BA.debugLine="Sub BtnPause_Click";
Debug.ShouldStop(256);
BA.debugLineNum = 170;BA.debugLine="Running = False";
Debug.ShouldStop(512);
main._running = main.mostCurrent.__c.getField(true,"False");
BA.debugLineNum = 171;BA.debugLine="End Sub";
Debug.ShouldStop(1024);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _btnreset_click() throws Exception{
try {
Debug.PushSubsStack("BtnReset_Click (main) ","main",0,main.mostCurrent.activityBA,main.mostCurrent,174);
if (RapidSub.canDelegate("btnreset_click")) { return b4a.example.main.remoteMe.runUserSub(false, "main","btnreset_click");}
BA.debugLineNum = 174;BA.debugLine="Sub BtnReset_Click";
Debug.ShouldStop(8192);
BA.debugLineNum = 175;BA.debugLine="Running = False";
Debug.ShouldStop(16384);
main._running = main.mostCurrent.__c.getField(true,"False");
BA.debugLineNum = 176;BA.debugLine="ElapsedTime = 0";
Debug.ShouldStop(32768);
main._elapsedtime = BA.numberCast(long.class, 0);
BA.debugLineNum = 177;BA.debugLine="lblElapsedTime.Text = \"Tempo: 00:00:00\"";
Debug.ShouldStop(65536);
main.mostCurrent._lblelapsedtime.runMethod(true,"setText",BA.ObjectToCharSequence("Tempo: 00:00:00"));
BA.debugLineNum = 178;BA.debugLine="End Sub";
Debug.ShouldStop(131072);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _btnstart_click() throws Exception{
try {
Debug.PushSubsStack("BtnStart_Click (main) ","main",0,main.mostCurrent.activityBA,main.mostCurrent,157);
if (RapidSub.canDelegate("btnstart_click")) { return b4a.example.main.remoteMe.runUserSub(false, "main","btnstart_click");}
BA.debugLineNum = 157;BA.debugLine="Sub BtnStart_Click";
Debug.ShouldStop(268435456);
BA.debugLineNum = 158;BA.debugLine="If Not(Running) Then";
Debug.ShouldStop(536870912);
if (main.mostCurrent.__c.runMethod(true,"Not",(Object)(main._running)).<Boolean>get().booleanValue()) {
BA.debugLineNum = 159;BA.debugLine="Running = True";
Debug.ShouldStop(1073741824);
main._running = main.mostCurrent.__c.getField(true,"True");
BA.debugLineNum = 161;BA.debugLine="Timer1.Initialize(\"Timer1\",1000)";
Debug.ShouldStop(1);
main._timer1.runVoidMethod ("Initialize",main.processBA,(Object)(BA.ObjectToString("Timer1")),(Object)(BA.numberCast(long.class, 1000)));
BA.debugLineNum = 163;BA.debugLine="Timer1.Enabled = True";
Debug.ShouldStop(4);
main._timer1.runMethod(true,"setEnabled",main.mostCurrent.__c.getField(true,"True"));
BA.debugLineNum = 164;BA.debugLine="StartTime = DateTime.Now - ElapsedTime";
Debug.ShouldStop(8);
main._starttime = RemoteObject.solve(new RemoteObject[] {main.mostCurrent.__c.getField(false,"DateTime").runMethod(true,"getNow"),main._elapsedtime}, "-",1, 2);
};
BA.debugLineNum = 166;BA.debugLine="End Sub";
Debug.ShouldStop(32);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _btnsync_click() throws Exception{
try {
Debug.PushSubsStack("BtnSync_Click (main) ","main",0,main.mostCurrent.activityBA,main.mostCurrent,181);
if (RapidSub.canDelegate("btnsync_click")) { return b4a.example.main.remoteMe.runUserSub(false, "main","btnsync_click");}
BA.debugLineNum = 181;BA.debugLine="Sub BtnSync_Click";
Debug.ShouldStop(1048576);
BA.debugLineNum = 182;BA.debugLine="SynchronizeClock";
Debug.ShouldStop(2097152);
_synchronizeclock();
BA.debugLineNum = 183;BA.debugLine="End Sub";
Debug.ShouldStop(4194304);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _drawclock() throws Exception{
try {
Debug.PushSubsStack("DrawClock (main) ","main",0,main.mostCurrent.activityBA,main.mostCurrent,91);
if (RapidSub.canDelegate("drawclock")) { return b4a.example.main.remoteMe.runUserSub(false, "main","drawclock");}
RemoteObject _now = RemoteObject.createImmutable(0L);
RemoteObject _hours = RemoteObject.createImmutable(0);
RemoteObject _minutes = RemoteObject.createImmutable(0);
RemoteObject _seconds = RemoteObject.createImmutable(0);
RemoteObject _x = RemoteObject.createImmutable(0);
RemoteObject _y = RemoteObject.createImmutable(0);
RemoteObject _radius = RemoteObject.createImmutable(0);
RemoteObject _hourangle = RemoteObject.createImmutable(0f);
RemoteObject _minuteangle = RemoteObject.createImmutable(0f);
RemoteObject _secondangle = RemoteObject.createImmutable(0f);
BA.debugLineNum = 91;BA.debugLine="Sub DrawClock";
Debug.ShouldStop(67108864);
BA.debugLineNum = 92;BA.debugLine="Canvas1.Initialize(Activity)";
Debug.ShouldStop(134217728);
main.mostCurrent._canvas1.runVoidMethod ("Initialize",(Object)((main.mostCurrent._activity.getObject())));
BA.debugLineNum = 93;BA.debugLine="Dim now As Long = DateTime.Now";
Debug.ShouldStop(268435456);
_now = main.mostCurrent.__c.getField(false,"DateTime").runMethod(true,"getNow");Debug.locals.put("now", _now);Debug.locals.put("now", _now);
BA.debugLineNum = 94;BA.debugLine="Dim Hours As Int = DateTime.GetHour(now) Mod 1";
Debug.ShouldStop(536870912);
_hours = RemoteObject.solve(new RemoteObject[] {main.mostCurrent.__c.getField(false,"DateTime").runMethod(true,"GetHour",(Object)(_now)),RemoteObject.createImmutable(12)}, "%",0, 1);Debug.locals.put("Hours", _hours);Debug.locals.put("Hours", _hours);
BA.debugLineNum = 95;BA.debugLine="Dim Minutes As Int = DateTime.GetMinute(now)";
Debug.ShouldStop(1073741824);
_minutes = main.mostCurrent.__c.getField(false,"DateTime").runMethod(true,"GetMinute",(Object)(_now));Debug.locals.put("Minutes", _minutes);Debug.locals.put("Minutes", _minutes);
BA.debugLineNum = 96;BA.debugLine="Dim Seconds As Int = DateTime.GetSecond(now)";
Debug.ShouldStop(-2147483648);
_seconds = main.mostCurrent.__c.getField(false,"DateTime").runMethod(true,"GetSecond",(Object)(_now));Debug.locals.put("Seconds", _seconds);Debug.locals.put("Seconds", _seconds);
BA.debugLineNum = 99;BA.debugLine="Dim x As Int = Activity.Width / 2";
Debug.ShouldStop(4);
_x = BA.numberCast(int.class, RemoteObject.solve(new RemoteObject[] {main.mostCurrent._activity.runMethod(true,"getWidth"),RemoteObject.createImmutable(2)}, "/",0, 0));Debug.locals.put("x", _x);Debug.locals.put("x", _x);
BA.debugLineNum = 100;BA.debugLine="Dim y As Int = Activity.Height / 2";
Debug.ShouldStop(8);
_y = BA.numberCast(int.class, RemoteObject.solve(new RemoteObject[] {main.mostCurrent._activity.runMethod(true,"getHeight"),RemoteObject.createImmutable(2)}, "/",0, 0));Debug.locals.put("y", _y);Debug.locals.put("y", _y);
BA.debugLineNum = 101;BA.debugLine="Dim Radius As Int = Min(x, y) - 10";
Debug.ShouldStop(16);
_radius = BA.numberCast(int.class, RemoteObject.solve(new RemoteObject[] {main.mostCurrent.__c.runMethod(true,"Min",(Object)(BA.numberCast(double.class, _x)),(Object)(BA.numberCast(double.class, _y))),RemoteObject.createImmutable(10)}, "-",1, 0));Debug.locals.put("Radius", _radius);Debug.locals.put("Radius", _radius);
BA.debugLineNum = 104;BA.debugLine="Canvas1.DrawColor(Colors.White)";
Debug.ShouldStop(128);
main.mostCurrent._canvas1.runVoidMethod ("DrawColor",(Object)(main.mostCurrent.__c.getField(false,"Colors").getField(true,"White")));
BA.debugLineNum = 107;BA.debugLine="Canvas1.DrawCircle(x, y, Radius, Colors.Black,";
Debug.ShouldStop(1024);
main.mostCurrent._canvas1.runVoidMethod ("DrawCircle",(Object)(BA.numberCast(float.class, _x)),(Object)(BA.numberCast(float.class, _y)),(Object)(BA.numberCast(float.class, _radius)),(Object)(main.mostCurrent.__c.getField(false,"Colors").getField(true,"Black")),(Object)(main.mostCurrent.__c.getField(true,"False")),(Object)(BA.numberCast(float.class, 5)));
BA.debugLineNum = 110;BA.debugLine="Dim HourAngle As Float = -90 + Hours * 30 + Mi";
Debug.ShouldStop(8192);
_hourangle = BA.numberCast(float.class, -(double) (0 + 90)+(double) (0 + _hours.<Integer>get().intValue())*(double) (0 + 30)+(double) (0 + _minutes.<Integer>get().intValue())/(double)(double) (0 + 2));Debug.locals.put("HourAngle", _hourangle);Debug.locals.put("HourAngle", _hourangle);
BA.debugLineNum = 111;BA.debugLine="DrawHand(x, y, Radius * 0.5, HourAngle, 8, Col";
Debug.ShouldStop(16384);
_drawhand(_x,_y,BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {_radius,RemoteObject.createImmutable(0.5)}, "*",0, 0)),_hourangle,BA.numberCast(int.class, 8),main.mostCurrent.__c.getField(false,"Colors").getField(true,"Black"));
BA.debugLineNum = 114;BA.debugLine="Dim MinuteAngle As Float = -90 + Minutes * 6";
Debug.ShouldStop(131072);
_minuteangle = BA.numberCast(float.class, -(double) (0 + 90)+(double) (0 + _minutes.<Integer>get().intValue())*(double) (0 + 6));Debug.locals.put("MinuteAngle", _minuteangle);Debug.locals.put("MinuteAngle", _minuteangle);
BA.debugLineNum = 115;BA.debugLine="DrawHand(x, y, Radius * 0.7, MinuteAngle, 5, C";
Debug.ShouldStop(262144);
_drawhand(_x,_y,BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {_radius,RemoteObject.createImmutable(0.7)}, "*",0, 0)),_minuteangle,BA.numberCast(int.class, 5),main.mostCurrent.__c.getField(false,"Colors").getField(true,"Blue"));
BA.debugLineNum = 118;BA.debugLine="Dim SecondAngle As Float = -90 + Seconds * 6";
Debug.ShouldStop(2097152);
_secondangle = BA.numberCast(float.class, -(double) (0 + 90)+(double) (0 + _seconds.<Integer>get().intValue())*(double) (0 + 6));Debug.locals.put("SecondAngle", _secondangle);Debug.locals.put("SecondAngle", _secondangle);
BA.debugLineNum = 119;BA.debugLine="DrawHand(x, y, Radius * 0.9, SecondAngle, 2, C";
Debug.ShouldStop(4194304);
_drawhand(_x,_y,BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {_radius,RemoteObject.createImmutable(0.9)}, "*",0, 0)),_secondangle,BA.numberCast(int.class, 2),main.mostCurrent.__c.getField(false,"Colors").getField(true,"Red"));
BA.debugLineNum = 120;BA.debugLine="End Sub";
Debug.ShouldStop(8388608);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _drawhand(RemoteObject _x,RemoteObject _y,RemoteObject _length,RemoteObject _angle,RemoteObject _width,RemoteObject _color) throws Exception{
try {
Debug.PushSubsStack("DrawHand (main) ","main",0,main.mostCurrent.activityBA,main.mostCurrent,122);
if (RapidSub.canDelegate("drawhand")) { return b4a.example.main.remoteMe.runUserSub(false, "main","drawhand", _x, _y, _length, _angle, _width, _color);}
RemoteObject _endx = RemoteObject.createImmutable(0f);
RemoteObject _endy = RemoteObject.createImmutable(0f);
Debug.locals.put("x", _x);
Debug.locals.put("y", _y);
Debug.locals.put("length", _length);
Debug.locals.put("angle", _angle);
Debug.locals.put("width", _width);
Debug.locals.put("color", _color);
BA.debugLineNum = 122;BA.debugLine="Sub DrawHand(x As Int, y As Int, length As Float,";
Debug.ShouldStop(33554432);
BA.debugLineNum = 123;BA.debugLine="Dim endX As Float = x + length * CosD(angle)";
Debug.ShouldStop(67108864);
_endx = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {_x,_length,main.mostCurrent.__c.runMethod(true,"CosD",(Object)(BA.numberCast(double.class, _angle)))}, "+*",1, 0));Debug.locals.put("endX", _endx);Debug.locals.put("endX", _endx);
BA.debugLineNum = 124;BA.debugLine="Dim endY As Float = y + length * SinD(angle)";
Debug.ShouldStop(134217728);
_endy = BA.numberCast(float.class, RemoteObject.solve(new RemoteObject[] {_y,_length,main.mostCurrent.__c.runMethod(true,"SinD",(Object)(BA.numberCast(double.class, _angle)))}, "+*",1, 0));Debug.locals.put("endY", _endy);Debug.locals.put("endY", _endy);
BA.debugLineNum = 125;BA.debugLine="Canvas1.DrawLine(x, y, endX, endY, color, widt";
Debug.ShouldStop(268435456);
main.mostCurrent._canvas1.runVoidMethod ("DrawLine",(Object)(BA.numberCast(float.class, _x)),(Object)(BA.numberCast(float.class, _y)),(Object)(_endx),(Object)(_endy),(Object)(_color),(Object)(BA.numberCast(float.class, _width)));
BA.debugLineNum = 126;BA.debugLine="End Sub";
Debug.ShouldStop(536870912);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _formatelapsedtime(RemoteObject _ms) throws Exception{
try {
Debug.PushSubsStack("FormatElapsedTime (main) ","main",0,main.mostCurrent.activityBA,main.mostCurrent,147);
if (RapidSub.canDelegate("formatelapsedtime")) { return b4a.example.main.remoteMe.runUserSub(false, "main","formatelapsedtime", _ms);}
RemoteObject _seconds = RemoteObject.createImmutable(0);
RemoteObject _minutes = RemoteObject.createImmutable(0);
RemoteObject _hours = RemoteObject.createImmutable(0);
Debug.locals.put("ms", _ms);
BA.debugLineNum = 147;BA.debugLine="Sub FormatElapsedTime(ms As Long) As String";
Debug.ShouldStop(262144);
BA.debugLineNum = 148;BA.debugLine="Dim seconds As Int = ms / 1000";
Debug.ShouldStop(524288);
_seconds = BA.numberCast(int.class, RemoteObject.solve(new RemoteObject[] {_ms,RemoteObject.createImmutable(1000)}, "/",0, 0));Debug.locals.put("seconds", _seconds);Debug.locals.put("seconds", _seconds);
BA.debugLineNum = 149;BA.debugLine="Dim minutes As Int = seconds / 60";
Debug.ShouldStop(1048576);
_minutes = BA.numberCast(int.class, RemoteObject.solve(new RemoteObject[] {_seconds,RemoteObject.createImmutable(60)}, "/",0, 0));Debug.locals.put("minutes", _minutes);Debug.locals.put("minutes", _minutes);
BA.debugLineNum = 150;BA.debugLine="Dim hours As Int = minutes / 60";
Debug.ShouldStop(2097152);
_hours = BA.numberCast(int.class, RemoteObject.solve(new RemoteObject[] {_minutes,RemoteObject.createImmutable(60)}, "/",0, 0));Debug.locals.put("hours", _hours);Debug.locals.put("hours", _hours);
BA.debugLineNum = 151;BA.debugLine="seconds = seconds Mod 60";
Debug.ShouldStop(4194304);
_seconds = RemoteObject.solve(new RemoteObject[] {_seconds,RemoteObject.createImmutable(60)}, "%",0, 1);Debug.locals.put("seconds", _seconds);
BA.debugLineNum = 152;BA.debugLine="minutes = minutes Mod 60";
Debug.ShouldStop(8388608);
_minutes = RemoteObject.solve(new RemoteObject[] {_minutes,RemoteObject.createImmutable(60)}, "%",0, 1);Debug.locals.put("minutes", _minutes);
BA.debugLineNum = 153;BA.debugLine="Return NumberFormat(hours, 2, 0) & \":\" & Numbe";
Debug.ShouldStop(16777216);
if (true) return RemoteObject.concat(main.mostCurrent.__c.runMethod(true,"NumberFormat",(Object)(BA.numberCast(double.class, _hours)),(Object)(BA.numberCast(int.class, 2)),(Object)(BA.numberCast(int.class, 0))),RemoteObject.createImmutable(":"),main.mostCurrent.__c.runMethod(true,"NumberFormat",(Object)(BA.numberCast(double.class, _minutes)),(Object)(BA.numberCast(int.class, 2)),(Object)(BA.numberCast(int.class, 0))),RemoteObject.createImmutable(":"),main.mostCurrent.__c.runMethod(true,"NumberFormat",(Object)(BA.numberCast(double.class, _seconds)),(Object)(BA.numberCast(int.class, 2)),(Object)(BA.numberCast(int.class, 0))));
BA.debugLineNum = 154;BA.debugLine="End Sub";
Debug.ShouldStop(33554432);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _globals() throws Exception{
//BA.debugLineNum = 21;BA.debugLine="Sub Globals";
//BA.debugLineNum = 22;BA.debugLine="Private Canvas1 As Canvas";
main.mostCurrent._canvas1 = RemoteObject.createNew ("anywheresoftware.b4a.objects.drawable.CanvasWrapper");
//BA.debugLineNum = 23;BA.debugLine="Private Panel1 As Panel";
main.mostCurrent._panel1 = RemoteObject.createNew ("anywheresoftware.b4a.objects.PanelWrapper");
//BA.debugLineNum = 24;BA.debugLine="Private BtnStart As Button";
main.mostCurrent._btnstart = RemoteObject.createNew ("anywheresoftware.b4a.objects.ButtonWrapper");
//BA.debugLineNum = 25;BA.debugLine="Private BtnPause As Button";
main.mostCurrent._btnpause = RemoteObject.createNew ("anywheresoftware.b4a.objects.ButtonWrapper");
//BA.debugLineNum = 26;BA.debugLine="Private BtnReset As Button";
main.mostCurrent._btnreset = RemoteObject.createNew ("anywheresoftware.b4a.objects.ButtonWrapper");
//BA.debugLineNum = 27;BA.debugLine="Private BtnSync As Button";
main.mostCurrent._btnsync = RemoteObject.createNew ("anywheresoftware.b4a.objects.ButtonWrapper");
//BA.debugLineNum = 29;BA.debugLine="Private lblElapsedTime As Label";
main.mostCurrent._lblelapsedtime = RemoteObject.createNew ("anywheresoftware.b4a.objects.LabelWrapper");
//BA.debugLineNum = 30;BA.debugLine="Private pnlClock As Panel";
main.mostCurrent._pnlclock = RemoteObject.createNew ("anywheresoftware.b4a.objects.PanelWrapper");
//BA.debugLineNum = 31;BA.debugLine="Private Timer1 As Timer";
main._timer1 = RemoteObject.createNew ("anywheresoftware.b4a.objects.Timer");
//BA.debugLineNum = 32;BA.debugLine="Private myClock As AnalogClock";
main.mostCurrent._myclock = RemoteObject.createNew ("b4a.example.analogclock");
//BA.debugLineNum = 33;BA.debugLine="Log(\"lblElapsedTime nel Sub Globals: \" & lblElaps";
main.mostCurrent.__c.runVoidMethod ("LogImpl","365548",RemoteObject.concat(RemoteObject.createImmutable("lblElapsedTime nel Sub Globals: "),main.mostCurrent._lblelapsedtime.runMethod(true,"IsInitialized")),0);
//BA.debugLineNum = 34;BA.debugLine="End Sub";
return RemoteObject.createImmutable("");
}
public static void initializeProcessGlobals() {
if (main.processGlobalsRun == false) {
main.processGlobalsRun = true;
try {
main_subs_0._process_globals();
starter_subs_0._process_globals();
main.myClass = BA.getDeviceClass ("b4a.example.main");
starter.myClass = BA.getDeviceClass ("b4a.example.starter");
analogclock.myClass = BA.getDeviceClass ("b4a.example.analogclock");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}public static RemoteObject _process_globals() throws Exception{
//BA.debugLineNum = 13;BA.debugLine="Sub Process_Globals";
//BA.debugLineNum = 14;BA.debugLine="Private Timer1 As Timer";
main._timer1 = RemoteObject.createNew ("anywheresoftware.b4a.objects.Timer");
//BA.debugLineNum = 15;BA.debugLine="Private Running As Boolean = False";
main._running = main.mostCurrent.__c.getField(true,"False");
//BA.debugLineNum = 16;BA.debugLine="Private StartTime As Long = 0";
main._starttime = BA.numberCast(long.class, 0);
//BA.debugLineNum = 17;BA.debugLine="Private ElapsedTime As Long = 0";
main._elapsedtime = BA.numberCast(long.class, 0);
//BA.debugLineNum = 19;BA.debugLine="End Sub";
return RemoteObject.createImmutable("");
}
public static RemoteObject _synchronizeclock() throws Exception{
try {
Debug.PushSubsStack("SynchronizeClock (main) ","main",0,main.mostCurrent.activityBA,main.mostCurrent,186);
if (RapidSub.canDelegate("synchronizeclock")) { return b4a.example.main.remoteMe.runUserSub(false, "main","synchronizeclock");}
BA.debugLineNum = 186;BA.debugLine="Sub SynchronizeClock";
Debug.ShouldStop(33554432);
BA.debugLineNum = 187;BA.debugLine="DrawClock";
Debug.ShouldStop(67108864);
_drawclock();
BA.debugLineNum = 188;BA.debugLine="End Sub";
Debug.ShouldStop(134217728);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _timer1_tick() throws Exception{
try {
Debug.PushSubsStack("Timer1_Tick (main) ","main",0,main.mostCurrent.activityBA,main.mostCurrent,78);
if (RapidSub.canDelegate("timer1_tick")) { return b4a.example.main.remoteMe.runUserSub(false, "main","timer1_tick");}
BA.debugLineNum = 78;BA.debugLine="Sub Timer1_Tick";
Debug.ShouldStop(8192);
BA.debugLineNum = 79;BA.debugLine="myClock.DrawClock";
Debug.ShouldStop(16384);
main.mostCurrent._myclock.runClassMethod (b4a.example.analogclock.class, "_drawclock" /*RemoteObject*/ );
BA.debugLineNum = 80;BA.debugLine="End Sub";
Debug.ShouldStop(32768);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
}

View File

@@ -0,0 +1,58 @@
package b4a.example;
import java.io.IOException;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.pc.PCBA;
import anywheresoftware.b4a.pc.RDebug;
import anywheresoftware.b4a.pc.RemoteObject;
import anywheresoftware.b4a.pc.RDebug.IRemote;
import anywheresoftware.b4a.pc.Debug;
import anywheresoftware.b4a.pc.B4XTypes.B4XClass;
import anywheresoftware.b4a.pc.B4XTypes.DeviceClass;
public class starter implements IRemote{
public static starter mostCurrent;
public static RemoteObject processBA;
public static boolean processGlobalsRun;
public static RemoteObject myClass;
public static RemoteObject remoteMe;
public starter() {
mostCurrent = this;
}
public RemoteObject getRemoteMe() {
return remoteMe;
}
public boolean isSingleton() {
return true;
}
static {
anywheresoftware.b4a.pc.RapidSub.moduleToObject.put(new B4XClass("starter"), "b4a.example.starter");
}
public static RemoteObject getObject() {
return myClass;
}
public RemoteObject _service;
private PCBA pcBA;
public PCBA create(Object[] args) throws ClassNotFoundException{
processBA = (RemoteObject) args[1];
_service = (RemoteObject) args[2];
remoteMe = RemoteObject.declareNull("b4a.example.starter");
anywheresoftware.b4a.keywords.Common.Density = (Float)args[3];
pcBA = new PCBA(this, starter.class);
main_subs_0.initializeProcessGlobals();
return pcBA;
}public static RemoteObject runMethod(boolean notUsed, String method, Object... args) throws Exception{
return (RemoteObject) mostCurrent.pcBA.raiseEvent(method.substring(1), args);
}
public static void runVoidMethod(String method, Object... args) throws Exception{
runMethod(false, method, args);
}
public static RemoteObject __c = RemoteObject.declareNull("anywheresoftware.b4a.keywords.Common");
public static b4a.example.main _main = null;
public Object[] GetGlobals() {
return new Object[] {"Main",Debug.moduleToString(b4a.example.main.class),"Service",starter.mostCurrent._service};
}
}

View File

@@ -0,0 +1,103 @@
package b4a.example;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.pc.*;
public class starter_subs_0 {
public static RemoteObject _application_error(RemoteObject _error,RemoteObject _stacktrace) throws Exception{
try {
Debug.PushSubsStack("Application_Error (starter) ","starter",1,starter.processBA,starter.mostCurrent,27);
if (RapidSub.canDelegate("application_error")) { return b4a.example.starter.remoteMe.runUserSub(false, "starter","application_error", _error, _stacktrace);}
Debug.locals.put("Error", _error);
Debug.locals.put("StackTrace", _stacktrace);
BA.debugLineNum = 27;BA.debugLine="Sub Application_Error (Error As Exception, StackTr";
Debug.ShouldStop(67108864);
BA.debugLineNum = 28;BA.debugLine="Return True";
Debug.ShouldStop(134217728);
if (true) return starter.mostCurrent.__c.getField(true,"True");
BA.debugLineNum = 29;BA.debugLine="End Sub";
Debug.ShouldStop(268435456);
return RemoteObject.createImmutable(false);
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _process_globals() throws Exception{
//BA.debugLineNum = 6;BA.debugLine="Sub Process_Globals";
//BA.debugLineNum = 10;BA.debugLine="End Sub";
return RemoteObject.createImmutable("");
}
public static RemoteObject _service_create() throws Exception{
try {
Debug.PushSubsStack("Service_Create (starter) ","starter",1,starter.processBA,starter.mostCurrent,12);
if (RapidSub.canDelegate("service_create")) { return b4a.example.starter.remoteMe.runUserSub(false, "starter","service_create");}
BA.debugLineNum = 12;BA.debugLine="Sub Service_Create";
Debug.ShouldStop(2048);
BA.debugLineNum = 16;BA.debugLine="End Sub";
Debug.ShouldStop(32768);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _service_destroy() throws Exception{
try {
Debug.PushSubsStack("Service_Destroy (starter) ","starter",1,starter.processBA,starter.mostCurrent,31);
if (RapidSub.canDelegate("service_destroy")) { return b4a.example.starter.remoteMe.runUserSub(false, "starter","service_destroy");}
BA.debugLineNum = 31;BA.debugLine="Sub Service_Destroy";
Debug.ShouldStop(1073741824);
BA.debugLineNum = 33;BA.debugLine="End Sub";
Debug.ShouldStop(1);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _service_start(RemoteObject _startingintent) throws Exception{
try {
Debug.PushSubsStack("Service_Start (starter) ","starter",1,starter.processBA,starter.mostCurrent,18);
if (RapidSub.canDelegate("service_start")) { return b4a.example.starter.remoteMe.runUserSub(false, "starter","service_start", _startingintent);}
Debug.locals.put("StartingIntent", _startingintent);
BA.debugLineNum = 18;BA.debugLine="Sub Service_Start (StartingIntent As Intent)";
Debug.ShouldStop(131072);
BA.debugLineNum = 19;BA.debugLine="Service.StopAutomaticForeground 'Starter service";
Debug.ShouldStop(262144);
starter.mostCurrent._service.runVoidMethod ("StopAutomaticForeground");
BA.debugLineNum = 20;BA.debugLine="End Sub";
Debug.ShouldStop(524288);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
public static RemoteObject _service_taskremoved() throws Exception{
try {
Debug.PushSubsStack("Service_TaskRemoved (starter) ","starter",1,starter.processBA,starter.mostCurrent,22);
if (RapidSub.canDelegate("service_taskremoved")) { return b4a.example.starter.remoteMe.runUserSub(false, "starter","service_taskremoved");}
BA.debugLineNum = 22;BA.debugLine="Sub Service_TaskRemoved";
Debug.ShouldStop(2097152);
BA.debugLineNum = 24;BA.debugLine="End Sub";
Debug.ShouldStop(8388608);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
throw Debug.ErrorCaught(e);
}
finally {
Debug.PopSubsStack();
}}
}

View File

@@ -0,0 +1,513 @@
package b4a.example;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.B4AClass;
import anywheresoftware.b4a.BALayout;
import anywheresoftware.b4a.debug.*;
public class analogclock extends B4AClass.ImplB4AClass implements BA.SubDelegator{
private static java.util.HashMap<String, java.lang.reflect.Method> htSubs;
private void innerInitialize(BA _ba) throws Exception {
if (ba == null) {
ba = new anywheresoftware.b4a.ShellBA(_ba, this, htSubs, "b4a.example.analogclock");
if (htSubs == null) {
ba.loadHtSubs(this.getClass());
htSubs = ba.htSubs;
}
}
if (BA.isShellModeRuntimeCheck(ba))
this.getClass().getMethod("_class_globals", b4a.example.analogclock.class).invoke(this, new Object[] {null});
else
ba.raiseEvent2(null, true, "class_globals", false);
}
public void innerInitializeHelper(anywheresoftware.b4a.BA _ba) throws Exception{
innerInitialize(_ba);
}
public Object callSub(String sub, Object sender, Object[] args) throws Exception {
return BA.SubDelegator.SubNotFound;
}
public anywheresoftware.b4a.keywords.Common __c = null;
public anywheresoftware.b4a.objects.B4XViewWrapper.XUI _xui = null;
public anywheresoftware.b4a.objects.PanelWrapper _pnlclock = null;
public anywheresoftware.b4a.objects.B4XCanvas _cvsclock = null;
public float _clockdiameter = 0f;
public float _centerx = 0f;
public float _centery = 0f;
public anywheresoftware.b4a.objects.collections.List _intervals = null;
public float _quadrantstrokewidth = 0f;
public float _hourtickstrokewidth = 0f;
public float _minutetickstrokewidth = 0f;
public float _intervalarcstrokewidth = 0f;
public float _hourhandstrokewidth = 0f;
public float _minutehandstrokewidth = 0f;
public b4a.example.main _main = null;
public b4a.example.starter _starter = null;
public String _initialize(b4a.example.analogclock __ref,anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.PanelWrapper _parentpanel,float _percentageofwidth) throws Exception{
__ref = this;
innerInitialize(_ba);
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "initialize", false))
{return ((String) Debug.delegate(ba, "initialize", new Object[] {_ba,_parentpanel,_percentageofwidth}));}
RDebugUtils.currentLine=1376256;
//BA.debugLineNum = 1376256;BA.debugLine="Public Sub Initialize(ParentPanel As Panel, Percen";
RDebugUtils.currentLine=1376257;
//BA.debugLineNum = 1376257;BA.debugLine="pnlClock = ParentPanel";
__ref._pnlclock /*anywheresoftware.b4a.objects.PanelWrapper*/ = _parentpanel;
RDebugUtils.currentLine=1376258;
//BA.debugLineNum = 1376258;BA.debugLine="cvsClock.Initialize(pnlClock)";
__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .Initialize((anywheresoftware.b4a.objects.B4XViewWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.B4XViewWrapper(), (java.lang.Object)(__ref._pnlclock /*anywheresoftware.b4a.objects.PanelWrapper*/ .getObject())));
RDebugUtils.currentLine=1376259;
//BA.debugLineNum = 1376259;BA.debugLine="intervals.Initialize";
__ref._intervals /*anywheresoftware.b4a.objects.collections.List*/ .Initialize();
RDebugUtils.currentLine=1376260;
//BA.debugLineNum = 1376260;BA.debugLine="SetClockSize(PercentageOfWidth)";
__ref._setclocksize /*String*/ (null,_percentageofwidth);
RDebugUtils.currentLine=1376261;
//BA.debugLineNum = 1376261;BA.debugLine="End Sub";
return "";
}
public String _drawclock(b4a.example.analogclock __ref) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "drawclock", false))
{return ((String) Debug.delegate(ba, "drawclock", null));}
anywheresoftware.b4a.objects.collections.Map _interval = null;
long _now = 0L;
int _hours = 0;
int _minutes = 0;
int _seconds = 0;
float _hourangle = 0f;
float _minuteangle = 0f;
float _secondangle = 0f;
RDebugUtils.currentLine=1572864;
//BA.debugLineNum = 1572864;BA.debugLine="Public Sub DrawClock";
RDebugUtils.currentLine=1572865;
//BA.debugLineNum = 1572865;BA.debugLine="cvsClock.Initialize(pnlClock)";
__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .Initialize((anywheresoftware.b4a.objects.B4XViewWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.B4XViewWrapper(), (java.lang.Object)(__ref._pnlclock /*anywheresoftware.b4a.objects.PanelWrapper*/ .getObject())));
RDebugUtils.currentLine=1572868;
//BA.debugLineNum = 1572868;BA.debugLine="ClearCanvas(Colors.White)";
__ref._clearcanvas /*String*/ (null,__c.Colors.White);
RDebugUtils.currentLine=1572871;
//BA.debugLineNum = 1572871;BA.debugLine="cvsClock.DrawCircle(centerX, centerY, clockDia";
__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .DrawCircle(__ref._centerx /*float*/ ,__ref._centery /*float*/ ,(float) (__ref._clockdiameter /*float*/ /(double)2),__c.Colors.Black,__c.False,__ref._quadrantstrokewidth /*float*/ );
RDebugUtils.currentLine=1572874;
//BA.debugLineNum = 1572874;BA.debugLine="DrawTicks";
__ref._drawticks /*String*/ (null);
RDebugUtils.currentLine=1572877;
//BA.debugLineNum = 1572877;BA.debugLine="For Each interval As Map In intervals";
_interval = new anywheresoftware.b4a.objects.collections.Map();
{
final anywheresoftware.b4a.BA.IterableList group5 = __ref._intervals /*anywheresoftware.b4a.objects.collections.List*/ ;
final int groupLen5 = group5.getSize()
;int index5 = 0;
;
for (; index5 < groupLen5;index5++){
_interval = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group5.Get(index5)));
RDebugUtils.currentLine=1572878;
//BA.debugLineNum = 1572878;BA.debugLine="DrawInterval(interval.Get(\"startHour\"), in";
__ref._drawinterval /*String*/ (null,(int)(BA.ObjectToNumber(_interval.Get((Object)("startHour")))),(int)(BA.ObjectToNumber(_interval.Get((Object)("startMinute")))),(int)(BA.ObjectToNumber(_interval.Get((Object)("endHour")))),(int)(BA.ObjectToNumber(_interval.Get((Object)("endMinute")))),(int)(BA.ObjectToNumber(_interval.Get((Object)("color")))),(float)(BA.ObjectToNumber(_interval.Get((Object)("radius")))),(float)(BA.ObjectToNumber(_interval.Get((Object)("strokeWidth")))));
}
};
RDebugUtils.currentLine=1572882;
//BA.debugLineNum = 1572882;BA.debugLine="Dim now As Long = DateTime.Now";
_now = __c.DateTime.getNow();
RDebugUtils.currentLine=1572883;
//BA.debugLineNum = 1572883;BA.debugLine="Dim Hours As Int = DateTime.GetHour(now) Mod 1";
_hours = (int) (__c.DateTime.GetHour(_now)%12);
RDebugUtils.currentLine=1572884;
//BA.debugLineNum = 1572884;BA.debugLine="Dim Minutes As Int = DateTime.GetMinute(now)";
_minutes = __c.DateTime.GetMinute(_now);
RDebugUtils.currentLine=1572885;
//BA.debugLineNum = 1572885;BA.debugLine="Dim Seconds As Int = DateTime.GetSecond(now)";
_seconds = __c.DateTime.GetSecond(_now);
RDebugUtils.currentLine=1572888;
//BA.debugLineNum = 1572888;BA.debugLine="Dim HourAngle As Float = -90 + Hours * 30 + Mi";
_hourangle = (float) (-90+_hours*30+_minutes/(double)2);
RDebugUtils.currentLine=1572889;
//BA.debugLineNum = 1572889;BA.debugLine="DrawHand(centerX, centerY, clockDiameter * 0.2";
__ref._drawhand /*String*/ (null,__ref._centerx /*float*/ ,__ref._centery /*float*/ ,(float) (__ref._clockdiameter /*float*/ *0.25),_hourangle,__ref._hourhandstrokewidth /*float*/ ,__c.Colors.Black);
RDebugUtils.currentLine=1572892;
//BA.debugLineNum = 1572892;BA.debugLine="Dim MinuteAngle As Float = -90 + Minutes * 6";
_minuteangle = (float) (-90+_minutes*6);
RDebugUtils.currentLine=1572893;
//BA.debugLineNum = 1572893;BA.debugLine="DrawHand(centerX, centerY, clockDiameter * 0.4";
__ref._drawhand /*String*/ (null,__ref._centerx /*float*/ ,__ref._centery /*float*/ ,(float) (__ref._clockdiameter /*float*/ *0.4),_minuteangle,__ref._minutehandstrokewidth /*float*/ ,__c.Colors.Blue);
RDebugUtils.currentLine=1572896;
//BA.debugLineNum = 1572896;BA.debugLine="Dim SecondAngle As Float = -90 + Seconds * 6";
_secondangle = (float) (-90+_seconds*6);
RDebugUtils.currentLine=1572897;
//BA.debugLineNum = 1572897;BA.debugLine="DrawHand(centerX, centerY, clockDiameter * 0.4";
__ref._drawhand /*String*/ (null,__ref._centerx /*float*/ ,__ref._centery /*float*/ ,(float) (__ref._clockdiameter /*float*/ *0.45),_secondangle,(float) (__c.DipToCurrent((int) (2))),__c.Colors.Red);
RDebugUtils.currentLine=1572900;
//BA.debugLineNum = 1572900;BA.debugLine="pnlClock.Invalidate";
__ref._pnlclock /*anywheresoftware.b4a.objects.PanelWrapper*/ .Invalidate();
RDebugUtils.currentLine=1572901;
//BA.debugLineNum = 1572901;BA.debugLine="End Sub";
return "";
}
public String _addinterval(b4a.example.analogclock __ref,int _starthour,int _startminute,int _endhour,int _endminute,String _tipo) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "addinterval", false))
{return ((String) Debug.delegate(ba, "addinterval", new Object[] {_starthour,_startminute,_endhour,_endminute,_tipo}));}
anywheresoftware.b4a.objects.collections.Map _interval = null;
RDebugUtils.currentLine=1769472;
//BA.debugLineNum = 1769472;BA.debugLine="Public Sub AddInterval(startHour As Int, startMinu";
RDebugUtils.currentLine=1769473;
//BA.debugLineNum = 1769473;BA.debugLine="Dim interval As Map";
_interval = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=1769474;
//BA.debugLineNum = 1769474;BA.debugLine="interval.Initialize";
_interval.Initialize();
RDebugUtils.currentLine=1769475;
//BA.debugLineNum = 1769475;BA.debugLine="interval.Put(\"startHour\", startHour)";
_interval.Put((Object)("startHour"),(Object)(_starthour));
RDebugUtils.currentLine=1769476;
//BA.debugLineNum = 1769476;BA.debugLine="interval.Put(\"startMinute\", startMinute)";
_interval.Put((Object)("startMinute"),(Object)(_startminute));
RDebugUtils.currentLine=1769477;
//BA.debugLineNum = 1769477;BA.debugLine="interval.Put(\"endHour\", endHour)";
_interval.Put((Object)("endHour"),(Object)(_endhour));
RDebugUtils.currentLine=1769478;
//BA.debugLineNum = 1769478;BA.debugLine="interval.Put(\"endMinute\", endMinute)";
_interval.Put((Object)("endMinute"),(Object)(_endminute));
RDebugUtils.currentLine=1769479;
//BA.debugLineNum = 1769479;BA.debugLine="Select tipo.ToLowerCase";
switch (BA.switchObjectToInt(_tipo.toLowerCase(),"mattino","pomeriggio")) {
case 0: {
RDebugUtils.currentLine=1769481;
//BA.debugLineNum = 1769481;BA.debugLine="interval.Put(\"color\", Colors.Blue)";
_interval.Put((Object)("color"),(Object)(__c.Colors.Blue));
RDebugUtils.currentLine=1769482;
//BA.debugLineNum = 1769482;BA.debugLine="interval.Put(\"radius\", clockDiameter /";
_interval.Put((Object)("radius"),(Object)(__ref._clockdiameter /*float*/ /(double)2-__c.DipToCurrent((int) (15))));
RDebugUtils.currentLine=1769483;
//BA.debugLineNum = 1769483;BA.debugLine="interval.Put(\"strokeWidth\", intervalAr";
_interval.Put((Object)("strokeWidth"),(Object)(__ref._intervalarcstrokewidth /*float*/ ));
break; }
case 1: {
RDebugUtils.currentLine=1769485;
//BA.debugLineNum = 1769485;BA.debugLine="interval.Put(\"color\", Colors.Green)";
_interval.Put((Object)("color"),(Object)(__c.Colors.Green));
RDebugUtils.currentLine=1769486;
//BA.debugLineNum = 1769486;BA.debugLine="interval.Put(\"radius\", clockDiameter /";
_interval.Put((Object)("radius"),(Object)(__ref._clockdiameter /*float*/ /(double)2-__c.DipToCurrent((int) (25))));
RDebugUtils.currentLine=1769487;
//BA.debugLineNum = 1769487;BA.debugLine="interval.Put(\"strokeWidth\", intervalAr";
_interval.Put((Object)("strokeWidth"),(Object)(__ref._intervalarcstrokewidth /*float*/ ));
break; }
default: {
RDebugUtils.currentLine=1769489;
//BA.debugLineNum = 1769489;BA.debugLine="Log(\"Tipo di intervallo non riconosciu";
__c.LogImpl("31769489","Tipo di intervallo non riconosciuto: "+_tipo,0);
RDebugUtils.currentLine=1769490;
//BA.debugLineNum = 1769490;BA.debugLine="Return";
if (true) return "";
break; }
}
;
RDebugUtils.currentLine=1769492;
//BA.debugLineNum = 1769492;BA.debugLine="intervals.Add(interval)";
__ref._intervals /*anywheresoftware.b4a.objects.collections.List*/ .Add((Object)(_interval.getObject()));
RDebugUtils.currentLine=1769493;
//BA.debugLineNum = 1769493;BA.debugLine="DrawClock";
__ref._drawclock /*String*/ (null);
RDebugUtils.currentLine=1769494;
//BA.debugLineNum = 1769494;BA.debugLine="End Sub";
return "";
}
public String _class_globals(b4a.example.analogclock __ref) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
RDebugUtils.currentLine=1310720;
//BA.debugLineNum = 1310720;BA.debugLine="Sub Class_Globals";
RDebugUtils.currentLine=1310721;
//BA.debugLineNum = 1310721;BA.debugLine="Private xui As XUI";
_xui = new anywheresoftware.b4a.objects.B4XViewWrapper.XUI();
RDebugUtils.currentLine=1310723;
//BA.debugLineNum = 1310723;BA.debugLine="Private pnlClock As Panel ' Pannello in c";
_pnlclock = new anywheresoftware.b4a.objects.PanelWrapper();
RDebugUtils.currentLine=1310724;
//BA.debugLineNum = 1310724;BA.debugLine="Private cvsClock As B4XCanvas ' Canvas per";
_cvsclock = new anywheresoftware.b4a.objects.B4XCanvas();
RDebugUtils.currentLine=1310725;
//BA.debugLineNum = 1310725;BA.debugLine="Private clockDiameter As Float ' Diametro dell";
_clockdiameter = 0f;
RDebugUtils.currentLine=1310726;
//BA.debugLineNum = 1310726;BA.debugLine="Private centerX As Float ' Coordinata X";
_centerx = 0f;
RDebugUtils.currentLine=1310727;
//BA.debugLineNum = 1310727;BA.debugLine="Private centerY As Float ' Coordinata Y";
_centery = 0f;
RDebugUtils.currentLine=1310728;
//BA.debugLineNum = 1310728;BA.debugLine="Private intervals As List ' Lista degli i";
_intervals = new anywheresoftware.b4a.objects.collections.List();
RDebugUtils.currentLine=1310731;
//BA.debugLineNum = 1310731;BA.debugLine="Private quadrantStrokeWidth As Float = 5dip";
_quadrantstrokewidth = (float) (__c.DipToCurrent((int) (5)));
RDebugUtils.currentLine=1310732;
//BA.debugLineNum = 1310732;BA.debugLine="Private hourTickStrokeWidth As Float = 5dip";
_hourtickstrokewidth = (float) (__c.DipToCurrent((int) (5)));
RDebugUtils.currentLine=1310733;
//BA.debugLineNum = 1310733;BA.debugLine="Private minuteTickStrokeWidth As Float = 2dip";
_minutetickstrokewidth = (float) (__c.DipToCurrent((int) (2)));
RDebugUtils.currentLine=1310734;
//BA.debugLineNum = 1310734;BA.debugLine="Private intervalArcStrokeWidth As Float = 5dip";
_intervalarcstrokewidth = (float) (__c.DipToCurrent((int) (5)));
RDebugUtils.currentLine=1310735;
//BA.debugLineNum = 1310735;BA.debugLine="Private hourHandStrokeWidth As Float = 8dip";
_hourhandstrokewidth = (float) (__c.DipToCurrent((int) (8)));
RDebugUtils.currentLine=1310736;
//BA.debugLineNum = 1310736;BA.debugLine="Private minuteHandStrokeWidth As Float = 5dip";
_minutehandstrokewidth = (float) (__c.DipToCurrent((int) (5)));
RDebugUtils.currentLine=1310737;
//BA.debugLineNum = 1310737;BA.debugLine="End Sub";
return "";
}
public String _clearcanvas(b4a.example.analogclock __ref,int _color) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "clearcanvas", false))
{return ((String) Debug.delegate(ba, "clearcanvas", new Object[] {_color}));}
RDebugUtils.currentLine=2031616;
//BA.debugLineNum = 2031616;BA.debugLine="Private Sub ClearCanvas(color As Int)";
RDebugUtils.currentLine=2031617;
//BA.debugLineNum = 2031617;BA.debugLine="cvsClock.DrawRect(cvsClock.TargetRect, color, Tru";
__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .DrawRect(__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .getTargetRect(),_color,__c.True,(float) (0));
RDebugUtils.currentLine=2031618;
//BA.debugLineNum = 2031618;BA.debugLine="cvsClock.Invalidate";
__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .Invalidate();
RDebugUtils.currentLine=2031619;
//BA.debugLineNum = 2031619;BA.debugLine="End Sub";
return "";
}
public String _drawticks(b4a.example.analogclock __ref) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "drawticks", false))
{return ((String) Debug.delegate(ba, "drawticks", null));}
int _i = 0;
float _angle = 0f;
float _startx = 0f;
float _starty = 0f;
float _endx = 0f;
float _endy = 0f;
RDebugUtils.currentLine=1703936;
//BA.debugLineNum = 1703936;BA.debugLine="Private Sub DrawTicks";
RDebugUtils.currentLine=1703937;
//BA.debugLineNum = 1703937;BA.debugLine="For i = 0 To 59";
{
final int step1 = 1;
final int limit1 = (int) (59);
_i = (int) (0) ;
for (;_i <= limit1 ;_i = _i + step1 ) {
RDebugUtils.currentLine=1703938;
//BA.debugLineNum = 1703938;BA.debugLine="Dim angle As Float = -90 + i * 6";
_angle = (float) (-90+_i*6);
RDebugUtils.currentLine=1703939;
//BA.debugLineNum = 1703939;BA.debugLine="Dim startX As Float";
_startx = 0f;
RDebugUtils.currentLine=1703940;
//BA.debugLineNum = 1703940;BA.debugLine="Dim startY As Float";
_starty = 0f;
RDebugUtils.currentLine=1703941;
//BA.debugLineNum = 1703941;BA.debugLine="Dim endX As Float";
_endx = 0f;
RDebugUtils.currentLine=1703942;
//BA.debugLineNum = 1703942;BA.debugLine="Dim endY As Float";
_endy = 0f;
RDebugUtils.currentLine=1703943;
//BA.debugLineNum = 1703943;BA.debugLine="If i Mod 5 = 0 Then";
if (_i%5==0) {
RDebugUtils.currentLine=1703945;
//BA.debugLineNum = 1703945;BA.debugLine="startX = centerX + (clockDiameter / 2";
_startx = (float) (__ref._centerx /*float*/ +(__ref._clockdiameter /*float*/ /(double)2-__c.DipToCurrent((int) (20)))*__c.CosD(_angle));
RDebugUtils.currentLine=1703946;
//BA.debugLineNum = 1703946;BA.debugLine="startY = centerY + (clockDiameter / 2";
_starty = (float) (__ref._centery /*float*/ +(__ref._clockdiameter /*float*/ /(double)2-__c.DipToCurrent((int) (20)))*__c.SinD(_angle));
RDebugUtils.currentLine=1703947;
//BA.debugLineNum = 1703947;BA.debugLine="endX = centerX + (clockDiameter / 2 -";
_endx = (float) (__ref._centerx /*float*/ +(__ref._clockdiameter /*float*/ /(double)2-__c.DipToCurrent((int) (5)))*__c.CosD(_angle));
RDebugUtils.currentLine=1703948;
//BA.debugLineNum = 1703948;BA.debugLine="endY = centerY + (clockDiameter / 2 -";
_endy = (float) (__ref._centery /*float*/ +(__ref._clockdiameter /*float*/ /(double)2-__c.DipToCurrent((int) (5)))*__c.SinD(_angle));
RDebugUtils.currentLine=1703949;
//BA.debugLineNum = 1703949;BA.debugLine="cvsClock.DrawLine(startX, startY, endX";
__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .DrawLine(_startx,_starty,_endx,_endy,__c.Colors.Black,__ref._hourtickstrokewidth /*float*/ );
}else {
RDebugUtils.currentLine=1703952;
//BA.debugLineNum = 1703952;BA.debugLine="startX = centerX + (clockDiameter / 2";
_startx = (float) (__ref._centerx /*float*/ +(__ref._clockdiameter /*float*/ /(double)2-__c.DipToCurrent((int) (10)))*__c.CosD(_angle));
RDebugUtils.currentLine=1703953;
//BA.debugLineNum = 1703953;BA.debugLine="startY = centerY + (clockDiameter / 2";
_starty = (float) (__ref._centery /*float*/ +(__ref._clockdiameter /*float*/ /(double)2-__c.DipToCurrent((int) (10)))*__c.SinD(_angle));
RDebugUtils.currentLine=1703954;
//BA.debugLineNum = 1703954;BA.debugLine="endX = centerX + (clockDiameter / 2 -";
_endx = (float) (__ref._centerx /*float*/ +(__ref._clockdiameter /*float*/ /(double)2-__c.DipToCurrent((int) (5)))*__c.CosD(_angle));
RDebugUtils.currentLine=1703955;
//BA.debugLineNum = 1703955;BA.debugLine="endY = centerY + (clockDiameter / 2 -";
_endy = (float) (__ref._centery /*float*/ +(__ref._clockdiameter /*float*/ /(double)2-__c.DipToCurrent((int) (5)))*__c.SinD(_angle));
RDebugUtils.currentLine=1703956;
//BA.debugLineNum = 1703956;BA.debugLine="cvsClock.DrawLine(startX, startY, endX";
__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .DrawLine(_startx,_starty,_endx,_endy,__c.Colors.Black,__ref._minutetickstrokewidth /*float*/ );
};
}
};
RDebugUtils.currentLine=1703959;
//BA.debugLineNum = 1703959;BA.debugLine="End Sub";
return "";
}
public String _drawinterval(b4a.example.analogclock __ref,int _starthour,int _startminute,int _endhour,int _endminute,int _color,float _radius,float _strokewidth) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "drawinterval", false))
{return ((String) Debug.delegate(ba, "drawinterval", new Object[] {_starthour,_startminute,_endhour,_endminute,_color,_radius,_strokewidth}));}
float _startangle = 0f;
float _endangle = 0f;
float _sweepangle = 0f;
anywheresoftware.b4a.objects.B4XCanvas.B4XPath _path = null;
RDebugUtils.currentLine=1835008;
//BA.debugLineNum = 1835008;BA.debugLine="Private Sub DrawInterval(startHour As Int, startMi";
RDebugUtils.currentLine=1835009;
//BA.debugLineNum = 1835009;BA.debugLine="Dim startAngle As Float = (startHour Mod 12 + sta";
_startangle = (float) ((_starthour%12+_startminute/(double)60)*30-90);
RDebugUtils.currentLine=1835010;
//BA.debugLineNum = 1835010;BA.debugLine="Dim endAngle As Float = (endHour Mod 12 + endMinu";
_endangle = (float) ((_endhour%12+_endminute/(double)60)*30-90);
RDebugUtils.currentLine=1835011;
//BA.debugLineNum = 1835011;BA.debugLine="Dim sweepAngle As Float = endAngle - startAngle";
_sweepangle = (float) (_endangle-_startangle);
RDebugUtils.currentLine=1835012;
//BA.debugLineNum = 1835012;BA.debugLine="If sweepAngle < 0 Then sweepAngle = sweepAngle +";
if (_sweepangle<0) {
_sweepangle = (float) (_sweepangle+360);};
RDebugUtils.currentLine=1835014;
//BA.debugLineNum = 1835014;BA.debugLine="Dim path As B4XPath";
_path = new anywheresoftware.b4a.objects.B4XCanvas.B4XPath();
RDebugUtils.currentLine=1835015;
//BA.debugLineNum = 1835015;BA.debugLine="path.InitializeArc(centerX, centerY, radius, star";
_path.InitializeArc(__ref._centerx /*float*/ ,__ref._centery /*float*/ ,_radius,_startangle,_sweepangle);
RDebugUtils.currentLine=1835016;
//BA.debugLineNum = 1835016;BA.debugLine="cvsClock.DrawPath(path, color, False, strokeWidth";
__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .DrawPath(_path,_color,__c.False,_strokewidth);
RDebugUtils.currentLine=1835017;
//BA.debugLineNum = 1835017;BA.debugLine="End Sub";
return "";
}
public String _drawhand(b4a.example.analogclock __ref,float _x,float _y,float _length,float _angle,float _width,int _color) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "drawhand", false))
{return ((String) Debug.delegate(ba, "drawhand", new Object[] {_x,_y,_length,_angle,_width,_color}));}
float _endx = 0f;
float _endy = 0f;
RDebugUtils.currentLine=1638400;
//BA.debugLineNum = 1638400;BA.debugLine="Private Sub DrawHand(x As Float, y As Float, lengt";
RDebugUtils.currentLine=1638401;
//BA.debugLineNum = 1638401;BA.debugLine="Dim endX As Float = x + length * CosD(angle)";
_endx = (float) (_x+_length*__c.CosD(_angle));
RDebugUtils.currentLine=1638402;
//BA.debugLineNum = 1638402;BA.debugLine="Dim endY As Float = y + length * SinD(angle)";
_endy = (float) (_y+_length*__c.SinD(_angle));
RDebugUtils.currentLine=1638403;
//BA.debugLineNum = 1638403;BA.debugLine="cvsClock.DrawLine(x, y, endX, endY, color, wid";
__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .DrawLine(_x,_y,_endx,_endy,_color,_width);
RDebugUtils.currentLine=1638404;
//BA.debugLineNum = 1638404;BA.debugLine="End Sub";
return "";
}
public String _setclocksize(b4a.example.analogclock __ref,float _percentageofwidth) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "setclocksize", false))
{return ((String) Debug.delegate(ba, "setclocksize", new Object[] {_percentageofwidth}));}
RDebugUtils.currentLine=1441792;
//BA.debugLineNum = 1441792;BA.debugLine="Public Sub SetClockSize(PercentageOfWidth As Float";
RDebugUtils.currentLine=1441793;
//BA.debugLineNum = 1441793;BA.debugLine="clockDiameter = pnlClock.Width * PercentageOfW";
__ref._clockdiameter /*float*/ = (float) (__ref._pnlclock /*anywheresoftware.b4a.objects.PanelWrapper*/ .getWidth()*_percentageofwidth/(double)100);
RDebugUtils.currentLine=1441794;
//BA.debugLineNum = 1441794;BA.debugLine="centerX = pnlClock.Width / 2";
__ref._centerx /*float*/ = (float) (__ref._pnlclock /*anywheresoftware.b4a.objects.PanelWrapper*/ .getWidth()/(double)2);
RDebugUtils.currentLine=1441795;
//BA.debugLineNum = 1441795;BA.debugLine="centerY = pnlClock.Height / 2";
__ref._centery /*float*/ = (float) (__ref._pnlclock /*anywheresoftware.b4a.objects.PanelWrapper*/ .getHeight()/(double)2);
RDebugUtils.currentLine=1441796;
//BA.debugLineNum = 1441796;BA.debugLine="DrawClock";
__ref._drawclock /*String*/ (null);
RDebugUtils.currentLine=1441797;
//BA.debugLineNum = 1441797;BA.debugLine="End Sub";
return "";
}
public String _setstrokewidths(b4a.example.analogclock __ref,float _quadrantwidth,float _hourtickwidth,float _minutetickwidth,float _intervalarcwidth,float _hourhandwidth,float _minutehandwidth) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "setstrokewidths", false))
{return ((String) Debug.delegate(ba, "setstrokewidths", new Object[] {_quadrantwidth,_hourtickwidth,_minutetickwidth,_intervalarcwidth,_hourhandwidth,_minutehandwidth}));}
RDebugUtils.currentLine=1507328;
//BA.debugLineNum = 1507328;BA.debugLine="Public Sub SetStrokeWidths(quadrantWidth As Float,";
RDebugUtils.currentLine=1507329;
//BA.debugLineNum = 1507329;BA.debugLine="quadrantStrokeWidth = quadrantWidth";
__ref._quadrantstrokewidth /*float*/ = _quadrantwidth;
RDebugUtils.currentLine=1507330;
//BA.debugLineNum = 1507330;BA.debugLine="hourTickStrokeWidth = hourTickWidth";
__ref._hourtickstrokewidth /*float*/ = _hourtickwidth;
RDebugUtils.currentLine=1507331;
//BA.debugLineNum = 1507331;BA.debugLine="minuteTickStrokeWidth = minuteTickWidth";
__ref._minutetickstrokewidth /*float*/ = _minutetickwidth;
RDebugUtils.currentLine=1507332;
//BA.debugLineNum = 1507332;BA.debugLine="intervalArcStrokeWidth = intervalArcWidth";
__ref._intervalarcstrokewidth /*float*/ = _intervalarcwidth;
RDebugUtils.currentLine=1507333;
//BA.debugLineNum = 1507333;BA.debugLine="hourHandStrokeWidth = hourHandWidth";
__ref._hourhandstrokewidth /*float*/ = _hourhandwidth;
RDebugUtils.currentLine=1507334;
//BA.debugLineNum = 1507334;BA.debugLine="minuteHandStrokeWidth = minuteHandWidth";
__ref._minutehandstrokewidth /*float*/ = _minutehandwidth;
RDebugUtils.currentLine=1507335;
//BA.debugLineNum = 1507335;BA.debugLine="DrawClock";
__ref._drawclock /*String*/ (null);
RDebugUtils.currentLine=1507336;
//BA.debugLineNum = 1507336;BA.debugLine="End Sub";
return "";
}
public String _startclock(b4a.example.analogclock __ref) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "startclock", false))
{return ((String) Debug.delegate(ba, "startclock", null));}
anywheresoftware.b4a.objects.Timer _timer = null;
RDebugUtils.currentLine=1900544;
//BA.debugLineNum = 1900544;BA.debugLine="Public Sub StartClock";
RDebugUtils.currentLine=1900545;
//BA.debugLineNum = 1900545;BA.debugLine="Dim timer As Timer";
_timer = new anywheresoftware.b4a.objects.Timer();
RDebugUtils.currentLine=1900546;
//BA.debugLineNum = 1900546;BA.debugLine="timer.Initialize(\"timer\", 1000)";
_timer.Initialize(ba,"timer",(long) (1000));
RDebugUtils.currentLine=1900547;
//BA.debugLineNum = 1900547;BA.debugLine="timer.Enabled = True";
_timer.setEnabled(__c.True);
RDebugUtils.currentLine=1900548;
//BA.debugLineNum = 1900548;BA.debugLine="End Sub";
return "";
}
public String _timer_tick(b4a.example.analogclock __ref) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "timer_tick", false))
{return ((String) Debug.delegate(ba, "timer_tick", null));}
RDebugUtils.currentLine=1966080;
//BA.debugLineNum = 1966080;BA.debugLine="Private Sub timer_Tick";
RDebugUtils.currentLine=1966081;
//BA.debugLineNum = 1966081;BA.debugLine="DrawClock";
__ref._drawclock /*String*/ (null);
RDebugUtils.currentLine=1966082;
//BA.debugLineNum = 1966082;BA.debugLine="End Sub";
return "";
}
}

View File

@@ -0,0 +1,16 @@
package b4a.example.designerscripts;
import anywheresoftware.b4a.objects.TextViewWrapper;
import anywheresoftware.b4a.objects.ImageViewWrapper;
import anywheresoftware.b4a.BA;
public class LS_main_layout{
public static void LS_general(anywheresoftware.b4a.BA ba, android.view.View parent, anywheresoftware.b4a.keywords.LayoutValues lv, java.util.Map props,
java.util.Map<String, anywheresoftware.b4a.keywords.LayoutBuilder.ViewWrapperAndAnchor> views, int width, int height, float scale) throws Exception {
anywheresoftware.b4a.keywords.LayoutBuilder.setScaleRate(0.3);
//BA.debugLineNum = 2;BA.debugLine="AutoScaleAll"[Main_Layout/General script]
anywheresoftware.b4a.keywords.LayoutBuilder.scaleAll(views);
}
}

View File

@@ -0,0 +1,654 @@
package b4a.example;
import anywheresoftware.b4a.B4AMenuItem;
import android.app.Activity;
import android.os.Bundle;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BALayout;
import anywheresoftware.b4a.B4AActivity;
import anywheresoftware.b4a.ObjectWrapper;
import anywheresoftware.b4a.objects.ActivityWrapper;
import java.lang.reflect.InvocationTargetException;
import anywheresoftware.b4a.B4AUncaughtException;
import anywheresoftware.b4a.debug.*;
import java.lang.ref.WeakReference;
public class main extends Activity implements B4AActivity{
public static main mostCurrent;
static boolean afterFirstLayout;
static boolean isFirst = true;
private static boolean processGlobalsRun = false;
BALayout layout;
public static BA processBA;
BA activityBA;
ActivityWrapper _activity;
java.util.ArrayList<B4AMenuItem> menuItems;
public static final boolean fullScreen = false;
public static final boolean includeTitle = true;
public static WeakReference<Activity> previousOne;
public static boolean dontPause;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mostCurrent = this;
if (processBA == null) {
processBA = new anywheresoftware.b4a.ShellBA(this.getApplicationContext(), null, null, "b4a.example", "b4a.example.main");
processBA.loadHtSubs(this.getClass());
float deviceScale = getApplicationContext().getResources().getDisplayMetrics().density;
BALayout.setDeviceScale(deviceScale);
}
else if (previousOne != null) {
Activity p = previousOne.get();
if (p != null && p != this) {
BA.LogInfo("Killing previous instance (main).");
p.finish();
}
}
processBA.setActivityPaused(true);
processBA.runHook("oncreate", this, null);
if (!includeTitle) {
this.getWindow().requestFeature(android.view.Window.FEATURE_NO_TITLE);
}
if (fullScreen) {
getWindow().setFlags(android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN,
android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
processBA.sharedProcessBA.activityBA = null;
layout = new BALayout(this);
setContentView(layout);
afterFirstLayout = false;
WaitForLayout wl = new WaitForLayout();
if (anywheresoftware.b4a.objects.ServiceHelper.StarterHelper.startFromActivity(this, processBA, wl, false))
BA.handler.postDelayed(wl, 5);
}
static class WaitForLayout implements Runnable {
public void run() {
if (afterFirstLayout)
return;
if (mostCurrent == null)
return;
if (mostCurrent.layout.getWidth() == 0) {
BA.handler.postDelayed(this, 5);
return;
}
mostCurrent.layout.getLayoutParams().height = mostCurrent.layout.getHeight();
mostCurrent.layout.getLayoutParams().width = mostCurrent.layout.getWidth();
afterFirstLayout = true;
mostCurrent.afterFirstLayout();
}
}
private void afterFirstLayout() {
if (this != mostCurrent)
return;
activityBA = new BA(this, layout, processBA, "b4a.example", "b4a.example.main");
processBA.sharedProcessBA.activityBA = new java.lang.ref.WeakReference<BA>(activityBA);
anywheresoftware.b4a.objects.ViewWrapper.lastId = 0;
_activity = new ActivityWrapper(activityBA, "activity");
anywheresoftware.b4a.Msgbox.isDismissing = false;
if (BA.isShellModeRuntimeCheck(processBA)) {
if (isFirst)
processBA.raiseEvent2(null, true, "SHELL", false);
processBA.raiseEvent2(null, true, "CREATE", true, "b4a.example.main", processBA, activityBA, _activity, anywheresoftware.b4a.keywords.Common.Density, mostCurrent);
_activity.reinitializeForShell(activityBA, "activity");
}
initializeProcessGlobals();
initializeGlobals();
BA.LogInfo("** Activity (main) Create " + (isFirst ? "(first time)" : "") + " **");
processBA.raiseEvent2(null, true, "activity_create", false, isFirst);
isFirst = false;
if (this != mostCurrent)
return;
processBA.setActivityPaused(false);
BA.LogInfo("** Activity (main) Resume **");
processBA.raiseEvent(null, "activity_resume");
if (android.os.Build.VERSION.SDK_INT >= 11) {
try {
android.app.Activity.class.getMethod("invalidateOptionsMenu").invoke(this,(Object[]) null);
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void addMenuItem(B4AMenuItem item) {
if (menuItems == null)
menuItems = new java.util.ArrayList<B4AMenuItem>();
menuItems.add(item);
}
@Override
public boolean onCreateOptionsMenu(android.view.Menu menu) {
super.onCreateOptionsMenu(menu);
try {
if (processBA.subExists("activity_actionbarhomeclick")) {
Class.forName("android.app.ActionBar").getMethod("setHomeButtonEnabled", boolean.class).invoke(
getClass().getMethod("getActionBar").invoke(this), true);
}
} catch (Exception e) {
e.printStackTrace();
}
if (processBA.runHook("oncreateoptionsmenu", this, new Object[] {menu}))
return true;
if (menuItems == null)
return false;
for (B4AMenuItem bmi : menuItems) {
android.view.MenuItem mi = menu.add(bmi.title);
if (bmi.drawable != null)
mi.setIcon(bmi.drawable);
if (android.os.Build.VERSION.SDK_INT >= 11) {
try {
if (bmi.addToBar) {
android.view.MenuItem.class.getMethod("setShowAsAction", int.class).invoke(mi, 1);
}
} catch (Exception e) {
e.printStackTrace();
}
}
mi.setOnMenuItemClickListener(new B4AMenuItemsClickListener(bmi.eventName.toLowerCase(BA.cul)));
}
return true;
}
@Override
public boolean onOptionsItemSelected(android.view.MenuItem item) {
if (item.getItemId() == 16908332) {
processBA.raiseEvent(null, "activity_actionbarhomeclick");
return true;
}
else
return super.onOptionsItemSelected(item);
}
@Override
public boolean onPrepareOptionsMenu(android.view.Menu menu) {
super.onPrepareOptionsMenu(menu);
processBA.runHook("onprepareoptionsmenu", this, new Object[] {menu});
return true;
}
protected void onStart() {
super.onStart();
processBA.runHook("onstart", this, null);
}
protected void onStop() {
super.onStop();
processBA.runHook("onstop", this, null);
}
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (processBA.subExists("activity_windowfocuschanged"))
processBA.raiseEvent2(null, true, "activity_windowfocuschanged", false, hasFocus);
}
private class B4AMenuItemsClickListener implements android.view.MenuItem.OnMenuItemClickListener {
private final String eventName;
public B4AMenuItemsClickListener(String eventName) {
this.eventName = eventName;
}
public boolean onMenuItemClick(android.view.MenuItem item) {
processBA.raiseEventFromUI(item.getTitle(), eventName + "_click");
return true;
}
}
public static Class<?> getObject() {
return main.class;
}
private Boolean onKeySubExist = null;
private Boolean onKeyUpSubExist = null;
@Override
public boolean onKeyDown(int keyCode, android.view.KeyEvent event) {
if (processBA.runHook("onkeydown", this, new Object[] {keyCode, event}))
return true;
if (onKeySubExist == null)
onKeySubExist = processBA.subExists("activity_keypress");
if (onKeySubExist) {
if (keyCode == anywheresoftware.b4a.keywords.constants.KeyCodes.KEYCODE_BACK &&
android.os.Build.VERSION.SDK_INT >= 18) {
HandleKeyDelayed hk = new HandleKeyDelayed();
hk.kc = keyCode;
BA.handler.post(hk);
return true;
}
else {
boolean res = new HandleKeyDelayed().runDirectly(keyCode);
if (res)
return true;
}
}
return super.onKeyDown(keyCode, event);
}
private class HandleKeyDelayed implements Runnable {
int kc;
public void run() {
runDirectly(kc);
}
public boolean runDirectly(int keyCode) {
Boolean res = (Boolean)processBA.raiseEvent2(_activity, false, "activity_keypress", false, keyCode);
if (res == null || res == true) {
return true;
}
else if (keyCode == anywheresoftware.b4a.keywords.constants.KeyCodes.KEYCODE_BACK) {
finish();
return true;
}
return false;
}
}
@Override
public boolean onKeyUp(int keyCode, android.view.KeyEvent event) {
if (processBA.runHook("onkeyup", this, new Object[] {keyCode, event}))
return true;
if (onKeyUpSubExist == null)
onKeyUpSubExist = processBA.subExists("activity_keyup");
if (onKeyUpSubExist) {
Boolean res = (Boolean)processBA.raiseEvent2(_activity, false, "activity_keyup", false, keyCode);
if (res == null || res == true)
return true;
}
return super.onKeyUp(keyCode, event);
}
@Override
public void onNewIntent(android.content.Intent intent) {
super.onNewIntent(intent);
this.setIntent(intent);
processBA.runHook("onnewintent", this, new Object[] {intent});
}
@Override
public void onPause() {
super.onPause();
if (_activity == null)
return;
if (this != mostCurrent)
return;
anywheresoftware.b4a.Msgbox.dismiss(true);
if (!dontPause)
BA.LogInfo("** Activity (main) Pause, UserClosed = " + activityBA.activity.isFinishing() + " **");
else
BA.LogInfo("** Activity (main) Pause event (activity is not paused). **");
if (mostCurrent != null)
processBA.raiseEvent2(_activity, true, "activity_pause", false, activityBA.activity.isFinishing());
if (!dontPause) {
processBA.setActivityPaused(true);
mostCurrent = null;
}
if (!activityBA.activity.isFinishing())
previousOne = new WeakReference<Activity>(this);
anywheresoftware.b4a.Msgbox.isDismissing = false;
processBA.runHook("onpause", this, null);
}
@Override
public void onDestroy() {
super.onDestroy();
previousOne = null;
processBA.runHook("ondestroy", this, null);
}
@Override
public void onResume() {
super.onResume();
mostCurrent = this;
anywheresoftware.b4a.Msgbox.isDismissing = false;
if (activityBA != null) { //will be null during activity create (which waits for AfterLayout).
ResumeMessage rm = new ResumeMessage(mostCurrent);
BA.handler.post(rm);
}
processBA.runHook("onresume", this, null);
}
private static class ResumeMessage implements Runnable {
private final WeakReference<Activity> activity;
public ResumeMessage(Activity activity) {
this.activity = new WeakReference<Activity>(activity);
}
public void run() {
main mc = mostCurrent;
if (mc == null || mc != activity.get())
return;
processBA.setActivityPaused(false);
BA.LogInfo("** Activity (main) Resume **");
if (mc != mostCurrent)
return;
processBA.raiseEvent(mc._activity, "activity_resume", (Object[])null);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode,
android.content.Intent data) {
processBA.onActivityResult(requestCode, resultCode, data);
processBA.runHook("onactivityresult", this, new Object[] {requestCode, resultCode});
}
private static void initializeGlobals() {
processBA.raiseEvent2(null, true, "globals", false, (Object[])null);
}
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
for (int i = 0;i < permissions.length;i++) {
Object[] o = new Object[] {permissions[i], grantResults[i] == 0};
processBA.raiseEventFromDifferentThread(null,null, 0, "activity_permissionresult", true, o);
}
}
public static void initializeProcessGlobals() {
if (main.processGlobalsRun == false) {
main.processGlobalsRun = true;
try {
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
public static boolean isAnyActivityVisible() {
boolean vis = false;
vis = vis | (main.mostCurrent != null);
return vis;}
private static BA killProgramHelper(BA ba) {
if (ba == null)
return null;
anywheresoftware.b4a.BA.SharedProcessBA sharedProcessBA = ba.sharedProcessBA;
if (sharedProcessBA == null || sharedProcessBA.activityBA == null)
return null;
return sharedProcessBA.activityBA.get();
}
public static void killProgram() {
{
Activity __a = null;
if (main.previousOne != null) {
__a = main.previousOne.get();
}
else {
BA ba = killProgramHelper(main.mostCurrent == null ? null : main.mostCurrent.processBA);
if (ba != null) __a = ba.activity;
}
if (__a != null)
__a.finish();}
BA.applicationContext.stopService(new android.content.Intent(BA.applicationContext, starter.class));
}
public anywheresoftware.b4a.keywords.Common __c = null;
public static anywheresoftware.b4a.objects.Timer _timer1 = null;
public static boolean _running = false;
public static long _starttime = 0L;
public static long _elapsedtime = 0L;
public anywheresoftware.b4a.objects.drawable.CanvasWrapper _canvas1 = null;
public anywheresoftware.b4a.objects.PanelWrapper _panel1 = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btnstart = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btnpause = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btnreset = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btnsync = null;
public anywheresoftware.b4a.objects.LabelWrapper _lblelapsedtime = null;
public anywheresoftware.b4a.objects.PanelWrapper _pnlclock = null;
public b4a.example.analogclock _myclock = null;
public b4a.example.starter _starter = null;
public static String _activity_create(boolean _firsttime) throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "activity_create", false))
{return ((String) Debug.delegate(mostCurrent.activityBA, "activity_create", new Object[] {_firsttime}));}
RDebugUtils.currentLine=131072;
//BA.debugLineNum = 131072;BA.debugLine="Sub Activity_Create(FirstTime As Boolean)";
RDebugUtils.currentLine=131073;
//BA.debugLineNum = 131073;BA.debugLine="Activity.LoadLayout(\"Main_Layout\")";
mostCurrent._activity.LoadLayout("Main_Layout",mostCurrent.activityBA);
RDebugUtils.currentLine=131074;
//BA.debugLineNum = 131074;BA.debugLine="Log(\"Layout caricato correttamente.\")";
anywheresoftware.b4a.keywords.Common.LogImpl("3131074","Layout caricato correttamente.",0);
RDebugUtils.currentLine=131077;
//BA.debugLineNum = 131077;BA.debugLine="myClock.Initialize(pnlClock, 50) ' L'orologio avr";
mostCurrent._myclock._initialize /*String*/ (null,mostCurrent.activityBA,mostCurrent._pnlclock,(float) (50));
RDebugUtils.currentLine=131080;
//BA.debugLineNum = 131080;BA.debugLine="Timer1.Initialize(\"Timer1\", 1000) ' Aggiornamento";
_timer1.Initialize(processBA,"Timer1",(long) (1000));
RDebugUtils.currentLine=131081;
//BA.debugLineNum = 131081;BA.debugLine="Timer1.Enabled = True";
_timer1.setEnabled(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=131097;
//BA.debugLineNum = 131097;BA.debugLine="End Sub";
return "";
}
public static String _activity_pause(boolean _userclosed) throws Exception{
RDebugUtils.currentModule="main";
RDebugUtils.currentLine=327680;
//BA.debugLineNum = 327680;BA.debugLine="Sub Activity_Pause (UserClosed As Boolean)";
RDebugUtils.currentLine=327682;
//BA.debugLineNum = 327682;BA.debugLine="End Sub";
return "";
}
public static String _activity_resume() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "activity_resume", false))
{return ((String) Debug.delegate(mostCurrent.activityBA, "activity_resume", null));}
RDebugUtils.currentLine=262144;
//BA.debugLineNum = 262144;BA.debugLine="Sub Activity_Resume";
RDebugUtils.currentLine=262146;
//BA.debugLineNum = 262146;BA.debugLine="End Sub";
return "";
}
public static String _btnpause_click() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "btnpause_click", false))
{return ((String) Debug.delegate(mostCurrent.activityBA, "btnpause_click", null));}
RDebugUtils.currentLine=655360;
//BA.debugLineNum = 655360;BA.debugLine="Sub BtnPause_Click";
RDebugUtils.currentLine=655361;
//BA.debugLineNum = 655361;BA.debugLine="Running = False";
_running = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=655362;
//BA.debugLineNum = 655362;BA.debugLine="End Sub";
return "";
}
public static String _btnreset_click() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "btnreset_click", false))
{return ((String) Debug.delegate(mostCurrent.activityBA, "btnreset_click", null));}
RDebugUtils.currentLine=720896;
//BA.debugLineNum = 720896;BA.debugLine="Sub BtnReset_Click";
RDebugUtils.currentLine=720897;
//BA.debugLineNum = 720897;BA.debugLine="Running = False";
_running = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=720898;
//BA.debugLineNum = 720898;BA.debugLine="ElapsedTime = 0";
_elapsedtime = (long) (0);
RDebugUtils.currentLine=720899;
//BA.debugLineNum = 720899;BA.debugLine="lblElapsedTime.Text = \"Tempo: 00:00:00\"";
mostCurrent._lblelapsedtime.setText(BA.ObjectToCharSequence("Tempo: 00:00:00"));
RDebugUtils.currentLine=720900;
//BA.debugLineNum = 720900;BA.debugLine="End Sub";
return "";
}
public static String _btnstart_click() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "btnstart_click", false))
{return ((String) Debug.delegate(mostCurrent.activityBA, "btnstart_click", null));}
RDebugUtils.currentLine=589824;
//BA.debugLineNum = 589824;BA.debugLine="Sub BtnStart_Click";
RDebugUtils.currentLine=589825;
//BA.debugLineNum = 589825;BA.debugLine="If Not(Running) Then";
if (anywheresoftware.b4a.keywords.Common.Not(_running)) {
RDebugUtils.currentLine=589826;
//BA.debugLineNum = 589826;BA.debugLine="Running = True";
_running = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=589828;
//BA.debugLineNum = 589828;BA.debugLine="Timer1.Initialize(\"Timer1\",1000)";
_timer1.Initialize(processBA,"Timer1",(long) (1000));
RDebugUtils.currentLine=589830;
//BA.debugLineNum = 589830;BA.debugLine="Timer1.Enabled = True";
_timer1.setEnabled(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=589831;
//BA.debugLineNum = 589831;BA.debugLine="StartTime = DateTime.Now - ElapsedTime";
_starttime = (long) (anywheresoftware.b4a.keywords.Common.DateTime.getNow()-_elapsedtime);
};
RDebugUtils.currentLine=589833;
//BA.debugLineNum = 589833;BA.debugLine="End Sub";
return "";
}
public static String _btnsync_click() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "btnsync_click", false))
{return ((String) Debug.delegate(mostCurrent.activityBA, "btnsync_click", null));}
RDebugUtils.currentLine=786432;
//BA.debugLineNum = 786432;BA.debugLine="Sub BtnSync_Click";
RDebugUtils.currentLine=786433;
//BA.debugLineNum = 786433;BA.debugLine="SynchronizeClock";
_synchronizeclock();
RDebugUtils.currentLine=786434;
//BA.debugLineNum = 786434;BA.debugLine="End Sub";
return "";
}
public static String _synchronizeclock() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "synchronizeclock", false))
{return ((String) Debug.delegate(mostCurrent.activityBA, "synchronizeclock", null));}
RDebugUtils.currentLine=851968;
//BA.debugLineNum = 851968;BA.debugLine="Sub SynchronizeClock";
RDebugUtils.currentLine=851969;
//BA.debugLineNum = 851969;BA.debugLine="DrawClock";
_drawclock();
RDebugUtils.currentLine=851970;
//BA.debugLineNum = 851970;BA.debugLine="End Sub";
return "";
}
public static String _drawclock() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "drawclock", false))
{return ((String) Debug.delegate(mostCurrent.activityBA, "drawclock", null));}
long _now = 0L;
int _hours = 0;
int _minutes = 0;
int _seconds = 0;
int _x = 0;
int _y = 0;
int _radius = 0;
float _hourangle = 0f;
float _minuteangle = 0f;
float _secondangle = 0f;
RDebugUtils.currentLine=393216;
//BA.debugLineNum = 393216;BA.debugLine="Sub DrawClock";
RDebugUtils.currentLine=393217;
//BA.debugLineNum = 393217;BA.debugLine="Canvas1.Initialize(Activity)";
mostCurrent._canvas1.Initialize((android.view.View)(mostCurrent._activity.getObject()));
RDebugUtils.currentLine=393218;
//BA.debugLineNum = 393218;BA.debugLine="Dim now As Long = DateTime.Now";
_now = anywheresoftware.b4a.keywords.Common.DateTime.getNow();
RDebugUtils.currentLine=393219;
//BA.debugLineNum = 393219;BA.debugLine="Dim Hours As Int = DateTime.GetHour(now) Mod 1";
_hours = (int) (anywheresoftware.b4a.keywords.Common.DateTime.GetHour(_now)%12);
RDebugUtils.currentLine=393220;
//BA.debugLineNum = 393220;BA.debugLine="Dim Minutes As Int = DateTime.GetMinute(now)";
_minutes = anywheresoftware.b4a.keywords.Common.DateTime.GetMinute(_now);
RDebugUtils.currentLine=393221;
//BA.debugLineNum = 393221;BA.debugLine="Dim Seconds As Int = DateTime.GetSecond(now)";
_seconds = anywheresoftware.b4a.keywords.Common.DateTime.GetSecond(_now);
RDebugUtils.currentLine=393224;
//BA.debugLineNum = 393224;BA.debugLine="Dim x As Int = Activity.Width / 2";
_x = (int) (mostCurrent._activity.getWidth()/(double)2);
RDebugUtils.currentLine=393225;
//BA.debugLineNum = 393225;BA.debugLine="Dim y As Int = Activity.Height / 2";
_y = (int) (mostCurrent._activity.getHeight()/(double)2);
RDebugUtils.currentLine=393226;
//BA.debugLineNum = 393226;BA.debugLine="Dim Radius As Int = Min(x, y) - 10";
_radius = (int) (anywheresoftware.b4a.keywords.Common.Min(_x,_y)-10);
RDebugUtils.currentLine=393229;
//BA.debugLineNum = 393229;BA.debugLine="Canvas1.DrawColor(Colors.White)";
mostCurrent._canvas1.DrawColor(anywheresoftware.b4a.keywords.Common.Colors.White);
RDebugUtils.currentLine=393232;
//BA.debugLineNum = 393232;BA.debugLine="Canvas1.DrawCircle(x, y, Radius, Colors.Black,";
mostCurrent._canvas1.DrawCircle((float) (_x),(float) (_y),(float) (_radius),anywheresoftware.b4a.keywords.Common.Colors.Black,anywheresoftware.b4a.keywords.Common.False,(float) (5));
RDebugUtils.currentLine=393235;
//BA.debugLineNum = 393235;BA.debugLine="Dim HourAngle As Float = -90 + Hours * 30 + Mi";
_hourangle = (float) (-90+_hours*30+_minutes/(double)2);
RDebugUtils.currentLine=393236;
//BA.debugLineNum = 393236;BA.debugLine="DrawHand(x, y, Radius * 0.5, HourAngle, 8, Col";
_drawhand(_x,_y,(float) (_radius*0.5),_hourangle,(int) (8),anywheresoftware.b4a.keywords.Common.Colors.Black);
RDebugUtils.currentLine=393239;
//BA.debugLineNum = 393239;BA.debugLine="Dim MinuteAngle As Float = -90 + Minutes * 6";
_minuteangle = (float) (-90+_minutes*6);
RDebugUtils.currentLine=393240;
//BA.debugLineNum = 393240;BA.debugLine="DrawHand(x, y, Radius * 0.7, MinuteAngle, 5, C";
_drawhand(_x,_y,(float) (_radius*0.7),_minuteangle,(int) (5),anywheresoftware.b4a.keywords.Common.Colors.Blue);
RDebugUtils.currentLine=393243;
//BA.debugLineNum = 393243;BA.debugLine="Dim SecondAngle As Float = -90 + Seconds * 6";
_secondangle = (float) (-90+_seconds*6);
RDebugUtils.currentLine=393244;
//BA.debugLineNum = 393244;BA.debugLine="DrawHand(x, y, Radius * 0.9, SecondAngle, 2, C";
_drawhand(_x,_y,(float) (_radius*0.9),_secondangle,(int) (2),anywheresoftware.b4a.keywords.Common.Colors.Red);
RDebugUtils.currentLine=393245;
//BA.debugLineNum = 393245;BA.debugLine="End Sub";
return "";
}
public static String _drawhand(int _x,int _y,float _length,float _angle,int _width,int _color) throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "drawhand", false))
{return ((String) Debug.delegate(mostCurrent.activityBA, "drawhand", new Object[] {_x,_y,_length,_angle,_width,_color}));}
float _endx = 0f;
float _endy = 0f;
RDebugUtils.currentLine=458752;
//BA.debugLineNum = 458752;BA.debugLine="Sub DrawHand(x As Int, y As Int, length As Float,";
RDebugUtils.currentLine=458753;
//BA.debugLineNum = 458753;BA.debugLine="Dim endX As Float = x + length * CosD(angle)";
_endx = (float) (_x+_length*anywheresoftware.b4a.keywords.Common.CosD(_angle));
RDebugUtils.currentLine=458754;
//BA.debugLineNum = 458754;BA.debugLine="Dim endY As Float = y + length * SinD(angle)";
_endy = (float) (_y+_length*anywheresoftware.b4a.keywords.Common.SinD(_angle));
RDebugUtils.currentLine=458755;
//BA.debugLineNum = 458755;BA.debugLine="Canvas1.DrawLine(x, y, endX, endY, color, widt";
mostCurrent._canvas1.DrawLine((float) (_x),(float) (_y),_endx,_endy,_color,(float) (_width));
RDebugUtils.currentLine=458756;
//BA.debugLineNum = 458756;BA.debugLine="End Sub";
return "";
}
public static String _formatelapsedtime(long _ms) throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "formatelapsedtime", false))
{return ((String) Debug.delegate(mostCurrent.activityBA, "formatelapsedtime", new Object[] {_ms}));}
int _seconds = 0;
int _minutes = 0;
int _hours = 0;
RDebugUtils.currentLine=524288;
//BA.debugLineNum = 524288;BA.debugLine="Sub FormatElapsedTime(ms As Long) As String";
RDebugUtils.currentLine=524289;
//BA.debugLineNum = 524289;BA.debugLine="Dim seconds As Int = ms / 1000";
_seconds = (int) (_ms/(double)1000);
RDebugUtils.currentLine=524290;
//BA.debugLineNum = 524290;BA.debugLine="Dim minutes As Int = seconds / 60";
_minutes = (int) (_seconds/(double)60);
RDebugUtils.currentLine=524291;
//BA.debugLineNum = 524291;BA.debugLine="Dim hours As Int = minutes / 60";
_hours = (int) (_minutes/(double)60);
RDebugUtils.currentLine=524292;
//BA.debugLineNum = 524292;BA.debugLine="seconds = seconds Mod 60";
_seconds = (int) (_seconds%60);
RDebugUtils.currentLine=524293;
//BA.debugLineNum = 524293;BA.debugLine="minutes = minutes Mod 60";
_minutes = (int) (_minutes%60);
RDebugUtils.currentLine=524294;
//BA.debugLineNum = 524294;BA.debugLine="Return NumberFormat(hours, 2, 0) & \":\" & Numbe";
if (true) return anywheresoftware.b4a.keywords.Common.NumberFormat(_hours,(int) (2),(int) (0))+":"+anywheresoftware.b4a.keywords.Common.NumberFormat(_minutes,(int) (2),(int) (0))+":"+anywheresoftware.b4a.keywords.Common.NumberFormat(_seconds,(int) (2),(int) (0));
RDebugUtils.currentLine=524295;
//BA.debugLineNum = 524295;BA.debugLine="End Sub";
return "";
}
public static String _timer1_tick() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "timer1_tick", false))
{return ((String) Debug.delegate(mostCurrent.activityBA, "timer1_tick", null));}
RDebugUtils.currentLine=196608;
//BA.debugLineNum = 196608;BA.debugLine="Sub Timer1_Tick";
RDebugUtils.currentLine=196609;
//BA.debugLineNum = 196609;BA.debugLine="myClock.DrawClock";
mostCurrent._myclock._drawclock /*String*/ (null);
RDebugUtils.currentLine=196610;
//BA.debugLineNum = 196610;BA.debugLine="End Sub";
return "";
}
}

View File

@@ -0,0 +1,197 @@
package b4a.example;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.objects.ServiceHelper;
import anywheresoftware.b4a.debug.*;
public class starter extends android.app.Service{
public static class starter_BR extends android.content.BroadcastReceiver {
@Override
public void onReceive(android.content.Context context, android.content.Intent intent) {
BA.LogInfo("** Receiver (starter) OnReceive **");
android.content.Intent in = new android.content.Intent(context, starter.class);
if (intent != null)
in.putExtra("b4a_internal_intent", intent);
ServiceHelper.StarterHelper.startServiceFromReceiver (context, in, true, anywheresoftware.b4a.ShellBA.class);
}
}
static starter mostCurrent;
public static BA processBA;
private ServiceHelper _service;
public static Class<?> getObject() {
return starter.class;
}
@Override
public void onCreate() {
super.onCreate();
mostCurrent = this;
if (processBA == null) {
processBA = new anywheresoftware.b4a.ShellBA(this, null, null, "b4a.example", "b4a.example.starter");
if (BA.isShellModeRuntimeCheck(processBA)) {
processBA.raiseEvent2(null, true, "SHELL", false);
}
try {
Class.forName(BA.applicationContext.getPackageName() + ".main").getMethod("initializeProcessGlobals").invoke(null, null);
} catch (Exception e) {
throw new RuntimeException(e);
}
processBA.loadHtSubs(this.getClass());
ServiceHelper.init();
}
_service = new ServiceHelper(this);
processBA.service = this;
if (BA.isShellModeRuntimeCheck(processBA)) {
processBA.raiseEvent2(null, true, "CREATE", true, "b4a.example.starter", processBA, _service, anywheresoftware.b4a.keywords.Common.Density);
}
if (!true && ServiceHelper.StarterHelper.startFromServiceCreate(processBA, false) == false) {
}
else {
processBA.setActivityPaused(false);
BA.LogInfo("*** Service (starter) Create ***");
processBA.raiseEvent(null, "service_create");
}
processBA.runHook("oncreate", this, null);
if (true) {
if (ServiceHelper.StarterHelper.runWaitForLayouts() == false) {
BA.LogInfo("stopping spontaneous created service");
stopSelf();
}
}
}
@Override
public void onStart(android.content.Intent intent, int startId) {
onStartCommand(intent, 0, 0);
}
@Override
public int onStartCommand(final android.content.Intent intent, int flags, int startId) {
if (ServiceHelper.StarterHelper.onStartCommand(processBA, new Runnable() {
public void run() {
handleStart(intent);
}}))
;
else {
ServiceHelper.StarterHelper.addWaitForLayout (new Runnable() {
public void run() {
processBA.setActivityPaused(false);
BA.LogInfo("** Service (starter) Create **");
processBA.raiseEvent(null, "service_create");
handleStart(intent);
ServiceHelper.StarterHelper.removeWaitForLayout();
}
});
}
processBA.runHook("onstartcommand", this, new Object[] {intent, flags, startId});
return android.app.Service.START_NOT_STICKY;
}
public void onTaskRemoved(android.content.Intent rootIntent) {
super.onTaskRemoved(rootIntent);
if (true)
processBA.raiseEvent(null, "service_taskremoved");
}
private void handleStart(android.content.Intent intent) {
BA.LogInfo("** Service (starter) Start **");
java.lang.reflect.Method startEvent = processBA.htSubs.get("service_start");
if (startEvent != null) {
if (startEvent.getParameterTypes().length > 0) {
anywheresoftware.b4a.objects.IntentWrapper iw = ServiceHelper.StarterHelper.handleStartIntent(intent, _service, processBA);
processBA.raiseEvent(null, "service_start", iw);
}
else {
processBA.raiseEvent(null, "service_start");
}
}
}
public void onTimeout(int startId) {
BA.LogInfo("** Service (starter) Timeout **");
anywheresoftware.b4a.objects.collections.Map params = new anywheresoftware.b4a.objects.collections.Map();
params.Initialize();
params.Put("StartId", startId);
processBA.raiseEvent(null, "service_timeout", params);
}
@Override
public void onDestroy() {
super.onDestroy();
if (true) {
BA.LogInfo("** Service (starter) Destroy (ignored)**");
}
else {
BA.LogInfo("** Service (starter) Destroy **");
processBA.raiseEvent(null, "service_destroy");
processBA.service = null;
mostCurrent = null;
processBA.setActivityPaused(true);
processBA.runHook("ondestroy", this, null);
}
}
@Override
public android.os.IBinder onBind(android.content.Intent intent) {
return null;
}
public anywheresoftware.b4a.keywords.Common __c = null;
public b4a.example.main _main = null;
public static boolean _application_error(anywheresoftware.b4a.objects.B4AException _error,String _stacktrace) throws Exception{
RDebugUtils.currentModule="starter";
if (Debug.shouldDelegate(processBA, "application_error", false))
{return ((Boolean) Debug.delegate(processBA, "application_error", new Object[] {_error,_stacktrace}));}
RDebugUtils.currentLine=1179648;
//BA.debugLineNum = 1179648;BA.debugLine="Sub Application_Error (Error As Exception, StackTr";
RDebugUtils.currentLine=1179649;
//BA.debugLineNum = 1179649;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=1179650;
//BA.debugLineNum = 1179650;BA.debugLine="End Sub";
return false;
}
public static String _service_create() throws Exception{
RDebugUtils.currentModule="starter";
if (Debug.shouldDelegate(processBA, "service_create", false))
{return ((String) Debug.delegate(processBA, "service_create", null));}
RDebugUtils.currentLine=983040;
//BA.debugLineNum = 983040;BA.debugLine="Sub Service_Create";
RDebugUtils.currentLine=983044;
//BA.debugLineNum = 983044;BA.debugLine="End Sub";
return "";
}
public static String _service_destroy() throws Exception{
RDebugUtils.currentModule="starter";
if (Debug.shouldDelegate(processBA, "service_destroy", false))
{return ((String) Debug.delegate(processBA, "service_destroy", null));}
RDebugUtils.currentLine=1245184;
//BA.debugLineNum = 1245184;BA.debugLine="Sub Service_Destroy";
RDebugUtils.currentLine=1245186;
//BA.debugLineNum = 1245186;BA.debugLine="End Sub";
return "";
}
public static String _service_start(anywheresoftware.b4a.objects.IntentWrapper _startingintent) throws Exception{
RDebugUtils.currentModule="starter";
if (Debug.shouldDelegate(processBA, "service_start", false))
{return ((String) Debug.delegate(processBA, "service_start", new Object[] {_startingintent}));}
RDebugUtils.currentLine=1048576;
//BA.debugLineNum = 1048576;BA.debugLine="Sub Service_Start (StartingIntent As Intent)";
RDebugUtils.currentLine=1048577;
//BA.debugLineNum = 1048577;BA.debugLine="Service.StopAutomaticForeground 'Starter service";
mostCurrent._service.StopAutomaticForeground();
RDebugUtils.currentLine=1048578;
//BA.debugLineNum = 1048578;BA.debugLine="End Sub";
return "";
}
public static String _service_taskremoved() throws Exception{
RDebugUtils.currentModule="starter";
if (Debug.shouldDelegate(processBA, "service_taskremoved", false))
{return ((String) Debug.delegate(processBA, "service_taskremoved", null));}
RDebugUtils.currentLine=1114112;
//BA.debugLineNum = 1114112;BA.debugLine="Sub Service_TaskRemoved";
RDebugUtils.currentLine=1114114;
//BA.debugLineNum = 1114114;BA.debugLine="End Sub";
return "";
}
}

39
refusi/Starter.bas Normal file
View File

@@ -0,0 +1,39 @@
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Service
Version=9.9
@EndOfDesignText@
#Region Service Attributes
#StartAtBoot: False
#ExcludeFromLibrary: 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
Sub Service_Create
'This is the program entry point.
'This is a good place to load resources that are not specific to a single activity.
End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
End Sub
Sub Service_TaskRemoved
'This event will be raised when the user removes the app from the recent apps list.
End Sub
'Return true To allow the OS default exceptions handler To handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub Service_Destroy
End Sub

View File

@@ -0,0 +1,202 @@
Build1=Default,b4a.example
File1=Main_Layout.bal
FileGroup1=Default Group
Group=Default Group
Library1=core
Library2=xui
ManifestCode='This code will be applied to the manifest file during compilation.~\n~'You do not need to modify it in most cases.~\n~'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136~\n~AddManifestText(~\n~<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34"/>~\n~<supports-screens android:largeScreens="true" ~\n~ android:normalScreens="true" ~\n~ android:smallScreens="true" ~\n~ android:anyDensity="true"/>)~\n~SetApplicationAttribute(android:icon, "@drawable/icon")~\n~SetApplicationAttribute(android:label, "$LABEL$")~\n~CreateResourceFromFile(Macro, Themes.LightTheme)~\n~'End of default text.~\n~
Module1=AnalogClock
Module2=Starter
NumberOfFiles=1
NumberOfLibraries=2
NumberOfModules=2
Version=13
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Orologio Analogico
#VersionCode: 1
#VersionName: 1.0
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
Private Timer1 As Timer
Private Running As Boolean = False
Private StartTime As Long = 0
Private ElapsedTime As Long = 0
End Sub
Sub Globals
Private Canvas1 As Canvas
Private Panel1 As Panel
Private BtnStart As Button
Private BtnPause As Button
Private BtnReset As Button
Private BtnSync As Button
Private lblElapsedTime As Label
Private pnlClock As Panel
Private Timer1 As Timer
Private myClock As AnalogClock
Log("lblElapsedTime nel Sub Globals: " & lblElapsedTime.IsInitialized)
End Sub
'Sub Activity_Create(FirstTime As Boolean)
' Activity.LoadLayout("Main_Layout") 'Layout file to be created in the designer.
' Log("Layout caricato correttamente.")
'
' ' Impostazioni Timer
' Log("Panel1 inizializzato: " & Panel1.IsInitialized)
' Log("Numero di viste in Panel1: " & Panel1.NumberOfViews)
'
' ' Sincronizza inizialmente
' SynchronizeClock
'End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main_Layout")
Log("Layout caricato correttamente.")
'Inizializza l'orologio
myClock.Initialize(pnlClock, 50) ' L'orologio avrà un diametro pari al 50% della larghezza del pannello
' Imposta il timer per aggiornare l'orologio
Timer1.Initialize("Timer1", 1000) ' Aggiornamento ogni secondo
Timer1.Enabled = True
' ' Cerca tra tutte le viste dell'Activity
' For i = 0 To Activity.NumberOfViews - 1
' Dim v As View = Activity.GetView(i)
' Log("Vista trovata: " & v)
'
' ' Controlla se la vista è un Label
' If v Is Label Then
' Dim tempLabel As Label = v
' Log("Label trovato: " & tempLabel.Text)
' If tempLabel.Text = "Tempo: 00:00:00" Then ' Verifica basata sul testo iniziale
' lblElapsedTime = tempLabel
' Log("lblElapsedTime assegnato correttamente!")
' End If
' End If
' Next
End Sub
Sub Timer1_Tick
myClock.DrawClock
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
' Disegna l'orologio
Sub DrawClock
Canvas1.Initialize(Activity)
Dim now As Long = DateTime.Now
Dim Hours As Int = DateTime.GetHour(now) Mod 12
Dim Minutes As Int = DateTime.GetMinute(now)
Dim Seconds As Int = DateTime.GetSecond(now)
' Centro
Dim x As Int = Activity.Width / 2
Dim y As Int = Activity.Height / 2
Dim Radius As Int = Min(x, y) - 10
' Cancella il canvas
Canvas1.DrawColor(Colors.White)
' Cerchio esterno
Canvas1.DrawCircle(x, y, Radius, Colors.Black, False, 5)
' Lancetta ore
Dim HourAngle As Float = -90 + Hours * 30 + Minutes / 2
DrawHand(x, y, Radius * 0.5, HourAngle, 8, Colors.Black)
' Lancetta minuti
Dim MinuteAngle As Float = -90 + Minutes * 6
DrawHand(x, y, Radius * 0.7, MinuteAngle, 5, Colors.Blue)
' Lancetta secondi
Dim SecondAngle As Float = -90 + Seconds * 6
DrawHand(x, y, Radius * 0.9, SecondAngle, 2, Colors.Red)
End Sub
Sub DrawHand(x As Int, y As Int, length As Float, angle As Float, width As Int, color As Int)
Dim endX As Float = x + length * CosD(angle)
Dim endY As Float = y + length * SinD(angle)
Canvas1.DrawLine(x, y, endX, endY, color, width)
End Sub
' Aggiorna l'orologio e il cronometro
'Sub Timer1_Tick
' DrawClock
' If lblElapsedTime.IsInitialized Then
' DrawClock
' If Running Then
' ElapsedTime = DateTime.Now - StartTime
' lblElapsedTime.Text = "Tempo: " & FormatElapsedTime(ElapsedTime)
' End If
' Else
' Log("lblElapsedTime non è inizializzato.")
' End If
'
'
'
'
'End Sub
' Formatta il tempo in HH:MM:SS
Sub FormatElapsedTime(ms As Long) As String
Dim seconds As Int = ms / 1000
Dim minutes As Int = seconds / 60
Dim hours As Int = minutes / 60
seconds = seconds Mod 60
minutes = minutes Mod 60
Return NumberFormat(hours, 2, 0) & ":" & NumberFormat(minutes, 2, 0) & ":" & NumberFormat(seconds, 2, 0)
End Sub
' Pulsante Start
Sub BtnStart_Click
If Not(Running) Then
Running = True
Timer1.Initialize("Timer1",1000)
Timer1.Enabled = True
StartTime = DateTime.Now - ElapsedTime
End If
End Sub
' Pulsante Pause
Sub BtnPause_Click
Running = False
End Sub
' Pulsante Reset
Sub BtnReset_Click
Running = False
ElapsedTime = 0
lblElapsedTime.Text = "Tempo: 00:00:00"
End Sub
' Pulsante Sync
Sub BtnSync_Click
SynchronizeClock
End Sub
' Sincronizza l'orologio
Sub SynchronizeClock
DrawClock
End Sub

View File

@@ -0,0 +1,12 @@
ModuleBookmarks0=
ModuleBookmarks1=
ModuleBookmarks2=
ModuleBreakpoints0=
ModuleBreakpoints1=
ModuleBreakpoints2=
ModuleClosedNodes0=
ModuleClosedNodes1=
ModuleClosedNodes2=
NavigationStack=Main,Activity_Create,74,0,Designer Visuale,Main_Layout.bal,-100,3,Main,DrawHand,140,0,AnalogClock,AddInterval,150,0,AnalogClock,DrawInterval,151,0,AnalogClock,Class_Globals,2,0,AnalogClock,SetStrokeWidths,46,0,AnalogClock,ClearCanvas,48,0,AnalogClock,DrawClock,57,1,Main,Globals,36,0
SelectedBuild=0
VisibleModules=2,1