diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..013466d --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +build-b4a.log +install-b4a.log +run-b4a.log +emulator-*.png +Objects/b4a_orologio_marcatempo.apk +Objects/bin/temp.ap_ +Objects/classes.dex +Objects/d8_arguments.txt diff --git a/AnalogClock.bas b/AnalogClock.bas index 105c6bd..1c0bfe3 100644 --- a/AnalogClock.bas +++ b/AnalogClock.bas @@ -12,7 +12,7 @@ Sub Class_Globals 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 + Private segments As List ' Segmenti cronologici registrati ' Parametri di spessore Private quadrantStrokeWidth As Float = 5dip @@ -21,40 +21,64 @@ Sub Class_Globals Private intervalArcStrokeWidth As Float = 5dip Private hourHandStrokeWidth As Float = 8dip Private minuteHandStrokeWidth As Float = 5dip - Private intervals As List + Private baseDurationMs As Long + Private activeDurationMs As Long + Private activeColor As Int + Private activeIsPause As Boolean + Private hasActiveSegment As Boolean End Sub ' Inizializza l'orologio Public Sub Initialize(ParentPanel As Panel, PercentageOfWidth As Float) pnlClock = ParentPanel cvsClock.Initialize(pnlClock) - intervals.Initialize - Dim interval As Map - interval.Initialize - interval.Put("startHour", 8) - interval.Put("startMinute", 0) - interval.Put("endHour", 12) - interval.Put("endMinute", 0) - interval.Put("color", Colors.Magenta) - interval.Put("radius",(clockDiameter/2 +25dip)) - interval.Put("strokeWidth", 5dip) - interval.Put("period", "mattino") - intervals.Add(interval) - - interval.Initialize - interval.Put("startHour", 13) - interval.Put("startMinute", 0) - interval.Put("endHour", 17) - interval.Put("endMinute", 0) - interval.Put("color", Colors.Green) - interval.Put("radius", (clockDiameter/2 )+25dip) - interval.Put("strokeWidth", 5dip) - interval.Put("period", "pomeriggio") - intervals.Add(interval) - + segments.Initialize + baseDurationMs = 12 * DateTime.TicksPerHour SetClockSize(PercentageOfWidth) End Sub +' Imposta la durata piena del quadrante. Le pause gialle vengono aggiunte a parte. +Public Sub SetBaseDuration(DurationMs As Long) + baseDurationMs = DurationMs + DrawClock +End Sub + +' Rimuove tutti i segmenti registrati. +Public Sub ClearSegments + If segments.IsInitialized = False Then segments.Initialize + segments.Clear + hasActiveSegment = False + activeDurationMs = 0 + DrawClock +End Sub + +' Aggiunge un segmento concluso. +Public Sub AddSegment(DurationMs As Long, SegmentColor As Int, IsPause As Boolean) + If DurationMs <= 0 Then Return + Dim segment As Map + segment.Initialize + segment.Put("duration", DurationMs) + segment.Put("color", SegmentColor) + segment.Put("pause", IsPause) + segments.Add(segment) + DrawClock +End Sub + +' Imposta il segmento in corso, non ancora concluso. +Public Sub SetActiveSegment(DurationMs As Long, SegmentColor As Int, IsPause As Boolean) + activeDurationMs = Max(0, DurationMs) + activeColor = SegmentColor + activeIsPause = IsPause + hasActiveSegment = activeDurationMs > 0 + DrawClock +End Sub + +Public Sub ClearActiveSegment + hasActiveSegment = False + activeDurationMs = 0 + DrawClock +End Sub + ' Imposta la dimensione dell'orologio come percentuale della larghezza del pannello Public Sub SetClockSize(PercentageOfWidth As Float) clockDiameter = pnlClock.Width * PercentageOfWidth / 100 @@ -90,14 +114,12 @@ Public Sub DrawClock ' Disegna il cerchio esterno cvsClock.DrawCircle(centerX, centerY, clockDiameter / 2, Colors.Black, False, quadrantStrokeWidth) + ' Disegna i segmenti di lavoro / pausa / straordinario + DrawSegments + ' 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 @@ -120,6 +142,51 @@ Public Sub DrawClock pnlClock.Invalidate End Sub +Private Sub DrawSegments + If segments.IsInitialized = False Then Return + Dim totalPauseMs As Long = 0 + Dim totalRecordedMs As Long = 0 + For Each segment As Map In segments + Dim duration As Long = segment.Get("duration") + totalRecordedMs = totalRecordedMs + duration + If segment.Get("pause") = True Then totalPauseMs = totalPauseMs + duration + Next + If hasActiveSegment Then + totalRecordedMs = totalRecordedMs + activeDurationMs + If activeIsPause Then totalPauseMs = totalPauseMs + activeDurationMs + End If + + Dim totalDisplayMs As Long = Max(baseDurationMs, totalRecordedMs) + If totalDisplayMs <= 0 Then Return + + Dim startAngle As Float = -90 + Dim radius As Float = clockDiameter / 2 - 22dip + For Each segment As Map In segments + Dim sweepAngle As Float = 360 * segment.Get("duration") / totalDisplayMs + DrawPieSegment(startAngle, sweepAngle, segment.Get("color"), radius) + startAngle = startAngle + sweepAngle + Next + If hasActiveSegment Then + Dim activeSweepAngle As Float = 360 * activeDurationMs / totalDisplayMs + DrawPieSegment(startAngle, activeSweepAngle, activeColor, radius) + End If +End Sub + +Private Sub DrawPieSegment(startAngle As Float, sweepAngle As Float, color As Int, radius As Float) + If sweepAngle <= 0 Then Return + Dim steps As Int = Max(2, Ceil(sweepAngle / 4)) + Dim path As B4XPath + path.Initialize(centerX, centerY) + For i = 0 To steps + Dim angle As Float = startAngle + sweepAngle * i / steps + Dim x As Float = centerX + radius * CosD(angle) + Dim y As Float = centerY + radius * SinD(angle) + path.LineTo(x, y) + Next + path.LineTo(centerX, centerY) + cvsClock.DrawPath(path, color, True, 0) +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) @@ -152,43 +219,6 @@ Private Sub DrawTicks 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 diff --git a/Localization.bas b/Localization.bas new file mode 100644 index 0000000..69c9dd9 --- /dev/null +++ b/Localization.bas @@ -0,0 +1,292 @@ +B4A=true +Group=Default Group +ModulesStructureVersion=1 +Type=StaticCode +Version=13 +@EndOfDesignText@ + +Sub Process_Globals + Private translations As Map + Private currentLanguage As String + Private initialized As Boolean +End Sub + +Public Sub Initialize + If initialized Then Return + translations.Initialize + LoadLanguage("en", CreateEnglishMap) + LoadLanguage("it", CreateItalianMap) + LoadLanguage("fr", CreateFrenchMap) + LoadLanguage("de", CreateGermanMap) + LoadLanguage("es", CreateSpanishMap) + currentLanguage = NormalizeLanguage(DetectDeviceLanguage) + initialized = True +End Sub + +Public Sub T(Key As String) As String + If initialized = False Then Initialize + Dim languageMap As Map = translations.Get(currentLanguage) + If languageMap.IsInitialized And languageMap.ContainsKey(Key) Then Return languageMap.Get(Key) + Dim fallback As Map = translations.Get("en") + If fallback.IsInitialized And fallback.ContainsKey(Key) Then Return fallback.Get(Key) + Return Key +End Sub + +Public Sub CurrentLanguageCode As String + If initialized = False Then Initialize + Return currentLanguage +End Sub + +Private Sub LoadLanguage(Code As String, Values As Map) + translations.Put(Code, Values) +End Sub + +Private Sub NormalizeLanguage(Code As String) As String + Code = Code.ToLowerCase + Select True + Case Code.StartsWith("it") + Return "it" + Case Code.StartsWith("fr") + Return "fr" + Case Code.StartsWith("de") + Return "de" + Case Code.StartsWith("es") + Return "es" + Case Else + Return "en" + End Select +End Sub + +Private Sub DetectDeviceLanguage As String + Dim context As JavaObject + context.InitializeContext + Dim resources As JavaObject = context.RunMethod("getResources", Null) + Dim configuration As JavaObject = resources.RunMethod("getConfiguration", Null) + Dim locale As JavaObject = configuration.GetField("locale") + Dim code As String = locale.RunMethod("getLanguage", Null) + If code <> "" Then Return code + Dim jo As JavaObject + jo.InitializeStatic("java.util.Locale") + locale = jo.RunMethod("getDefault", Null) + Return locale.RunMethod("getLanguage", Null) +End Sub + +Private Sub CreateEnglishMap As Map + Dim m As Map + m.Initialize + m.Put("app_title", "Overtime Guard") + m.Put("start", "Start") + m.Put("end", "End") + m.Put("pause", "Pause") + m.Put("end_pause", "End pause") + m.Put("stats", "Stats") + m.Put("config", "Config") + m.Put("bg", "Bg") + m.Put("statistics", "Statistics") + m.Put("close", "Close") + m.Put("work_start", "Work start") + m.Put("pause_start", "Pause start") + m.Put("pause_end", "Pause end") + m.Put("work_end", "Work end") + m.Put("set_config", "Set config") + m.Put("reset_config", "Reset config") + m.Put("clear_today", "Clear today") + m.Put("date", "Date") + m.Put("work", "Work") + m.Put("pause_col", "Pause") + m.Put("overtime", "Overtime") + m.Put("totals", "Totals") + m.Put("manual_mode", "Manual mode") + m.Put("auto_recording", "Auto: recording...") + m.Put("auto_paused", "Auto: paused...") + m.Put("auto_stopped", "Auto: stopped...") + m.Put("use_hhmm", "Use HH:MM times.") + m.Put("times_order", "Times must be in order.") + m.Put("work_exceed", "Configured work cannot exceed 8 hours.") + m.Put("auto_enabled", "Automatic config enabled.") + m.Put("auto_disabled", "Automatic config disabled.") + m.Put("no_day_to_clear", "No day to clear.") + m.Put("clear_today_title", "Clear today") + m.Put("clear_today_confirm", "Clear all recorded data for") + m.Put("clear_button", "Clear") + m.Put("cancel", "Cancel") + m.Put("today_cleared", "Today cleared.") + m.Put("limit_reached", "9-hour limit already reached for this workday.") + Return m +End Sub + +Private Sub CreateItalianMap As Map + Dim m As Map + m.Initialize + m.Put("app_title", "Overtime Guard") + m.Put("start", "Start") + m.Put("end", "End") + m.Put("pause", "Pausa") + m.Put("end_pause", "Fine pausa") + m.Put("stats", "Statistiche") + m.Put("config", "Config") + m.Put("bg", "Sfondo") + m.Put("statistics", "Statistiche") + m.Put("close", "Chiudi") + m.Put("work_start", "Inizio lavoro") + m.Put("pause_start", "Inizio pausa") + m.Put("pause_end", "Fine pausa") + m.Put("work_end", "Fine lavoro") + m.Put("set_config", "Imposta config") + m.Put("reset_config", "Reset config") + m.Put("clear_today", "Azzera oggi") + m.Put("date", "Data") + m.Put("work", "Lavoro") + m.Put("pause_col", "Pausa") + m.Put("overtime", "Straord.") + m.Put("totals", "Totali") + m.Put("manual_mode", "Modalita manuale") + m.Put("auto_recording", "Auto: registrazione...") + m.Put("auto_paused", "Auto: pausa...") + m.Put("auto_stopped", "Auto: fermo...") + m.Put("use_hhmm", "Usa orari HH:MM.") + m.Put("times_order", "Gli orari devono essere in ordine.") + m.Put("work_exceed", "Il lavoro configurato non puo superare 8 ore.") + m.Put("auto_enabled", "Configurazione automatica attiva.") + m.Put("auto_disabled", "Configurazione automatica disattivata.") + m.Put("no_day_to_clear", "Nessun giorno da azzerare.") + m.Put("clear_today_title", "Azzera oggi") + m.Put("clear_today_confirm", "Cancellare tutti i dati registrati per") + m.Put("clear_button", "Azzera") + m.Put("cancel", "Annulla") + m.Put("today_cleared", "Giornata azzerata.") + m.Put("limit_reached", "Limite di 9 ore gia raggiunto per questa giornata.") + Return m +End Sub + +Private Sub CreateFrenchMap As Map + Dim m As Map + m.Initialize + m.Put("app_title", "Overtime Guard") + m.Put("start", "Demarrer") + m.Put("end", "Arreter") + m.Put("pause", "Pause") + m.Put("end_pause", "Fin pause") + m.Put("stats", "Stats") + m.Put("config", "Config") + m.Put("bg", "Fond") + m.Put("statistics", "Statistiques") + m.Put("close", "Fermer") + m.Put("work_start", "Debut travail") + m.Put("pause_start", "Debut pause") + m.Put("pause_end", "Fin pause") + m.Put("work_end", "Fin travail") + m.Put("set_config", "Activer config") + m.Put("reset_config", "Reinit config") + m.Put("clear_today", "Effacer aujourd'hui") + m.Put("date", "Date") + m.Put("work", "Travail") + m.Put("pause_col", "Pause") + m.Put("overtime", "Heures sup.") + m.Put("totals", "Totaux") + m.Put("manual_mode", "Mode manuel") + m.Put("auto_recording", "Auto: enregistrement...") + m.Put("auto_paused", "Auto: pause...") + m.Put("auto_stopped", "Auto: arrete...") + m.Put("use_hhmm", "Utilisez des heures HH:MM.") + m.Put("times_order", "Les heures doivent etre dans l'ordre.") + m.Put("work_exceed", "Le travail configure ne peut pas depasser 8 heures.") + m.Put("auto_enabled", "Configuration automatique activee.") + m.Put("auto_disabled", "Configuration automatique desactivee.") + m.Put("no_day_to_clear", "Aucun jour a effacer.") + m.Put("clear_today_title", "Effacer aujourd'hui") + m.Put("clear_today_confirm", "Effacer toutes les donnees enregistrees pour") + m.Put("clear_button", "Effacer") + m.Put("cancel", "Annuler") + m.Put("today_cleared", "Journee effacee.") + m.Put("limit_reached", "Limite de 9 heures deja atteinte pour cette journee.") + Return m +End Sub + +Private Sub CreateGermanMap As Map + Dim m As Map + m.Initialize + m.Put("app_title", "Overtime Guard") + m.Put("start", "Start") + m.Put("end", "Stopp") + m.Put("pause", "Pause") + m.Put("end_pause", "Pause beenden") + m.Put("stats", "Statistik") + m.Put("config", "Konfig") + m.Put("bg", "Hint.") + m.Put("statistics", "Statistik") + m.Put("close", "Schliessen") + m.Put("work_start", "Arbeitsbeginn") + m.Put("pause_start", "Pausenbeginn") + m.Put("pause_end", "Pausenende") + m.Put("work_end", "Arbeitsende") + m.Put("set_config", "Konfig setzen") + m.Put("reset_config", "Konfig reset") + m.Put("clear_today", "Heute loschen") + m.Put("date", "Datum") + m.Put("work", "Arbeit") + m.Put("pause_col", "Pause") + m.Put("overtime", "Uberzeit") + m.Put("totals", "Summen") + m.Put("manual_mode", "Manueller Modus") + m.Put("auto_recording", "Auto: Aufnahme...") + m.Put("auto_paused", "Auto: Pause...") + m.Put("auto_stopped", "Auto: gestoppt...") + m.Put("use_hhmm", "Bitte HH:MM verwenden.") + m.Put("times_order", "Die Zeiten muessen in Reihenfolge sein.") + m.Put("work_exceed", "Die konfigurierte Arbeit darf 8 Stunden nicht uberschreiten.") + m.Put("auto_enabled", "Automatische Konfiguration aktiviert.") + m.Put("auto_disabled", "Automatische Konfiguration deaktiviert.") + m.Put("no_day_to_clear", "Kein Tag zum Loschen.") + m.Put("clear_today_title", "Heute loschen") + m.Put("clear_today_confirm", "Alle erfassten Daten loschen fur") + m.Put("clear_button", "Loschen") + m.Put("cancel", "Abbrechen") + m.Put("today_cleared", "Heutige Daten geloscht.") + m.Put("limit_reached", "9-Stunden-Limit fur diesen Arbeitstag bereits erreicht.") + Return m +End Sub + +Private Sub CreateSpanishMap As Map + Dim m As Map + m.Initialize + m.Put("app_title", "Overtime Guard") + m.Put("start", "Iniciar") + m.Put("end", "Detener") + m.Put("pause", "Pausa") + m.Put("end_pause", "Fin pausa") + m.Put("stats", "Stats") + m.Put("config", "Config") + m.Put("bg", "Fondo") + m.Put("statistics", "Estadisticas") + m.Put("close", "Cerrar") + m.Put("work_start", "Inicio trabajo") + m.Put("pause_start", "Inicio pausa") + m.Put("pause_end", "Fin pausa") + m.Put("work_end", "Fin trabajo") + m.Put("set_config", "Activar config") + m.Put("reset_config", "Reset config") + m.Put("clear_today", "Borrar hoy") + m.Put("date", "Fecha") + m.Put("work", "Trabajo") + m.Put("pause_col", "Pausa") + m.Put("overtime", "Extra") + m.Put("totals", "Totales") + m.Put("manual_mode", "Modo manual") + m.Put("auto_recording", "Auto: grabando...") + m.Put("auto_paused", "Auto: pausa...") + m.Put("auto_stopped", "Auto: detenido...") + m.Put("use_hhmm", "Usa horas HH:MM.") + m.Put("times_order", "Las horas deben estar en orden.") + m.Put("work_exceed", "El trabajo configurado no puede superar 8 horas.") + m.Put("auto_enabled", "Configuracion automatica activada.") + m.Put("auto_disabled", "Configuracion automatica desactivada.") + m.Put("no_day_to_clear", "No hay dia para borrar.") + m.Put("clear_today_title", "Borrar hoy") + m.Put("clear_today_confirm", "Borrar todos los datos registrados de") + m.Put("clear_button", "Borrar") + m.Put("cancel", "Cancelar") + m.Put("today_cleared", "Dia borrado.") + m.Put("limit_reached", "Limite de 9 horas ya alcanzado para esta jornada.") + Return m +End Sub diff --git a/Objects/AndroidManifest.xml b/Objects/AndroidManifest.xml index b6f0e18..5e3e8d1 100644 --- a/Objects/AndroidManifest.xml +++ b/Objects/AndroidManifest.xml @@ -11,18 +11,17 @@ android:normalScreens="true" android:smallScreens="true" android:anyDensity="true"/> - diff --git a/Objects/bin/classes/b4a/example/analogclock.class b/Objects/bin/classes/b4a/example/analogclock.class index 9b099a5..c789706 100644 Binary files a/Objects/bin/classes/b4a/example/analogclock.class and b/Objects/bin/classes/b4a/example/analogclock.class differ diff --git a/Objects/bin/classes/b4a/example/localization.class b/Objects/bin/classes/b4a/example/localization.class new file mode 100644 index 0000000..b4f7b0d Binary files /dev/null and b/Objects/bin/classes/b4a/example/localization.class differ diff --git a/Objects/bin/classes/b4a/example/main.class b/Objects/bin/classes/b4a/example/main.class index c319676..26a4bea 100644 Binary files a/Objects/bin/classes/b4a/example/main.class and b/Objects/bin/classes/b4a/example/main.class differ diff --git a/Objects/bin/classes/b4a/example/starter$starter_BR.class b/Objects/bin/classes/b4a/example/starter$starter_BR.class index 0ff3d05..814f85b 100644 Binary files a/Objects/bin/classes/b4a/example/starter$starter_BR.class and b/Objects/bin/classes/b4a/example/starter$starter_BR.class differ diff --git a/Objects/bin/classes/b4a/example/starter.class b/Objects/bin/classes/b4a/example/starter.class index 5f2c158..b6ea2c2 100644 Binary files a/Objects/bin/classes/b4a/example/starter.class and b/Objects/bin/classes/b4a/example/starter.class differ diff --git a/Objects/dexed/b4a/example/analogclock.dex b/Objects/dexed/b4a/example/analogclock.dex index 216010a..7e55732 100644 Binary files a/Objects/dexed/b4a/example/analogclock.dex and b/Objects/dexed/b4a/example/analogclock.dex differ diff --git a/Objects/dexed/b4a/example/localization.dex b/Objects/dexed/b4a/example/localization.dex new file mode 100644 index 0000000..b9cee3a Binary files /dev/null and b/Objects/dexed/b4a/example/localization.dex differ diff --git a/Objects/dexed/b4a/example/main.dex b/Objects/dexed/b4a/example/main.dex index d126fdb..e7148e8 100644 Binary files a/Objects/dexed/b4a/example/main.dex and b/Objects/dexed/b4a/example/main.dex differ diff --git a/Objects/dexed/b4a/example/starter$starter_BR.dex b/Objects/dexed/b4a/example/starter$starter_BR.dex index 2b1395f..325dbcb 100644 Binary files a/Objects/dexed/b4a/example/starter$starter_BR.dex and b/Objects/dexed/b4a/example/starter$starter_BR.dex differ diff --git a/Objects/dexed/b4a/example/starter.dex b/Objects/dexed/b4a/example/starter.dex index 1e531de..708eb18 100644 Binary files a/Objects/dexed/b4a/example/starter.dex and b/Objects/dexed/b4a/example/starter.dex differ diff --git a/Objects/shell/bin/classes/b4a/example/analogclock.class b/Objects/shell/bin/classes/b4a/example/analogclock.class deleted file mode 100644 index 6f5c419..0000000 Binary files a/Objects/shell/bin/classes/b4a/example/analogclock.class and /dev/null differ diff --git a/Objects/shell/bin/classes/b4a/example/analogclock_subs_0.class b/Objects/shell/bin/classes/b4a/example/analogclock_subs_0.class deleted file mode 100644 index 7604d7d..0000000 Binary files a/Objects/shell/bin/classes/b4a/example/analogclock_subs_0.class and /dev/null differ diff --git a/Objects/shell/bin/classes/b4a/example/main.class b/Objects/shell/bin/classes/b4a/example/main.class deleted file mode 100644 index babc8d1..0000000 Binary files a/Objects/shell/bin/classes/b4a/example/main.class and /dev/null differ diff --git a/Objects/shell/bin/classes/b4a/example/main_subs_0.class b/Objects/shell/bin/classes/b4a/example/main_subs_0.class deleted file mode 100644 index b1ab63e..0000000 Binary files a/Objects/shell/bin/classes/b4a/example/main_subs_0.class and /dev/null differ diff --git a/Objects/shell/bin/classes/b4a/example/starter.class b/Objects/shell/bin/classes/b4a/example/starter.class deleted file mode 100644 index 4d317cd..0000000 Binary files a/Objects/shell/bin/classes/b4a/example/starter.class and /dev/null differ diff --git a/Objects/shell/bin/classes/b4a/example/starter_subs_0.class b/Objects/shell/bin/classes/b4a/example/starter_subs_0.class deleted file mode 100644 index 65c2475..0000000 Binary files a/Objects/shell/bin/classes/b4a/example/starter_subs_0.class and /dev/null differ diff --git a/Objects/shell/bin/classes/subs.txt b/Objects/shell/bin/classes/subs.txt deleted file mode 100644 index c24f5ee..0000000 --- a/Objects/shell/bin/classes/subs.txt +++ /dev/null @@ -1,133 +0,0 @@ -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,1,22,50 - - -,setclocksize,,drawclock,,clearcanvas,,drawticks,,drawinterval,,drawhand -analogclock,drawclock,0,0,78,115 - - -,clearcanvas,,drawticks,,drawinterval,,drawhand -analogclock,addinterval,0,0,150,172 - - -,drawclock,,clearcanvas,,drawticks,,drawinterval,,drawhand -analogclock,class_globals,0,0,1,19 - - - -analogclock,clearcanvas,0,0,72,75 - - - -analogclock,drawticks,0,0,124,147 - - - -analogclock,drawinterval,0,0,174,183 - - - -analogclock,drawhand,0,0,118,122 - - - -analogclock,setclocksize,0,0,53,58 - - -,drawclock,,clearcanvas,,drawticks,,drawinterval,,drawhand -analogclock,setstrokewidths,0,0,61,69 - - -,drawclock,,clearcanvas,,drawticks,,drawinterval,,drawhand -analogclock,startclock,0,0,187,191 - - - -analogclock,timer_tick,0,0,194,196 - - -,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 - - - diff --git a/Objects/shell/src/b4a/example/analogclock.java b/Objects/shell/src/b4a/example/analogclock.java deleted file mode 100644 index 710d948..0000000 --- a/Objects/shell/src/b4a/example/analogclock.java +++ /dev/null @@ -1,32 +0,0 @@ - -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")}; -} -} \ No newline at end of file diff --git a/Objects/shell/src/b4a/example/analogclock_subs_0.java b/Objects/shell/src/b4a/example/analogclock_subs_0.java deleted file mode 100644 index 96a9202..0000000 --- a/Objects/shell/src/b4a/example/analogclock_subs_0.java +++ /dev/null @@ -1,610 +0,0 @@ -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,150); -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 = 150;BA.debugLine="Public Sub AddInterval(startHour As Int, startMinu"; -Debug.ShouldStop(2097152); - BA.debugLineNum = 151;BA.debugLine="Dim interval As Map"; -Debug.ShouldStop(4194304); -_interval = RemoteObject.createNew ("anywheresoftware.b4a.objects.collections.Map");Debug.locals.put("interval", _interval); - BA.debugLineNum = 152;BA.debugLine="interval.Initialize"; -Debug.ShouldStop(8388608); -_interval.runVoidMethod ("Initialize"); - BA.debugLineNum = 153;BA.debugLine="interval.Put(\"startHour\", startHour)"; -Debug.ShouldStop(16777216); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("startHour"))),(Object)((_starthour))); - BA.debugLineNum = 154;BA.debugLine="interval.Put(\"startMinute\", startMinute)"; -Debug.ShouldStop(33554432); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("startMinute"))),(Object)((_startminute))); - BA.debugLineNum = 155;BA.debugLine="interval.Put(\"endHour\", endHour)"; -Debug.ShouldStop(67108864); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("endHour"))),(Object)((_endhour))); - BA.debugLineNum = 156;BA.debugLine="interval.Put(\"endMinute\", endMinute)"; -Debug.ShouldStop(134217728); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("endMinute"))),(Object)((_endminute))); - BA.debugLineNum = 157;BA.debugLine="Select tipo.ToLowerCase"; -Debug.ShouldStop(268435456); -switch (BA.switchObjectToInt(_tipo.runMethod(true,"toLowerCase"),BA.ObjectToString("mattino"),BA.ObjectToString("pomeriggio"))) { -case 0: { - BA.debugLineNum = 159;BA.debugLine="interval.Put(\"color\", Colors.Blue)"; -Debug.ShouldStop(1073741824); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("color"))),(Object)((analogclock.__c.getField(false,"Colors").getField(true,"Blue")))); - BA.debugLineNum = 160;BA.debugLine="interval.Put(\"radius\", clockDiameter /"; -Debug.ShouldStop(-2147483648); -_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 = 161;BA.debugLine="interval.Put(\"strokeWidth\", intervalAr"; -Debug.ShouldStop(1); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("strokeWidth"))),(Object)((__ref.getField(true,"_intervalarcstrokewidth" /*RemoteObject*/ )))); - break; } -case 1: { - BA.debugLineNum = 163;BA.debugLine="interval.Put(\"color\", Colors.Green)"; -Debug.ShouldStop(4); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("color"))),(Object)((analogclock.__c.getField(false,"Colors").getField(true,"Green")))); - BA.debugLineNum = 164;BA.debugLine="interval.Put(\"radius\", clockDiameter /"; -Debug.ShouldStop(8); -_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 = 165;BA.debugLine="interval.Put(\"strokeWidth\", intervalAr"; -Debug.ShouldStop(16); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("strokeWidth"))),(Object)((__ref.getField(true,"_intervalarcstrokewidth" /*RemoteObject*/ )))); - break; } -default: { - BA.debugLineNum = 167;BA.debugLine="Log(\"Tipo di intervallo non riconosciu"; -Debug.ShouldStop(64); -analogclock.__c.runVoidMethod ("LogImpl","31835025",RemoteObject.concat(RemoteObject.createImmutable("Tipo di intervallo non riconosciuto: "),_tipo),0); - BA.debugLineNum = 168;BA.debugLine="Return"; -Debug.ShouldStop(128); -if (true) return RemoteObject.createImmutable(""); - break; } -} -; - BA.debugLineNum = 170;BA.debugLine="intervals.Add(interval)"; -Debug.ShouldStop(512); -__ref.getField(false,"_intervals" /*RemoteObject*/ ).runVoidMethod ("Add",(Object)((_interval.getObject()))); - 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(); - }} -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="Private intervals As List"; -analogclock._intervals = RemoteObject.createNew ("anywheresoftware.b4a.objects.collections.List");__ref.setField("_intervals",analogclock._intervals); - //BA.debugLineNum = 19;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,72); -if (RapidSub.canDelegate("clearcanvas")) { return __ref.runUserSub(false, "analogclock","clearcanvas", __ref, _color);} -Debug.locals.put("color", _color); - BA.debugLineNum = 72;BA.debugLine="Private Sub ClearCanvas(color As Int)"; -Debug.ShouldStop(128); - BA.debugLineNum = 73;BA.debugLine="cvsClock.DrawRect(cvsClock.TargetRect, color, Tru"; -Debug.ShouldStop(256); -__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 = 74;BA.debugLine="cvsClock.Invalidate"; -Debug.ShouldStop(512); -__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runVoidMethod ("Invalidate"); - BA.debugLineNum = 75;BA.debugLine="End Sub"; -Debug.ShouldStop(1024); -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,78); -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 = 78;BA.debugLine="Public Sub DrawClock"; -Debug.ShouldStop(8192); - BA.debugLineNum = 79;BA.debugLine="cvsClock.Initialize(pnlClock)"; -Debug.ShouldStop(16384); -__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 = 82;BA.debugLine="ClearCanvas(Colors.White)"; -Debug.ShouldStop(131072); -__ref.runClassMethod (b4a.example.analogclock.class, "_clearcanvas" /*RemoteObject*/ ,(Object)(analogclock.__c.getField(false,"Colors").getField(true,"White"))); - BA.debugLineNum = 85;BA.debugLine="cvsClock.DrawCircle(centerX, centerY, clockDia"; -Debug.ShouldStop(1048576); -__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 = 88;BA.debugLine="DrawTicks"; -Debug.ShouldStop(8388608); -__ref.runClassMethod (b4a.example.analogclock.class, "_drawticks" /*RemoteObject*/ ); - BA.debugLineNum = 91;BA.debugLine="For Each interval As Map In intervals"; -Debug.ShouldStop(67108864); -_interval = RemoteObject.createNew ("anywheresoftware.b4a.objects.collections.Map"); -{ -final RemoteObject group5 = __ref.getField(false,"_intervals" /*RemoteObject*/ ); -final int groupLen5 = group5.runMethod(true,"getSize").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 = 92;BA.debugLine="DrawInterval(interval.Get(\"startHour\"), in"; -Debug.ShouldStop(134217728); -__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 = 96;BA.debugLine="Dim now As Long = DateTime.Now"; -Debug.ShouldStop(-2147483648); -_now = analogclock.__c.getField(false,"DateTime").runMethod(true,"getNow");Debug.locals.put("now", _now);Debug.locals.put("now", _now); - BA.debugLineNum = 97;BA.debugLine="Dim Hours As Int = DateTime.GetHour(now) Mod 1"; -Debug.ShouldStop(1); -_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 = 98;BA.debugLine="Dim Minutes As Int = DateTime.GetMinute(now)"; -Debug.ShouldStop(2); -_minutes = analogclock.__c.getField(false,"DateTime").runMethod(true,"GetMinute",(Object)(_now));Debug.locals.put("Minutes", _minutes);Debug.locals.put("Minutes", _minutes); - BA.debugLineNum = 99;BA.debugLine="Dim Seconds As Int = DateTime.GetSecond(now)"; -Debug.ShouldStop(4); -_seconds = analogclock.__c.getField(false,"DateTime").runMethod(true,"GetSecond",(Object)(_now));Debug.locals.put("Seconds", _seconds);Debug.locals.put("Seconds", _seconds); - BA.debugLineNum = 102;BA.debugLine="Dim HourAngle As Float = -90 + Hours * 30 + Mi"; -Debug.ShouldStop(32); -_hourangle = BA.numberCast(float.class, -(double) (0 + 90)+(double) (0 + _hours.get().intValue())*(double) (0 + 30)+(double) (0 + _minutes.get().intValue())/(double)(double) (0 + 2));Debug.locals.put("HourAngle", _hourangle);Debug.locals.put("HourAngle", _hourangle); - BA.debugLineNum = 103;BA.debugLine="DrawHand(centerX, centerY, clockDiameter * 0.2"; -Debug.ShouldStop(64); -__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 = 106;BA.debugLine="Dim MinuteAngle As Float = -90 + Minutes * 6"; -Debug.ShouldStop(512); -_minuteangle = BA.numberCast(float.class, -(double) (0 + 90)+(double) (0 + _minutes.get().intValue())*(double) (0 + 6));Debug.locals.put("MinuteAngle", _minuteangle);Debug.locals.put("MinuteAngle", _minuteangle); - BA.debugLineNum = 107;BA.debugLine="DrawHand(centerX, centerY, clockDiameter * 0.4"; -Debug.ShouldStop(1024); -__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 = 110;BA.debugLine="Dim SecondAngle As Float = -90 + Seconds * 6"; -Debug.ShouldStop(8192); -_secondangle = BA.numberCast(float.class, -(double) (0 + 90)+(double) (0 + _seconds.get().intValue())*(double) (0 + 6));Debug.locals.put("SecondAngle", _secondangle);Debug.locals.put("SecondAngle", _secondangle); - BA.debugLineNum = 111;BA.debugLine="DrawHand(centerX, centerY, clockDiameter * 0.4"; -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.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 = 114;BA.debugLine="pnlClock.Invalidate"; -Debug.ShouldStop(131072); -__ref.getField(false,"_pnlclock" /*RemoteObject*/ ).runVoidMethod ("Invalidate"); - BA.debugLineNum = 115;BA.debugLine="End Sub"; -Debug.ShouldStop(262144); -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,118); -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 = 118;BA.debugLine="Private Sub DrawHand(x As Float, y As Float, lengt"; -Debug.ShouldStop(2097152); - BA.debugLineNum = 119;BA.debugLine="Dim endX As Float = x + length * CosD(angle)"; -Debug.ShouldStop(4194304); -_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 = 120;BA.debugLine="Dim endY As Float = y + length * SinD(angle)"; -Debug.ShouldStop(8388608); -_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 = 121;BA.debugLine="cvsClock.DrawLine(x, y, endX, endY, color, wid"; -Debug.ShouldStop(16777216); -__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runVoidMethod ("DrawLine",(Object)(_x),(Object)(_y),(Object)(_endx),(Object)(_endy),(Object)(_color),(Object)(_width)); - BA.debugLineNum = 122;BA.debugLine="End Sub"; -Debug.ShouldStop(33554432); -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,174); -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 = 174;BA.debugLine="Private Sub DrawInterval(startHour As Int, startMi"; -Debug.ShouldStop(8192); - BA.debugLineNum = 175;BA.debugLine="Dim startAngle As Float = (startHour Mod 12 + sta"; -Debug.ShouldStop(16384); -_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 = 176;BA.debugLine="Dim endAngle As Float = (endHour Mod 12 + endMinu"; -Debug.ShouldStop(32768); -_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 = 177;BA.debugLine="Dim sweepAngle As Float = endAngle - startAngle"; -Debug.ShouldStop(65536); -_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 = 178;BA.debugLine="If sweepAngle < 0 Then sweepAngle = sweepAngle +"; -Debug.ShouldStop(131072); -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 = 180;BA.debugLine="Dim path As B4XPath"; -Debug.ShouldStop(524288); -_path = RemoteObject.createNew ("anywheresoftware.b4a.objects.B4XCanvas.B4XPath");Debug.locals.put("path", _path); - BA.debugLineNum = 181;BA.debugLine="path.InitializeArc(centerX, centerY, radius, star"; -Debug.ShouldStop(1048576); -_path.runVoidMethod ("InitializeArc",(Object)(__ref.getField(true,"_centerx" /*RemoteObject*/ )),(Object)(__ref.getField(true,"_centery" /*RemoteObject*/ )),(Object)(_radius),(Object)(_startangle),(Object)(_sweepangle)); - BA.debugLineNum = 182;BA.debugLine="cvsClock.DrawPath(path, color, False, strokeWidth"; -Debug.ShouldStop(2097152); -__ref.getField(false,"_cvsclock" /*RemoteObject*/ ).runVoidMethod ("DrawPath",(Object)(_path),(Object)(_color),(Object)(analogclock.__c.getField(true,"False")),(Object)(_strokewidth)); - 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 _drawticks(RemoteObject __ref) throws Exception{ -try { - Debug.PushSubsStack("DrawTicks (analogclock) ","analogclock",2,__ref.getField(false, "ba"),__ref,124); -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 = 124;BA.debugLine="Private Sub DrawTicks"; -Debug.ShouldStop(134217728); - BA.debugLineNum = 125;BA.debugLine="For i = 0 To 59"; -Debug.ShouldStop(268435456); -{ -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 = 126;BA.debugLine="Dim angle As Float = -90 + i * 6"; -Debug.ShouldStop(536870912); -_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 = 127;BA.debugLine="Dim startX As Float"; -Debug.ShouldStop(1073741824); -_startx = RemoteObject.createImmutable(0f);Debug.locals.put("startX", _startx); - BA.debugLineNum = 128;BA.debugLine="Dim startY As Float"; -Debug.ShouldStop(-2147483648); -_starty = RemoteObject.createImmutable(0f);Debug.locals.put("startY", _starty); - BA.debugLineNum = 129;BA.debugLine="Dim endX As Float"; -Debug.ShouldStop(1); -_endx = RemoteObject.createImmutable(0f);Debug.locals.put("endX", _endx); - BA.debugLineNum = 130;BA.debugLine="Dim endY As Float"; -Debug.ShouldStop(2); -_endy = RemoteObject.createImmutable(0f);Debug.locals.put("endY", _endy); - BA.debugLineNum = 131;BA.debugLine="If i Mod 5 = 0 Then"; -Debug.ShouldStop(4); -if (RemoteObject.solveBoolean("=",RemoteObject.solve(new RemoteObject[] {RemoteObject.createImmutable(_i),RemoteObject.createImmutable(5)}, "%",0, 1),BA.numberCast(double.class, 0))) { - BA.debugLineNum = 133;BA.debugLine="startX = centerX + (clockDiameter / 2"; -Debug.ShouldStop(16); -_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 = 134;BA.debugLine="startY = centerY + (clockDiameter / 2"; -Debug.ShouldStop(32); -_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 = 135;BA.debugLine="endX = centerX + (clockDiameter / 2 -"; -Debug.ShouldStop(64); -_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 = 136;BA.debugLine="endY = centerY + (clockDiameter / 2 -"; -Debug.ShouldStop(128); -_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 = 137;BA.debugLine="cvsClock.DrawLine(startX, startY, endX"; -Debug.ShouldStop(256); -__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 = 140;BA.debugLine="startX = centerX + (clockDiameter / 2"; -Debug.ShouldStop(2048); -_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 = 141;BA.debugLine="startY = centerY + (clockDiameter / 2"; -Debug.ShouldStop(4096); -_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 = 142;BA.debugLine="endX = centerX + (clockDiameter / 2 -"; -Debug.ShouldStop(8192); -_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 = 143;BA.debugLine="endY = centerY + (clockDiameter / 2 -"; -Debug.ShouldStop(16384); -_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 = 144;BA.debugLine="cvsClock.DrawLine(startX, startY, endX"; -Debug.ShouldStop(32768); -__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 = 147;BA.debugLine="End Sub"; -Debug.ShouldStop(262144); -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,22); -if (RapidSub.canDelegate("initialize")) { return __ref.runUserSub(false, "analogclock","initialize", __ref, _ba, _parentpanel, _percentageofwidth);} -__ref.runVoidMethodAndSync("innerInitializeHelper", _ba); -RemoteObject _interval = RemoteObject.declareNull("anywheresoftware.b4a.objects.collections.Map"); -Debug.locals.put("ba", _ba); -Debug.locals.put("ParentPanel", _parentpanel); -Debug.locals.put("PercentageOfWidth", _percentageofwidth); - BA.debugLineNum = 22;BA.debugLine="Public Sub Initialize(ParentPanel As Panel, Percen"; -Debug.ShouldStop(2097152); - BA.debugLineNum = 23;BA.debugLine="pnlClock = ParentPanel"; -Debug.ShouldStop(4194304); -__ref.setField ("_pnlclock" /*RemoteObject*/ ,_parentpanel); - BA.debugLineNum = 24;BA.debugLine="cvsClock.Initialize(pnlClock)"; -Debug.ShouldStop(8388608); -__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 = 25;BA.debugLine="intervals.Initialize"; -Debug.ShouldStop(16777216); -__ref.getField(false,"_intervals" /*RemoteObject*/ ).runVoidMethod ("Initialize"); - BA.debugLineNum = 26;BA.debugLine="Dim interval As Map"; -Debug.ShouldStop(33554432); -_interval = RemoteObject.createNew ("anywheresoftware.b4a.objects.collections.Map");Debug.locals.put("interval", _interval); - BA.debugLineNum = 27;BA.debugLine="interval.Initialize"; -Debug.ShouldStop(67108864); -_interval.runVoidMethod ("Initialize"); - BA.debugLineNum = 28;BA.debugLine="interval.Put(\"startHour\", 8)"; -Debug.ShouldStop(134217728); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("startHour"))),(Object)(RemoteObject.createImmutable((8)))); - BA.debugLineNum = 29;BA.debugLine="interval.Put(\"startMinute\", 0)"; -Debug.ShouldStop(268435456); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("startMinute"))),(Object)(RemoteObject.createImmutable((0)))); - BA.debugLineNum = 30;BA.debugLine="interval.Put(\"endHour\", 12)"; -Debug.ShouldStop(536870912); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("endHour"))),(Object)(RemoteObject.createImmutable((12)))); - BA.debugLineNum = 31;BA.debugLine="interval.Put(\"endMinute\", 0)"; -Debug.ShouldStop(1073741824); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("endMinute"))),(Object)(RemoteObject.createImmutable((0)))); - BA.debugLineNum = 32;BA.debugLine="interval.Put(\"color\", Colors.Magenta)"; -Debug.ShouldStop(-2147483648); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("color"))),(Object)((analogclock.__c.getField(false,"Colors").getField(true,"Magenta")))); - BA.debugLineNum = 33;BA.debugLine="interval.Put(\"radius\",(clockDiameter/2 +25dip))"; -Debug.ShouldStop(1); -_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 = 34;BA.debugLine="interval.Put(\"strokeWidth\", 5dip)"; -Debug.ShouldStop(2); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("strokeWidth"))),(Object)((analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 5)))))); - BA.debugLineNum = 35;BA.debugLine="interval.Put(\"period\", \"mattino\")"; -Debug.ShouldStop(4); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("period"))),(Object)((RemoteObject.createImmutable("mattino")))); - BA.debugLineNum = 36;BA.debugLine="intervals.Add(interval)"; -Debug.ShouldStop(8); -__ref.getField(false,"_intervals" /*RemoteObject*/ ).runVoidMethod ("Add",(Object)((_interval.getObject()))); - BA.debugLineNum = 38;BA.debugLine="interval.Initialize"; -Debug.ShouldStop(32); -_interval.runVoidMethod ("Initialize"); - BA.debugLineNum = 39;BA.debugLine="interval.Put(\"startHour\", 13)"; -Debug.ShouldStop(64); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("startHour"))),(Object)(RemoteObject.createImmutable((13)))); - BA.debugLineNum = 40;BA.debugLine="interval.Put(\"startMinute\", 0)"; -Debug.ShouldStop(128); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("startMinute"))),(Object)(RemoteObject.createImmutable((0)))); - BA.debugLineNum = 41;BA.debugLine="interval.Put(\"endHour\", 17)"; -Debug.ShouldStop(256); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("endHour"))),(Object)(RemoteObject.createImmutable((17)))); - BA.debugLineNum = 42;BA.debugLine="interval.Put(\"endMinute\", 0)"; -Debug.ShouldStop(512); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("endMinute"))),(Object)(RemoteObject.createImmutable((0)))); - BA.debugLineNum = 43;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 = 44;BA.debugLine="interval.Put(\"radius\", (clockDiameter/2 )+25dip)"; -Debug.ShouldStop(2048); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("radius"))),(Object)((RemoteObject.solve(new RemoteObject[] {(RemoteObject.solve(new RemoteObject[] {__ref.getField(true,"_clockdiameter" /*RemoteObject*/ ),RemoteObject.createImmutable(2)}, "/",0, 0)),analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 25)))}, "+",1, 0)))); - BA.debugLineNum = 45;BA.debugLine="interval.Put(\"strokeWidth\", 5dip)"; -Debug.ShouldStop(4096); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("strokeWidth"))),(Object)((analogclock.__c.runMethod(true,"DipToCurrent",(Object)(BA.numberCast(int.class, 5)))))); - BA.debugLineNum = 46;BA.debugLine="interval.Put(\"period\", \"pomeriggio\")"; -Debug.ShouldStop(8192); -_interval.runVoidMethod ("Put",(Object)(RemoteObject.createImmutable(("period"))),(Object)((RemoteObject.createImmutable("pomeriggio")))); - BA.debugLineNum = 47;BA.debugLine="intervals.Add(interval)"; -Debug.ShouldStop(16384); -__ref.getField(false,"_intervals" /*RemoteObject*/ ).runVoidMethod ("Add",(Object)((_interval.getObject()))); - BA.debugLineNum = 49;BA.debugLine="SetClockSize(PercentageOfWidth)"; -Debug.ShouldStop(65536); -__ref.runClassMethod (b4a.example.analogclock.class, "_setclocksize" /*RemoteObject*/ ,(Object)(_percentageofwidth)); - BA.debugLineNum = 50;BA.debugLine="End Sub"; -Debug.ShouldStop(131072); -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,53); -if (RapidSub.canDelegate("setclocksize")) { return __ref.runUserSub(false, "analogclock","setclocksize", __ref, _percentageofwidth);} -Debug.locals.put("PercentageOfWidth", _percentageofwidth); - BA.debugLineNum = 53;BA.debugLine="Public Sub SetClockSize(PercentageOfWidth As Float"; -Debug.ShouldStop(1048576); - BA.debugLineNum = 54;BA.debugLine="clockDiameter = pnlClock.Width * PercentageOfW"; -Debug.ShouldStop(2097152); -__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 = 55;BA.debugLine="centerX = pnlClock.Width / 2"; -Debug.ShouldStop(4194304); -__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 = 56;BA.debugLine="centerY = pnlClock.Height / 2"; -Debug.ShouldStop(8388608); -__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 = 57;BA.debugLine="DrawClock"; -Debug.ShouldStop(16777216); -__ref.runClassMethod (b4a.example.analogclock.class, "_drawclock" /*RemoteObject*/ ); - BA.debugLineNum = 58;BA.debugLine="End Sub"; -Debug.ShouldStop(33554432); -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,61); -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 = 61;BA.debugLine="Public Sub SetStrokeWidths(quadrantWidth As Float,"; -Debug.ShouldStop(268435456); - BA.debugLineNum = 62;BA.debugLine="quadrantStrokeWidth = quadrantWidth"; -Debug.ShouldStop(536870912); -__ref.setField ("_quadrantstrokewidth" /*RemoteObject*/ ,_quadrantwidth); - BA.debugLineNum = 63;BA.debugLine="hourTickStrokeWidth = hourTickWidth"; -Debug.ShouldStop(1073741824); -__ref.setField ("_hourtickstrokewidth" /*RemoteObject*/ ,_hourtickwidth); - BA.debugLineNum = 64;BA.debugLine="minuteTickStrokeWidth = minuteTickWidth"; -Debug.ShouldStop(-2147483648); -__ref.setField ("_minutetickstrokewidth" /*RemoteObject*/ ,_minutetickwidth); - BA.debugLineNum = 65;BA.debugLine="intervalArcStrokeWidth = intervalArcWidth"; -Debug.ShouldStop(1); -__ref.setField ("_intervalarcstrokewidth" /*RemoteObject*/ ,_intervalarcwidth); - BA.debugLineNum = 66;BA.debugLine="hourHandStrokeWidth = hourHandWidth"; -Debug.ShouldStop(2); -__ref.setField ("_hourhandstrokewidth" /*RemoteObject*/ ,_hourhandwidth); - BA.debugLineNum = 67;BA.debugLine="minuteHandStrokeWidth = minuteHandWidth"; -Debug.ShouldStop(4); -__ref.setField ("_minutehandstrokewidth" /*RemoteObject*/ ,_minutehandwidth); - BA.debugLineNum = 68;BA.debugLine="DrawClock"; -Debug.ShouldStop(8); -__ref.runClassMethod (b4a.example.analogclock.class, "_drawclock" /*RemoteObject*/ ); - BA.debugLineNum = 69;BA.debugLine="End Sub"; -Debug.ShouldStop(16); -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,187); -if (RapidSub.canDelegate("startclock")) { return __ref.runUserSub(false, "analogclock","startclock", __ref);} -RemoteObject _timer = RemoteObject.declareNull("anywheresoftware.b4a.objects.Timer"); - BA.debugLineNum = 187;BA.debugLine="Public Sub StartClock"; -Debug.ShouldStop(67108864); - BA.debugLineNum = 188;BA.debugLine="Dim timer As Timer"; -Debug.ShouldStop(134217728); -_timer = RemoteObject.createNew ("anywheresoftware.b4a.objects.Timer");Debug.locals.put("timer", _timer); - BA.debugLineNum = 189;BA.debugLine="timer.Initialize(\"timer\", 1000)"; -Debug.ShouldStop(268435456); -_timer.runVoidMethod ("Initialize",__ref.getField(false, "ba"),(Object)(BA.ObjectToString("timer")),(Object)(BA.numberCast(long.class, 1000))); - BA.debugLineNum = 190;BA.debugLine="timer.Enabled = True"; -Debug.ShouldStop(536870912); -_timer.runMethod(true,"setEnabled",analogclock.__c.getField(true,"True")); - BA.debugLineNum = 191;BA.debugLine="End Sub"; -Debug.ShouldStop(1073741824); -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,194); -if (RapidSub.canDelegate("timer_tick")) { return __ref.runUserSub(false, "analogclock","timer_tick", __ref);} - BA.debugLineNum = 194;BA.debugLine="Private Sub timer_Tick"; -Debug.ShouldStop(2); - BA.debugLineNum = 195;BA.debugLine="DrawClock"; -Debug.ShouldStop(4); -__ref.runClassMethod (b4a.example.analogclock.class, "_drawclock" /*RemoteObject*/ ); - BA.debugLineNum = 196;BA.debugLine="End Sub"; -Debug.ShouldStop(8); -return RemoteObject.createImmutable(""); -} -catch (Exception e) { - throw Debug.ErrorCaught(e); - } -finally { - Debug.PopSubsStack(); - }} -} \ No newline at end of file diff --git a/Objects/shell/src/b4a/example/main.java b/Objects/shell/src/b4a/example/main.java deleted file mode 100644 index 83c473c..0000000 --- a/Objects/shell/src/b4a/example/main.java +++ /dev/null @@ -1,75 +0,0 @@ - -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}; -} -} \ No newline at end of file diff --git a/Objects/shell/src/b4a/example/main_subs_0.java b/Objects/shell/src/b4a/example/main_subs_0.java deleted file mode 100644 index e487a62..0000000 --- a/Objects/shell/src/b4a/example/main_subs_0.java +++ /dev/null @@ -1,408 +0,0 @@ -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)).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.get().intValue())*(double) (0 + 30)+(double) (0 + _minutes.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.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.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(); - }} -} \ No newline at end of file diff --git a/Objects/shell/src/b4a/example/starter.java b/Objects/shell/src/b4a/example/starter.java deleted file mode 100644 index 2731137..0000000 --- a/Objects/shell/src/b4a/example/starter.java +++ /dev/null @@ -1,58 +0,0 @@ - -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}; -} -} \ No newline at end of file diff --git a/Objects/shell/src/b4a/example/starter_subs_0.java b/Objects/shell/src/b4a/example/starter_subs_0.java deleted file mode 100644 index f71a094..0000000 --- a/Objects/shell/src/b4a/example/starter_subs_0.java +++ /dev/null @@ -1,103 +0,0 @@ -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(); - }} -} \ No newline at end of file diff --git a/Objects/src/b4a/example/analogclock.java b/Objects/src/b4a/example/analogclock.java index bbbd6f8..eb1ea45 100644 --- a/Objects/src/b4a/example/analogclock.java +++ b/Objects/src/b4a/example/analogclock.java @@ -10,7 +10,7 @@ public class analogclock extends B4AClass.ImplB4AClass implements BA.SubDelegato private static java.util.HashMap htSubs; private void innerInitialize(BA _ba) throws Exception { if (ba == null) { - ba = new anywheresoftware.b4a.ShellBA(_ba, this, htSubs, "b4a.example.analogclock"); + ba = new BA(_ba, this, htSubs, "b4a.example.analogclock"); if (htSubs == null) { ba.loadHtSubs(this.getClass()); htSubs = ba.htSubs; @@ -23,123 +23,129 @@ public class analogclock extends B4AClass.ImplB4AClass implements BA.SubDelegato 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.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 anywheresoftware.b4a.objects.collections.List _segments = 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 long _basedurationms = 0L; +public long _activedurationms = 0L; +public int _activecolor = 0; +public boolean _activeispause = false; +public boolean _hasactivesegment = false; 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}));} -anywheresoftware.b4a.objects.collections.Map _interval = null; -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="Dim interval As Map"; -_interval = new anywheresoftware.b4a.objects.collections.Map(); -RDebugUtils.currentLine=1376261; - //BA.debugLineNum = 1376261;BA.debugLine="interval.Initialize"; -_interval.Initialize(); -RDebugUtils.currentLine=1376262; - //BA.debugLineNum = 1376262;BA.debugLine="interval.Put(\"startHour\", 8)"; -_interval.Put((Object)("startHour"),(Object)(8)); -RDebugUtils.currentLine=1376263; - //BA.debugLineNum = 1376263;BA.debugLine="interval.Put(\"startMinute\", 0)"; -_interval.Put((Object)("startMinute"),(Object)(0)); -RDebugUtils.currentLine=1376264; - //BA.debugLineNum = 1376264;BA.debugLine="interval.Put(\"endHour\", 12)"; -_interval.Put((Object)("endHour"),(Object)(12)); -RDebugUtils.currentLine=1376265; - //BA.debugLineNum = 1376265;BA.debugLine="interval.Put(\"endMinute\", 0)"; -_interval.Put((Object)("endMinute"),(Object)(0)); -RDebugUtils.currentLine=1376266; - //BA.debugLineNum = 1376266;BA.debugLine="interval.Put(\"color\", Colors.Magenta)"; -_interval.Put((Object)("color"),(Object)(__c.Colors.Magenta)); -RDebugUtils.currentLine=1376267; - //BA.debugLineNum = 1376267;BA.debugLine="interval.Put(\"radius\",(clockDiameter/2 +25dip))"; -_interval.Put((Object)("radius"),(Object)((__ref._clockdiameter /*float*/ /(double)2+__c.DipToCurrent((int) (25))))); -RDebugUtils.currentLine=1376268; - //BA.debugLineNum = 1376268;BA.debugLine="interval.Put(\"strokeWidth\", 5dip)"; -_interval.Put((Object)("strokeWidth"),(Object)(__c.DipToCurrent((int) (5)))); -RDebugUtils.currentLine=1376269; - //BA.debugLineNum = 1376269;BA.debugLine="interval.Put(\"period\", \"mattino\")"; -_interval.Put((Object)("period"),(Object)("mattino")); -RDebugUtils.currentLine=1376270; - //BA.debugLineNum = 1376270;BA.debugLine="intervals.Add(interval)"; -__ref._intervals /*anywheresoftware.b4a.objects.collections.List*/ .Add((Object)(_interval.getObject())); -RDebugUtils.currentLine=1376272; - //BA.debugLineNum = 1376272;BA.debugLine="interval.Initialize"; -_interval.Initialize(); -RDebugUtils.currentLine=1376273; - //BA.debugLineNum = 1376273;BA.debugLine="interval.Put(\"startHour\", 13)"; -_interval.Put((Object)("startHour"),(Object)(13)); -RDebugUtils.currentLine=1376274; - //BA.debugLineNum = 1376274;BA.debugLine="interval.Put(\"startMinute\", 0)"; -_interval.Put((Object)("startMinute"),(Object)(0)); -RDebugUtils.currentLine=1376275; - //BA.debugLineNum = 1376275;BA.debugLine="interval.Put(\"endHour\", 17)"; -_interval.Put((Object)("endHour"),(Object)(17)); -RDebugUtils.currentLine=1376276; - //BA.debugLineNum = 1376276;BA.debugLine="interval.Put(\"endMinute\", 0)"; -_interval.Put((Object)("endMinute"),(Object)(0)); -RDebugUtils.currentLine=1376277; - //BA.debugLineNum = 1376277;BA.debugLine="interval.Put(\"color\", Colors.Green)"; -_interval.Put((Object)("color"),(Object)(__c.Colors.Green)); -RDebugUtils.currentLine=1376278; - //BA.debugLineNum = 1376278;BA.debugLine="interval.Put(\"radius\", (clockDiameter/2 )+25dip)"; -_interval.Put((Object)("radius"),(Object)((__ref._clockdiameter /*float*/ /(double)2)+__c.DipToCurrent((int) (25)))); -RDebugUtils.currentLine=1376279; - //BA.debugLineNum = 1376279;BA.debugLine="interval.Put(\"strokeWidth\", 5dip)"; -_interval.Put((Object)("strokeWidth"),(Object)(__c.DipToCurrent((int) (5)))); -RDebugUtils.currentLine=1376280; - //BA.debugLineNum = 1376280;BA.debugLine="interval.Put(\"period\", \"pomeriggio\")"; -_interval.Put((Object)("period"),(Object)("pomeriggio")); -RDebugUtils.currentLine=1376281; - //BA.debugLineNum = 1376281;BA.debugLine="intervals.Add(interval)"; -__ref._intervals /*anywheresoftware.b4a.objects.collections.List*/ .Add((Object)(_interval.getObject())); -RDebugUtils.currentLine=1376283; - //BA.debugLineNum = 1376283;BA.debugLine="SetClockSize(PercentageOfWidth)"; -__ref._setclocksize /*String*/ (null,_percentageofwidth); -RDebugUtils.currentLine=1376284; - //BA.debugLineNum = 1376284;BA.debugLine="End Sub"; +public b4a.example.localization _localization = null; +public String _addsegment(long _durationms,int _segmentcolor,boolean _ispause) throws Exception{ +anywheresoftware.b4a.objects.collections.Map _segment = null; + //BA.debugLineNum = 50;BA.debugLine="Public Sub AddSegment(DurationMs As Long, SegmentC"; + //BA.debugLineNum = 51;BA.debugLine="If DurationMs <= 0 Then Return"; +if (_durationms<=0) { +if (true) return "";}; + //BA.debugLineNum = 52;BA.debugLine="Dim segment As Map"; +_segment = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 53;BA.debugLine="segment.Initialize"; +_segment.Initialize(); + //BA.debugLineNum = 54;BA.debugLine="segment.Put(\"duration\", DurationMs)"; +_segment.Put((Object)("duration"),(Object)(_durationms)); + //BA.debugLineNum = 55;BA.debugLine="segment.Put(\"color\", SegmentColor)"; +_segment.Put((Object)("color"),(Object)(_segmentcolor)); + //BA.debugLineNum = 56;BA.debugLine="segment.Put(\"pause\", IsPause)"; +_segment.Put((Object)("pause"),(Object)(_ispause)); + //BA.debugLineNum = 57;BA.debugLine="segments.Add(segment)"; +_segments.Add((Object)(_segment.getObject())); + //BA.debugLineNum = 58;BA.debugLine="DrawClock"; +_drawclock(); + //BA.debugLineNum = 59;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; +public String _class_globals() throws Exception{ + //BA.debugLineNum = 1;BA.debugLine="Sub Class_Globals"; + //BA.debugLineNum = 2;BA.debugLine="Private xui As XUI"; +_xui = new anywheresoftware.b4a.objects.B4XViewWrapper.XUI(); + //BA.debugLineNum = 4;BA.debugLine="Private pnlClock As Panel ' Pannello in c"; +_pnlclock = new anywheresoftware.b4a.objects.PanelWrapper(); + //BA.debugLineNum = 5;BA.debugLine="Private cvsClock As B4XCanvas ' Canvas per"; +_cvsclock = new anywheresoftware.b4a.objects.B4XCanvas(); + //BA.debugLineNum = 6;BA.debugLine="Private clockDiameter As Float ' Diametro dell"; +_clockdiameter = 0f; + //BA.debugLineNum = 7;BA.debugLine="Private centerX As Float ' Coordinata X"; +_centerx = 0f; + //BA.debugLineNum = 8;BA.debugLine="Private centerY As Float ' Coordinata Y"; +_centery = 0f; + //BA.debugLineNum = 9;BA.debugLine="Private segments As List ' Segmenti cron"; +_segments = new anywheresoftware.b4a.objects.collections.List(); + //BA.debugLineNum = 12;BA.debugLine="Private quadrantStrokeWidth As Float = 5dip"; +_quadrantstrokewidth = (float) (__c.DipToCurrent((int) (5))); + //BA.debugLineNum = 13;BA.debugLine="Private hourTickStrokeWidth As Float = 5dip"; +_hourtickstrokewidth = (float) (__c.DipToCurrent((int) (5))); + //BA.debugLineNum = 14;BA.debugLine="Private minuteTickStrokeWidth As Float = 2dip"; +_minutetickstrokewidth = (float) (__c.DipToCurrent((int) (2))); + //BA.debugLineNum = 15;BA.debugLine="Private intervalArcStrokeWidth As Float = 5dip"; +_intervalarcstrokewidth = (float) (__c.DipToCurrent((int) (5))); + //BA.debugLineNum = 16;BA.debugLine="Private hourHandStrokeWidth As Float = 8dip"; +_hourhandstrokewidth = (float) (__c.DipToCurrent((int) (8))); + //BA.debugLineNum = 17;BA.debugLine="Private minuteHandStrokeWidth As Float = 5dip"; +_minutehandstrokewidth = (float) (__c.DipToCurrent((int) (5))); + //BA.debugLineNum = 18;BA.debugLine="Private baseDurationMs As Long"; +_basedurationms = 0L; + //BA.debugLineNum = 19;BA.debugLine="Private activeDurationMs As Long"; +_activedurationms = 0L; + //BA.debugLineNum = 20;BA.debugLine="Private activeColor As Int"; +_activecolor = 0; + //BA.debugLineNum = 21;BA.debugLine="Private activeIsPause As Boolean"; +_activeispause = false; + //BA.debugLineNum = 22;BA.debugLine="Private hasActiveSegment As Boolean"; +_hasactivesegment = false; + //BA.debugLineNum = 23;BA.debugLine="End Sub"; +return ""; +} +public String _clearactivesegment() throws Exception{ + //BA.debugLineNum = 70;BA.debugLine="Public Sub ClearActiveSegment"; + //BA.debugLineNum = 71;BA.debugLine="hasActiveSegment = False"; +_hasactivesegment = __c.False; + //BA.debugLineNum = 72;BA.debugLine="activeDurationMs = 0"; +_activedurationms = (long) (0); + //BA.debugLineNum = 73;BA.debugLine="DrawClock"; +_drawclock(); + //BA.debugLineNum = 74;BA.debugLine="End Sub"; +return ""; +} +public String _clearcanvas(int _color) throws Exception{ + //BA.debugLineNum = 96;BA.debugLine="Private Sub ClearCanvas(color As Int)"; + //BA.debugLineNum = 97;BA.debugLine="cvsClock.DrawRect(cvsClock.TargetRect, color, Tru"; +_cvsclock.DrawRect(_cvsclock.getTargetRect(),_color,__c.True,(float) (0)); + //BA.debugLineNum = 98;BA.debugLine="cvsClock.Invalidate"; +_cvsclock.Invalidate(); + //BA.debugLineNum = 99;BA.debugLine="End Sub"; +return ""; +} +public String _clearsegments() throws Exception{ + //BA.debugLineNum = 41;BA.debugLine="Public Sub ClearSegments"; + //BA.debugLineNum = 42;BA.debugLine="If segments.IsInitialized = False Then segments.I"; +if (_segments.IsInitialized()==__c.False) { +_segments.Initialize();}; + //BA.debugLineNum = 43;BA.debugLine="segments.Clear"; +_segments.Clear(); + //BA.debugLineNum = 44;BA.debugLine="hasActiveSegment = False"; +_hasactivesegment = __c.False; + //BA.debugLineNum = 45;BA.debugLine="activeDurationMs = 0"; +_activedurationms = (long) (0); + //BA.debugLineNum = 46;BA.debugLine="DrawClock"; +_drawclock(); + //BA.debugLineNum = 47;BA.debugLine="End Sub"; +return ""; +} +public String _drawclock() throws Exception{ long _now = 0L; int _hours = 0; int _minutes = 0; @@ -147,434 +153,321 @@ int _seconds = 0; float _hourangle = 0f; float _minuteangle = 0f; float _secondangle = 0f; -RDebugUtils.currentLine=1638400; - //BA.debugLineNum = 1638400;BA.debugLine="Public Sub DrawClock"; -RDebugUtils.currentLine=1638401; - //BA.debugLineNum = 1638401;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=1638404; - //BA.debugLineNum = 1638404;BA.debugLine="ClearCanvas(Colors.White)"; -__ref._clearcanvas /*String*/ (null,__c.Colors.White); -RDebugUtils.currentLine=1638407; - //BA.debugLineNum = 1638407;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=1638410; - //BA.debugLineNum = 1638410;BA.debugLine="DrawTicks"; -__ref._drawticks /*String*/ (null); -RDebugUtils.currentLine=1638413; - //BA.debugLineNum = 1638413;BA.debugLine="For Each interval As Map In intervals"; -_interval = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 102;BA.debugLine="Public Sub DrawClock"; + //BA.debugLineNum = 103;BA.debugLine="cvsClock.Initialize(pnlClock)"; +_cvsclock.Initialize((anywheresoftware.b4a.objects.B4XViewWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.B4XViewWrapper(), (java.lang.Object)(_pnlclock.getObject()))); + //BA.debugLineNum = 106;BA.debugLine="ClearCanvas(Colors.White)"; +_clearcanvas(__c.Colors.White); + //BA.debugLineNum = 109;BA.debugLine="cvsClock.DrawCircle(centerX, centerY, clockDia"; +_cvsclock.DrawCircle(_centerx,_centery,(float) (_clockdiameter/(double)2),__c.Colors.Black,__c.False,_quadrantstrokewidth); + //BA.debugLineNum = 112;BA.debugLine="DrawSegments"; +_drawsegments(); + //BA.debugLineNum = 115;BA.debugLine="DrawTicks"; +_drawticks(); + //BA.debugLineNum = 118;BA.debugLine="Dim now As Long = DateTime.Now"; +_now = __c.DateTime.getNow(); + //BA.debugLineNum = 119;BA.debugLine="Dim Hours As Int = DateTime.GetHour(now) Mod 1"; +_hours = (int) (__c.DateTime.GetHour(_now)%12); + //BA.debugLineNum = 120;BA.debugLine="Dim Minutes As Int = DateTime.GetMinute(now)"; +_minutes = __c.DateTime.GetMinute(_now); + //BA.debugLineNum = 121;BA.debugLine="Dim Seconds As Int = DateTime.GetSecond(now)"; +_seconds = __c.DateTime.GetSecond(_now); + //BA.debugLineNum = 124;BA.debugLine="Dim HourAngle As Float = -90 + Hours * 30 + Mi"; +_hourangle = (float) (-90+_hours*30+_minutes/(double)2); + //BA.debugLineNum = 125;BA.debugLine="DrawHand(centerX, centerY, clockDiameter * 0.2"; +_drawhand(_centerx,_centery,(float) (_clockdiameter*0.25),_hourangle,_hourhandstrokewidth,__c.Colors.Black); + //BA.debugLineNum = 128;BA.debugLine="Dim MinuteAngle As Float = -90 + Minutes * 6"; +_minuteangle = (float) (-90+_minutes*6); + //BA.debugLineNum = 129;BA.debugLine="DrawHand(centerX, centerY, clockDiameter * 0.4"; +_drawhand(_centerx,_centery,(float) (_clockdiameter*0.4),_minuteangle,_minutehandstrokewidth,__c.Colors.Blue); + //BA.debugLineNum = 132;BA.debugLine="Dim SecondAngle As Float = -90 + Seconds * 6"; +_secondangle = (float) (-90+_seconds*6); + //BA.debugLineNum = 133;BA.debugLine="DrawHand(centerX, centerY, clockDiameter * 0.4"; +_drawhand(_centerx,_centery,(float) (_clockdiameter*0.45),_secondangle,(float) (__c.DipToCurrent((int) (2))),__c.Colors.Red); + //BA.debugLineNum = 136;BA.debugLine="pnlClock.Invalidate"; +_pnlclock.Invalidate(); + //BA.debugLineNum = 137;BA.debugLine="End Sub"; +return ""; +} +public String _drawhand(float _x,float _y,float _length,float _angle,float _width,int _color) throws Exception{ +float _endx = 0f; +float _endy = 0f; + //BA.debugLineNum = 185;BA.debugLine="Private Sub DrawHand(x As Float, y As Float, lengt"; + //BA.debugLineNum = 186;BA.debugLine="Dim endX As Float = x + length * CosD(angle)"; +_endx = (float) (_x+_length*__c.CosD(_angle)); + //BA.debugLineNum = 187;BA.debugLine="Dim endY As Float = y + length * SinD(angle)"; +_endy = (float) (_y+_length*__c.SinD(_angle)); + //BA.debugLineNum = 188;BA.debugLine="cvsClock.DrawLine(x, y, endX, endY, color, wid"; +_cvsclock.DrawLine(_x,_y,_endx,_endy,_color,_width); + //BA.debugLineNum = 189;BA.debugLine="End Sub"; +return ""; +} +public String _drawpiesegment(float _startangle,float _sweepangle,int _color,float _radius) throws Exception{ +int _steps = 0; +anywheresoftware.b4a.objects.B4XCanvas.B4XPath _path = null; +int _i = 0; +float _angle = 0f; +float _x = 0f; +float _y = 0f; + //BA.debugLineNum = 169;BA.debugLine="Private Sub DrawPieSegment(startAngle As Float, sw"; + //BA.debugLineNum = 170;BA.debugLine="If sweepAngle <= 0 Then Return"; +if (_sweepangle<=0) { +if (true) return "";}; + //BA.debugLineNum = 171;BA.debugLine="Dim steps As Int = Max(2, Ceil(sweepAngle / 4))"; +_steps = (int) (__c.Max(2,__c.Ceil(_sweepangle/(double)4))); + //BA.debugLineNum = 172;BA.debugLine="Dim path As B4XPath"; +_path = new anywheresoftware.b4a.objects.B4XCanvas.B4XPath(); + //BA.debugLineNum = 173;BA.debugLine="path.Initialize(centerX, centerY)"; +_path.Initialize(_centerx,_centery); + //BA.debugLineNum = 174;BA.debugLine="For i = 0 To steps"; { -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=1638414; - //BA.debugLineNum = 1638414;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"))))); +final int step5 = 1; +final int limit5 = _steps; +_i = (int) (0) ; +for (;_i <= limit5 ;_i = _i + step5 ) { + //BA.debugLineNum = 175;BA.debugLine="Dim angle As Float = startAngle + sweepAngle * i"; +_angle = (float) (_startangle+_sweepangle*_i/(double)_steps); + //BA.debugLineNum = 176;BA.debugLine="Dim x As Float = centerX + radius * CosD(angle)"; +_x = (float) (_centerx+_radius*__c.CosD(_angle)); + //BA.debugLineNum = 177;BA.debugLine="Dim y As Float = centerY + radius * SinD(angle)"; +_y = (float) (_centery+_radius*__c.SinD(_angle)); + //BA.debugLineNum = 178;BA.debugLine="path.LineTo(x, y)"; +_path.LineTo(_x,_y); } }; -RDebugUtils.currentLine=1638418; - //BA.debugLineNum = 1638418;BA.debugLine="Dim now As Long = DateTime.Now"; -_now = __c.DateTime.getNow(); -RDebugUtils.currentLine=1638419; - //BA.debugLineNum = 1638419;BA.debugLine="Dim Hours As Int = DateTime.GetHour(now) Mod 1"; -_hours = (int) (__c.DateTime.GetHour(_now)%12); -RDebugUtils.currentLine=1638420; - //BA.debugLineNum = 1638420;BA.debugLine="Dim Minutes As Int = DateTime.GetMinute(now)"; -_minutes = __c.DateTime.GetMinute(_now); -RDebugUtils.currentLine=1638421; - //BA.debugLineNum = 1638421;BA.debugLine="Dim Seconds As Int = DateTime.GetSecond(now)"; -_seconds = __c.DateTime.GetSecond(_now); -RDebugUtils.currentLine=1638424; - //BA.debugLineNum = 1638424;BA.debugLine="Dim HourAngle As Float = -90 + Hours * 30 + Mi"; -_hourangle = (float) (-90+_hours*30+_minutes/(double)2); -RDebugUtils.currentLine=1638425; - //BA.debugLineNum = 1638425;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=1638428; - //BA.debugLineNum = 1638428;BA.debugLine="Dim MinuteAngle As Float = -90 + Minutes * 6"; -_minuteangle = (float) (-90+_minutes*6); -RDebugUtils.currentLine=1638429; - //BA.debugLineNum = 1638429;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=1638432; - //BA.debugLineNum = 1638432;BA.debugLine="Dim SecondAngle As Float = -90 + Seconds * 6"; -_secondangle = (float) (-90+_seconds*6); -RDebugUtils.currentLine=1638433; - //BA.debugLineNum = 1638433;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=1638436; - //BA.debugLineNum = 1638436;BA.debugLine="pnlClock.Invalidate"; -__ref._pnlclock /*anywheresoftware.b4a.objects.PanelWrapper*/ .Invalidate(); -RDebugUtils.currentLine=1638437; - //BA.debugLineNum = 1638437;BA.debugLine="End Sub"; + //BA.debugLineNum = 180;BA.debugLine="path.LineTo(centerX, centerY)"; +_path.LineTo(_centerx,_centery); + //BA.debugLineNum = 181;BA.debugLine="cvsClock.DrawPath(path, color, True, 0)"; +_cvsclock.DrawPath(_path,_color,__c.True,(float) (0)); + //BA.debugLineNum = 182;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=1835008; - //BA.debugLineNum = 1835008;BA.debugLine="Public Sub AddInterval(startHour As Int, startMinu"; -RDebugUtils.currentLine=1835009; - //BA.debugLineNum = 1835009;BA.debugLine="Dim interval As Map"; -_interval = new anywheresoftware.b4a.objects.collections.Map(); -RDebugUtils.currentLine=1835010; - //BA.debugLineNum = 1835010;BA.debugLine="interval.Initialize"; -_interval.Initialize(); -RDebugUtils.currentLine=1835011; - //BA.debugLineNum = 1835011;BA.debugLine="interval.Put(\"startHour\", startHour)"; -_interval.Put((Object)("startHour"),(Object)(_starthour)); -RDebugUtils.currentLine=1835012; - //BA.debugLineNum = 1835012;BA.debugLine="interval.Put(\"startMinute\", startMinute)"; -_interval.Put((Object)("startMinute"),(Object)(_startminute)); -RDebugUtils.currentLine=1835013; - //BA.debugLineNum = 1835013;BA.debugLine="interval.Put(\"endHour\", endHour)"; -_interval.Put((Object)("endHour"),(Object)(_endhour)); -RDebugUtils.currentLine=1835014; - //BA.debugLineNum = 1835014;BA.debugLine="interval.Put(\"endMinute\", endMinute)"; -_interval.Put((Object)("endMinute"),(Object)(_endminute)); -RDebugUtils.currentLine=1835015; - //BA.debugLineNum = 1835015;BA.debugLine="Select tipo.ToLowerCase"; -switch (BA.switchObjectToInt(_tipo.toLowerCase(),"mattino","pomeriggio")) { -case 0: { -RDebugUtils.currentLine=1835017; - //BA.debugLineNum = 1835017;BA.debugLine="interval.Put(\"color\", Colors.Blue)"; -_interval.Put((Object)("color"),(Object)(__c.Colors.Blue)); -RDebugUtils.currentLine=1835018; - //BA.debugLineNum = 1835018;BA.debugLine="interval.Put(\"radius\", clockDiameter /"; -_interval.Put((Object)("radius"),(Object)(__ref._clockdiameter /*float*/ /(double)2-__c.DipToCurrent((int) (15)))); -RDebugUtils.currentLine=1835019; - //BA.debugLineNum = 1835019;BA.debugLine="interval.Put(\"strokeWidth\", intervalAr"; -_interval.Put((Object)("strokeWidth"),(Object)(__ref._intervalarcstrokewidth /*float*/ )); - break; } -case 1: { -RDebugUtils.currentLine=1835021; - //BA.debugLineNum = 1835021;BA.debugLine="interval.Put(\"color\", Colors.Green)"; -_interval.Put((Object)("color"),(Object)(__c.Colors.Green)); -RDebugUtils.currentLine=1835022; - //BA.debugLineNum = 1835022;BA.debugLine="interval.Put(\"radius\", clockDiameter /"; -_interval.Put((Object)("radius"),(Object)(__ref._clockdiameter /*float*/ /(double)2-__c.DipToCurrent((int) (25)))); -RDebugUtils.currentLine=1835023; - //BA.debugLineNum = 1835023;BA.debugLine="interval.Put(\"strokeWidth\", intervalAr"; -_interval.Put((Object)("strokeWidth"),(Object)(__ref._intervalarcstrokewidth /*float*/ )); - break; } -default: { -RDebugUtils.currentLine=1835025; - //BA.debugLineNum = 1835025;BA.debugLine="Log(\"Tipo di intervallo non riconosciu"; -__c.LogImpl("31835025","Tipo di intervallo non riconosciuto: "+_tipo,0); -RDebugUtils.currentLine=1835026; - //BA.debugLineNum = 1835026;BA.debugLine="Return"; -if (true) return ""; - break; } -} +public String _drawsegments() throws Exception{ +long _totalpausems = 0L; +long _totalrecordedms = 0L; +anywheresoftware.b4a.objects.collections.Map _segment = null; +long _duration = 0L; +long _totaldisplayms = 0L; +float _startangle = 0f; +float _radius = 0f; +float _sweepangle = 0f; +float _activesweepangle = 0f; + //BA.debugLineNum = 139;BA.debugLine="Private Sub DrawSegments"; + //BA.debugLineNum = 140;BA.debugLine="If segments.IsInitialized = False Then Return"; +if (_segments.IsInitialized()==__c.False) { +if (true) return "";}; + //BA.debugLineNum = 141;BA.debugLine="Dim totalPauseMs As Long = 0"; +_totalpausems = (long) (0); + //BA.debugLineNum = 142;BA.debugLine="Dim totalRecordedMs As Long = 0"; +_totalrecordedms = (long) (0); + //BA.debugLineNum = 143;BA.debugLine="For Each segment As Map In segments"; +_segment = new anywheresoftware.b4a.objects.collections.Map(); +{ +final anywheresoftware.b4a.BA.IterableList group4 = _segments; +final int groupLen4 = group4.getSize() +;int index4 = 0; ; -RDebugUtils.currentLine=1835028; - //BA.debugLineNum = 1835028;BA.debugLine="intervals.Add(interval)"; -__ref._intervals /*anywheresoftware.b4a.objects.collections.List*/ .Add((Object)(_interval.getObject())); -RDebugUtils.currentLine=1835029; - //BA.debugLineNum = 1835029;BA.debugLine="DrawClock"; -__ref._drawclock /*String*/ (null); -RDebugUtils.currentLine=1835030; - //BA.debugLineNum = 1835030;BA.debugLine="End Sub"; +for (; index4 < groupLen4;index4++){ +_segment = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group4.Get(index4))); + //BA.debugLineNum = 144;BA.debugLine="Dim duration As Long = segment.Get(\"duration\")"; +_duration = BA.ObjectToLongNumber(_segment.Get((Object)("duration"))); + //BA.debugLineNum = 145;BA.debugLine="totalRecordedMs = totalRecordedMs + duration"; +_totalrecordedms = (long) (_totalrecordedms+_duration); + //BA.debugLineNum = 146;BA.debugLine="If segment.Get(\"pause\") = True Then totalPauseMs"; +if ((_segment.Get((Object)("pause"))).equals((Object)(__c.True))) { +_totalpausems = (long) (_totalpausems+_duration);}; + } +}; + //BA.debugLineNum = 148;BA.debugLine="If hasActiveSegment Then"; +if (_hasactivesegment) { + //BA.debugLineNum = 149;BA.debugLine="totalRecordedMs = totalRecordedMs + activeDurati"; +_totalrecordedms = (long) (_totalrecordedms+_activedurationms); + //BA.debugLineNum = 150;BA.debugLine="If activeIsPause Then totalPauseMs = totalPauseM"; +if (_activeispause) { +_totalpausems = (long) (_totalpausems+_activedurationms);}; + }; + //BA.debugLineNum = 153;BA.debugLine="Dim totalDisplayMs As Long = Max(baseDurationMs,"; +_totaldisplayms = (long) (__c.Max(_basedurationms,_totalrecordedms)); + //BA.debugLineNum = 154;BA.debugLine="If totalDisplayMs <= 0 Then Return"; +if (_totaldisplayms<=0) { +if (true) return "";}; + //BA.debugLineNum = 156;BA.debugLine="Dim startAngle As Float = -90"; +_startangle = (float) (-90); + //BA.debugLineNum = 157;BA.debugLine="Dim radius As Float = clockDiameter / 2 - 22dip"; +_radius = (float) (_clockdiameter/(double)2-__c.DipToCurrent((int) (22))); + //BA.debugLineNum = 158;BA.debugLine="For Each segment As Map In segments"; +_segment = new anywheresoftware.b4a.objects.collections.Map(); +{ +final anywheresoftware.b4a.BA.IterableList group17 = _segments; +final int groupLen17 = group17.getSize() +;int index17 = 0; +; +for (; index17 < groupLen17;index17++){ +_segment = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group17.Get(index17))); + //BA.debugLineNum = 159;BA.debugLine="Dim sweepAngle As Float = 360 * segment.Get(\"dur"; +_sweepangle = (float) (360*(double)(BA.ObjectToNumber(_segment.Get((Object)("duration"))))/(double)_totaldisplayms); + //BA.debugLineNum = 160;BA.debugLine="DrawPieSegment(startAngle, sweepAngle, segment.G"; +_drawpiesegment(_startangle,_sweepangle,(int)(BA.ObjectToNumber(_segment.Get((Object)("color")))),_radius); + //BA.debugLineNum = 161;BA.debugLine="startAngle = startAngle + sweepAngle"; +_startangle = (float) (_startangle+_sweepangle); + } +}; + //BA.debugLineNum = 163;BA.debugLine="If hasActiveSegment Then"; +if (_hasactivesegment) { + //BA.debugLineNum = 164;BA.debugLine="Dim activeSweepAngle As Float = 360 * activeDura"; +_activesweepangle = (float) (360*_activedurationms/(double)_totaldisplayms); + //BA.debugLineNum = 165;BA.debugLine="DrawPieSegment(startAngle, activeSweepAngle, act"; +_drawpiesegment(_startangle,_activesweepangle,_activecolor,_radius); + }; + //BA.debugLineNum = 167;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="Private intervals As List"; -_intervals = new anywheresoftware.b4a.objects.collections.List(); -RDebugUtils.currentLine=1310738; - //BA.debugLineNum = 1310738;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=1572864; - //BA.debugLineNum = 1572864;BA.debugLine="Private Sub ClearCanvas(color As Int)"; -RDebugUtils.currentLine=1572865; - //BA.debugLineNum = 1572865;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=1572866; - //BA.debugLineNum = 1572866;BA.debugLine="cvsClock.Invalidate"; -__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .Invalidate(); -RDebugUtils.currentLine=1572867; - //BA.debugLineNum = 1572867;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));} +public String _drawticks() throws Exception{ int _i = 0; float _angle = 0f; float _startx = 0f; float _starty = 0f; float _endx = 0f; float _endy = 0f; -RDebugUtils.currentLine=1769472; - //BA.debugLineNum = 1769472;BA.debugLine="Private Sub DrawTicks"; -RDebugUtils.currentLine=1769473; - //BA.debugLineNum = 1769473;BA.debugLine="For i = 0 To 59"; + //BA.debugLineNum = 191;BA.debugLine="Private Sub DrawTicks"; + //BA.debugLineNum = 192;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=1769474; - //BA.debugLineNum = 1769474;BA.debugLine="Dim angle As Float = -90 + i * 6"; + //BA.debugLineNum = 193;BA.debugLine="Dim angle As Float = -90 + i * 6"; _angle = (float) (-90+_i*6); -RDebugUtils.currentLine=1769475; - //BA.debugLineNum = 1769475;BA.debugLine="Dim startX As Float"; + //BA.debugLineNum = 194;BA.debugLine="Dim startX As Float"; _startx = 0f; -RDebugUtils.currentLine=1769476; - //BA.debugLineNum = 1769476;BA.debugLine="Dim startY As Float"; + //BA.debugLineNum = 195;BA.debugLine="Dim startY As Float"; _starty = 0f; -RDebugUtils.currentLine=1769477; - //BA.debugLineNum = 1769477;BA.debugLine="Dim endX As Float"; + //BA.debugLineNum = 196;BA.debugLine="Dim endX As Float"; _endx = 0f; -RDebugUtils.currentLine=1769478; - //BA.debugLineNum = 1769478;BA.debugLine="Dim endY As Float"; + //BA.debugLineNum = 197;BA.debugLine="Dim endY As Float"; _endy = 0f; -RDebugUtils.currentLine=1769479; - //BA.debugLineNum = 1769479;BA.debugLine="If i Mod 5 = 0 Then"; + //BA.debugLineNum = 198;BA.debugLine="If i Mod 5 = 0 Then"; if (_i%5==0) { -RDebugUtils.currentLine=1769481; - //BA.debugLineNum = 1769481;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=1769482; - //BA.debugLineNum = 1769482;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=1769483; - //BA.debugLineNum = 1769483;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=1769484; - //BA.debugLineNum = 1769484;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=1769485; - //BA.debugLineNum = 1769485;BA.debugLine="cvsClock.DrawLine(startX, startY, endX"; -__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .DrawLine(_startx,_starty,_endx,_endy,__c.Colors.Black,__ref._hourtickstrokewidth /*float*/ ); + //BA.debugLineNum = 200;BA.debugLine="startX = centerX + (clockDiameter / 2"; +_startx = (float) (_centerx+(_clockdiameter/(double)2-__c.DipToCurrent((int) (20)))*__c.CosD(_angle)); + //BA.debugLineNum = 201;BA.debugLine="startY = centerY + (clockDiameter / 2"; +_starty = (float) (_centery+(_clockdiameter/(double)2-__c.DipToCurrent((int) (20)))*__c.SinD(_angle)); + //BA.debugLineNum = 202;BA.debugLine="endX = centerX + (clockDiameter / 2 -"; +_endx = (float) (_centerx+(_clockdiameter/(double)2-__c.DipToCurrent((int) (5)))*__c.CosD(_angle)); + //BA.debugLineNum = 203;BA.debugLine="endY = centerY + (clockDiameter / 2 -"; +_endy = (float) (_centery+(_clockdiameter/(double)2-__c.DipToCurrent((int) (5)))*__c.SinD(_angle)); + //BA.debugLineNum = 204;BA.debugLine="cvsClock.DrawLine(startX, startY, endX"; +_cvsclock.DrawLine(_startx,_starty,_endx,_endy,__c.Colors.Black,_hourtickstrokewidth); }else { -RDebugUtils.currentLine=1769488; - //BA.debugLineNum = 1769488;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=1769489; - //BA.debugLineNum = 1769489;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=1769490; - //BA.debugLineNum = 1769490;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=1769491; - //BA.debugLineNum = 1769491;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=1769492; - //BA.debugLineNum = 1769492;BA.debugLine="cvsClock.DrawLine(startX, startY, endX"; -__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .DrawLine(_startx,_starty,_endx,_endy,__c.Colors.Black,__ref._minutetickstrokewidth /*float*/ ); + //BA.debugLineNum = 207;BA.debugLine="startX = centerX + (clockDiameter / 2"; +_startx = (float) (_centerx+(_clockdiameter/(double)2-__c.DipToCurrent((int) (10)))*__c.CosD(_angle)); + //BA.debugLineNum = 208;BA.debugLine="startY = centerY + (clockDiameter / 2"; +_starty = (float) (_centery+(_clockdiameter/(double)2-__c.DipToCurrent((int) (10)))*__c.SinD(_angle)); + //BA.debugLineNum = 209;BA.debugLine="endX = centerX + (clockDiameter / 2 -"; +_endx = (float) (_centerx+(_clockdiameter/(double)2-__c.DipToCurrent((int) (5)))*__c.CosD(_angle)); + //BA.debugLineNum = 210;BA.debugLine="endY = centerY + (clockDiameter / 2 -"; +_endy = (float) (_centery+(_clockdiameter/(double)2-__c.DipToCurrent((int) (5)))*__c.SinD(_angle)); + //BA.debugLineNum = 211;BA.debugLine="cvsClock.DrawLine(startX, startY, endX"; +_cvsclock.DrawLine(_startx,_starty,_endx,_endy,__c.Colors.Black,_minutetickstrokewidth); }; } }; -RDebugUtils.currentLine=1769495; - //BA.debugLineNum = 1769495;BA.debugLine="End Sub"; + //BA.debugLineNum = 214;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=1900544; - //BA.debugLineNum = 1900544;BA.debugLine="Private Sub DrawInterval(startHour As Int, startMi"; -RDebugUtils.currentLine=1900545; - //BA.debugLineNum = 1900545;BA.debugLine="Dim startAngle As Float = (startHour Mod 12 + sta"; -_startangle = (float) ((_starthour%12+_startminute/(double)60)*30-90); -RDebugUtils.currentLine=1900546; - //BA.debugLineNum = 1900546;BA.debugLine="Dim endAngle As Float = (endHour Mod 12 + endMinu"; -_endangle = (float) ((_endhour%12+_endminute/(double)60)*30-90); -RDebugUtils.currentLine=1900547; - //BA.debugLineNum = 1900547;BA.debugLine="Dim sweepAngle As Float = endAngle - startAngle"; -_sweepangle = (float) (_endangle-_startangle); -RDebugUtils.currentLine=1900548; - //BA.debugLineNum = 1900548;BA.debugLine="If sweepAngle < 0 Then sweepAngle = sweepAngle +"; -if (_sweepangle<0) { -_sweepangle = (float) (_sweepangle+360);}; -RDebugUtils.currentLine=1900550; - //BA.debugLineNum = 1900550;BA.debugLine="Dim path As B4XPath"; -_path = new anywheresoftware.b4a.objects.B4XCanvas.B4XPath(); -RDebugUtils.currentLine=1900551; - //BA.debugLineNum = 1900551;BA.debugLine="path.InitializeArc(centerX, centerY, radius, star"; -_path.InitializeArc(__ref._centerx /*float*/ ,__ref._centery /*float*/ ,_radius,_startangle,_sweepangle); -RDebugUtils.currentLine=1900552; - //BA.debugLineNum = 1900552;BA.debugLine="cvsClock.DrawPath(path, color, False, strokeWidth"; -__ref._cvsclock /*anywheresoftware.b4a.objects.B4XCanvas*/ .DrawPath(_path,_color,__c.False,_strokewidth); -RDebugUtils.currentLine=1900553; - //BA.debugLineNum = 1900553;BA.debugLine="End Sub"; +public String _initialize(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.PanelWrapper _parentpanel,float _percentageofwidth) throws Exception{ +innerInitialize(_ba); + //BA.debugLineNum = 26;BA.debugLine="Public Sub Initialize(ParentPanel As Panel, Percen"; + //BA.debugLineNum = 27;BA.debugLine="pnlClock = ParentPanel"; +_pnlclock = _parentpanel; + //BA.debugLineNum = 28;BA.debugLine="cvsClock.Initialize(pnlClock)"; +_cvsclock.Initialize((anywheresoftware.b4a.objects.B4XViewWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.B4XViewWrapper(), (java.lang.Object)(_pnlclock.getObject()))); + //BA.debugLineNum = 29;BA.debugLine="segments.Initialize"; +_segments.Initialize(); + //BA.debugLineNum = 30;BA.debugLine="baseDurationMs = 12 * DateTime.TicksPerHour"; +_basedurationms = (long) (12*__c.DateTime.TicksPerHour); + //BA.debugLineNum = 31;BA.debugLine="SetClockSize(PercentageOfWidth)"; +_setclocksize(_percentageofwidth); + //BA.debugLineNum = 32;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=1703936; - //BA.debugLineNum = 1703936;BA.debugLine="Private Sub DrawHand(x As Float, y As Float, lengt"; -RDebugUtils.currentLine=1703937; - //BA.debugLineNum = 1703937;BA.debugLine="Dim endX As Float = x + length * CosD(angle)"; -_endx = (float) (_x+_length*__c.CosD(_angle)); -RDebugUtils.currentLine=1703938; - //BA.debugLineNum = 1703938;BA.debugLine="Dim endY As Float = y + length * SinD(angle)"; -_endy = (float) (_y+_length*__c.SinD(_angle)); -RDebugUtils.currentLine=1703939; - //BA.debugLineNum = 1703939;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=1703940; - //BA.debugLineNum = 1703940;BA.debugLine="End Sub"; +public String _setactivesegment(long _durationms,int _segmentcolor,boolean _ispause) throws Exception{ + //BA.debugLineNum = 62;BA.debugLine="Public Sub SetActiveSegment(DurationMs As Long, Se"; + //BA.debugLineNum = 63;BA.debugLine="activeDurationMs = Max(0, DurationMs)"; +_activedurationms = (long) (__c.Max(0,_durationms)); + //BA.debugLineNum = 64;BA.debugLine="activeColor = SegmentColor"; +_activecolor = _segmentcolor; + //BA.debugLineNum = 65;BA.debugLine="activeIsPause = IsPause"; +_activeispause = _ispause; + //BA.debugLineNum = 66;BA.debugLine="hasActiveSegment = activeDurationMs > 0"; +_hasactivesegment = _activedurationms>0; + //BA.debugLineNum = 67;BA.debugLine="DrawClock"; +_drawclock(); + //BA.debugLineNum = 68;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"; +public String _setbaseduration(long _durationms) throws Exception{ + //BA.debugLineNum = 35;BA.debugLine="Public Sub SetBaseDuration(DurationMs As Long)"; + //BA.debugLineNum = 36;BA.debugLine="baseDurationMs = DurationMs"; +_basedurationms = _durationms; + //BA.debugLineNum = 37;BA.debugLine="DrawClock"; +_drawclock(); + //BA.debugLineNum = 38;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"; +public String _setclocksize(float _percentageofwidth) throws Exception{ + //BA.debugLineNum = 77;BA.debugLine="Public Sub SetClockSize(PercentageOfWidth As Float"; + //BA.debugLineNum = 78;BA.debugLine="clockDiameter = pnlClock.Width * PercentageOfW"; +_clockdiameter = (float) (_pnlclock.getWidth()*_percentageofwidth/(double)100); + //BA.debugLineNum = 79;BA.debugLine="centerX = pnlClock.Width / 2"; +_centerx = (float) (_pnlclock.getWidth()/(double)2); + //BA.debugLineNum = 80;BA.debugLine="centerY = pnlClock.Height / 2"; +_centery = (float) (_pnlclock.getHeight()/(double)2); + //BA.debugLineNum = 81;BA.debugLine="DrawClock"; +_drawclock(); + //BA.debugLineNum = 82;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));} +public String _setstrokewidths(float _quadrantwidth,float _hourtickwidth,float _minutetickwidth,float _intervalarcwidth,float _hourhandwidth,float _minutehandwidth) throws Exception{ + //BA.debugLineNum = 85;BA.debugLine="Public Sub SetStrokeWidths(quadrantWidth As Float,"; + //BA.debugLineNum = 86;BA.debugLine="quadrantStrokeWidth = quadrantWidth"; +_quadrantstrokewidth = _quadrantwidth; + //BA.debugLineNum = 87;BA.debugLine="hourTickStrokeWidth = hourTickWidth"; +_hourtickstrokewidth = _hourtickwidth; + //BA.debugLineNum = 88;BA.debugLine="minuteTickStrokeWidth = minuteTickWidth"; +_minutetickstrokewidth = _minutetickwidth; + //BA.debugLineNum = 89;BA.debugLine="intervalArcStrokeWidth = intervalArcWidth"; +_intervalarcstrokewidth = _intervalarcwidth; + //BA.debugLineNum = 90;BA.debugLine="hourHandStrokeWidth = hourHandWidth"; +_hourhandstrokewidth = _hourhandwidth; + //BA.debugLineNum = 91;BA.debugLine="minuteHandStrokeWidth = minuteHandWidth"; +_minutehandstrokewidth = _minutehandwidth; + //BA.debugLineNum = 92;BA.debugLine="DrawClock"; +_drawclock(); + //BA.debugLineNum = 93;BA.debugLine="End Sub"; +return ""; +} +public String _startclock() throws Exception{ anywheresoftware.b4a.objects.Timer _timer = null; -RDebugUtils.currentLine=1966080; - //BA.debugLineNum = 1966080;BA.debugLine="Public Sub StartClock"; -RDebugUtils.currentLine=1966081; - //BA.debugLineNum = 1966081;BA.debugLine="Dim timer As Timer"; + //BA.debugLineNum = 217;BA.debugLine="Public Sub StartClock"; + //BA.debugLineNum = 218;BA.debugLine="Dim timer As Timer"; _timer = new anywheresoftware.b4a.objects.Timer(); -RDebugUtils.currentLine=1966082; - //BA.debugLineNum = 1966082;BA.debugLine="timer.Initialize(\"timer\", 1000)"; + //BA.debugLineNum = 219;BA.debugLine="timer.Initialize(\"timer\", 1000)"; _timer.Initialize(ba,"timer",(long) (1000)); -RDebugUtils.currentLine=1966083; - //BA.debugLineNum = 1966083;BA.debugLine="timer.Enabled = True"; + //BA.debugLineNum = 220;BA.debugLine="timer.Enabled = True"; _timer.setEnabled(__c.True); -RDebugUtils.currentLine=1966084; - //BA.debugLineNum = 1966084;BA.debugLine="End Sub"; + //BA.debugLineNum = 221;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=2031616; - //BA.debugLineNum = 2031616;BA.debugLine="Private Sub timer_Tick"; -RDebugUtils.currentLine=2031617; - //BA.debugLineNum = 2031617;BA.debugLine="DrawClock"; -__ref._drawclock /*String*/ (null); -RDebugUtils.currentLine=2031618; - //BA.debugLineNum = 2031618;BA.debugLine="End Sub"; +public String _timer_tick() throws Exception{ + //BA.debugLineNum = 224;BA.debugLine="Private Sub timer_Tick"; + //BA.debugLineNum = 225;BA.debugLine="DrawClock"; +_drawclock(); + //BA.debugLineNum = 226;BA.debugLine="End Sub"; return ""; } -} \ No newline at end of file +public Object callSub(String sub, Object sender, Object[] args) throws Exception { +BA.senderHolder.set(sender); +return BA.SubDelegator.SubNotFound; +} +} diff --git a/Objects/src/b4a/example/localization.java b/Objects/src/b4a/example/localization.java new file mode 100644 index 0000000..540dac1 --- /dev/null +++ b/Objects/src/b4a/example/localization.java @@ -0,0 +1,603 @@ +package b4a.example; + + +import anywheresoftware.b4a.BA; +import anywheresoftware.b4a.BALayout; +import anywheresoftware.b4a.debug.*; + +public class localization { +private static localization mostCurrent = new localization(); +public static Object getObject() { + throw new RuntimeException("Code module does not support this method."); +} + public anywheresoftware.b4a.keywords.Common __c = null; +public static anywheresoftware.b4a.objects.collections.Map _translations = null; +public static String _currentlanguage = ""; +public static boolean _initialized = false; +public b4a.example.main _main = null; +public b4a.example.starter _starter = null; +public static anywheresoftware.b4a.objects.collections.Map _createenglishmap(anywheresoftware.b4a.BA _ba) throws Exception{ +anywheresoftware.b4a.objects.collections.Map _m = null; + //BA.debugLineNum = 68;BA.debugLine="Private Sub CreateEnglishMap As Map"; + //BA.debugLineNum = 69;BA.debugLine="Dim m As Map"; +_m = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 70;BA.debugLine="m.Initialize"; +_m.Initialize(); + //BA.debugLineNum = 71;BA.debugLine="m.Put(\"app_title\", \"Overtime Guard\")"; +_m.Put((Object)("app_title"),(Object)("Overtime Guard")); + //BA.debugLineNum = 72;BA.debugLine="m.Put(\"start\", \"Start\")"; +_m.Put((Object)("start"),(Object)("Start")); + //BA.debugLineNum = 73;BA.debugLine="m.Put(\"end\", \"End\")"; +_m.Put((Object)("end"),(Object)("End")); + //BA.debugLineNum = 74;BA.debugLine="m.Put(\"pause\", \"Pause\")"; +_m.Put((Object)("pause"),(Object)("Pause")); + //BA.debugLineNum = 75;BA.debugLine="m.Put(\"end_pause\", \"End pause\")"; +_m.Put((Object)("end_pause"),(Object)("End pause")); + //BA.debugLineNum = 76;BA.debugLine="m.Put(\"stats\", \"Stats\")"; +_m.Put((Object)("stats"),(Object)("Stats")); + //BA.debugLineNum = 77;BA.debugLine="m.Put(\"config\", \"Config\")"; +_m.Put((Object)("config"),(Object)("Config")); + //BA.debugLineNum = 78;BA.debugLine="m.Put(\"bg\", \"Bg\")"; +_m.Put((Object)("bg"),(Object)("Bg")); + //BA.debugLineNum = 79;BA.debugLine="m.Put(\"statistics\", \"Statistics\")"; +_m.Put((Object)("statistics"),(Object)("Statistics")); + //BA.debugLineNum = 80;BA.debugLine="m.Put(\"close\", \"Close\")"; +_m.Put((Object)("close"),(Object)("Close")); + //BA.debugLineNum = 81;BA.debugLine="m.Put(\"work_start\", \"Work start\")"; +_m.Put((Object)("work_start"),(Object)("Work start")); + //BA.debugLineNum = 82;BA.debugLine="m.Put(\"pause_start\", \"Pause start\")"; +_m.Put((Object)("pause_start"),(Object)("Pause start")); + //BA.debugLineNum = 83;BA.debugLine="m.Put(\"pause_end\", \"Pause end\")"; +_m.Put((Object)("pause_end"),(Object)("Pause end")); + //BA.debugLineNum = 84;BA.debugLine="m.Put(\"work_end\", \"Work end\")"; +_m.Put((Object)("work_end"),(Object)("Work end")); + //BA.debugLineNum = 85;BA.debugLine="m.Put(\"set_config\", \"Set config\")"; +_m.Put((Object)("set_config"),(Object)("Set config")); + //BA.debugLineNum = 86;BA.debugLine="m.Put(\"reset_config\", \"Reset config\")"; +_m.Put((Object)("reset_config"),(Object)("Reset config")); + //BA.debugLineNum = 87;BA.debugLine="m.Put(\"clear_today\", \"Clear today\")"; +_m.Put((Object)("clear_today"),(Object)("Clear today")); + //BA.debugLineNum = 88;BA.debugLine="m.Put(\"date\", \"Date\")"; +_m.Put((Object)("date"),(Object)("Date")); + //BA.debugLineNum = 89;BA.debugLine="m.Put(\"work\", \"Work\")"; +_m.Put((Object)("work"),(Object)("Work")); + //BA.debugLineNum = 90;BA.debugLine="m.Put(\"pause_col\", \"Pause\")"; +_m.Put((Object)("pause_col"),(Object)("Pause")); + //BA.debugLineNum = 91;BA.debugLine="m.Put(\"overtime\", \"Overtime\")"; +_m.Put((Object)("overtime"),(Object)("Overtime")); + //BA.debugLineNum = 92;BA.debugLine="m.Put(\"totals\", \"Totals\")"; +_m.Put((Object)("totals"),(Object)("Totals")); + //BA.debugLineNum = 93;BA.debugLine="m.Put(\"manual_mode\", \"Manual mode\")"; +_m.Put((Object)("manual_mode"),(Object)("Manual mode")); + //BA.debugLineNum = 94;BA.debugLine="m.Put(\"auto_recording\", \"Auto: recording...\")"; +_m.Put((Object)("auto_recording"),(Object)("Auto: recording...")); + //BA.debugLineNum = 95;BA.debugLine="m.Put(\"auto_paused\", \"Auto: paused...\")"; +_m.Put((Object)("auto_paused"),(Object)("Auto: paused...")); + //BA.debugLineNum = 96;BA.debugLine="m.Put(\"auto_stopped\", \"Auto: stopped...\")"; +_m.Put((Object)("auto_stopped"),(Object)("Auto: stopped...")); + //BA.debugLineNum = 97;BA.debugLine="m.Put(\"use_hhmm\", \"Use HH:MM times.\")"; +_m.Put((Object)("use_hhmm"),(Object)("Use HH:MM times.")); + //BA.debugLineNum = 98;BA.debugLine="m.Put(\"times_order\", \"Times must be in order.\")"; +_m.Put((Object)("times_order"),(Object)("Times must be in order.")); + //BA.debugLineNum = 99;BA.debugLine="m.Put(\"work_exceed\", \"Configured work cannot exce"; +_m.Put((Object)("work_exceed"),(Object)("Configured work cannot exceed 8 hours.")); + //BA.debugLineNum = 100;BA.debugLine="m.Put(\"auto_enabled\", \"Automatic config enabled.\""; +_m.Put((Object)("auto_enabled"),(Object)("Automatic config enabled.")); + //BA.debugLineNum = 101;BA.debugLine="m.Put(\"auto_disabled\", \"Automatic config disabled"; +_m.Put((Object)("auto_disabled"),(Object)("Automatic config disabled.")); + //BA.debugLineNum = 102;BA.debugLine="m.Put(\"no_day_to_clear\", \"No day to clear.\")"; +_m.Put((Object)("no_day_to_clear"),(Object)("No day to clear.")); + //BA.debugLineNum = 103;BA.debugLine="m.Put(\"clear_today_title\", \"Clear today\")"; +_m.Put((Object)("clear_today_title"),(Object)("Clear today")); + //BA.debugLineNum = 104;BA.debugLine="m.Put(\"clear_today_confirm\", \"Clear all recorded"; +_m.Put((Object)("clear_today_confirm"),(Object)("Clear all recorded data for")); + //BA.debugLineNum = 105;BA.debugLine="m.Put(\"clear_button\", \"Clear\")"; +_m.Put((Object)("clear_button"),(Object)("Clear")); + //BA.debugLineNum = 106;BA.debugLine="m.Put(\"cancel\", \"Cancel\")"; +_m.Put((Object)("cancel"),(Object)("Cancel")); + //BA.debugLineNum = 107;BA.debugLine="m.Put(\"today_cleared\", \"Today cleared.\")"; +_m.Put((Object)("today_cleared"),(Object)("Today cleared.")); + //BA.debugLineNum = 108;BA.debugLine="m.Put(\"limit_reached\", \"9-hour limit already reac"; +_m.Put((Object)("limit_reached"),(Object)("9-hour limit already reached for this workday.")); + //BA.debugLineNum = 109;BA.debugLine="Return m"; +if (true) return _m; + //BA.debugLineNum = 110;BA.debugLine="End Sub"; +return null; +} +public static anywheresoftware.b4a.objects.collections.Map _createfrenchmap(anywheresoftware.b4a.BA _ba) throws Exception{ +anywheresoftware.b4a.objects.collections.Map _m = null; + //BA.debugLineNum = 156;BA.debugLine="Private Sub CreateFrenchMap As Map"; + //BA.debugLineNum = 157;BA.debugLine="Dim m As Map"; +_m = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 158;BA.debugLine="m.Initialize"; +_m.Initialize(); + //BA.debugLineNum = 159;BA.debugLine="m.Put(\"app_title\", \"Overtime Guard\")"; +_m.Put((Object)("app_title"),(Object)("Overtime Guard")); + //BA.debugLineNum = 160;BA.debugLine="m.Put(\"start\", \"Demarrer\")"; +_m.Put((Object)("start"),(Object)("Demarrer")); + //BA.debugLineNum = 161;BA.debugLine="m.Put(\"end\", \"Arreter\")"; +_m.Put((Object)("end"),(Object)("Arreter")); + //BA.debugLineNum = 162;BA.debugLine="m.Put(\"pause\", \"Pause\")"; +_m.Put((Object)("pause"),(Object)("Pause")); + //BA.debugLineNum = 163;BA.debugLine="m.Put(\"end_pause\", \"Fin pause\")"; +_m.Put((Object)("end_pause"),(Object)("Fin pause")); + //BA.debugLineNum = 164;BA.debugLine="m.Put(\"stats\", \"Stats\")"; +_m.Put((Object)("stats"),(Object)("Stats")); + //BA.debugLineNum = 165;BA.debugLine="m.Put(\"config\", \"Config\")"; +_m.Put((Object)("config"),(Object)("Config")); + //BA.debugLineNum = 166;BA.debugLine="m.Put(\"bg\", \"Fond\")"; +_m.Put((Object)("bg"),(Object)("Fond")); + //BA.debugLineNum = 167;BA.debugLine="m.Put(\"statistics\", \"Statistiques\")"; +_m.Put((Object)("statistics"),(Object)("Statistiques")); + //BA.debugLineNum = 168;BA.debugLine="m.Put(\"close\", \"Fermer\")"; +_m.Put((Object)("close"),(Object)("Fermer")); + //BA.debugLineNum = 169;BA.debugLine="m.Put(\"work_start\", \"Debut travail\")"; +_m.Put((Object)("work_start"),(Object)("Debut travail")); + //BA.debugLineNum = 170;BA.debugLine="m.Put(\"pause_start\", \"Debut pause\")"; +_m.Put((Object)("pause_start"),(Object)("Debut pause")); + //BA.debugLineNum = 171;BA.debugLine="m.Put(\"pause_end\", \"Fin pause\")"; +_m.Put((Object)("pause_end"),(Object)("Fin pause")); + //BA.debugLineNum = 172;BA.debugLine="m.Put(\"work_end\", \"Fin travail\")"; +_m.Put((Object)("work_end"),(Object)("Fin travail")); + //BA.debugLineNum = 173;BA.debugLine="m.Put(\"set_config\", \"Activer config\")"; +_m.Put((Object)("set_config"),(Object)("Activer config")); + //BA.debugLineNum = 174;BA.debugLine="m.Put(\"reset_config\", \"Reinit config\")"; +_m.Put((Object)("reset_config"),(Object)("Reinit config")); + //BA.debugLineNum = 175;BA.debugLine="m.Put(\"clear_today\", \"Effacer aujourd'hui\")"; +_m.Put((Object)("clear_today"),(Object)("Effacer aujourd'hui")); + //BA.debugLineNum = 176;BA.debugLine="m.Put(\"date\", \"Date\")"; +_m.Put((Object)("date"),(Object)("Date")); + //BA.debugLineNum = 177;BA.debugLine="m.Put(\"work\", \"Travail\")"; +_m.Put((Object)("work"),(Object)("Travail")); + //BA.debugLineNum = 178;BA.debugLine="m.Put(\"pause_col\", \"Pause\")"; +_m.Put((Object)("pause_col"),(Object)("Pause")); + //BA.debugLineNum = 179;BA.debugLine="m.Put(\"overtime\", \"Heures sup.\")"; +_m.Put((Object)("overtime"),(Object)("Heures sup.")); + //BA.debugLineNum = 180;BA.debugLine="m.Put(\"totals\", \"Totaux\")"; +_m.Put((Object)("totals"),(Object)("Totaux")); + //BA.debugLineNum = 181;BA.debugLine="m.Put(\"manual_mode\", \"Mode manuel\")"; +_m.Put((Object)("manual_mode"),(Object)("Mode manuel")); + //BA.debugLineNum = 182;BA.debugLine="m.Put(\"auto_recording\", \"Auto: enregistrement...\""; +_m.Put((Object)("auto_recording"),(Object)("Auto: enregistrement...")); + //BA.debugLineNum = 183;BA.debugLine="m.Put(\"auto_paused\", \"Auto: pause...\")"; +_m.Put((Object)("auto_paused"),(Object)("Auto: pause...")); + //BA.debugLineNum = 184;BA.debugLine="m.Put(\"auto_stopped\", \"Auto: arrete...\")"; +_m.Put((Object)("auto_stopped"),(Object)("Auto: arrete...")); + //BA.debugLineNum = 185;BA.debugLine="m.Put(\"use_hhmm\", \"Utilisez des heures HH:MM.\")"; +_m.Put((Object)("use_hhmm"),(Object)("Utilisez des heures HH:MM.")); + //BA.debugLineNum = 186;BA.debugLine="m.Put(\"times_order\", \"Les heures doivent etre dan"; +_m.Put((Object)("times_order"),(Object)("Les heures doivent etre dans l'ordre.")); + //BA.debugLineNum = 187;BA.debugLine="m.Put(\"work_exceed\", \"Le travail configure ne peu"; +_m.Put((Object)("work_exceed"),(Object)("Le travail configure ne peut pas depasser 8 heures.")); + //BA.debugLineNum = 188;BA.debugLine="m.Put(\"auto_enabled\", \"Configuration automatique"; +_m.Put((Object)("auto_enabled"),(Object)("Configuration automatique activee.")); + //BA.debugLineNum = 189;BA.debugLine="m.Put(\"auto_disabled\", \"Configuration automatique"; +_m.Put((Object)("auto_disabled"),(Object)("Configuration automatique desactivee.")); + //BA.debugLineNum = 190;BA.debugLine="m.Put(\"no_day_to_clear\", \"Aucun jour a effacer.\")"; +_m.Put((Object)("no_day_to_clear"),(Object)("Aucun jour a effacer.")); + //BA.debugLineNum = 191;BA.debugLine="m.Put(\"clear_today_title\", \"Effacer aujourd'hui\")"; +_m.Put((Object)("clear_today_title"),(Object)("Effacer aujourd'hui")); + //BA.debugLineNum = 192;BA.debugLine="m.Put(\"clear_today_confirm\", \"Effacer toutes les"; +_m.Put((Object)("clear_today_confirm"),(Object)("Effacer toutes les donnees enregistrees pour")); + //BA.debugLineNum = 193;BA.debugLine="m.Put(\"clear_button\", \"Effacer\")"; +_m.Put((Object)("clear_button"),(Object)("Effacer")); + //BA.debugLineNum = 194;BA.debugLine="m.Put(\"cancel\", \"Annuler\")"; +_m.Put((Object)("cancel"),(Object)("Annuler")); + //BA.debugLineNum = 195;BA.debugLine="m.Put(\"today_cleared\", \"Journee effacee.\")"; +_m.Put((Object)("today_cleared"),(Object)("Journee effacee.")); + //BA.debugLineNum = 196;BA.debugLine="m.Put(\"limit_reached\", \"Limite de 9 heures deja a"; +_m.Put((Object)("limit_reached"),(Object)("Limite de 9 heures deja atteinte pour cette journee.")); + //BA.debugLineNum = 197;BA.debugLine="Return m"; +if (true) return _m; + //BA.debugLineNum = 198;BA.debugLine="End Sub"; +return null; +} +public static anywheresoftware.b4a.objects.collections.Map _creategermanmap(anywheresoftware.b4a.BA _ba) throws Exception{ +anywheresoftware.b4a.objects.collections.Map _m = null; + //BA.debugLineNum = 200;BA.debugLine="Private Sub CreateGermanMap As Map"; + //BA.debugLineNum = 201;BA.debugLine="Dim m As Map"; +_m = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 202;BA.debugLine="m.Initialize"; +_m.Initialize(); + //BA.debugLineNum = 203;BA.debugLine="m.Put(\"app_title\", \"Overtime Guard\")"; +_m.Put((Object)("app_title"),(Object)("Overtime Guard")); + //BA.debugLineNum = 204;BA.debugLine="m.Put(\"start\", \"Start\")"; +_m.Put((Object)("start"),(Object)("Start")); + //BA.debugLineNum = 205;BA.debugLine="m.Put(\"end\", \"Stopp\")"; +_m.Put((Object)("end"),(Object)("Stopp")); + //BA.debugLineNum = 206;BA.debugLine="m.Put(\"pause\", \"Pause\")"; +_m.Put((Object)("pause"),(Object)("Pause")); + //BA.debugLineNum = 207;BA.debugLine="m.Put(\"end_pause\", \"Pause beenden\")"; +_m.Put((Object)("end_pause"),(Object)("Pause beenden")); + //BA.debugLineNum = 208;BA.debugLine="m.Put(\"stats\", \"Statistik\")"; +_m.Put((Object)("stats"),(Object)("Statistik")); + //BA.debugLineNum = 209;BA.debugLine="m.Put(\"config\", \"Konfig\")"; +_m.Put((Object)("config"),(Object)("Konfig")); + //BA.debugLineNum = 210;BA.debugLine="m.Put(\"bg\", \"Hint.\")"; +_m.Put((Object)("bg"),(Object)("Hint.")); + //BA.debugLineNum = 211;BA.debugLine="m.Put(\"statistics\", \"Statistik\")"; +_m.Put((Object)("statistics"),(Object)("Statistik")); + //BA.debugLineNum = 212;BA.debugLine="m.Put(\"close\", \"Schliessen\")"; +_m.Put((Object)("close"),(Object)("Schliessen")); + //BA.debugLineNum = 213;BA.debugLine="m.Put(\"work_start\", \"Arbeitsbeginn\")"; +_m.Put((Object)("work_start"),(Object)("Arbeitsbeginn")); + //BA.debugLineNum = 214;BA.debugLine="m.Put(\"pause_start\", \"Pausenbeginn\")"; +_m.Put((Object)("pause_start"),(Object)("Pausenbeginn")); + //BA.debugLineNum = 215;BA.debugLine="m.Put(\"pause_end\", \"Pausenende\")"; +_m.Put((Object)("pause_end"),(Object)("Pausenende")); + //BA.debugLineNum = 216;BA.debugLine="m.Put(\"work_end\", \"Arbeitsende\")"; +_m.Put((Object)("work_end"),(Object)("Arbeitsende")); + //BA.debugLineNum = 217;BA.debugLine="m.Put(\"set_config\", \"Konfig setzen\")"; +_m.Put((Object)("set_config"),(Object)("Konfig setzen")); + //BA.debugLineNum = 218;BA.debugLine="m.Put(\"reset_config\", \"Konfig reset\")"; +_m.Put((Object)("reset_config"),(Object)("Konfig reset")); + //BA.debugLineNum = 219;BA.debugLine="m.Put(\"clear_today\", \"Heute loschen\")"; +_m.Put((Object)("clear_today"),(Object)("Heute loschen")); + //BA.debugLineNum = 220;BA.debugLine="m.Put(\"date\", \"Datum\")"; +_m.Put((Object)("date"),(Object)("Datum")); + //BA.debugLineNum = 221;BA.debugLine="m.Put(\"work\", \"Arbeit\")"; +_m.Put((Object)("work"),(Object)("Arbeit")); + //BA.debugLineNum = 222;BA.debugLine="m.Put(\"pause_col\", \"Pause\")"; +_m.Put((Object)("pause_col"),(Object)("Pause")); + //BA.debugLineNum = 223;BA.debugLine="m.Put(\"overtime\", \"Uberzeit\")"; +_m.Put((Object)("overtime"),(Object)("Uberzeit")); + //BA.debugLineNum = 224;BA.debugLine="m.Put(\"totals\", \"Summen\")"; +_m.Put((Object)("totals"),(Object)("Summen")); + //BA.debugLineNum = 225;BA.debugLine="m.Put(\"manual_mode\", \"Manueller Modus\")"; +_m.Put((Object)("manual_mode"),(Object)("Manueller Modus")); + //BA.debugLineNum = 226;BA.debugLine="m.Put(\"auto_recording\", \"Auto: Aufnahme...\")"; +_m.Put((Object)("auto_recording"),(Object)("Auto: Aufnahme...")); + //BA.debugLineNum = 227;BA.debugLine="m.Put(\"auto_paused\", \"Auto: Pause...\")"; +_m.Put((Object)("auto_paused"),(Object)("Auto: Pause...")); + //BA.debugLineNum = 228;BA.debugLine="m.Put(\"auto_stopped\", \"Auto: gestoppt...\")"; +_m.Put((Object)("auto_stopped"),(Object)("Auto: gestoppt...")); + //BA.debugLineNum = 229;BA.debugLine="m.Put(\"use_hhmm\", \"Bitte HH:MM verwenden.\")"; +_m.Put((Object)("use_hhmm"),(Object)("Bitte HH:MM verwenden.")); + //BA.debugLineNum = 230;BA.debugLine="m.Put(\"times_order\", \"Die Zeiten muessen in Reihe"; +_m.Put((Object)("times_order"),(Object)("Die Zeiten muessen in Reihenfolge sein.")); + //BA.debugLineNum = 231;BA.debugLine="m.Put(\"work_exceed\", \"Die konfigurierte Arbeit da"; +_m.Put((Object)("work_exceed"),(Object)("Die konfigurierte Arbeit darf 8 Stunden nicht uberschreiten.")); + //BA.debugLineNum = 232;BA.debugLine="m.Put(\"auto_enabled\", \"Automatische Konfiguration"; +_m.Put((Object)("auto_enabled"),(Object)("Automatische Konfiguration aktiviert.")); + //BA.debugLineNum = 233;BA.debugLine="m.Put(\"auto_disabled\", \"Automatische Konfiguratio"; +_m.Put((Object)("auto_disabled"),(Object)("Automatische Konfiguration deaktiviert.")); + //BA.debugLineNum = 234;BA.debugLine="m.Put(\"no_day_to_clear\", \"Kein Tag zum Loschen.\")"; +_m.Put((Object)("no_day_to_clear"),(Object)("Kein Tag zum Loschen.")); + //BA.debugLineNum = 235;BA.debugLine="m.Put(\"clear_today_title\", \"Heute loschen\")"; +_m.Put((Object)("clear_today_title"),(Object)("Heute loschen")); + //BA.debugLineNum = 236;BA.debugLine="m.Put(\"clear_today_confirm\", \"Alle erfassten Date"; +_m.Put((Object)("clear_today_confirm"),(Object)("Alle erfassten Daten loschen fur")); + //BA.debugLineNum = 237;BA.debugLine="m.Put(\"clear_button\", \"Loschen\")"; +_m.Put((Object)("clear_button"),(Object)("Loschen")); + //BA.debugLineNum = 238;BA.debugLine="m.Put(\"cancel\", \"Abbrechen\")"; +_m.Put((Object)("cancel"),(Object)("Abbrechen")); + //BA.debugLineNum = 239;BA.debugLine="m.Put(\"today_cleared\", \"Heutige Daten geloscht.\")"; +_m.Put((Object)("today_cleared"),(Object)("Heutige Daten geloscht.")); + //BA.debugLineNum = 240;BA.debugLine="m.Put(\"limit_reached\", \"9-Stunden-Limit fur diese"; +_m.Put((Object)("limit_reached"),(Object)("9-Stunden-Limit fur diesen Arbeitstag bereits erreicht.")); + //BA.debugLineNum = 241;BA.debugLine="Return m"; +if (true) return _m; + //BA.debugLineNum = 242;BA.debugLine="End Sub"; +return null; +} +public static anywheresoftware.b4a.objects.collections.Map _createitalianmap(anywheresoftware.b4a.BA _ba) throws Exception{ +anywheresoftware.b4a.objects.collections.Map _m = null; + //BA.debugLineNum = 112;BA.debugLine="Private Sub CreateItalianMap As Map"; + //BA.debugLineNum = 113;BA.debugLine="Dim m As Map"; +_m = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 114;BA.debugLine="m.Initialize"; +_m.Initialize(); + //BA.debugLineNum = 115;BA.debugLine="m.Put(\"app_title\", \"Overtime Guard\")"; +_m.Put((Object)("app_title"),(Object)("Overtime Guard")); + //BA.debugLineNum = 116;BA.debugLine="m.Put(\"start\", \"Start\")"; +_m.Put((Object)("start"),(Object)("Start")); + //BA.debugLineNum = 117;BA.debugLine="m.Put(\"end\", \"End\")"; +_m.Put((Object)("end"),(Object)("End")); + //BA.debugLineNum = 118;BA.debugLine="m.Put(\"pause\", \"Pausa\")"; +_m.Put((Object)("pause"),(Object)("Pausa")); + //BA.debugLineNum = 119;BA.debugLine="m.Put(\"end_pause\", \"Fine pausa\")"; +_m.Put((Object)("end_pause"),(Object)("Fine pausa")); + //BA.debugLineNum = 120;BA.debugLine="m.Put(\"stats\", \"Statistiche\")"; +_m.Put((Object)("stats"),(Object)("Statistiche")); + //BA.debugLineNum = 121;BA.debugLine="m.Put(\"config\", \"Config\")"; +_m.Put((Object)("config"),(Object)("Config")); + //BA.debugLineNum = 122;BA.debugLine="m.Put(\"bg\", \"Sfondo\")"; +_m.Put((Object)("bg"),(Object)("Sfondo")); + //BA.debugLineNum = 123;BA.debugLine="m.Put(\"statistics\", \"Statistiche\")"; +_m.Put((Object)("statistics"),(Object)("Statistiche")); + //BA.debugLineNum = 124;BA.debugLine="m.Put(\"close\", \"Chiudi\")"; +_m.Put((Object)("close"),(Object)("Chiudi")); + //BA.debugLineNum = 125;BA.debugLine="m.Put(\"work_start\", \"Inizio lavoro\")"; +_m.Put((Object)("work_start"),(Object)("Inizio lavoro")); + //BA.debugLineNum = 126;BA.debugLine="m.Put(\"pause_start\", \"Inizio pausa\")"; +_m.Put((Object)("pause_start"),(Object)("Inizio pausa")); + //BA.debugLineNum = 127;BA.debugLine="m.Put(\"pause_end\", \"Fine pausa\")"; +_m.Put((Object)("pause_end"),(Object)("Fine pausa")); + //BA.debugLineNum = 128;BA.debugLine="m.Put(\"work_end\", \"Fine lavoro\")"; +_m.Put((Object)("work_end"),(Object)("Fine lavoro")); + //BA.debugLineNum = 129;BA.debugLine="m.Put(\"set_config\", \"Imposta config\")"; +_m.Put((Object)("set_config"),(Object)("Imposta config")); + //BA.debugLineNum = 130;BA.debugLine="m.Put(\"reset_config\", \"Reset config\")"; +_m.Put((Object)("reset_config"),(Object)("Reset config")); + //BA.debugLineNum = 131;BA.debugLine="m.Put(\"clear_today\", \"Azzera oggi\")"; +_m.Put((Object)("clear_today"),(Object)("Azzera oggi")); + //BA.debugLineNum = 132;BA.debugLine="m.Put(\"date\", \"Data\")"; +_m.Put((Object)("date"),(Object)("Data")); + //BA.debugLineNum = 133;BA.debugLine="m.Put(\"work\", \"Lavoro\")"; +_m.Put((Object)("work"),(Object)("Lavoro")); + //BA.debugLineNum = 134;BA.debugLine="m.Put(\"pause_col\", \"Pausa\")"; +_m.Put((Object)("pause_col"),(Object)("Pausa")); + //BA.debugLineNum = 135;BA.debugLine="m.Put(\"overtime\", \"Straord.\")"; +_m.Put((Object)("overtime"),(Object)("Straord.")); + //BA.debugLineNum = 136;BA.debugLine="m.Put(\"totals\", \"Totali\")"; +_m.Put((Object)("totals"),(Object)("Totali")); + //BA.debugLineNum = 137;BA.debugLine="m.Put(\"manual_mode\", \"Modalita manuale\")"; +_m.Put((Object)("manual_mode"),(Object)("Modalita manuale")); + //BA.debugLineNum = 138;BA.debugLine="m.Put(\"auto_recording\", \"Auto: registrazione...\")"; +_m.Put((Object)("auto_recording"),(Object)("Auto: registrazione...")); + //BA.debugLineNum = 139;BA.debugLine="m.Put(\"auto_paused\", \"Auto: pausa...\")"; +_m.Put((Object)("auto_paused"),(Object)("Auto: pausa...")); + //BA.debugLineNum = 140;BA.debugLine="m.Put(\"auto_stopped\", \"Auto: fermo...\")"; +_m.Put((Object)("auto_stopped"),(Object)("Auto: fermo...")); + //BA.debugLineNum = 141;BA.debugLine="m.Put(\"use_hhmm\", \"Usa orari HH:MM.\")"; +_m.Put((Object)("use_hhmm"),(Object)("Usa orari HH:MM.")); + //BA.debugLineNum = 142;BA.debugLine="m.Put(\"times_order\", \"Gli orari devono essere in"; +_m.Put((Object)("times_order"),(Object)("Gli orari devono essere in ordine.")); + //BA.debugLineNum = 143;BA.debugLine="m.Put(\"work_exceed\", \"Il lavoro configurato non p"; +_m.Put((Object)("work_exceed"),(Object)("Il lavoro configurato non puo superare 8 ore.")); + //BA.debugLineNum = 144;BA.debugLine="m.Put(\"auto_enabled\", \"Configurazione automatica"; +_m.Put((Object)("auto_enabled"),(Object)("Configurazione automatica attiva.")); + //BA.debugLineNum = 145;BA.debugLine="m.Put(\"auto_disabled\", \"Configurazione automatica"; +_m.Put((Object)("auto_disabled"),(Object)("Configurazione automatica disattivata.")); + //BA.debugLineNum = 146;BA.debugLine="m.Put(\"no_day_to_clear\", \"Nessun giorno da azzera"; +_m.Put((Object)("no_day_to_clear"),(Object)("Nessun giorno da azzerare.")); + //BA.debugLineNum = 147;BA.debugLine="m.Put(\"clear_today_title\", \"Azzera oggi\")"; +_m.Put((Object)("clear_today_title"),(Object)("Azzera oggi")); + //BA.debugLineNum = 148;BA.debugLine="m.Put(\"clear_today_confirm\", \"Cancellare tutti i"; +_m.Put((Object)("clear_today_confirm"),(Object)("Cancellare tutti i dati registrati per")); + //BA.debugLineNum = 149;BA.debugLine="m.Put(\"clear_button\", \"Azzera\")"; +_m.Put((Object)("clear_button"),(Object)("Azzera")); + //BA.debugLineNum = 150;BA.debugLine="m.Put(\"cancel\", \"Annulla\")"; +_m.Put((Object)("cancel"),(Object)("Annulla")); + //BA.debugLineNum = 151;BA.debugLine="m.Put(\"today_cleared\", \"Giornata azzerata.\")"; +_m.Put((Object)("today_cleared"),(Object)("Giornata azzerata.")); + //BA.debugLineNum = 152;BA.debugLine="m.Put(\"limit_reached\", \"Limite di 9 ore gia raggi"; +_m.Put((Object)("limit_reached"),(Object)("Limite di 9 ore gia raggiunto per questa giornata.")); + //BA.debugLineNum = 153;BA.debugLine="Return m"; +if (true) return _m; + //BA.debugLineNum = 154;BA.debugLine="End Sub"; +return null; +} +public static anywheresoftware.b4a.objects.collections.Map _createspanishmap(anywheresoftware.b4a.BA _ba) throws Exception{ +anywheresoftware.b4a.objects.collections.Map _m = null; + //BA.debugLineNum = 244;BA.debugLine="Private Sub CreateSpanishMap As Map"; + //BA.debugLineNum = 245;BA.debugLine="Dim m As Map"; +_m = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 246;BA.debugLine="m.Initialize"; +_m.Initialize(); + //BA.debugLineNum = 247;BA.debugLine="m.Put(\"app_title\", \"Overtime Guard\")"; +_m.Put((Object)("app_title"),(Object)("Overtime Guard")); + //BA.debugLineNum = 248;BA.debugLine="m.Put(\"start\", \"Iniciar\")"; +_m.Put((Object)("start"),(Object)("Iniciar")); + //BA.debugLineNum = 249;BA.debugLine="m.Put(\"end\", \"Detener\")"; +_m.Put((Object)("end"),(Object)("Detener")); + //BA.debugLineNum = 250;BA.debugLine="m.Put(\"pause\", \"Pausa\")"; +_m.Put((Object)("pause"),(Object)("Pausa")); + //BA.debugLineNum = 251;BA.debugLine="m.Put(\"end_pause\", \"Fin pausa\")"; +_m.Put((Object)("end_pause"),(Object)("Fin pausa")); + //BA.debugLineNum = 252;BA.debugLine="m.Put(\"stats\", \"Stats\")"; +_m.Put((Object)("stats"),(Object)("Stats")); + //BA.debugLineNum = 253;BA.debugLine="m.Put(\"config\", \"Config\")"; +_m.Put((Object)("config"),(Object)("Config")); + //BA.debugLineNum = 254;BA.debugLine="m.Put(\"bg\", \"Fondo\")"; +_m.Put((Object)("bg"),(Object)("Fondo")); + //BA.debugLineNum = 255;BA.debugLine="m.Put(\"statistics\", \"Estadisticas\")"; +_m.Put((Object)("statistics"),(Object)("Estadisticas")); + //BA.debugLineNum = 256;BA.debugLine="m.Put(\"close\", \"Cerrar\")"; +_m.Put((Object)("close"),(Object)("Cerrar")); + //BA.debugLineNum = 257;BA.debugLine="m.Put(\"work_start\", \"Inicio trabajo\")"; +_m.Put((Object)("work_start"),(Object)("Inicio trabajo")); + //BA.debugLineNum = 258;BA.debugLine="m.Put(\"pause_start\", \"Inicio pausa\")"; +_m.Put((Object)("pause_start"),(Object)("Inicio pausa")); + //BA.debugLineNum = 259;BA.debugLine="m.Put(\"pause_end\", \"Fin pausa\")"; +_m.Put((Object)("pause_end"),(Object)("Fin pausa")); + //BA.debugLineNum = 260;BA.debugLine="m.Put(\"work_end\", \"Fin trabajo\")"; +_m.Put((Object)("work_end"),(Object)("Fin trabajo")); + //BA.debugLineNum = 261;BA.debugLine="m.Put(\"set_config\", \"Activar config\")"; +_m.Put((Object)("set_config"),(Object)("Activar config")); + //BA.debugLineNum = 262;BA.debugLine="m.Put(\"reset_config\", \"Reset config\")"; +_m.Put((Object)("reset_config"),(Object)("Reset config")); + //BA.debugLineNum = 263;BA.debugLine="m.Put(\"clear_today\", \"Borrar hoy\")"; +_m.Put((Object)("clear_today"),(Object)("Borrar hoy")); + //BA.debugLineNum = 264;BA.debugLine="m.Put(\"date\", \"Fecha\")"; +_m.Put((Object)("date"),(Object)("Fecha")); + //BA.debugLineNum = 265;BA.debugLine="m.Put(\"work\", \"Trabajo\")"; +_m.Put((Object)("work"),(Object)("Trabajo")); + //BA.debugLineNum = 266;BA.debugLine="m.Put(\"pause_col\", \"Pausa\")"; +_m.Put((Object)("pause_col"),(Object)("Pausa")); + //BA.debugLineNum = 267;BA.debugLine="m.Put(\"overtime\", \"Extra\")"; +_m.Put((Object)("overtime"),(Object)("Extra")); + //BA.debugLineNum = 268;BA.debugLine="m.Put(\"totals\", \"Totales\")"; +_m.Put((Object)("totals"),(Object)("Totales")); + //BA.debugLineNum = 269;BA.debugLine="m.Put(\"manual_mode\", \"Modo manual\")"; +_m.Put((Object)("manual_mode"),(Object)("Modo manual")); + //BA.debugLineNum = 270;BA.debugLine="m.Put(\"auto_recording\", \"Auto: grabando...\")"; +_m.Put((Object)("auto_recording"),(Object)("Auto: grabando...")); + //BA.debugLineNum = 271;BA.debugLine="m.Put(\"auto_paused\", \"Auto: pausa...\")"; +_m.Put((Object)("auto_paused"),(Object)("Auto: pausa...")); + //BA.debugLineNum = 272;BA.debugLine="m.Put(\"auto_stopped\", \"Auto: detenido...\")"; +_m.Put((Object)("auto_stopped"),(Object)("Auto: detenido...")); + //BA.debugLineNum = 273;BA.debugLine="m.Put(\"use_hhmm\", \"Usa horas HH:MM.\")"; +_m.Put((Object)("use_hhmm"),(Object)("Usa horas HH:MM.")); + //BA.debugLineNum = 274;BA.debugLine="m.Put(\"times_order\", \"Las horas deben estar en or"; +_m.Put((Object)("times_order"),(Object)("Las horas deben estar en orden.")); + //BA.debugLineNum = 275;BA.debugLine="m.Put(\"work_exceed\", \"El trabajo configurado no p"; +_m.Put((Object)("work_exceed"),(Object)("El trabajo configurado no puede superar 8 horas.")); + //BA.debugLineNum = 276;BA.debugLine="m.Put(\"auto_enabled\", \"Configuracion automatica a"; +_m.Put((Object)("auto_enabled"),(Object)("Configuracion automatica activada.")); + //BA.debugLineNum = 277;BA.debugLine="m.Put(\"auto_disabled\", \"Configuracion automatica"; +_m.Put((Object)("auto_disabled"),(Object)("Configuracion automatica desactivada.")); + //BA.debugLineNum = 278;BA.debugLine="m.Put(\"no_day_to_clear\", \"No hay dia para borrar."; +_m.Put((Object)("no_day_to_clear"),(Object)("No hay dia para borrar.")); + //BA.debugLineNum = 279;BA.debugLine="m.Put(\"clear_today_title\", \"Borrar hoy\")"; +_m.Put((Object)("clear_today_title"),(Object)("Borrar hoy")); + //BA.debugLineNum = 280;BA.debugLine="m.Put(\"clear_today_confirm\", \"Borrar todos los da"; +_m.Put((Object)("clear_today_confirm"),(Object)("Borrar todos los datos registrados de")); + //BA.debugLineNum = 281;BA.debugLine="m.Put(\"clear_button\", \"Borrar\")"; +_m.Put((Object)("clear_button"),(Object)("Borrar")); + //BA.debugLineNum = 282;BA.debugLine="m.Put(\"cancel\", \"Cancelar\")"; +_m.Put((Object)("cancel"),(Object)("Cancelar")); + //BA.debugLineNum = 283;BA.debugLine="m.Put(\"today_cleared\", \"Dia borrado.\")"; +_m.Put((Object)("today_cleared"),(Object)("Dia borrado.")); + //BA.debugLineNum = 284;BA.debugLine="m.Put(\"limit_reached\", \"Limite de 9 horas ya alca"; +_m.Put((Object)("limit_reached"),(Object)("Limite de 9 horas ya alcanzado para esta jornada.")); + //BA.debugLineNum = 285;BA.debugLine="Return m"; +if (true) return _m; + //BA.debugLineNum = 286;BA.debugLine="End Sub"; +return null; +} +public static String _currentlanguagecode(anywheresoftware.b4a.BA _ba) throws Exception{ + //BA.debugLineNum = 29;BA.debugLine="Public Sub CurrentLanguageCode As String"; + //BA.debugLineNum = 30;BA.debugLine="If initialized = False Then Initialize"; +if (_initialized==anywheresoftware.b4a.keywords.Common.False) { +_initialize(_ba);}; + //BA.debugLineNum = 31;BA.debugLine="Return currentLanguage"; +if (true) return _currentlanguage; + //BA.debugLineNum = 32;BA.debugLine="End Sub"; +return ""; +} +public static String _detectdevicelanguage(anywheresoftware.b4a.BA _ba) throws Exception{ +anywheresoftware.b4j.object.JavaObject _context = null; +anywheresoftware.b4j.object.JavaObject _resources = null; +anywheresoftware.b4j.object.JavaObject _configuration = null; +anywheresoftware.b4j.object.JavaObject _locale = null; +String _code = ""; +anywheresoftware.b4j.object.JavaObject _jo = null; + //BA.debugLineNum = 54;BA.debugLine="Private Sub DetectDeviceLanguage As String"; + //BA.debugLineNum = 55;BA.debugLine="Dim context As JavaObject"; +_context = new anywheresoftware.b4j.object.JavaObject(); + //BA.debugLineNum = 56;BA.debugLine="context.InitializeContext"; +_context.InitializeContext((_ba.processBA == null ? _ba : _ba.processBA)); + //BA.debugLineNum = 57;BA.debugLine="Dim resources As JavaObject = context.RunMethod(\""; +_resources = new anywheresoftware.b4j.object.JavaObject(); +_resources = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_context.RunMethod("getResources",(Object[])(anywheresoftware.b4a.keywords.Common.Null)))); + //BA.debugLineNum = 58;BA.debugLine="Dim configuration As JavaObject = resources.RunMe"; +_configuration = new anywheresoftware.b4j.object.JavaObject(); +_configuration = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_resources.RunMethod("getConfiguration",(Object[])(anywheresoftware.b4a.keywords.Common.Null)))); + //BA.debugLineNum = 59;BA.debugLine="Dim locale As JavaObject = configuration.GetField"; +_locale = new anywheresoftware.b4j.object.JavaObject(); +_locale = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_configuration.GetField("locale"))); + //BA.debugLineNum = 60;BA.debugLine="Dim code As String = locale.RunMethod(\"getLanguag"; +_code = BA.ObjectToString(_locale.RunMethod("getLanguage",(Object[])(anywheresoftware.b4a.keywords.Common.Null))); + //BA.debugLineNum = 61;BA.debugLine="If code <> \"\" Then Return code"; +if ((_code).equals("") == false) { +if (true) return _code;}; + //BA.debugLineNum = 62;BA.debugLine="Dim jo As JavaObject"; +_jo = new anywheresoftware.b4j.object.JavaObject(); + //BA.debugLineNum = 63;BA.debugLine="jo.InitializeStatic(\"java.util.Locale\")"; +_jo.InitializeStatic("java.util.Locale"); + //BA.debugLineNum = 64;BA.debugLine="locale = jo.RunMethod(\"getDefault\", Null)"; +_locale = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_jo.RunMethod("getDefault",(Object[])(anywheresoftware.b4a.keywords.Common.Null)))); + //BA.debugLineNum = 65;BA.debugLine="Return locale.RunMethod(\"getLanguage\", Null)"; +if (true) return BA.ObjectToString(_locale.RunMethod("getLanguage",(Object[])(anywheresoftware.b4a.keywords.Common.Null))); + //BA.debugLineNum = 66;BA.debugLine="End Sub"; +return ""; +} +public static String _initialize(anywheresoftware.b4a.BA _ba) throws Exception{ + //BA.debugLineNum = 8;BA.debugLine="Public Sub Initialize"; + //BA.debugLineNum = 9;BA.debugLine="If initialized Then Return"; +if (_initialized) { +if (true) return "";}; + //BA.debugLineNum = 10;BA.debugLine="translations.Initialize"; +_translations.Initialize(); + //BA.debugLineNum = 11;BA.debugLine="LoadLanguage(\"en\", CreateEnglishMap)"; +_loadlanguage(_ba,"en",_createenglishmap(_ba)); + //BA.debugLineNum = 12;BA.debugLine="LoadLanguage(\"it\", CreateItalianMap)"; +_loadlanguage(_ba,"it",_createitalianmap(_ba)); + //BA.debugLineNum = 13;BA.debugLine="LoadLanguage(\"fr\", CreateFrenchMap)"; +_loadlanguage(_ba,"fr",_createfrenchmap(_ba)); + //BA.debugLineNum = 14;BA.debugLine="LoadLanguage(\"de\", CreateGermanMap)"; +_loadlanguage(_ba,"de",_creategermanmap(_ba)); + //BA.debugLineNum = 15;BA.debugLine="LoadLanguage(\"es\", CreateSpanishMap)"; +_loadlanguage(_ba,"es",_createspanishmap(_ba)); + //BA.debugLineNum = 16;BA.debugLine="currentLanguage = NormalizeLanguage(DetectDeviceL"; +_currentlanguage = _normalizelanguage(_ba,_detectdevicelanguage(_ba)); + //BA.debugLineNum = 17;BA.debugLine="initialized = True"; +_initialized = anywheresoftware.b4a.keywords.Common.True; + //BA.debugLineNum = 18;BA.debugLine="End Sub"; +return ""; +} +public static String _loadlanguage(anywheresoftware.b4a.BA _ba,String _code,anywheresoftware.b4a.objects.collections.Map _values) throws Exception{ + //BA.debugLineNum = 34;BA.debugLine="Private Sub LoadLanguage(Code As String, Values As"; + //BA.debugLineNum = 35;BA.debugLine="translations.Put(Code, Values)"; +_translations.Put((Object)(_code),(Object)(_values.getObject())); + //BA.debugLineNum = 36;BA.debugLine="End Sub"; +return ""; +} +public static String _normalizelanguage(anywheresoftware.b4a.BA _ba,String _code) throws Exception{ + //BA.debugLineNum = 38;BA.debugLine="Private Sub NormalizeLanguage(Code As String) As S"; + //BA.debugLineNum = 39;BA.debugLine="Code = Code.ToLowerCase"; +_code = _code.toLowerCase(); + //BA.debugLineNum = 40;BA.debugLine="Select True"; +switch (BA.switchObjectToInt(anywheresoftware.b4a.keywords.Common.True,_code.startsWith("it"),_code.startsWith("fr"),_code.startsWith("de"),_code.startsWith("es"))) { +case 0: { + //BA.debugLineNum = 42;BA.debugLine="Return \"it\""; +if (true) return "it"; + break; } +case 1: { + //BA.debugLineNum = 44;BA.debugLine="Return \"fr\""; +if (true) return "fr"; + break; } +case 2: { + //BA.debugLineNum = 46;BA.debugLine="Return \"de\""; +if (true) return "de"; + break; } +case 3: { + //BA.debugLineNum = 48;BA.debugLine="Return \"es\""; +if (true) return "es"; + break; } +default: { + //BA.debugLineNum = 50;BA.debugLine="Return \"en\""; +if (true) return "en"; + break; } +} +; + //BA.debugLineNum = 52;BA.debugLine="End Sub"; +return ""; +} +public static String _process_globals() throws Exception{ + //BA.debugLineNum = 2;BA.debugLine="Sub Process_Globals"; + //BA.debugLineNum = 3;BA.debugLine="Private translations As Map"; +_translations = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 4;BA.debugLine="Private currentLanguage As String"; +_currentlanguage = ""; + //BA.debugLineNum = 5;BA.debugLine="Private initialized As Boolean"; +_initialized = false; + //BA.debugLineNum = 6;BA.debugLine="End Sub"; +return ""; +} +public static String _t(anywheresoftware.b4a.BA _ba,String _key) throws Exception{ +anywheresoftware.b4a.objects.collections.Map _languagemap = null; +anywheresoftware.b4a.objects.collections.Map _fallback = null; + //BA.debugLineNum = 20;BA.debugLine="Public Sub T(Key As String) As String"; + //BA.debugLineNum = 21;BA.debugLine="If initialized = False Then Initialize"; +if (_initialized==anywheresoftware.b4a.keywords.Common.False) { +_initialize(_ba);}; + //BA.debugLineNum = 22;BA.debugLine="Dim languageMap As Map = translations.Get(current"; +_languagemap = new anywheresoftware.b4a.objects.collections.Map(); +_languagemap = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_translations.Get((Object)(_currentlanguage)))); + //BA.debugLineNum = 23;BA.debugLine="If languageMap.IsInitialized And languageMap.Cont"; +if (_languagemap.IsInitialized() && _languagemap.ContainsKey((Object)(_key))) { +if (true) return BA.ObjectToString(_languagemap.Get((Object)(_key)));}; + //BA.debugLineNum = 24;BA.debugLine="Dim fallback As Map = translations.Get(\"en\")"; +_fallback = new anywheresoftware.b4a.objects.collections.Map(); +_fallback = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_translations.Get((Object)("en")))); + //BA.debugLineNum = 25;BA.debugLine="If fallback.IsInitialized And fallback.ContainsKe"; +if (_fallback.IsInitialized() && _fallback.ContainsKey((Object)(_key))) { +if (true) return BA.ObjectToString(_fallback.Get((Object)(_key)));}; + //BA.debugLineNum = 26;BA.debugLine="Return Key"; +if (true) return _key; + //BA.debugLineNum = 27;BA.debugLine="End Sub"; +return ""; +} +} diff --git a/Objects/src/b4a/example/main.java b/Objects/src/b4a/example/main.java index 5599ff4..43788d1 100644 --- a/Objects/src/b4a/example/main.java +++ b/Objects/src/b4a/example/main.java @@ -25,7 +25,7 @@ public class main extends Activity implements B4AActivity{ ActivityWrapper _activity; java.util.ArrayList menuItems; public static final boolean fullScreen = false; - public static final boolean includeTitle = true; + public static final boolean includeTitle = false; public static WeakReference previousOne; public static boolean dontPause; @@ -34,7 +34,7 @@ public class main extends Activity implements B4AActivity{ super.onCreate(savedInstanceState); mostCurrent = this; if (processBA == null) { - processBA = new anywheresoftware.b4a.ShellBA(this.getApplicationContext(), null, null, "b4a.example", "b4a.example.main"); + processBA = new BA(this.getApplicationContext(), null, null, "b4a.example", "b4a.example.main"); processBA.loadHtSubs(this.getClass()); float deviceScale = getApplicationContext().getResources().getDisplayMetrics().density; BALayout.setDeviceScale(deviceScale); @@ -335,320 +335,2351 @@ public class main extends Activity implements B4AActivity{ } +public anywheresoftware.b4a.keywords.Common __c = null; +public static anywheresoftware.b4a.objects.Timer _timer1 = null; +public static long _firstworklimitms = 0L; +public static long _worklimitms = 0L; +public static long _overtimelimitms = 0L; +public static long _maxproductivems = 0L; +public static String _statsfilename = ""; +public static String _statefilename = ""; +public static String _autoconfigfilename = ""; +public static int _maxstoreddays = 0; +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 _btnstats = null; +public anywheresoftware.b4a.objects.ButtonWrapper _btnstatsclose = null; +public anywheresoftware.b4a.objects.LabelWrapper _btnconfig = null; +public anywheresoftware.b4a.objects.ButtonWrapper _btnconfigclose = null; +public anywheresoftware.b4a.objects.ButtonWrapper _btnconfigsave = null; +public anywheresoftware.b4a.objects.ButtonWrapper _btnconfigreset = null; +public anywheresoftware.b4a.objects.ButtonWrapper _btncleartoday = null; +public anywheresoftware.b4a.objects.LabelWrapper _btnbackground = null; +public anywheresoftware.b4a.objects.LabelWrapper _lblelapsedtime = null; +public anywheresoftware.b4a.objects.LabelWrapper _lblautostatus = null; +public anywheresoftware.b4a.objects.PanelWrapper _pnlclock = null; +public anywheresoftware.b4a.objects.PanelWrapper _pnlstats = null; +public anywheresoftware.b4a.objects.PanelWrapper _pnlconfig = null; +public anywheresoftware.b4a.objects.ScrollViewWrapper _svstats = null; +public anywheresoftware.b4a.objects.EditTextWrapper _txtcfgstart = null; +public anywheresoftware.b4a.objects.EditTextWrapper _txtcfgpausestart = null; +public anywheresoftware.b4a.objects.EditTextWrapper _txtcfgpauseend = null; +public anywheresoftware.b4a.objects.EditTextWrapper _txtcfgend = null; +public b4a.example.analogclock _myclock = null; +public static boolean _sessionactive = false; +public static boolean _pauseactive = false; +public static long _productiveelapsedms = 0L; +public static long _currentsegmentstart = 0L; +public static int _currentsegmentcolor = 0; +public anywheresoftware.b4a.objects.collections.List _statsrows = null; +public static int _workmorningcolor = 0; +public static long _currentworkdaystart = 0L; +public static long _currentworkdaykey = 0L; +public static boolean _automodeenabled = false; +public static int _autostartminutes = 0; +public static int _autopausestartminutes = 0; +public static int _autopauseendminutes = 0; +public static int _autoendminutes = 0; +public static String _autostate = ""; +public static long _lastactivestatesaveat = 0L; +public b4a.example.starter _starter = null; +public b4a.example.localization _localization = null; +public static boolean isAnyActivityVisible() { + boolean vis = false; +vis = vis | (main.mostCurrent != null); +return vis;} +public static String _activity_create(boolean _firsttime) throws Exception{ + //BA.debugLineNum = 68;BA.debugLine="Sub Activity_Create(FirstTime As Boolean)"; + //BA.debugLineNum = 69;BA.debugLine="Localization.Initialize"; +mostCurrent._localization._initialize /*String*/ (mostCurrent.activityBA); + //BA.debugLineNum = 70;BA.debugLine="Activity.LoadLayout(\"Main_Layout\")"; +mostCurrent._activity.LoadLayout("Main_Layout",mostCurrent.activityBA); + //BA.debugLineNum = 71;BA.debugLine="Activity.Title = Localization.T(\"app_title\")"; +mostCurrent._activity.setTitle(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"app_title"))); + //BA.debugLineNum = 72;BA.debugLine="Log(\"Layout loaded successfully.\")"; +anywheresoftware.b4a.keywords.Common.LogImpl("131076","Layout loaded successfully.",0); + //BA.debugLineNum = 73;BA.debugLine="ResizeClockPanel"; +_resizeclockpanel(); + //BA.debugLineNum = 75;BA.debugLine="FirstWorkLimitMs = 4 * DateTime.TicksPerHour"; +_firstworklimitms = (long) (4*anywheresoftware.b4a.keywords.Common.DateTime.TicksPerHour); + //BA.debugLineNum = 76;BA.debugLine="WorkLimitMs = 8 * DateTime.TicksPerHour"; +_worklimitms = (long) (8*anywheresoftware.b4a.keywords.Common.DateTime.TicksPerHour); + //BA.debugLineNum = 77;BA.debugLine="OvertimeLimitMs = DateTime.TicksPerHour"; +_overtimelimitms = anywheresoftware.b4a.keywords.Common.DateTime.TicksPerHour; + //BA.debugLineNum = 78;BA.debugLine="MaxProductiveMs = WorkLimitMs + OvertimeLimitMs"; +_maxproductivems = (long) (_worklimitms+_overtimelimitms); + //BA.debugLineNum = 79;BA.debugLine="WorkMorningColor = Colors.RGB(0, 190, 255)"; +_workmorningcolor = anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (0),(int) (190),(int) (255)); + //BA.debugLineNum = 80;BA.debugLine="StatsFileName = \"work_segments.txt\""; +_statsfilename = "work_segments.txt"; + //BA.debugLineNum = 81;BA.debugLine="StateFileName = \"active_state.txt\""; +_statefilename = "active_state.txt"; + //BA.debugLineNum = 82;BA.debugLine="AutoConfigFileName = \"auto_config.txt\""; +_autoconfigfilename = "auto_config.txt"; + //BA.debugLineNum = 83;BA.debugLine="MaxStoredDays = 62"; +_maxstoreddays = (int) (62); + //BA.debugLineNum = 85;BA.debugLine="myClock.Initialize(pnlClock, 96)"; +mostCurrent._myclock._initialize /*String*/ (mostCurrent.activityBA,mostCurrent._pnlclock,(float) (96)); + //BA.debugLineNum = 86;BA.debugLine="myClock.SetBaseDuration(12 * DateTime.TicksPerHou"; +mostCurrent._myclock._setbaseduration /*String*/ ((long) (12*anywheresoftware.b4a.keywords.Common.DateTime.TicksPerHour)); + //BA.debugLineNum = 88;BA.debugLine="Timer1.Initialize(\"Timer1\", 1000)"; +_timer1.Initialize(processBA,"Timer1",(long) (1000)); + //BA.debugLineNum = 89;BA.debugLine="Timer1.Enabled = True"; +_timer1.setEnabled(anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 91;BA.debugLine="StatsRows.Initialize"; +mostCurrent._statsrows.Initialize(); + //BA.debugLineNum = 92;BA.debugLine="LoadStatsRows"; +_loadstatsrows(); + //BA.debugLineNum = 93;BA.debugLine="HideLegacyButtons"; +_hidelegacybuttons(); + //BA.debugLineNum = 94;BA.debugLine="CreateStatsButton"; +_createstatsbutton(); + //BA.debugLineNum = 95;BA.debugLine="CreateStatsPage"; +_createstatspage(); + //BA.debugLineNum = 96;BA.debugLine="CreateConfigButton"; +_createconfigbutton(); + //BA.debugLineNum = 97;BA.debugLine="CreateConfigPage"; +_createconfigpage(); + //BA.debugLineNum = 98;BA.debugLine="CreateBackgroundButton"; +_createbackgroundbutton(); + //BA.debugLineNum = 99;BA.debugLine="CreateAutoStatusLabel"; +_createautostatuslabel(); + //BA.debugLineNum = 100;BA.debugLine="LayoutMainButtons"; +_layoutmainbuttons(); + //BA.debugLineNum = 101;BA.debugLine="LoadAutoConfig"; +_loadautoconfig(); + //BA.debugLineNum = 102;BA.debugLine="ResetSessionState(False)"; +_resetsessionstate(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 103;BA.debugLine="If AutoModeEnabled Then"; +if (_automodeenabled) { + //BA.debugLineNum = 104;BA.debugLine="UpdateAutomaticState(DateTime.Now)"; +_updateautomaticstate(anywheresoftware.b4a.keywords.Common.DateTime.getNow()); + }else { + //BA.debugLineNum = 106;BA.debugLine="RestoreActiveState"; +_restoreactivestate(); + //BA.debugLineNum = 107;BA.debugLine="If SessionActive = False Then RestoreLastClosedD"; +if (_sessionactive==anywheresoftware.b4a.keywords.Common.False) { +_restorelastcloseddaystate();}; + }; + //BA.debugLineNum = 109;BA.debugLine="End Sub"; +return ""; +} +public static String _activity_pause(boolean _userclosed) throws Exception{ + //BA.debugLineNum = 294;BA.debugLine="Sub Activity_Pause (UserClosed As Boolean)"; + //BA.debugLineNum = 295;BA.debugLine="If AutoModeEnabled = False Then SaveActiveState"; +if (_automodeenabled==anywheresoftware.b4a.keywords.Common.False) { +_saveactivestate();}; + //BA.debugLineNum = 296;BA.debugLine="End Sub"; +return ""; +} +public static String _activity_resume() throws Exception{ + //BA.debugLineNum = 135;BA.debugLine="Sub Activity_Resume"; + //BA.debugLineNum = 136;BA.debugLine="If AutoModeEnabled Then"; +if (_automodeenabled) { + //BA.debugLineNum = 137;BA.debugLine="UpdateAutomaticState(DateTime.Now)"; +_updateautomaticstate(anywheresoftware.b4a.keywords.Common.DateTime.getNow()); + }else { + //BA.debugLineNum = 139;BA.debugLine="RestoreActiveState"; +_restoreactivestate(); + //BA.debugLineNum = 140;BA.debugLine="If SessionActive = False Then RestoreLastClosedD"; +if (_sessionactive==anywheresoftware.b4a.keywords.Common.False) { +_restorelastcloseddaystate();}; + }; + //BA.debugLineNum = 142;BA.debugLine="End Sub"; +return ""; +} +public static String _addautosegmentnosave(long _daystart,int _fromminutes,int _tominutes,String _category) throws Exception{ +long _duration = 0L; +anywheresoftware.b4a.objects.collections.Map _row = null; + //BA.debugLineNum = 1045;BA.debugLine="Private Sub AddAutoSegmentNoSave(DayStart As Long,"; + //BA.debugLineNum = 1046;BA.debugLine="Dim duration As Long = (ToMinutes - FromMinutes)"; +_duration = (long) ((_tominutes-_fromminutes)*anywheresoftware.b4a.keywords.Common.DateTime.TicksPerMinute); + //BA.debugLineNum = 1047;BA.debugLine="If duration <= 0 Then Return"; +if (_duration<=0) { +if (true) return "";}; + //BA.debugLineNum = 1048;BA.debugLine="Dim row As Map"; +_row = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 1049;BA.debugLine="row.Initialize"; +_row.Initialize(); + //BA.debugLineNum = 1050;BA.debugLine="row.Put(\"dayStart\", DayStart)"; +_row.Put((Object)("dayStart"),(Object)(_daystart)); + //BA.debugLineNum = 1051;BA.debugLine="row.Put(\"dayKey\", DayStart)"; +_row.Put((Object)("dayKey"),(Object)(_daystart)); + //BA.debugLineNum = 1052;BA.debugLine="row.Put(\"segmentStart\", DayStart + FromMinutes *"; +_row.Put((Object)("segmentStart"),(Object)(_daystart+_fromminutes*anywheresoftware.b4a.keywords.Common.DateTime.TicksPerMinute)); + //BA.debugLineNum = 1053;BA.debugLine="row.Put(\"date\", DateTime.Date(DayStart))"; +_row.Put((Object)("date"),(Object)(anywheresoftware.b4a.keywords.Common.DateTime.Date(_daystart))); + //BA.debugLineNum = 1054;BA.debugLine="row.Put(\"duration\", duration)"; +_row.Put((Object)("duration"),(Object)(_duration)); + //BA.debugLineNum = 1055;BA.debugLine="row.Put(\"category\", Category)"; +_row.Put((Object)("category"),(Object)(_category)); + //BA.debugLineNum = 1056;BA.debugLine="row.Put(\"source\", \"auto\")"; +_row.Put((Object)("source"),(Object)("auto")); + //BA.debugLineNum = 1057;BA.debugLine="StatsRows.Add(row)"; +mostCurrent._statsrows.Add((Object)(_row.getObject())); + //BA.debugLineNum = 1058;BA.debugLine="End Sub"; +return ""; +} +public static String _addcell(String _text,int _x,int _y,int _w,int _h,boolean _header) throws Exception{ +anywheresoftware.b4a.objects.LabelWrapper _lbl = null; + //BA.debugLineNum = 1112;BA.debugLine="Private Sub AddCell(Text As String, x As Int, y As"; + //BA.debugLineNum = 1113;BA.debugLine="Dim lbl As Label"; +_lbl = new anywheresoftware.b4a.objects.LabelWrapper(); + //BA.debugLineNum = 1114;BA.debugLine="lbl.Initialize(\"\")"; +_lbl.Initialize(mostCurrent.activityBA,""); + //BA.debugLineNum = 1115;BA.debugLine="lbl.Text = Text"; +_lbl.setText(BA.ObjectToCharSequence(_text)); + //BA.debugLineNum = 1116;BA.debugLine="lbl.TextSize = 12"; +_lbl.setTextSize((float) (12)); + //BA.debugLineNum = 1117;BA.debugLine="lbl.TextColor = Colors.Black"; +_lbl.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black); + //BA.debugLineNum = 1118;BA.debugLine="lbl.Gravity = Gravity.CENTER"; +_lbl.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER); + //BA.debugLineNum = 1119;BA.debugLine="If Header Then"; +if (_header) { + //BA.debugLineNum = 1120;BA.debugLine="lbl.Color = Colors.RGB(230, 230, 230)"; +_lbl.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (230),(int) (230),(int) (230))); + }else { + //BA.debugLineNum = 1122;BA.debugLine="lbl.Color = Colors.White"; +_lbl.setColor(anywheresoftware.b4a.keywords.Common.Colors.White); + }; + //BA.debugLineNum = 1124;BA.debugLine="svStats.Panel.AddView(lbl, x, y, w, h)"; +mostCurrent._svstats.getPanel().AddView((android.view.View)(_lbl.getObject()),_x,_y,_w,_h); + //BA.debugLineNum = 1125;BA.debugLine="End Sub"; +return ""; +} +public static anywheresoftware.b4a.objects.EditTextWrapper _addconfigfield(String _labeltext,String _valuetext,int _y) throws Exception{ +anywheresoftware.b4a.objects.LabelWrapper _lbl = null; +anywheresoftware.b4a.objects.EditTextWrapper _txt = null; + //BA.debugLineNum = 275;BA.debugLine="Private Sub AddConfigField(LabelText As String, Va"; + //BA.debugLineNum = 276;BA.debugLine="Dim lbl As Label"; +_lbl = new anywheresoftware.b4a.objects.LabelWrapper(); + //BA.debugLineNum = 277;BA.debugLine="lbl.Initialize(\"\")"; +_lbl.Initialize(mostCurrent.activityBA,""); + //BA.debugLineNum = 278;BA.debugLine="lbl.Text = LabelText"; +_lbl.setText(BA.ObjectToCharSequence(_labeltext)); + //BA.debugLineNum = 279;BA.debugLine="lbl.TextSize = 16"; +_lbl.setTextSize((float) (16)); + //BA.debugLineNum = 280;BA.debugLine="lbl.TextColor = Colors.Black"; +_lbl.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black); + //BA.debugLineNum = 281;BA.debugLine="lbl.Gravity = Gravity.CENTER_VERTICAL"; +_lbl.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER_VERTICAL); + //BA.debugLineNum = 282;BA.debugLine="pnlConfig.AddView(lbl, 12dip, y, 140dip, 46dip)"; +mostCurrent._pnlconfig.AddView((android.view.View)(_lbl.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (12)),_y,anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (140)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (46))); + //BA.debugLineNum = 284;BA.debugLine="Dim txt As EditText"; +_txt = new anywheresoftware.b4a.objects.EditTextWrapper(); + //BA.debugLineNum = 285;BA.debugLine="txt.Initialize(\"\")"; +_txt.Initialize(mostCurrent.activityBA,""); + //BA.debugLineNum = 286;BA.debugLine="txt.Text = ValueText"; +_txt.setText(BA.ObjectToCharSequence(_valuetext)); + //BA.debugLineNum = 287;BA.debugLine="txt.TextSize = 18"; +_txt.setTextSize((float) (18)); + //BA.debugLineNum = 288;BA.debugLine="txt.SingleLine = True"; +_txt.setSingleLine(anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 289;BA.debugLine="txt.InputType = txt.INPUT_TYPE_NUMBERS"; +_txt.setInputType(_txt.INPUT_TYPE_NUMBERS); + //BA.debugLineNum = 290;BA.debugLine="pnlConfig.AddView(txt, 160dip, y, Activity.Width"; +mostCurrent._pnlconfig.AddView((android.view.View)(_txt.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (160)),_y,(int) (mostCurrent._activity.getWidth()-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (172))),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (46))); + //BA.debugLineNum = 291;BA.debugLine="Return txt"; +if (true) return _txt; + //BA.debugLineNum = 292;BA.debugLine="End Sub"; +return null; +} +public static String _adddisplayproductivesegment(long _duration,long _startproductivems) throws Exception{ +long _remaining = 0L; +long _cursor = 0L; +int _segmentcolor = 0; +long _boundary = 0L; +long _chunk = 0L; + //BA.debugLineNum = 628;BA.debugLine="Private Sub AddDisplayProductiveSegment(Duration A"; + //BA.debugLineNum = 629;BA.debugLine="Dim remaining As Long = Duration"; +_remaining = _duration; + //BA.debugLineNum = 630;BA.debugLine="Dim cursor As Long = StartProductiveMs"; +_cursor = _startproductivems; + //BA.debugLineNum = 631;BA.debugLine="Do While remaining > 0"; +while (_remaining>0) { + //BA.debugLineNum = 632;BA.debugLine="Dim segmentColor As Int"; +_segmentcolor = 0; + //BA.debugLineNum = 633;BA.debugLine="Dim boundary As Long"; +_boundary = 0L; + //BA.debugLineNum = 634;BA.debugLine="If cursor < FirstWorkLimitMs Then"; +if (_cursor<_firstworklimitms) { + //BA.debugLineNum = 635;BA.debugLine="segmentColor = WorkMorningColor"; +_segmentcolor = _workmorningcolor; + //BA.debugLineNum = 636;BA.debugLine="boundary = FirstWorkLimitMs"; +_boundary = _firstworklimitms; + }else if(_cursor<_worklimitms) { + //BA.debugLineNum = 638;BA.debugLine="segmentColor = Colors.Green"; +_segmentcolor = anywheresoftware.b4a.keywords.Common.Colors.Green; + //BA.debugLineNum = 639;BA.debugLine="boundary = WorkLimitMs"; +_boundary = _worklimitms; + }else { + //BA.debugLineNum = 641;BA.debugLine="segmentColor = Colors.Red"; +_segmentcolor = anywheresoftware.b4a.keywords.Common.Colors.Red; + //BA.debugLineNum = 642;BA.debugLine="boundary = MaxProductiveMs"; +_boundary = _maxproductivems; + }; + //BA.debugLineNum = 644;BA.debugLine="Dim chunk As Long = remaining"; +_chunk = _remaining; + //BA.debugLineNum = 645;BA.debugLine="If cursor < boundary Then chunk = Min(chunk, bou"; +if (_cursor<_boundary) { +_chunk = (long) (anywheresoftware.b4a.keywords.Common.Min(_chunk,_boundary-_cursor));}; + //BA.debugLineNum = 646;BA.debugLine="myClock.AddSegment(chunk, segmentColor, False)"; +mostCurrent._myclock._addsegment /*String*/ (_chunk,_segmentcolor,anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 647;BA.debugLine="remaining = remaining - chunk"; +_remaining = (long) (_remaining-_chunk); + //BA.debugLineNum = 648;BA.debugLine="cursor = cursor + chunk"; +_cursor = (long) (_cursor+_chunk); + } +; + //BA.debugLineNum = 650;BA.debugLine="End Sub"; +return ""; +} +public static String _addstatsduration(anywheresoftware.b4a.objects.collections.Map _dailyrows,String _datetext,String _category,long _duration) throws Exception{ +anywheresoftware.b4a.objects.collections.Map _dailytotals = null; + //BA.debugLineNum = 905;BA.debugLine="Private Sub AddStatsDuration(dailyRows As Map, Dat"; + //BA.debugLineNum = 906;BA.debugLine="Dim dailyTotals As Map"; +_dailytotals = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 907;BA.debugLine="If dailyRows.ContainsKey(DateText) Then"; +if (_dailyrows.ContainsKey((Object)(_datetext))) { + //BA.debugLineNum = 908;BA.debugLine="dailyTotals = dailyRows.Get(DateText)"; +_dailytotals = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_dailyrows.Get((Object)(_datetext)))); + }else { + //BA.debugLineNum = 910;BA.debugLine="dailyTotals.Initialize"; +_dailytotals.Initialize(); + //BA.debugLineNum = 911;BA.debugLine="dailyTotals.Put(\"lavoro\", 0)"; +_dailytotals.Put((Object)("lavoro"),(Object)(0)); + //BA.debugLineNum = 912;BA.debugLine="dailyTotals.Put(\"pausa\", 0)"; +_dailytotals.Put((Object)("pausa"),(Object)(0)); + //BA.debugLineNum = 913;BA.debugLine="dailyTotals.Put(\"straordinario\", 0)"; +_dailytotals.Put((Object)("straordinario"),(Object)(0)); + //BA.debugLineNum = 914;BA.debugLine="dailyRows.Put(DateText, dailyTotals)"; +_dailyrows.Put((Object)(_datetext),(Object)(_dailytotals.getObject())); + }; + //BA.debugLineNum = 916;BA.debugLine="dailyTotals.Put(Category, dailyTotals.Get(Categor"; +_dailytotals.Put((Object)(_category),(Object)((double)(BA.ObjectToNumber(_dailytotals.Get((Object)(_category))))+_duration)); + //BA.debugLineNum = 917;BA.debugLine="End Sub"; +return ""; +} +public static String _addstatsrow(int _y,String _datetext,String _worktext,String _pausetext,String _overtimetext,boolean _header) throws Exception{ +int _rowheight = 0; +int _col1 = 0; +int _col = 0; + //BA.debugLineNum = 1102;BA.debugLine="Private Sub AddStatsRow(y As Int, DateText As Stri"; + //BA.debugLineNum = 1103;BA.debugLine="Dim rowHeight As Int = 30dip"; +_rowheight = anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (30)); + //BA.debugLineNum = 1104;BA.debugLine="Dim col1 As Int = 104dip"; +_col1 = anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (104)); + //BA.debugLineNum = 1105;BA.debugLine="Dim col As Int = (Activity.Width - col1) / 3"; +_col = (int) ((mostCurrent._activity.getWidth()-_col1)/(double)3); + //BA.debugLineNum = 1106;BA.debugLine="AddCell(DateText, 0, y, col1, rowHeight, Header)"; +_addcell(_datetext,(int) (0),_y,_col1,_rowheight,_header); + //BA.debugLineNum = 1107;BA.debugLine="AddCell(WorkText, col1, y, col, rowHeight, Header"; +_addcell(_worktext,_col1,_y,_col,_rowheight,_header); + //BA.debugLineNum = 1108;BA.debugLine="AddCell(PauseText, col1 + col, y, col, rowHeight,"; +_addcell(_pausetext,(int) (_col1+_col),_y,_col,_rowheight,_header); + //BA.debugLineNum = 1109;BA.debugLine="AddCell(OvertimeText, col1 + 2 * col, y, col, row"; +_addcell(_overtimetext,(int) (_col1+2*_col),_y,_col,_rowheight,_header); + //BA.debugLineNum = 1110;BA.debugLine="End Sub"; +return ""; +} +public static String _addstatssegment(long _daystart,long _daykey,long _segmentstart,long _duration,String _category,String _source) throws Exception{ +anywheresoftware.b4a.objects.collections.Map _row = null; + //BA.debugLineNum = 505;BA.debugLine="Private Sub AddStatsSegment(DayStart As Long, DayK"; + //BA.debugLineNum = 506;BA.debugLine="Dim row As Map"; +_row = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 507;BA.debugLine="row.Initialize"; +_row.Initialize(); + //BA.debugLineNum = 508;BA.debugLine="row.Put(\"dayStart\", DayStart)"; +_row.Put((Object)("dayStart"),(Object)(_daystart)); + //BA.debugLineNum = 509;BA.debugLine="row.Put(\"dayKey\", DayKey)"; +_row.Put((Object)("dayKey"),(Object)(_daykey)); + //BA.debugLineNum = 510;BA.debugLine="row.Put(\"segmentStart\", SegmentStart)"; +_row.Put((Object)("segmentStart"),(Object)(_segmentstart)); + //BA.debugLineNum = 511;BA.debugLine="row.Put(\"date\", DateTime.Date(DayStart))"; +_row.Put((Object)("date"),(Object)(anywheresoftware.b4a.keywords.Common.DateTime.Date(_daystart))); + //BA.debugLineNum = 512;BA.debugLine="row.Put(\"duration\", Duration)"; +_row.Put((Object)("duration"),(Object)(_duration)); + //BA.debugLineNum = 513;BA.debugLine="row.Put(\"category\", Category)"; +_row.Put((Object)("category"),(Object)(_category)); + //BA.debugLineNum = 514;BA.debugLine="row.Put(\"source\", Source)"; +_row.Put((Object)("source"),(Object)(_source)); + //BA.debugLineNum = 515;BA.debugLine="StatsRows.Add(row)"; +mostCurrent._statsrows.Add((Object)(_row.getObject())); + //BA.debugLineNum = 516;BA.debugLine="TrimStatsRows"; +_trimstatsrows(); + //BA.debugLineNum = 517;BA.debugLine="SaveStatsRows"; +_savestatsrows(); + //BA.debugLineNum = 518;BA.debugLine="End Sub"; +return ""; +} +public static String _btnbackground_click() throws Exception{ +anywheresoftware.b4a.objects.IntentWrapper _home = null; + //BA.debugLineNum = 384;BA.debugLine="Sub BtnBackground_Click"; + //BA.debugLineNum = 385;BA.debugLine="SaveActiveState"; +_saveactivestate(); + //BA.debugLineNum = 386;BA.debugLine="Dim home As Intent"; +_home = new anywheresoftware.b4a.objects.IntentWrapper(); + //BA.debugLineNum = 387;BA.debugLine="home.Initialize(\"android.intent.action.MAIN\", \"\")"; +_home.Initialize("android.intent.action.MAIN",""); + //BA.debugLineNum = 388;BA.debugLine="home.AddCategory(\"android.intent.category.HOME\")"; +_home.AddCategory("android.intent.category.HOME"); + //BA.debugLineNum = 389;BA.debugLine="home.Flags = 268435456"; +_home.setFlags((int) (268435456)); + //BA.debugLineNum = 390;BA.debugLine="StartActivity(home)"; +anywheresoftware.b4a.keywords.Common.StartActivity(processBA,(Object)(_home.getObject())); + //BA.debugLineNum = 391;BA.debugLine="End Sub"; +return ""; +} +public static String _btncleartoday_click() throws Exception{ + //BA.debugLineNum = 380;BA.debugLine="Sub BtnClearToday_Click"; + //BA.debugLineNum = 381;BA.debugLine="ClearDisplayedDay"; +_cleardisplayedday(); + //BA.debugLineNum = 382;BA.debugLine="End Sub"; +return ""; +} +public static String _btnconfig_click() throws Exception{ + //BA.debugLineNum = 364;BA.debugLine="Sub BtnConfig_Click"; + //BA.debugLineNum = 365;BA.debugLine="ShowConfigPage"; +_showconfigpage(); + //BA.debugLineNum = 366;BA.debugLine="End Sub"; +return ""; +} +public static String _btnconfigclose_click() throws Exception{ + //BA.debugLineNum = 368;BA.debugLine="Sub BtnConfigClose_Click"; + //BA.debugLineNum = 369;BA.debugLine="ShowMainPage"; +_showmainpage(); + //BA.debugLineNum = 370;BA.debugLine="End Sub"; +return ""; +} +public static String _btnconfigreset_click() throws Exception{ + //BA.debugLineNum = 376;BA.debugLine="Sub BtnConfigReset_Click"; + //BA.debugLineNum = 377;BA.debugLine="ResetAutomaticConfig"; +_resetautomaticconfig(); + //BA.debugLineNum = 378;BA.debugLine="End Sub"; +return ""; +} +public static String _btnconfigsave_click() throws Exception{ + //BA.debugLineNum = 372;BA.debugLine="Sub BtnConfigSave_Click"; + //BA.debugLineNum = 373;BA.debugLine="SetAutomaticConfig"; +_setautomaticconfig(); + //BA.debugLineNum = 374;BA.debugLine="End Sub"; +return ""; +} +public static String _btnpause_click() throws Exception{ +long _now = 0L; + //BA.debugLineNum = 319;BA.debugLine="Sub BtnPause_Click"; + //BA.debugLineNum = 320;BA.debugLine="If AutoModeEnabled Then Return"; +if (_automodeenabled) { +if (true) return "";}; + //BA.debugLineNum = 321;BA.debugLine="If SessionActive = False Then Return"; +if (_sessionactive==anywheresoftware.b4a.keywords.Common.False) { +if (true) return "";}; + //BA.debugLineNum = 322;BA.debugLine="Dim now As Long = DateTime.Now"; +_now = anywheresoftware.b4a.keywords.Common.DateTime.getNow(); + //BA.debugLineNum = 323;BA.debugLine="If PauseActive Then"; +if (_pauseactive) { + //BA.debugLineNum = 324;BA.debugLine="CloseCurrentSegment(now)"; +_closecurrentsegment(_now); + //BA.debugLineNum = 325;BA.debugLine="PauseActive = False"; +_pauseactive = anywheresoftware.b4a.keywords.Common.False; + //BA.debugLineNum = 326;BA.debugLine="BtnPause.Text = Localization.T(\"pause\")"; +mostCurrent._btnpause.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"pause"))); + //BA.debugLineNum = 327;BA.debugLine="CurrentSegmentStart = now"; +_currentsegmentstart = _now; + //BA.debugLineNum = 328;BA.debugLine="CurrentSegmentColor = GetCurrentWorkColor"; +_currentsegmentcolor = _getcurrentworkcolor(); + //BA.debugLineNum = 329;BA.debugLine="myClock.SetActiveSegment(0, CurrentSegmentColor,"; +mostCurrent._myclock._setactivesegment /*String*/ ((long) (0),_currentsegmentcolor,anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 330;BA.debugLine="SaveActiveState"; +_saveactivestate(); + //BA.debugLineNum = 331;BA.debugLine="Log(\"Pause ended.\")"; +anywheresoftware.b4a.keywords.Common.LogImpl("1179660","Pause ended.",0); + }else { + //BA.debugLineNum = 333;BA.debugLine="ProcessActiveWorkSegment(now)"; +_processactiveworksegment(_now); + //BA.debugLineNum = 334;BA.debugLine="If SessionActive = False Then Return"; +if (_sessionactive==anywheresoftware.b4a.keywords.Common.False) { +if (true) return "";}; + //BA.debugLineNum = 335;BA.debugLine="CloseCurrentSegment(now)"; +_closecurrentsegment(_now); + //BA.debugLineNum = 336;BA.debugLine="PauseActive = True"; +_pauseactive = anywheresoftware.b4a.keywords.Common.True; + //BA.debugLineNum = 337;BA.debugLine="BtnPause.Text = Localization.T(\"end_pause\")"; +mostCurrent._btnpause.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"end_pause"))); + //BA.debugLineNum = 338;BA.debugLine="CurrentSegmentStart = now"; +_currentsegmentstart = _now; + //BA.debugLineNum = 339;BA.debugLine="CurrentSegmentColor = Colors.Yellow"; +_currentsegmentcolor = anywheresoftware.b4a.keywords.Common.Colors.Yellow; + //BA.debugLineNum = 340;BA.debugLine="myClock.SetActiveSegment(0, CurrentSegmentColor,"; +mostCurrent._myclock._setactivesegment /*String*/ ((long) (0),_currentsegmentcolor,anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 341;BA.debugLine="SaveActiveState"; +_saveactivestate(); + //BA.debugLineNum = 342;BA.debugLine="Log(\"Pause started.\")"; +anywheresoftware.b4a.keywords.Common.LogImpl("1179671","Pause started.",0); + }; + //BA.debugLineNum = 344;BA.debugLine="End Sub"; +return ""; +} +public static String _btnreset_click() throws Exception{ + //BA.debugLineNum = 347;BA.debugLine="Sub BtnReset_Click"; + //BA.debugLineNum = 348;BA.debugLine="ShowStatsPage"; +_showstatspage(); + //BA.debugLineNum = 349;BA.debugLine="End Sub"; +return ""; +} +public static String _btnstart_click() throws Exception{ + //BA.debugLineNum = 309;BA.debugLine="Sub BtnStart_Click"; + //BA.debugLineNum = 310;BA.debugLine="If AutoModeEnabled Then Return"; +if (_automodeenabled) { +if (true) return "";}; + //BA.debugLineNum = 311;BA.debugLine="If SessionActive = False Then"; +if (_sessionactive==anywheresoftware.b4a.keywords.Common.False) { + //BA.debugLineNum = 312;BA.debugLine="StartSession"; +_startsession(); + }else { + //BA.debugLineNum = 314;BA.debugLine="EndSession(DateTime.Now, False)"; +_endsession(anywheresoftware.b4a.keywords.Common.DateTime.getNow(),anywheresoftware.b4a.keywords.Common.False); + }; + //BA.debugLineNum = 316;BA.debugLine="End Sub"; +return ""; +} +public static String _btnstats_click() throws Exception{ + //BA.debugLineNum = 356;BA.debugLine="Sub BtnStats_Click"; + //BA.debugLineNum = 357;BA.debugLine="ShowStatsPage"; +_showstatspage(); + //BA.debugLineNum = 358;BA.debugLine="End Sub"; +return ""; +} +public static String _btnstatsclose_click() throws Exception{ + //BA.debugLineNum = 360;BA.debugLine="Sub BtnStatsClose_Click"; + //BA.debugLineNum = 361;BA.debugLine="ShowMainPage"; +_showmainpage(); + //BA.debugLineNum = 362;BA.debugLine="End Sub"; +return ""; +} +public static String _btnsync_click() throws Exception{ + //BA.debugLineNum = 352;BA.debugLine="Sub BtnSync_Click"; + //BA.debugLineNum = 353;BA.debugLine="ShowConfigPage"; +_showconfigpage(); + //BA.debugLineNum = 354;BA.debugLine="End Sub"; +return ""; +} +public static String _buildstatstable() throws Exception{ +int _y = 0; +long _totalwork = 0L; +long _totalpause = 0L; +long _totalovertime = 0L; +anywheresoftware.b4a.objects.collections.Map _dailyrows = null; +anywheresoftware.b4a.objects.collections.Map _row = null; +long _activeduration = 0L; +String _datetext = ""; +anywheresoftware.b4a.objects.collections.Map _dailytotals = null; + //BA.debugLineNum = 865;BA.debugLine="Private Sub BuildStatsTable"; + //BA.debugLineNum = 866;BA.debugLine="svStats.Panel.RemoveAllViews"; +mostCurrent._svstats.getPanel().RemoveAllViews(); + //BA.debugLineNum = 867;BA.debugLine="Dim y As Int = 0"; +_y = (int) (0); + //BA.debugLineNum = 868;BA.debugLine="AddStatsRow(y, Localization.T(\"date\"), Localizati"; +_addstatsrow(_y,mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"date"),mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"work"),mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"pause_col"),mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"overtime"),anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 869;BA.debugLine="y = y + 34dip"; +_y = (int) (_y+anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (34))); + //BA.debugLineNum = 871;BA.debugLine="Dim totalWork As Long = 0"; +_totalwork = (long) (0); + //BA.debugLineNum = 872;BA.debugLine="Dim totalPause As Long = 0"; +_totalpause = (long) (0); + //BA.debugLineNum = 873;BA.debugLine="Dim totalOvertime As Long = 0"; +_totalovertime = (long) (0); + //BA.debugLineNum = 874;BA.debugLine="Dim dailyRows As Map"; +_dailyrows = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 875;BA.debugLine="dailyRows.Initialize"; +_dailyrows.Initialize(); + //BA.debugLineNum = 876;BA.debugLine="For Each row As Map In StatsRows"; +_row = new anywheresoftware.b4a.objects.collections.Map(); +{ +final anywheresoftware.b4a.BA.IterableList group10 = mostCurrent._statsrows; +final int groupLen10 = group10.getSize() +;int index10 = 0; +; +for (; index10 < groupLen10;index10++){ +_row = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group10.Get(index10))); + //BA.debugLineNum = 877;BA.debugLine="AddStatsDuration(dailyRows, row.Get(\"date\"), row"; +_addstatsduration(_dailyrows,BA.ObjectToString(_row.Get((Object)("date"))),BA.ObjectToString(_row.Get((Object)("category"))),BA.ObjectToLongNumber(_row.Get((Object)("duration")))); + } +}; + //BA.debugLineNum = 879;BA.debugLine="If SessionActive Then"; +if (_sessionactive) { + //BA.debugLineNum = 880;BA.debugLine="Dim activeDuration As Long = Max(0, DateTime.Now"; +_activeduration = (long) (anywheresoftware.b4a.keywords.Common.Max(0,anywheresoftware.b4a.keywords.Common.DateTime.getNow()-_currentsegmentstart)); + //BA.debugLineNum = 881;BA.debugLine="If activeDuration > 0 Then"; +if (_activeduration>0) { + //BA.debugLineNum = 882;BA.debugLine="AddStatsDuration(dailyRows, DateTime.Date(Curre"; +_addstatsduration(_dailyrows,anywheresoftware.b4a.keywords.Common.DateTime.Date(_currentworkdaystart),_getsegmentcategory(_currentsegmentcolor,_pauseactive),_activeduration); + }; + }; + //BA.debugLineNum = 886;BA.debugLine="For Each dateText As String In dailyRows.Keys"; +{ +final anywheresoftware.b4a.BA.IterableList group19 = _dailyrows.Keys(); +final int groupLen19 = group19.getSize() +;int index19 = 0; +; +for (; index19 < groupLen19;index19++){ +_datetext = BA.ObjectToString(group19.Get(index19)); + //BA.debugLineNum = 887;BA.debugLine="Dim dailyTotals As Map = dailyRows.Get(dateText)"; +_dailytotals = new anywheresoftware.b4a.objects.collections.Map(); +_dailytotals = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_dailyrows.Get((Object)(_datetext)))); + //BA.debugLineNum = 888;BA.debugLine="totalWork = totalWork + dailyTotals.Get(\"lavoro\""; +_totalwork = (long) (_totalwork+(double)(BA.ObjectToNumber(_dailytotals.Get((Object)("lavoro"))))); + //BA.debugLineNum = 889;BA.debugLine="totalPause = totalPause + dailyTotals.Get(\"pausa"; +_totalpause = (long) (_totalpause+(double)(BA.ObjectToNumber(_dailytotals.Get((Object)("pausa"))))); + //BA.debugLineNum = 890;BA.debugLine="totalOvertime = totalOvertime + dailyTotals.Get("; +_totalovertime = (long) (_totalovertime+(double)(BA.ObjectToNumber(_dailytotals.Get((Object)("straordinario"))))); + } +}; + //BA.debugLineNum = 893;BA.debugLine="For Each dateText As String In dailyRows.Keys"; +{ +final anywheresoftware.b4a.BA.IterableList group25 = _dailyrows.Keys(); +final int groupLen25 = group25.getSize() +;int index25 = 0; +; +for (; index25 < groupLen25;index25++){ +_datetext = BA.ObjectToString(group25.Get(index25)); + //BA.debugLineNum = 894;BA.debugLine="Dim dailyTotals As Map = dailyRows.Get(dateText)"; +_dailytotals = new anywheresoftware.b4a.objects.collections.Map(); +_dailytotals = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_dailyrows.Get((Object)(_datetext)))); + //BA.debugLineNum = 895;BA.debugLine="AddStatsRow(y, dateText, FormatElapsedTime(daily"; +_addstatsrow(_y,_datetext,_formatelapsedtime(BA.ObjectToLongNumber(_dailytotals.Get((Object)("lavoro")))),_formatelapsedtime(BA.ObjectToLongNumber(_dailytotals.Get((Object)("pausa")))),_formatelapsedtime(BA.ObjectToLongNumber(_dailytotals.Get((Object)("straordinario")))),anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 896;BA.debugLine="y = y + 30dip"; +_y = (int) (_y+anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (30))); + } +}; + //BA.debugLineNum = 899;BA.debugLine="y = y + 8dip"; +_y = (int) (_y+anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (8))); + //BA.debugLineNum = 900;BA.debugLine="AddStatsRow(y, Localization.T(\"totals\"), FormatEl"; +_addstatsrow(_y,mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"totals"),_formatelapsedtime(_totalwork),_formatelapsedtime(_totalpause),_formatelapsedtime(_totalovertime),anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 901;BA.debugLine="y = y + 40dip"; +_y = (int) (_y+anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (40))); + //BA.debugLineNum = 902;BA.debugLine="svStats.Panel.Height = Max(y, svStats.Height + 1d"; +mostCurrent._svstats.getPanel().setHeight((int) (anywheresoftware.b4a.keywords.Common.Max(_y,mostCurrent._svstats.getHeight()+anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (1))))); + //BA.debugLineNum = 903;BA.debugLine="End Sub"; +return ""; +} +public static String _cleardisplayedday() throws Exception{ +long _daystart = 0L; +int _result = 0; +anywheresoftware.b4a.objects.collections.List _kept = null; +anywheresoftware.b4a.objects.collections.Map _row = null; + //BA.debugLineNum = 1076;BA.debugLine="Private Sub ClearDisplayedDay"; + //BA.debugLineNum = 1077;BA.debugLine="Dim dayStart As Long = GetDisplayedWorkDayStart"; +_daystart = _getdisplayedworkdaystart(); + //BA.debugLineNum = 1078;BA.debugLine="If dayStart = 0 Then"; +if (_daystart==0) { + //BA.debugLineNum = 1079;BA.debugLine="ToastMessageShow(Localization.T(\"no_day_to_clear"; +anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"no_day_to_clear")),anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 1080;BA.debugLine="Return"; +if (true) return ""; + }; + //BA.debugLineNum = 1082;BA.debugLine="Dim result As Int = Msgbox2(Localization.T(\"clear"; +_result = anywheresoftware.b4a.keywords.Common.Msgbox2(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"clear_today_confirm")+" "+_formatdayshort(_daystart)+"?"),BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"clear_today_title")),mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"clear_button"),mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"cancel"),"",(android.graphics.Bitmap)(anywheresoftware.b4a.keywords.Common.Null),mostCurrent.activityBA); + //BA.debugLineNum = 1083;BA.debugLine="If result <> DialogResponse.POSITIVE Then Return"; +if (_result!=anywheresoftware.b4a.keywords.Common.DialogResponse.POSITIVE) { +if (true) return "";}; + //BA.debugLineNum = 1084;BA.debugLine="Dim kept As List"; +_kept = new anywheresoftware.b4a.objects.collections.List(); + //BA.debugLineNum = 1085;BA.debugLine="kept.Initialize"; +_kept.Initialize(); + //BA.debugLineNum = 1086;BA.debugLine="For Each row As Map In StatsRows"; +_row = new anywheresoftware.b4a.objects.collections.Map(); +{ +final anywheresoftware.b4a.BA.IterableList group10 = mostCurrent._statsrows; +final int groupLen10 = group10.getSize() +;int index10 = 0; +; +for (; index10 < groupLen10;index10++){ +_row = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group10.Get(index10))); + //BA.debugLineNum = 1087;BA.debugLine="If row.Get(\"dayStart\") <> dayStart Then kept.Add"; +if ((_row.Get((Object)("dayStart"))).equals((Object)(_daystart)) == false) { +_kept.Add((Object)(_row.getObject()));}; + } +}; + //BA.debugLineNum = 1089;BA.debugLine="StatsRows.Clear"; +mostCurrent._statsrows.Clear(); + //BA.debugLineNum = 1090;BA.debugLine="StatsRows.AddAll(kept)"; +mostCurrent._statsrows.AddAll(_kept); + //BA.debugLineNum = 1091;BA.debugLine="SaveStatsRows"; +_savestatsrows(); + //BA.debugLineNum = 1092;BA.debugLine="If File.Exists(File.DirInternal, StateFileName) T"; +if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename)) { +anywheresoftware.b4a.keywords.Common.File.Delete(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename);}; + //BA.debugLineNum = 1093;BA.debugLine="ResetSessionState(True)"; +_resetsessionstate(anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 1094;BA.debugLine="If AutoModeEnabled Then"; +if (_automodeenabled) { + //BA.debugLineNum = 1095;BA.debugLine="UpdateAutomaticState(DateTime.Now)"; +_updateautomaticstate(anywheresoftware.b4a.keywords.Common.DateTime.getNow()); + }else { + //BA.debugLineNum = 1097;BA.debugLine="RestoreLastClosedDayState"; +_restorelastcloseddaystate(); + }; + //BA.debugLineNum = 1099;BA.debugLine="ToastMessageShow(Localization.T(\"today_cleared\"),"; +anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"today_cleared")),anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 1100;BA.debugLine="End Sub"; +return ""; +} +public static String _closecurrentsegment(long _finaltime) throws Exception{ +long _duration = 0L; + //BA.debugLineNum = 489;BA.debugLine="Private Sub CloseCurrentSegment(FinalTime As Long)"; + //BA.debugLineNum = 490;BA.debugLine="Dim duration As Long = FinalTime - CurrentSegment"; +_duration = (long) (_finaltime-_currentsegmentstart); + //BA.debugLineNum = 491;BA.debugLine="If duration <= 0 Then Return"; +if (_duration<=0) { +if (true) return "";}; + //BA.debugLineNum = 492;BA.debugLine="If PauseActive Then"; +if (_pauseactive) { + //BA.debugLineNum = 493;BA.debugLine="RecordSegment(CurrentSegmentStart, duration, Col"; +_recordsegment(_currentsegmentstart,_duration,anywheresoftware.b4a.keywords.Common.Colors.Yellow,anywheresoftware.b4a.keywords.Common.True); + }else { + //BA.debugLineNum = 495;BA.debugLine="RecordSegment(CurrentSegmentStart, duration, Get"; +_recordsegment(_currentsegmentstart,_duration,_getcurrentworkcolor(),anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 496;BA.debugLine="ProductiveElapsedMs = ProductiveElapsedMs + dura"; +_productiveelapsedms = (long) (_productiveelapsedms+_duration); + }; + //BA.debugLineNum = 498;BA.debugLine="End Sub"; +return ""; +} +public static String _createautostatuslabel() throws Exception{ + //BA.debugLineNum = 226;BA.debugLine="Private Sub CreateAutoStatusLabel"; + //BA.debugLineNum = 227;BA.debugLine="lblAutoStatus.Initialize(\"\")"; +mostCurrent._lblautostatus.Initialize(mostCurrent.activityBA,""); + //BA.debugLineNum = 228;BA.debugLine="lblAutoStatus.TextColor = Colors.DarkGray"; +mostCurrent._lblautostatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.DarkGray); + //BA.debugLineNum = 229;BA.debugLine="lblAutoStatus.TextSize = 13"; +mostCurrent._lblautostatus.setTextSize((float) (13)); + //BA.debugLineNum = 230;BA.debugLine="lblAutoStatus.Gravity = Bit.Or(Gravity.RIGHT, Gra"; +mostCurrent._lblautostatus.setGravity(anywheresoftware.b4a.keywords.Common.Bit.Or(anywheresoftware.b4a.keywords.Common.Gravity.RIGHT,anywheresoftware.b4a.keywords.Common.Gravity.CENTER_VERTICAL)); + //BA.debugLineNum = 231;BA.debugLine="lblAutoStatus.Text = Localization.T(\"manual_mode\""; +mostCurrent._lblautostatus.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"manual_mode"))); + //BA.debugLineNum = 232;BA.debugLine="Activity.AddView(lblAutoStatus, 0, 0, 10dip, 10di"; +mostCurrent._activity.AddView((android.view.View)(mostCurrent._lblautostatus.getObject()),(int) (0),(int) (0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (10)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (10))); + //BA.debugLineNum = 233;BA.debugLine="End Sub"; +return ""; +} +public static String _createbackgroundbutton() throws Exception{ + //BA.debugLineNum = 183;BA.debugLine="Private Sub CreateBackgroundButton"; + //BA.debugLineNum = 184;BA.debugLine="BtnBackground.Initialize(\"BtnBackground\")"; +mostCurrent._btnbackground.Initialize(mostCurrent.activityBA,"BtnBackground"); + //BA.debugLineNum = 185;BA.debugLine="BtnBackground.Text = Localization.T(\"bg\")"; +mostCurrent._btnbackground.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"bg"))); + //BA.debugLineNum = 186;BA.debugLine="Activity.AddView(BtnBackground, BtnPause.Left, Bt"; +mostCurrent._activity.AddView((android.view.View)(mostCurrent._btnbackground.getObject()),mostCurrent._btnpause.getLeft(),mostCurrent._btnpause.getTop(),mostCurrent._btnpause.getWidth(),mostCurrent._btnpause.getHeight()); + //BA.debugLineNum = 187;BA.debugLine="End Sub"; +return ""; +} +public static String _createconfigbutton() throws Exception{ + //BA.debugLineNum = 177;BA.debugLine="Private Sub CreateConfigButton"; + //BA.debugLineNum = 178;BA.debugLine="BtnConfig.Initialize(\"BtnConfig\")"; +mostCurrent._btnconfig.Initialize(mostCurrent.activityBA,"BtnConfig"); + //BA.debugLineNum = 179;BA.debugLine="BtnConfig.Text = Localization.T(\"config\")"; +mostCurrent._btnconfig.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"config"))); + //BA.debugLineNum = 180;BA.debugLine="Activity.AddView(BtnConfig, BtnReset.Left, BtnRes"; +mostCurrent._activity.AddView((android.view.View)(mostCurrent._btnconfig.getObject()),mostCurrent._btnreset.getLeft(),mostCurrent._btnreset.getTop(),mostCurrent._btnreset.getWidth(),mostCurrent._btnreset.getHeight()); + //BA.debugLineNum = 181;BA.debugLine="End Sub"; +return ""; +} +public static String _createconfigpage() throws Exception{ +anywheresoftware.b4a.objects.LabelWrapper _title = null; +int _y = 0; + //BA.debugLineNum = 235;BA.debugLine="Private Sub CreateConfigPage"; + //BA.debugLineNum = 236;BA.debugLine="pnlConfig.Initialize(\"\")"; +mostCurrent._pnlconfig.Initialize(mostCurrent.activityBA,""); + //BA.debugLineNum = 237;BA.debugLine="pnlConfig.Color = Colors.White"; +mostCurrent._pnlconfig.setColor(anywheresoftware.b4a.keywords.Common.Colors.White); + //BA.debugLineNum = 238;BA.debugLine="pnlConfig.Visible = False"; +mostCurrent._pnlconfig.setVisible(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 239;BA.debugLine="Activity.AddView(pnlConfig, 0, 0, Activity.Width,"; +mostCurrent._activity.AddView((android.view.View)(mostCurrent._pnlconfig.getObject()),(int) (0),(int) (0),mostCurrent._activity.getWidth(),mostCurrent._activity.getHeight()); + //BA.debugLineNum = 241;BA.debugLine="Dim title As Label"; +_title = new anywheresoftware.b4a.objects.LabelWrapper(); + //BA.debugLineNum = 242;BA.debugLine="title.Initialize(\"\")"; +_title.Initialize(mostCurrent.activityBA,""); + //BA.debugLineNum = 243;BA.debugLine="title.Text = Localization.T(\"config\")"; +_title.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"config"))); + //BA.debugLineNum = 244;BA.debugLine="title.TextSize = 22"; +_title.setTextSize((float) (22)); + //BA.debugLineNum = 245;BA.debugLine="title.TextColor = Colors.Black"; +_title.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black); + //BA.debugLineNum = 246;BA.debugLine="title.Gravity = Gravity.CENTER_VERTICAL"; +_title.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER_VERTICAL); + //BA.debugLineNum = 247;BA.debugLine="pnlConfig.AddView(title, 12dip, 8dip, Activity.Wi"; +mostCurrent._pnlconfig.AddView((android.view.View)(_title.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (12)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (8)),(int) (mostCurrent._activity.getWidth()-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (110))),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (46))); + //BA.debugLineNum = 249;BA.debugLine="BtnConfigClose.Initialize(\"BtnConfigClose\")"; +mostCurrent._btnconfigclose.Initialize(mostCurrent.activityBA,"BtnConfigClose"); + //BA.debugLineNum = 250;BA.debugLine="BtnConfigClose.Text = Localization.T(\"close\")"; +mostCurrent._btnconfigclose.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"close"))); + //BA.debugLineNum = 251;BA.debugLine="pnlConfig.AddView(BtnConfigClose, Activity.Width"; +mostCurrent._pnlconfig.AddView((android.view.View)(mostCurrent._btnconfigclose.getObject()),(int) (mostCurrent._activity.getWidth()-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (94))),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (8)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (84)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (46))); + //BA.debugLineNum = 253;BA.debugLine="Dim y As Int = 78dip"; +_y = anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (78)); + //BA.debugLineNum = 254;BA.debugLine="txtCfgStart = AddConfigField(Localization.T(\"work"; +mostCurrent._txtcfgstart = _addconfigfield(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"work_start"),"08:30",_y); + //BA.debugLineNum = 255;BA.debugLine="y = y + 58dip"; +_y = (int) (_y+anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (58))); + //BA.debugLineNum = 256;BA.debugLine="txtCfgPauseStart = AddConfigField(Localization.T("; +mostCurrent._txtcfgpausestart = _addconfigfield(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"pause_start"),"12:30",_y); + //BA.debugLineNum = 257;BA.debugLine="y = y + 58dip"; +_y = (int) (_y+anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (58))); + //BA.debugLineNum = 258;BA.debugLine="txtCfgPauseEnd = AddConfigField(Localization.T(\"p"; +mostCurrent._txtcfgpauseend = _addconfigfield(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"pause_end"),"13:00",_y); + //BA.debugLineNum = 259;BA.debugLine="y = y + 58dip"; +_y = (int) (_y+anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (58))); + //BA.debugLineNum = 260;BA.debugLine="txtCfgEnd = AddConfigField(Localization.T(\"work_e"; +mostCurrent._txtcfgend = _addconfigfield(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"work_end"),"17:00",_y); + //BA.debugLineNum = 262;BA.debugLine="BtnConfigSave.Initialize(\"BtnConfigSave\")"; +mostCurrent._btnconfigsave.Initialize(mostCurrent.activityBA,"BtnConfigSave"); + //BA.debugLineNum = 263;BA.debugLine="BtnConfigSave.Text = Localization.T(\"set_config\")"; +mostCurrent._btnconfigsave.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"set_config"))); + //BA.debugLineNum = 264;BA.debugLine="pnlConfig.AddView(BtnConfigSave, 12dip, y + 70dip"; +mostCurrent._pnlconfig.AddView((android.view.View)(mostCurrent._btnconfigsave.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (12)),(int) (_y+anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (70))),(int) ((mostCurrent._activity.getWidth()-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (32)))/(double)2),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (48))); + //BA.debugLineNum = 266;BA.debugLine="BtnConfigReset.Initialize(\"BtnConfigReset\")"; +mostCurrent._btnconfigreset.Initialize(mostCurrent.activityBA,"BtnConfigReset"); + //BA.debugLineNum = 267;BA.debugLine="BtnConfigReset.Text = Localization.T(\"reset_confi"; +mostCurrent._btnconfigreset.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"reset_config"))); + //BA.debugLineNum = 268;BA.debugLine="pnlConfig.AddView(BtnConfigReset, 20dip + ((Activ"; +mostCurrent._pnlconfig.AddView((android.view.View)(mostCurrent._btnconfigreset.getObject()),(int) (anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (20))+((mostCurrent._activity.getWidth()-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (32)))/(double)2)),(int) (_y+anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (70))),(int) ((mostCurrent._activity.getWidth()-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (32)))/(double)2),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (48))); + //BA.debugLineNum = 270;BA.debugLine="BtnClearToday.Initialize(\"BtnClearToday\")"; +mostCurrent._btncleartoday.Initialize(mostCurrent.activityBA,"BtnClearToday"); + //BA.debugLineNum = 271;BA.debugLine="BtnClearToday.Text = Localization.T(\"clear_today\""; +mostCurrent._btncleartoday.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"clear_today"))); + //BA.debugLineNum = 272;BA.debugLine="pnlConfig.AddView(BtnClearToday, 12dip, y + 126di"; +mostCurrent._pnlconfig.AddView((android.view.View)(mostCurrent._btncleartoday.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (12)),(int) (_y+anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (126))),(int) (mostCurrent._activity.getWidth()-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (24))),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (48))); + //BA.debugLineNum = 273;BA.debugLine="End Sub"; +return ""; +} +public static String _createstatsbutton() throws Exception{ + //BA.debugLineNum = 149;BA.debugLine="Private Sub CreateStatsButton"; + //BA.debugLineNum = 150;BA.debugLine="BtnStats.Initialize(\"BtnStats\")"; +mostCurrent._btnstats.Initialize(mostCurrent.activityBA,"BtnStats"); + //BA.debugLineNum = 151;BA.debugLine="BtnStats.Text = Localization.T(\"stats\")"; +mostCurrent._btnstats.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"stats"))); + //BA.debugLineNum = 152;BA.debugLine="Activity.AddView(BtnStats, BtnReset.Left, BtnRese"; +mostCurrent._activity.AddView((android.view.View)(mostCurrent._btnstats.getObject()),mostCurrent._btnreset.getLeft(),mostCurrent._btnreset.getTop(),mostCurrent._btnreset.getWidth(),mostCurrent._btnreset.getHeight()); + //BA.debugLineNum = 153;BA.debugLine="End Sub"; +return ""; +} +public static String _createstatspage() throws Exception{ +anywheresoftware.b4a.objects.LabelWrapper _title = null; + //BA.debugLineNum = 155;BA.debugLine="Private Sub CreateStatsPage"; + //BA.debugLineNum = 156;BA.debugLine="pnlStats.Initialize(\"\")"; +mostCurrent._pnlstats.Initialize(mostCurrent.activityBA,""); + //BA.debugLineNum = 157;BA.debugLine="pnlStats.Color = Colors.White"; +mostCurrent._pnlstats.setColor(anywheresoftware.b4a.keywords.Common.Colors.White); + //BA.debugLineNum = 158;BA.debugLine="pnlStats.Visible = False"; +mostCurrent._pnlstats.setVisible(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 159;BA.debugLine="Activity.AddView(pnlStats, 0, 0, Activity.Width,"; +mostCurrent._activity.AddView((android.view.View)(mostCurrent._pnlstats.getObject()),(int) (0),(int) (0),mostCurrent._activity.getWidth(),mostCurrent._activity.getHeight()); + //BA.debugLineNum = 161;BA.debugLine="Dim title As Label"; +_title = new anywheresoftware.b4a.objects.LabelWrapper(); + //BA.debugLineNum = 162;BA.debugLine="title.Initialize(\"\")"; +_title.Initialize(mostCurrent.activityBA,""); + //BA.debugLineNum = 163;BA.debugLine="title.Text = Localization.T(\"statistics\")"; +_title.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"statistics"))); + //BA.debugLineNum = 164;BA.debugLine="title.TextSize = 22"; +_title.setTextSize((float) (22)); + //BA.debugLineNum = 165;BA.debugLine="title.TextColor = Colors.Black"; +_title.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black); + //BA.debugLineNum = 166;BA.debugLine="title.Gravity = Gravity.CENTER_VERTICAL"; +_title.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER_VERTICAL); + //BA.debugLineNum = 167;BA.debugLine="pnlStats.AddView(title, 12dip, 8dip, Activity.Wid"; +mostCurrent._pnlstats.AddView((android.view.View)(_title.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (12)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (8)),(int) (mostCurrent._activity.getWidth()-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (110))),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (46))); + //BA.debugLineNum = 169;BA.debugLine="BtnStatsClose.Initialize(\"BtnStatsClose\")"; +mostCurrent._btnstatsclose.Initialize(mostCurrent.activityBA,"BtnStatsClose"); + //BA.debugLineNum = 170;BA.debugLine="BtnStatsClose.Text = Localization.T(\"close\")"; +mostCurrent._btnstatsclose.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"close"))); + //BA.debugLineNum = 171;BA.debugLine="pnlStats.AddView(BtnStatsClose, Activity.Width -"; +mostCurrent._pnlstats.AddView((android.view.View)(mostCurrent._btnstatsclose.getObject()),(int) (mostCurrent._activity.getWidth()-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (94))),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (8)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (84)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (46))); + //BA.debugLineNum = 173;BA.debugLine="svStats.Initialize(0)"; +mostCurrent._svstats.Initialize(mostCurrent.activityBA,(int) (0)); + //BA.debugLineNum = 174;BA.debugLine="pnlStats.AddView(svStats, 0, 62dip, Activity.Widt"; +mostCurrent._pnlstats.AddView((android.view.View)(mostCurrent._svstats.getObject()),(int) (0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (62)),mostCurrent._activity.getWidth(),(int) (mostCurrent._activity.getHeight()-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (62)))); + //BA.debugLineNum = 175;BA.debugLine="End Sub"; +return ""; +} +public static String _endsession(long _finaltime,boolean _automatic) throws Exception{ + //BA.debugLineNum = 424;BA.debugLine="Private Sub EndSession(FinalTime As Long, Automati"; + //BA.debugLineNum = 425;BA.debugLine="If SessionActive Then CloseCurrentSegment(FinalTi"; +if (_sessionactive) { +_closecurrentsegment(_finaltime);}; + //BA.debugLineNum = 426;BA.debugLine="SessionActive = False"; +_sessionactive = anywheresoftware.b4a.keywords.Common.False; + //BA.debugLineNum = 427;BA.debugLine="PauseActive = False"; +_pauseactive = anywheresoftware.b4a.keywords.Common.False; + //BA.debugLineNum = 428;BA.debugLine="BtnStart.Text = Localization.T(\"start\")"; +mostCurrent._btnstart.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"start"))); + //BA.debugLineNum = 429;BA.debugLine="BtnPause.Text = Localization.T(\"pause\")"; +mostCurrent._btnpause.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"pause"))); + //BA.debugLineNum = 430;BA.debugLine="BtnPause.Enabled = False"; +mostCurrent._btnpause.setEnabled(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 431;BA.debugLine="UpdateMainControlState"; +_updatemaincontrolstate(); + //BA.debugLineNum = 432;BA.debugLine="myClock.ClearActiveSegment"; +mostCurrent._myclock._clearactivesegment /*String*/ (); + //BA.debugLineNum = 433;BA.debugLine="UpdateElapsedLabel"; +_updateelapsedlabel(); + //BA.debugLineNum = 434;BA.debugLine="If File.Exists(File.DirInternal, StateFileName) T"; +if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename)) { +anywheresoftware.b4a.keywords.Common.File.Delete(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename);}; + //BA.debugLineNum = 435;BA.debugLine="If Automatic Then"; +if (_automatic) { + //BA.debugLineNum = 436;BA.debugLine="Log(\"Workday stopped automatically.\")"; +anywheresoftware.b4a.keywords.Common.LogImpl("2031628","Workday stopped automatically.",0); + }else { + //BA.debugLineNum = 438;BA.debugLine="Log(\"Workday closed manually.\")"; +anywheresoftware.b4a.keywords.Common.LogImpl("2031630","Workday closed manually.",0); + }; + //BA.debugLineNum = 440;BA.debugLine="End Sub"; +return ""; +} +public static String _formatdayshort(long _ticks) throws Exception{ + //BA.debugLineNum = 591;BA.debugLine="Private Sub FormatDayShort(ticks As Long) As Strin"; + //BA.debugLineNum = 592;BA.debugLine="Return NumberFormat(DateTime.GetDayOfMonth(ticks)"; +if (true) return anywheresoftware.b4a.keywords.Common.NumberFormat(anywheresoftware.b4a.keywords.Common.DateTime.GetDayOfMonth(_ticks),(int) (2),(int) (0))+"/"+anywheresoftware.b4a.keywords.Common.NumberFormat(anywheresoftware.b4a.keywords.Common.DateTime.GetMonth(_ticks),(int) (2),(int) (0)); + //BA.debugLineNum = 593;BA.debugLine="End Sub"; +return ""; +} +public static String _formatelapsedtime(long _ms) throws Exception{ +int _seconds = 0; +int _minutes = 0; +int _hours = 0; + //BA.debugLineNum = 299;BA.debugLine="Sub FormatElapsedTime(ms As Long) As String"; + //BA.debugLineNum = 300;BA.debugLine="Dim seconds As Int = ms / 1000"; +_seconds = (int) (_ms/(double)1000); + //BA.debugLineNum = 301;BA.debugLine="Dim minutes As Int = seconds / 60"; +_minutes = (int) (_seconds/(double)60); + //BA.debugLineNum = 302;BA.debugLine="Dim hours As Int = minutes / 60"; +_hours = (int) (_minutes/(double)60); + //BA.debugLineNum = 303;BA.debugLine="seconds = seconds Mod 60"; +_seconds = (int) (_seconds%60); + //BA.debugLineNum = 304;BA.debugLine="minutes = minutes Mod 60"; +_minutes = (int) (_minutes%60); + //BA.debugLineNum = 305;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)); + //BA.debugLineNum = 306;BA.debugLine="End Sub"; +return ""; +} +public static int _getcurrentworkcolor() throws Exception{ + //BA.debugLineNum = 534;BA.debugLine="Private Sub GetCurrentWorkColor As Int"; + //BA.debugLineNum = 535;BA.debugLine="If ProductiveElapsedMs < FirstWorkLimitMs Then Re"; +if (_productiveelapsedms<_firstworklimitms) { +if (true) return _workmorningcolor;}; + //BA.debugLineNum = 536;BA.debugLine="If ProductiveElapsedMs < WorkLimitMs Then Return"; +if (_productiveelapsedms<_worklimitms) { +if (true) return anywheresoftware.b4a.keywords.Common.Colors.Green;}; + //BA.debugLineNum = 537;BA.debugLine="Return Colors.Red"; +if (true) return anywheresoftware.b4a.keywords.Common.Colors.Red; + //BA.debugLineNum = 538;BA.debugLine="End Sub"; +return 0; +} +public static long _getdisplayedproductiveelapsed(long _now) throws Exception{ +long _total = 0L; + //BA.debugLineNum = 595;BA.debugLine="Private Sub GetDisplayedProductiveElapsed(now As L"; + //BA.debugLineNum = 596;BA.debugLine="Dim total As Long = ProductiveElapsedMs"; +_total = _productiveelapsedms; + //BA.debugLineNum = 597;BA.debugLine="If SessionActive And PauseActive = False Then tot"; +if (_sessionactive && _pauseactive==anywheresoftware.b4a.keywords.Common.False) { +_total = (long) (_total+anywheresoftware.b4a.keywords.Common.Max(0,_now-_currentsegmentstart));}; + //BA.debugLineNum = 598;BA.debugLine="Return total"; +if (true) return _total; + //BA.debugLineNum = 599;BA.debugLine="End Sub"; +return 0L; +} +public static long _getdisplayedworkdaystart() throws Exception{ + //BA.debugLineNum = 586;BA.debugLine="Private Sub GetDisplayedWorkDayStart As Long"; + //BA.debugLineNum = 587;BA.debugLine="If CurrentWorkDayStart > 0 Then Return CurrentWor"; +if (_currentworkdaystart>0) { +if (true) return _currentworkdaystart;}; + //BA.debugLineNum = 588;BA.debugLine="Return GetLatestWorkDayStart"; +if (true) return _getlatestworkdaystart(); + //BA.debugLineNum = 589;BA.debugLine="End Sub"; +return 0L; +} +public static long _getlatestworkdaystart() throws Exception{ +long _latestdaystart = 0L; +anywheresoftware.b4a.objects.collections.Map _row = null; +long _daystart = 0L; + //BA.debugLineNum = 665;BA.debugLine="Private Sub GetLatestWorkDayStart As Long"; + //BA.debugLineNum = 666;BA.debugLine="Dim latestDayStart As Long = 0"; +_latestdaystart = (long) (0); + //BA.debugLineNum = 667;BA.debugLine="For Each row As Map In StatsRows"; +_row = new anywheresoftware.b4a.objects.collections.Map(); +{ +final anywheresoftware.b4a.BA.IterableList group2 = mostCurrent._statsrows; +final int groupLen2 = group2.getSize() +;int index2 = 0; +; +for (; index2 < groupLen2;index2++){ +_row = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group2.Get(index2))); + //BA.debugLineNum = 668;BA.debugLine="Dim dayStart As Long = row.Get(\"dayStart\")"; +_daystart = BA.ObjectToLongNumber(_row.Get((Object)("dayStart"))); + //BA.debugLineNum = 669;BA.debugLine="If dayStart > latestDayStart Then latestDayStart"; +if (_daystart>_latestdaystart) { +_latestdaystart = _daystart;}; + } +}; + //BA.debugLineNum = 671;BA.debugLine="Return latestDayStart"; +if (true) return _latestdaystart; + //BA.debugLineNum = 672;BA.debugLine="End Sub"; +return 0L; +} +public static long _getnextmidnight(long _ticks) throws Exception{ + //BA.debugLineNum = 674;BA.debugLine="Private Sub GetNextMidnight(ticks As Long) As Long"; + //BA.debugLineNum = 675;BA.debugLine="Return DateTime.DateParse(DateTime.Date(ticks)) +"; +if (true) return (long) (anywheresoftware.b4a.keywords.Common.DateTime.DateParse(anywheresoftware.b4a.keywords.Common.DateTime.Date(_ticks))+anywheresoftware.b4a.keywords.Common.DateTime.TicksPerDay); + //BA.debugLineNum = 676;BA.debugLine="End Sub"; +return 0L; +} +public static long _getnextworkboundary() throws Exception{ + //BA.debugLineNum = 540;BA.debugLine="Private Sub GetNextWorkBoundary As Long"; + //BA.debugLineNum = 541;BA.debugLine="If ProductiveElapsedMs < FirstWorkLimitMs Then Re"; +if (_productiveelapsedms<_firstworklimitms) { +if (true) return _firstworklimitms;}; + //BA.debugLineNum = 542;BA.debugLine="If ProductiveElapsedMs < WorkLimitMs Then Return"; +if (_productiveelapsedms<_worklimitms) { +if (true) return _worklimitms;}; + //BA.debugLineNum = 543;BA.debugLine="Return MaxProductiveMs"; +if (true) return _maxproductivems; + //BA.debugLineNum = 544;BA.debugLine="End Sub"; +return 0L; +} +public static long _getproductivetotalforworkday(long _daykey) throws Exception{ +long _total = 0L; +anywheresoftware.b4a.objects.collections.Map _row = null; +String _category = ""; + //BA.debugLineNum = 601;BA.debugLine="Private Sub GetProductiveTotalForWorkDay(DayKey As"; + //BA.debugLineNum = 602;BA.debugLine="Dim total As Long = 0"; +_total = (long) (0); + //BA.debugLineNum = 603;BA.debugLine="For Each row As Map In StatsRows"; +_row = new anywheresoftware.b4a.objects.collections.Map(); +{ +final anywheresoftware.b4a.BA.IterableList group2 = mostCurrent._statsrows; +final int groupLen2 = group2.getSize() +;int index2 = 0; +; +for (; index2 < groupLen2;index2++){ +_row = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group2.Get(index2))); + //BA.debugLineNum = 604;BA.debugLine="If row.Get(\"dayKey\") = DayKey Then"; +if ((_row.Get((Object)("dayKey"))).equals((Object)(_daykey))) { + //BA.debugLineNum = 605;BA.debugLine="Dim category As String = row.Get(\"category\")"; +_category = BA.ObjectToString(_row.Get((Object)("category"))); + //BA.debugLineNum = 606;BA.debugLine="If category = \"lavoro\" Or category = \"straordin"; +if ((_category).equals("lavoro") || (_category).equals("straordinario")) { +_total = (long) (_total+(double)(BA.ObjectToNumber(_row.Get((Object)("duration")))));}; + }; + } +}; + //BA.debugLineNum = 609;BA.debugLine="Return total"; +if (true) return _total; + //BA.debugLineNum = 610;BA.debugLine="End Sub"; +return 0L; +} +public static String _getsegmentcategory(int _segmentcolor,boolean _ispausesegment) throws Exception{ + //BA.debugLineNum = 528;BA.debugLine="Private Sub GetSegmentCategory(SegmentColor As Int"; + //BA.debugLineNum = 529;BA.debugLine="If IsPauseSegment Then Return \"pausa\""; +if (_ispausesegment) { +if (true) return "pausa";}; + //BA.debugLineNum = 530;BA.debugLine="If SegmentColor = Colors.Red Then Return \"straord"; +if (_segmentcolor==anywheresoftware.b4a.keywords.Common.Colors.Red) { +if (true) return "straordinario";}; + //BA.debugLineNum = 531;BA.debugLine="Return \"lavoro\""; +if (true) return "lavoro"; + //BA.debugLineNum = 532;BA.debugLine="End Sub"; +return ""; +} +public static long _getworkdaystart(long _now) throws Exception{ +long _latestdaystart = 0L; +String _today = ""; +anywheresoftware.b4a.objects.collections.Map _row = null; +long _daystart = 0L; + //BA.debugLineNum = 652;BA.debugLine="Private Sub GetWorkDayStart(now As Long) As Long"; + //BA.debugLineNum = 653;BA.debugLine="Dim latestDayStart As Long = 0"; +_latestdaystart = (long) (0); + //BA.debugLineNum = 654;BA.debugLine="Dim today As String = DateTime.Date(now)"; +_today = anywheresoftware.b4a.keywords.Common.DateTime.Date(_now); + //BA.debugLineNum = 655;BA.debugLine="For Each row As Map In StatsRows"; +_row = new anywheresoftware.b4a.objects.collections.Map(); +{ +final anywheresoftware.b4a.BA.IterableList group3 = mostCurrent._statsrows; +final int groupLen3 = group3.getSize() +;int index3 = 0; +; +for (; index3 < groupLen3;index3++){ +_row = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group3.Get(index3))); + //BA.debugLineNum = 656;BA.debugLine="Dim dayStart As Long = row.Get(\"dayStart\")"; +_daystart = BA.ObjectToLongNumber(_row.Get((Object)("dayStart"))); + //BA.debugLineNum = 657;BA.debugLine="If dayStart > latestDayStart And DateTime.Date(d"; +if (_daystart>_latestdaystart && (anywheresoftware.b4a.keywords.Common.DateTime.Date(_daystart)).equals(_today)) { + //BA.debugLineNum = 658;BA.debugLine="latestDayStart = dayStart"; +_latestdaystart = _daystart; + }; + } +}; + //BA.debugLineNum = 661;BA.debugLine="If latestDayStart > 0 Then Return latestDayStart"; +if (_latestdaystart>0) { +if (true) return _latestdaystart;}; + //BA.debugLineNum = 662;BA.debugLine="Return now"; +if (true) return _now; + //BA.debugLineNum = 663;BA.debugLine="End Sub"; +return 0L; +} +public static String _globals() throws Exception{ + //BA.debugLineNum = 25;BA.debugLine="Sub Globals"; + //BA.debugLineNum = 26;BA.debugLine="Private BtnStart As Button"; +mostCurrent._btnstart = new anywheresoftware.b4a.objects.ButtonWrapper(); + //BA.debugLineNum = 27;BA.debugLine="Private BtnPause As Button"; +mostCurrent._btnpause = new anywheresoftware.b4a.objects.ButtonWrapper(); + //BA.debugLineNum = 28;BA.debugLine="Private BtnReset As Button"; +mostCurrent._btnreset = new anywheresoftware.b4a.objects.ButtonWrapper(); + //BA.debugLineNum = 29;BA.debugLine="Private BtnSync As Button"; +mostCurrent._btnsync = new anywheresoftware.b4a.objects.ButtonWrapper(); + //BA.debugLineNum = 30;BA.debugLine="Private BtnStats As Label"; +mostCurrent._btnstats = new anywheresoftware.b4a.objects.LabelWrapper(); + //BA.debugLineNum = 31;BA.debugLine="Private BtnStatsClose As Button"; +mostCurrent._btnstatsclose = new anywheresoftware.b4a.objects.ButtonWrapper(); + //BA.debugLineNum = 32;BA.debugLine="Private BtnConfig As Label"; +mostCurrent._btnconfig = new anywheresoftware.b4a.objects.LabelWrapper(); + //BA.debugLineNum = 33;BA.debugLine="Private BtnConfigClose As Button"; +mostCurrent._btnconfigclose = new anywheresoftware.b4a.objects.ButtonWrapper(); + //BA.debugLineNum = 34;BA.debugLine="Private BtnConfigSave As Button"; +mostCurrent._btnconfigsave = new anywheresoftware.b4a.objects.ButtonWrapper(); + //BA.debugLineNum = 35;BA.debugLine="Private BtnConfigReset As Button"; +mostCurrent._btnconfigreset = new anywheresoftware.b4a.objects.ButtonWrapper(); + //BA.debugLineNum = 36;BA.debugLine="Private BtnClearToday As Button"; +mostCurrent._btncleartoday = new anywheresoftware.b4a.objects.ButtonWrapper(); + //BA.debugLineNum = 37;BA.debugLine="Private BtnBackground As Label"; +mostCurrent._btnbackground = new anywheresoftware.b4a.objects.LabelWrapper(); + //BA.debugLineNum = 38;BA.debugLine="Private lblElapsedTime As Label"; +mostCurrent._lblelapsedtime = new anywheresoftware.b4a.objects.LabelWrapper(); + //BA.debugLineNum = 39;BA.debugLine="Private lblAutoStatus As Label"; +mostCurrent._lblautostatus = new anywheresoftware.b4a.objects.LabelWrapper(); + //BA.debugLineNum = 40;BA.debugLine="Private pnlClock As Panel"; +mostCurrent._pnlclock = new anywheresoftware.b4a.objects.PanelWrapper(); + //BA.debugLineNum = 41;BA.debugLine="Private pnlStats As Panel"; +mostCurrent._pnlstats = new anywheresoftware.b4a.objects.PanelWrapper(); + //BA.debugLineNum = 42;BA.debugLine="Private pnlConfig As Panel"; +mostCurrent._pnlconfig = new anywheresoftware.b4a.objects.PanelWrapper(); + //BA.debugLineNum = 43;BA.debugLine="Private svStats As ScrollView"; +mostCurrent._svstats = new anywheresoftware.b4a.objects.ScrollViewWrapper(); + //BA.debugLineNum = 44;BA.debugLine="Private txtCfgStart As EditText"; +mostCurrent._txtcfgstart = new anywheresoftware.b4a.objects.EditTextWrapper(); + //BA.debugLineNum = 45;BA.debugLine="Private txtCfgPauseStart As EditText"; +mostCurrent._txtcfgpausestart = new anywheresoftware.b4a.objects.EditTextWrapper(); + //BA.debugLineNum = 46;BA.debugLine="Private txtCfgPauseEnd As EditText"; +mostCurrent._txtcfgpauseend = new anywheresoftware.b4a.objects.EditTextWrapper(); + //BA.debugLineNum = 47;BA.debugLine="Private txtCfgEnd As EditText"; +mostCurrent._txtcfgend = new anywheresoftware.b4a.objects.EditTextWrapper(); + //BA.debugLineNum = 48;BA.debugLine="Private myClock As AnalogClock"; +mostCurrent._myclock = new b4a.example.analogclock(); + //BA.debugLineNum = 50;BA.debugLine="Private SessionActive As Boolean"; +_sessionactive = false; + //BA.debugLineNum = 51;BA.debugLine="Private PauseActive As Boolean"; +_pauseactive = false; + //BA.debugLineNum = 52;BA.debugLine="Private ProductiveElapsedMs As Long"; +_productiveelapsedms = 0L; + //BA.debugLineNum = 53;BA.debugLine="Private CurrentSegmentStart As Long"; +_currentsegmentstart = 0L; + //BA.debugLineNum = 54;BA.debugLine="Private CurrentSegmentColor As Int"; +_currentsegmentcolor = 0; + //BA.debugLineNum = 55;BA.debugLine="Private StatsRows As List"; +mostCurrent._statsrows = new anywheresoftware.b4a.objects.collections.List(); + //BA.debugLineNum = 56;BA.debugLine="Private WorkMorningColor As Int"; +_workmorningcolor = 0; + //BA.debugLineNum = 57;BA.debugLine="Private CurrentWorkDayStart As Long"; +_currentworkdaystart = 0L; + //BA.debugLineNum = 58;BA.debugLine="Private CurrentWorkDayKey As Long"; +_currentworkdaykey = 0L; + //BA.debugLineNum = 59;BA.debugLine="Private AutoModeEnabled As Boolean"; +_automodeenabled = false; + //BA.debugLineNum = 60;BA.debugLine="Private AutoStartMinutes As Int"; +_autostartminutes = 0; + //BA.debugLineNum = 61;BA.debugLine="Private AutoPauseStartMinutes As Int"; +_autopausestartminutes = 0; + //BA.debugLineNum = 62;BA.debugLine="Private AutoPauseEndMinutes As Int"; +_autopauseendminutes = 0; + //BA.debugLineNum = 63;BA.debugLine="Private AutoEndMinutes As Int"; +_autoendminutes = 0; + //BA.debugLineNum = 64;BA.debugLine="Private AutoState As String"; +mostCurrent._autostate = ""; + //BA.debugLineNum = 65;BA.debugLine="Private LastActiveStateSaveAt As Long"; +_lastactivestatesaveat = 0L; + //BA.debugLineNum = 66;BA.debugLine="End Sub"; +return ""; +} +public static String _hidelegacybuttons() throws Exception{ +int _i = 0; +anywheresoftware.b4a.objects.ConcreteViewWrapper _v = null; +anywheresoftware.b4a.objects.ButtonWrapper _legacy = null; + //BA.debugLineNum = 830;BA.debugLine="Private Sub HideLegacyButtons"; + //BA.debugLineNum = 831;BA.debugLine="If BtnReset.IsInitialized Then"; +if (mostCurrent._btnreset.IsInitialized()) { + //BA.debugLineNum = 832;BA.debugLine="BtnReset.Enabled = False"; +mostCurrent._btnreset.setEnabled(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 833;BA.debugLine="BtnReset.Visible = False"; +mostCurrent._btnreset.setVisible(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 834;BA.debugLine="BtnReset.SetLayout(-200dip, -200dip, 1dip, 1dip)"; +mostCurrent._btnreset.SetLayout((int) (-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (200))),(int) (-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (200))),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (1)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (1))); + }; + //BA.debugLineNum = 836;BA.debugLine="If BtnSync.IsInitialized Then"; +if (mostCurrent._btnsync.IsInitialized()) { + //BA.debugLineNum = 837;BA.debugLine="BtnSync.Enabled = False"; +mostCurrent._btnsync.setEnabled(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 838;BA.debugLine="BtnSync.Visible = False"; +mostCurrent._btnsync.setVisible(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 839;BA.debugLine="BtnSync.SetLayout(-200dip, -200dip, 1dip, 1dip)"; +mostCurrent._btnsync.SetLayout((int) (-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (200))),(int) (-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (200))),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (1)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (1))); + }; + //BA.debugLineNum = 841;BA.debugLine="For i = Activity.NumberOfViews - 1 To 0 Step -1"; +{ +final int step11 = -1; +final int limit11 = (int) (0); +_i = (int) (mostCurrent._activity.getNumberOfViews()-1) ; +for (;_i >= limit11 ;_i = _i + step11 ) { + //BA.debugLineNum = 842;BA.debugLine="Dim v As View = Activity.GetView(i)"; +_v = new anywheresoftware.b4a.objects.ConcreteViewWrapper(); +_v = mostCurrent._activity.GetView(_i); + //BA.debugLineNum = 843;BA.debugLine="If v Is Button Then"; +if (_v.getObjectOrNull() instanceof android.widget.Button) { + //BA.debugLineNum = 844;BA.debugLine="Dim legacy As Button = v"; +_legacy = new anywheresoftware.b4a.objects.ButtonWrapper(); +_legacy = (anywheresoftware.b4a.objects.ButtonWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.ButtonWrapper(), (android.widget.Button)(_v.getObject())); + //BA.debugLineNum = 845;BA.debugLine="If legacy.Text = \"Sync\" Or legacy.Text = \"Reset"; +if ((_legacy.getText()).equals("Sync") || (_legacy.getText()).equals("Reset")) { + //BA.debugLineNum = 846;BA.debugLine="legacy.RemoveView"; +_legacy.RemoveView(); + }; + }; + } +}; + //BA.debugLineNum = 850;BA.debugLine="End Sub"; +return ""; +} +public static String _layoutmainbuttons() throws Exception{ +int _margin = 0; +int _gap = 0; +int _rowgap = 0; +int _buttonheight = 0; +int _labeltop = 0; +int _row2top = 0; +int _row1top = 0; +int _widebuttonwidth = 0; +int _smallbuttonwidth = 0; + //BA.debugLineNum = 189;BA.debugLine="Private Sub LayoutMainButtons"; + //BA.debugLineNum = 190;BA.debugLine="Dim margin As Int = 8dip"; +_margin = anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (8)); + //BA.debugLineNum = 191;BA.debugLine="Dim gap As Int = 8dip"; +_gap = anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (8)); + //BA.debugLineNum = 192;BA.debugLine="Dim rowGap As Int = 8dip"; +_rowgap = anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (8)); + //BA.debugLineNum = 193;BA.debugLine="Dim buttonHeight As Int = 48dip"; +_buttonheight = anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (48)); + //BA.debugLineNum = 194;BA.debugLine="Dim labelTop As Int = Activity.Height - 28dip"; +_labeltop = (int) (mostCurrent._activity.getHeight()-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (28))); + //BA.debugLineNum = 195;BA.debugLine="Dim row2Top As Int = labelTop - gap - buttonHeigh"; +_row2top = (int) (_labeltop-_gap-_buttonheight); + //BA.debugLineNum = 196;BA.debugLine="Dim row1Top As Int = row2Top - rowGap - buttonHei"; +_row1top = (int) (_row2top-_rowgap-_buttonheight); + //BA.debugLineNum = 197;BA.debugLine="Dim wideButtonWidth As Int = (Activity.Width - (2"; +_widebuttonwidth = (int) ((mostCurrent._activity.getWidth()-(2*_margin)-_gap)/(double)2); + //BA.debugLineNum = 198;BA.debugLine="Dim smallButtonWidth As Int = (Activity.Width - ("; +_smallbuttonwidth = (int) ((mostCurrent._activity.getWidth()-(2*_margin)-(2*_gap))/(double)3); + //BA.debugLineNum = 200;BA.debugLine="BtnStart.TextSize = 16"; +mostCurrent._btnstart.setTextSize((float) (16)); + //BA.debugLineNum = 201;BA.debugLine="BtnPause.TextSize = 16"; +mostCurrent._btnpause.setTextSize((float) (16)); + //BA.debugLineNum = 202;BA.debugLine="BtnBackground.TextSize = 15"; +mostCurrent._btnbackground.setTextSize((float) (15)); + //BA.debugLineNum = 203;BA.debugLine="BtnStats.TextSize = 15"; +mostCurrent._btnstats.setTextSize((float) (15)); + //BA.debugLineNum = 204;BA.debugLine="BtnConfig.TextSize = 15"; +mostCurrent._btnconfig.setTextSize((float) (15)); + //BA.debugLineNum = 205;BA.debugLine="StyleNeutralButton(BtnPause)"; +_styleneutralbutton((anywheresoftware.b4a.objects.LabelWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.LabelWrapper(), (android.widget.TextView)(mostCurrent._btnpause.getObject()))); + //BA.debugLineNum = 206;BA.debugLine="StyleNeutralButton(BtnBackground)"; +_styleneutralbutton(mostCurrent._btnbackground); + //BA.debugLineNum = 207;BA.debugLine="StyleNeutralButton(BtnStats)"; +_styleneutralbutton(mostCurrent._btnstats); + //BA.debugLineNum = 208;BA.debugLine="StyleNeutralButton(BtnConfig)"; +_styleneutralbutton(mostCurrent._btnconfig); + //BA.debugLineNum = 210;BA.debugLine="BtnStart.SetLayout(margin, row1Top, wideButtonWid"; +mostCurrent._btnstart.SetLayout(_margin,_row1top,_widebuttonwidth,_buttonheight); + //BA.debugLineNum = 211;BA.debugLine="BtnPause.SetLayout(margin + wideButtonWidth + gap"; +mostCurrent._btnpause.SetLayout((int) (_margin+_widebuttonwidth+_gap),_row1top,_widebuttonwidth,_buttonheight); + //BA.debugLineNum = 212;BA.debugLine="BtnBackground.SetLayout(margin, row2Top, smallBut"; +mostCurrent._btnbackground.SetLayout(_margin,_row2top,_smallbuttonwidth,_buttonheight); + //BA.debugLineNum = 213;BA.debugLine="BtnStats.SetLayout(margin + smallButtonWidth + ga"; +mostCurrent._btnstats.SetLayout((int) (_margin+_smallbuttonwidth+_gap),_row2top,_smallbuttonwidth,_buttonheight); + //BA.debugLineNum = 214;BA.debugLine="BtnConfig.SetLayout(margin + (2 * (smallButtonWid"; +mostCurrent._btnconfig.SetLayout((int) (_margin+(2*(_smallbuttonwidth+_gap))),_row2top,_smallbuttonwidth,_buttonheight); + //BA.debugLineNum = 215;BA.debugLine="If lblElapsedTime.IsInitialized Then lblElapsedTi"; +if (mostCurrent._lblelapsedtime.IsInitialized()) { +mostCurrent._lblelapsedtime.SetLayout((int) (0),_labeltop,(int) (mostCurrent._activity.getWidth()*0.58),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (28)));}; + //BA.debugLineNum = 216;BA.debugLine="If lblAutoStatus.IsInitialized Then lblAutoStatus"; +if (mostCurrent._lblautostatus.IsInitialized()) { +mostCurrent._lblautostatus.SetLayout((int) (mostCurrent._activity.getWidth()*0.58),_labeltop,(int) (mostCurrent._activity.getWidth()*0.42),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (28)));}; + //BA.debugLineNum = 217;BA.debugLine="End Sub"; +return ""; +} +public static String _loadautoconfig() throws Exception{ +anywheresoftware.b4a.objects.collections.List _lines = null; + //BA.debugLineNum = 969;BA.debugLine="Private Sub LoadAutoConfig"; + //BA.debugLineNum = 970;BA.debugLine="AutoModeEnabled = False"; +_automodeenabled = anywheresoftware.b4a.keywords.Common.False; + //BA.debugLineNum = 971;BA.debugLine="AutoState = \"stopped\""; +mostCurrent._autostate = "stopped"; + //BA.debugLineNum = 972;BA.debugLine="If File.Exists(File.DirInternal, AutoConfigFileNa"; +if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_autoconfigfilename)==anywheresoftware.b4a.keywords.Common.False) { +if (true) return "";}; + //BA.debugLineNum = 973;BA.debugLine="Dim lines As List = File.ReadList(File.DirInterna"; +_lines = new anywheresoftware.b4a.objects.collections.List(); +_lines = anywheresoftware.b4a.keywords.Common.File.ReadList(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_autoconfigfilename); + //BA.debugLineNum = 974;BA.debugLine="If lines.Size < 4 Then Return"; +if (_lines.getSize()<4) { +if (true) return "";}; + //BA.debugLineNum = 975;BA.debugLine="AutoStartMinutes = lines.Get(0)"; +_autostartminutes = (int)(BA.ObjectToNumber(_lines.Get((int) (0)))); + //BA.debugLineNum = 976;BA.debugLine="AutoPauseStartMinutes = lines.Get(1)"; +_autopausestartminutes = (int)(BA.ObjectToNumber(_lines.Get((int) (1)))); + //BA.debugLineNum = 977;BA.debugLine="AutoPauseEndMinutes = lines.Get(2)"; +_autopauseendminutes = (int)(BA.ObjectToNumber(_lines.Get((int) (2)))); + //BA.debugLineNum = 978;BA.debugLine="AutoEndMinutes = lines.Get(3)"; +_autoendminutes = (int)(BA.ObjectToNumber(_lines.Get((int) (3)))); + //BA.debugLineNum = 979;BA.debugLine="AutoModeEnabled = True"; +_automodeenabled = anywheresoftware.b4a.keywords.Common.True; + //BA.debugLineNum = 980;BA.debugLine="txtCfgStart.Text = MinutesToTime(AutoStartMinutes"; +mostCurrent._txtcfgstart.setText(BA.ObjectToCharSequence(_minutestotime(_autostartminutes))); + //BA.debugLineNum = 981;BA.debugLine="txtCfgPauseStart.Text = MinutesToTime(AutoPauseSt"; +mostCurrent._txtcfgpausestart.setText(BA.ObjectToCharSequence(_minutestotime(_autopausestartminutes))); + //BA.debugLineNum = 982;BA.debugLine="txtCfgPauseEnd.Text = MinutesToTime(AutoPauseEndM"; +mostCurrent._txtcfgpauseend.setText(BA.ObjectToCharSequence(_minutestotime(_autopauseendminutes))); + //BA.debugLineNum = 983;BA.debugLine="txtCfgEnd.Text = MinutesToTime(AutoEndMinutes)"; +mostCurrent._txtcfgend.setText(BA.ObjectToCharSequence(_minutestotime(_autoendminutes))); + //BA.debugLineNum = 984;BA.debugLine="End Sub"; +return ""; +} +public static String _loadstatsrows() throws Exception{ +anywheresoftware.b4a.objects.collections.List _lines = null; +String _line = ""; +String[] _parts = null; +anywheresoftware.b4a.objects.collections.Map _row = null; +long _daystart = 0L; +long _segmentstart = 0L; +long _duration = 0L; + //BA.debugLineNum = 678;BA.debugLine="Private Sub LoadStatsRows"; + //BA.debugLineNum = 679;BA.debugLine="StatsRows.Clear"; +mostCurrent._statsrows.Clear(); + //BA.debugLineNum = 680;BA.debugLine="If File.Exists(File.DirInternal, StatsFileName) ="; +if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statsfilename)==anywheresoftware.b4a.keywords.Common.False) { +if (true) return "";}; + //BA.debugLineNum = 681;BA.debugLine="Dim lines As List = File.ReadList(File.DirInterna"; +_lines = new anywheresoftware.b4a.objects.collections.List(); +_lines = anywheresoftware.b4a.keywords.Common.File.ReadList(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statsfilename); + //BA.debugLineNum = 682;BA.debugLine="For Each line As String In lines"; +{ +final anywheresoftware.b4a.BA.IterableList group4 = _lines; +final int groupLen4 = group4.getSize() +;int index4 = 0; +; +for (; index4 < groupLen4;index4++){ +_line = BA.ObjectToString(group4.Get(index4)); + //BA.debugLineNum = 683;BA.debugLine="If line.Trim.Length > 0 Then"; +if (_line.trim().length()>0) { + //BA.debugLineNum = 684;BA.debugLine="Dim parts() As String = Regex.Split(\"\\|\", line)"; +_parts = anywheresoftware.b4a.keywords.Common.Regex.Split("\\|",_line); + //BA.debugLineNum = 685;BA.debugLine="If parts.Length >= 4 Then"; +if (_parts.length>=4) { + //BA.debugLineNum = 686;BA.debugLine="Dim row As Map"; +_row = new anywheresoftware.b4a.objects.collections.Map(); + //BA.debugLineNum = 687;BA.debugLine="row.Initialize"; +_row.Initialize(); + //BA.debugLineNum = 688;BA.debugLine="Dim dayStart As Long = parts(0)"; +_daystart = (long)(Double.parseDouble(_parts[(int) (0)])); + //BA.debugLineNum = 689;BA.debugLine="Dim segmentStart As Long = parts(1)"; +_segmentstart = (long)(Double.parseDouble(_parts[(int) (1)])); + //BA.debugLineNum = 690;BA.debugLine="Dim duration As Long = parts(2)"; +_duration = (long)(Double.parseDouble(_parts[(int) (2)])); + //BA.debugLineNum = 691;BA.debugLine="row.Put(\"dayStart\", dayStart)"; +_row.Put((Object)("dayStart"),(Object)(_daystart)); + //BA.debugLineNum = 692;BA.debugLine="row.Put(\"dayKey\", dayStart)"; +_row.Put((Object)("dayKey"),(Object)(_daystart)); + //BA.debugLineNum = 693;BA.debugLine="row.Put(\"segmentStart\", segmentStart)"; +_row.Put((Object)("segmentStart"),(Object)(_segmentstart)); + //BA.debugLineNum = 694;BA.debugLine="row.Put(\"date\", DateTime.Date(dayStart))"; +_row.Put((Object)("date"),(Object)(anywheresoftware.b4a.keywords.Common.DateTime.Date(_daystart))); + //BA.debugLineNum = 695;BA.debugLine="row.Put(\"duration\", duration)"; +_row.Put((Object)("duration"),(Object)(_duration)); + //BA.debugLineNum = 696;BA.debugLine="row.Put(\"category\", parts(3))"; +_row.Put((Object)("category"),(Object)(_parts[(int) (3)])); + //BA.debugLineNum = 697;BA.debugLine="If parts.Length >= 5 Then"; +if (_parts.length>=5) { + //BA.debugLineNum = 698;BA.debugLine="row.Put(\"source\", parts(4))"; +_row.Put((Object)("source"),(Object)(_parts[(int) (4)])); + }else { + //BA.debugLineNum = 700;BA.debugLine="row.Put(\"source\", \"manual\")"; +_row.Put((Object)("source"),(Object)("manual")); + }; + //BA.debugLineNum = 702;BA.debugLine="StatsRows.Add(row)"; +mostCurrent._statsrows.Add((Object)(_row.getObject())); + }; + }; + } +}; + //BA.debugLineNum = 706;BA.debugLine="TrimStatsRows"; +_trimstatsrows(); + //BA.debugLineNum = 707;BA.debugLine="SaveStatsRows"; +_savestatsrows(); + //BA.debugLineNum = 708;BA.debugLine="End Sub"; +return ""; +} +public static String _loadworkdaysegmentsintoclock(long _daykey) throws Exception{ +long _productivecursor = 0L; +anywheresoftware.b4a.objects.collections.Map _row = null; +String _category = ""; +long _duration = 0L; + //BA.debugLineNum = 612;BA.debugLine="Private Sub LoadWorkDaySegmentsIntoClock(DayKey As"; + //BA.debugLineNum = 613;BA.debugLine="Dim productiveCursor As Long = 0"; +_productivecursor = (long) (0); + //BA.debugLineNum = 614;BA.debugLine="For Each row As Map In StatsRows"; +_row = new anywheresoftware.b4a.objects.collections.Map(); +{ +final anywheresoftware.b4a.BA.IterableList group2 = mostCurrent._statsrows; +final int groupLen2 = group2.getSize() +;int index2 = 0; +; +for (; index2 < groupLen2;index2++){ +_row = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group2.Get(index2))); + //BA.debugLineNum = 615;BA.debugLine="If row.Get(\"dayKey\") = DayKey Then"; +if ((_row.Get((Object)("dayKey"))).equals((Object)(_daykey))) { + //BA.debugLineNum = 616;BA.debugLine="Dim category As String = row.Get(\"category\")"; +_category = BA.ObjectToString(_row.Get((Object)("category"))); + //BA.debugLineNum = 617;BA.debugLine="Dim duration As Long = row.Get(\"duration\")"; +_duration = BA.ObjectToLongNumber(_row.Get((Object)("duration"))); + //BA.debugLineNum = 618;BA.debugLine="If category = \"pausa\" Then"; +if ((_category).equals("pausa")) { + //BA.debugLineNum = 619;BA.debugLine="myClock.AddSegment(duration, Colors.Yellow, Tr"; +mostCurrent._myclock._addsegment /*String*/ (_duration,anywheresoftware.b4a.keywords.Common.Colors.Yellow,anywheresoftware.b4a.keywords.Common.True); + }else { + //BA.debugLineNum = 621;BA.debugLine="AddDisplayProductiveSegment(duration, producti"; +_adddisplayproductivesegment(_duration,_productivecursor); + //BA.debugLineNum = 622;BA.debugLine="productiveCursor = productiveCursor + duration"; +_productivecursor = (long) (_productivecursor+_duration); + }; + }; + } +}; + //BA.debugLineNum = 626;BA.debugLine="End Sub"; +return ""; +} +public static String _minutestotime(int _minutes) throws Exception{ + //BA.debugLineNum = 996;BA.debugLine="Private Sub MinutesToTime(Minutes As Int) As Strin"; + //BA.debugLineNum = 997;BA.debugLine="Return NumberFormat(Minutes / 60, 2, 0) & \":\" & N"; +if (true) return anywheresoftware.b4a.keywords.Common.NumberFormat(_minutes/(double)60,(int) (2),(int) (0))+":"+anywheresoftware.b4a.keywords.Common.NumberFormat(_minutes%60,(int) (2),(int) (0)); + //BA.debugLineNum = 998;BA.debugLine="End Sub"; +return ""; +} +public static int _parsetimetominutes(String _value) throws Exception{ +String[] _parts = null; +int _h = 0; +int _m = 0; + //BA.debugLineNum = 986;BA.debugLine="Private Sub ParseTimeToMinutes(Value As String) As"; + //BA.debugLineNum = 987;BA.debugLine="Dim parts() As String = Regex.Split(\":\", Value.Tr"; +_parts = anywheresoftware.b4a.keywords.Common.Regex.Split(":",_value.trim()); + //BA.debugLineNum = 988;BA.debugLine="If parts.Length <> 2 Then Return -1"; +if (_parts.length!=2) { +if (true) return (int) (-1);}; + //BA.debugLineNum = 989;BA.debugLine="If IsNumber(parts(0)) = False Or IsNumber(parts(1"; +if (anywheresoftware.b4a.keywords.Common.IsNumber(_parts[(int) (0)])==anywheresoftware.b4a.keywords.Common.False || anywheresoftware.b4a.keywords.Common.IsNumber(_parts[(int) (1)])==anywheresoftware.b4a.keywords.Common.False) { +if (true) return (int) (-1);}; + //BA.debugLineNum = 990;BA.debugLine="Dim h As Int = parts(0)"; +_h = (int)(Double.parseDouble(_parts[(int) (0)])); + //BA.debugLineNum = 991;BA.debugLine="Dim m As Int = parts(1)"; +_m = (int)(Double.parseDouble(_parts[(int) (1)])); + //BA.debugLineNum = 992;BA.debugLine="If h < 0 Or h > 23 Or m < 0 Or m > 59 Then Return"; +if (_h<0 || _h>23 || _m<0 || _m>59) { +if (true) return (int) (-1);}; + //BA.debugLineNum = 993;BA.debugLine="Return h * 60 + m"; +if (true) return (int) (_h*60+_m); + //BA.debugLineNum = 994;BA.debugLine="End Sub"; +return 0; +} public static void initializeProcessGlobals() { if (main.processGlobalsRun == false) { main.processGlobalsRun = true; try { - + main._process_globals(); +starter._process_globals(); +localization._process_globals(); + } 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"; +}public static String _process_globals() throws Exception{ + //BA.debugLineNum = 13;BA.debugLine="Sub Process_Globals"; + //BA.debugLineNum = 14;BA.debugLine="Private Timer1 As Timer"; +_timer1 = new anywheresoftware.b4a.objects.Timer(); + //BA.debugLineNum = 15;BA.debugLine="Private FirstWorkLimitMs As Long"; +_firstworklimitms = 0L; + //BA.debugLineNum = 16;BA.debugLine="Private WorkLimitMs As Long"; +_worklimitms = 0L; + //BA.debugLineNum = 17;BA.debugLine="Private OvertimeLimitMs As Long"; +_overtimelimitms = 0L; + //BA.debugLineNum = 18;BA.debugLine="Private MaxProductiveMs As Long"; +_maxproductivems = 0L; + //BA.debugLineNum = 19;BA.debugLine="Private StatsFileName As String"; +_statsfilename = ""; + //BA.debugLineNum = 20;BA.debugLine="Private StateFileName As String"; +_statefilename = ""; + //BA.debugLineNum = 21;BA.debugLine="Private AutoConfigFileName As String"; +_autoconfigfilename = ""; + //BA.debugLineNum = 22;BA.debugLine="Private MaxStoredDays As Int"; +_maxstoreddays = 0; + //BA.debugLineNum = 23;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); +public static String _processactivepausesegment(long _now) throws Exception{ +long _midnight = 0L; + //BA.debugLineNum = 520;BA.debugLine="Private Sub ProcessActivePauseSegment(now As Long)"; + //BA.debugLineNum = 521;BA.debugLine="Dim midnight As Long = GetNextMidnight(CurrentSeg"; +_midnight = _getnextmidnight(_currentsegmentstart); + //BA.debugLineNum = 522;BA.debugLine="If now >= midnight Then"; +if (_now>=_midnight) { + //BA.debugLineNum = 523;BA.debugLine="EndSession(midnight, True)"; +_endsession(_midnight,anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 524;BA.debugLine="Log(\"Workday stopped automatically during pause:"; +anywheresoftware.b4a.keywords.Common.LogImpl("2424836","Workday stopped automatically during pause: midnight reached.",0); }; -RDebugUtils.currentLine=589833; - //BA.debugLineNum = 589833;BA.debugLine="End Sub"; + //BA.debugLineNum = 526;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"; +public static String _processactiveworksegment(long _now) throws Exception{ +long _midnight = 0L; +long _segmentduration = 0L; +long _nextboundary = 0L; +long _durationtoboundary = 0L; + //BA.debugLineNum = 460;BA.debugLine="Private Sub ProcessActiveWorkSegment(now As Long)"; + //BA.debugLineNum = 461;BA.debugLine="Do While SessionActive And PauseActive = False"; +while (_sessionactive && _pauseactive==anywheresoftware.b4a.keywords.Common.False) { + //BA.debugLineNum = 462;BA.debugLine="Dim midnight As Long = GetNextMidnight(CurrentSe"; +_midnight = _getnextmidnight(_currentsegmentstart); + //BA.debugLineNum = 463;BA.debugLine="If now >= midnight Then"; +if (_now>=_midnight) { + //BA.debugLineNum = 464;BA.debugLine="EndSession(midnight, True)"; +_endsession(_midnight,anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 465;BA.debugLine="Log(\"Workday stopped automatically: midnight re"; +anywheresoftware.b4a.keywords.Common.LogImpl("2162693","Workday stopped automatically: midnight reached.",0); + //BA.debugLineNum = 466;BA.debugLine="Return"; +if (true) return ""; + }; + //BA.debugLineNum = 468;BA.debugLine="Dim segmentDuration As Long = now - CurrentSegme"; +_segmentduration = (long) (_now-_currentsegmentstart); + //BA.debugLineNum = 469;BA.debugLine="If segmentDuration <= 0 Then Return"; +if (_segmentduration<=0) { +if (true) return "";}; + //BA.debugLineNum = 470;BA.debugLine="Dim nextBoundary As Long = GetNextWorkBoundary"; +_nextboundary = _getnextworkboundary(); + //BA.debugLineNum = 471;BA.debugLine="Dim durationToBoundary As Long = nextBoundary -"; +_durationtoboundary = (long) (_nextboundary-_productiveelapsedms); + //BA.debugLineNum = 472;BA.debugLine="If segmentDuration < durationToBoundary Then"; +if (_segmentduration<_durationtoboundary) { + //BA.debugLineNum = 473;BA.debugLine="CurrentSegmentColor = GetCurrentWorkColor"; +_currentsegmentcolor = _getcurrentworkcolor(); + //BA.debugLineNum = 474;BA.debugLine="Return"; +if (true) return ""; + }; + //BA.debugLineNum = 477;BA.debugLine="RecordSegment(CurrentSegmentStart, durationToBou"; +_recordsegment(_currentsegmentstart,_durationtoboundary,_getcurrentworkcolor(),anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 478;BA.debugLine="ProductiveElapsedMs = ProductiveElapsedMs + dura"; +_productiveelapsedms = (long) (_productiveelapsedms+_durationtoboundary); + //BA.debugLineNum = 479;BA.debugLine="CurrentSegmentStart = CurrentSegmentStart + dura"; +_currentsegmentstart = (long) (_currentsegmentstart+_durationtoboundary); + //BA.debugLineNum = 480;BA.debugLine="CurrentSegmentColor = GetCurrentWorkColor"; +_currentsegmentcolor = _getcurrentworkcolor(); + //BA.debugLineNum = 482;BA.debugLine="If ProductiveElapsedMs >= MaxProductiveMs Then"; +if (_productiveelapsedms>=_maxproductivems) { + //BA.debugLineNum = 483;BA.debugLine="EndSession(CurrentSegmentStart, True)"; +_endsession(_currentsegmentstart,anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 484;BA.debugLine="Return"; +if (true) return ""; + }; + } +; + //BA.debugLineNum = 487;BA.debugLine="End Sub"; +return ""; +} +public static String _recordsegment(long _segmentstart,long _duration,int _segmentcolor,boolean _ispausesegment) throws Exception{ + //BA.debugLineNum = 500;BA.debugLine="Private Sub RecordSegment(SegmentStart As Long, Du"; + //BA.debugLineNum = 501;BA.debugLine="myClock.AddSegment(Duration, SegmentColor, IsPaus"; +mostCurrent._myclock._addsegment /*String*/ (_duration,_segmentcolor,_ispausesegment); + //BA.debugLineNum = 502;BA.debugLine="AddStatsSegment(CurrentWorkDayStart, CurrentWorkD"; +_addstatssegment(_currentworkdaystart,_currentworkdaykey,_segmentstart,_duration,_getsegmentcategory(_segmentcolor,_ispausesegment),"manual"); + //BA.debugLineNum = 503;BA.debugLine="End Sub"; +return ""; +} +public static String _regenerateautosegmentsforday(long _daystart,int _minuteofday) throws Exception{ +int _firstworkend = 0; +int _pauseend = 0; +int _secondworkend = 0; + //BA.debugLineNum = 1027;BA.debugLine="Private Sub RegenerateAutoSegmentsForDay(DayStart"; + //BA.debugLineNum = 1028;BA.debugLine="RemoveAutoRowsForDay(DayStart)"; +_removeautorowsforday(_daystart); + //BA.debugLineNum = 1029;BA.debugLine="Dim firstWorkEnd As Int = Min(MinuteOfDay, AutoPa"; +_firstworkend = (int) (anywheresoftware.b4a.keywords.Common.Min(_minuteofday,_autopausestartminutes)); + //BA.debugLineNum = 1030;BA.debugLine="If firstWorkEnd > AutoStartMinutes Then"; +if (_firstworkend>_autostartminutes) { + //BA.debugLineNum = 1031;BA.debugLine="AddAutoSegmentNoSave(DayStart, AutoStartMinutes,"; +_addautosegmentnosave(_daystart,_autostartminutes,_firstworkend,"lavoro"); + }; + //BA.debugLineNum = 1033;BA.debugLine="Dim pauseEnd As Int = Min(MinuteOfDay, AutoPauseE"; +_pauseend = (int) (anywheresoftware.b4a.keywords.Common.Min(_minuteofday,_autopauseendminutes)); + //BA.debugLineNum = 1034;BA.debugLine="If pauseEnd > AutoPauseStartMinutes Then"; +if (_pauseend>_autopausestartminutes) { + //BA.debugLineNum = 1035;BA.debugLine="AddAutoSegmentNoSave(DayStart, AutoPauseStartMin"; +_addautosegmentnosave(_daystart,_autopausestartminutes,_pauseend,"pausa"); + }; + //BA.debugLineNum = 1037;BA.debugLine="Dim secondWorkEnd As Int = Min(MinuteOfDay, AutoE"; +_secondworkend = (int) (anywheresoftware.b4a.keywords.Common.Min(_minuteofday,_autoendminutes)); + //BA.debugLineNum = 1038;BA.debugLine="If secondWorkEnd > AutoPauseEndMinutes Then"; +if (_secondworkend>_autopauseendminutes) { + //BA.debugLineNum = 1039;BA.debugLine="AddAutoSegmentNoSave(DayStart, AutoPauseEndMinut"; +_addautosegmentnosave(_daystart,_autopauseendminutes,_secondworkend,"lavoro"); + }; + //BA.debugLineNum = 1041;BA.debugLine="TrimStatsRows"; +_trimstatsrows(); + //BA.debugLineNum = 1042;BA.debugLine="SaveStatsRows"; +_savestatsrows(); + //BA.debugLineNum = 1043;BA.debugLine="End Sub"; +return ""; +} +public static String _removeautorowsforday(long _daystart) throws Exception{ +anywheresoftware.b4a.objects.collections.List _kept = null; +anywheresoftware.b4a.objects.collections.Map _row = null; +String _source = ""; + //BA.debugLineNum = 1060;BA.debugLine="Private Sub RemoveAutoRowsForDay(DayStart As Long)"; + //BA.debugLineNum = 1061;BA.debugLine="Dim kept As List"; +_kept = new anywheresoftware.b4a.objects.collections.List(); + //BA.debugLineNum = 1062;BA.debugLine="kept.Initialize"; +_kept.Initialize(); + //BA.debugLineNum = 1063;BA.debugLine="For Each row As Map In StatsRows"; +_row = new anywheresoftware.b4a.objects.collections.Map(); +{ +final anywheresoftware.b4a.BA.IterableList group3 = mostCurrent._statsrows; +final int groupLen3 = group3.getSize() +;int index3 = 0; +; +for (; index3 < groupLen3;index3++){ +_row = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group3.Get(index3))); + //BA.debugLineNum = 1064;BA.debugLine="Dim source As String = \"manual\""; +_source = "manual"; + //BA.debugLineNum = 1065;BA.debugLine="If row.ContainsKey(\"source\") Then source = row.G"; +if (_row.ContainsKey((Object)("source"))) { +_source = BA.ObjectToString(_row.Get((Object)("source")));}; + //BA.debugLineNum = 1066;BA.debugLine="If row.Get(\"dayStart\") = DayStart And source = \""; +if ((_row.Get((Object)("dayStart"))).equals((Object)(_daystart)) && (_source).equals("auto")) { + }else { + //BA.debugLineNum = 1069;BA.debugLine="kept.Add(row)"; +_kept.Add((Object)(_row.getObject())); + }; + } +}; + //BA.debugLineNum = 1072;BA.debugLine="StatsRows.Clear"; +mostCurrent._statsrows.Clear(); + //BA.debugLineNum = 1073;BA.debugLine="StatsRows.AddAll(kept)"; +mostCurrent._statsrows.AddAll(_kept); + //BA.debugLineNum = 1074;BA.debugLine="End Sub"; +return ""; +} +public static String _resetautomaticconfig() throws Exception{ + //BA.debugLineNum = 949;BA.debugLine="Private Sub ResetAutomaticConfig"; + //BA.debugLineNum = 950;BA.debugLine="AutoModeEnabled = False"; +_automodeenabled = anywheresoftware.b4a.keywords.Common.False; + //BA.debugLineNum = 951;BA.debugLine="AutoState = \"stopped\""; +mostCurrent._autostate = "stopped"; + //BA.debugLineNum = 952;BA.debugLine="If File.Exists(File.DirInternal, AutoConfigFileNa"; +if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_autoconfigfilename)) { +anywheresoftware.b4a.keywords.Common.File.Delete(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_autoconfigfilename);}; + //BA.debugLineNum = 953;BA.debugLine="ResetSessionState(False)"; +_resetsessionstate(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 954;BA.debugLine="RestoreLastClosedDayState"; +_restorelastcloseddaystate(); + //BA.debugLineNum = 955;BA.debugLine="UpdateMainControlState"; +_updatemaincontrolstate(); + //BA.debugLineNum = 956;BA.debugLine="ToastMessageShow(Localization.T(\"auto_disabled\"),"; +anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"auto_disabled")),anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 957;BA.debugLine="End Sub"; +return ""; +} +public static String _resetsessionstate(boolean _clearclock) throws Exception{ + //BA.debugLineNum = 442;BA.debugLine="Private Sub ResetSessionState(ClearClock As Boolea"; + //BA.debugLineNum = 443;BA.debugLine="SessionActive = False"; +_sessionactive = anywheresoftware.b4a.keywords.Common.False; + //BA.debugLineNum = 444;BA.debugLine="PauseActive = False"; +_pauseactive = anywheresoftware.b4a.keywords.Common.False; + //BA.debugLineNum = 445;BA.debugLine="ProductiveElapsedMs = 0"; +_productiveelapsedms = (long) (0); + //BA.debugLineNum = 446;BA.debugLine="CurrentSegmentStart = 0"; +_currentsegmentstart = (long) (0); + //BA.debugLineNum = 447;BA.debugLine="CurrentWorkDayStart = 0"; +_currentworkdaystart = (long) (0); + //BA.debugLineNum = 448;BA.debugLine="CurrentWorkDayKey = 0"; +_currentworkdaykey = (long) (0); + //BA.debugLineNum = 449;BA.debugLine="CurrentSegmentColor = WorkMorningColor"; +_currentsegmentcolor = _workmorningcolor; + //BA.debugLineNum = 450;BA.debugLine="LastActiveStateSaveAt = 0"; +_lastactivestatesaveat = (long) (0); + //BA.debugLineNum = 451;BA.debugLine="BtnStart.Text = Localization.T(\"start\")"; +mostCurrent._btnstart.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"start"))); + //BA.debugLineNum = 452;BA.debugLine="BtnPause.Text = Localization.T(\"pause\")"; +mostCurrent._btnpause.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"pause"))); + //BA.debugLineNum = 453;BA.debugLine="BtnPause.Enabled = False"; +mostCurrent._btnpause.setEnabled(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 454;BA.debugLine="UpdateMainControlState"; +_updatemaincontrolstate(); + //BA.debugLineNum = 455;BA.debugLine="If ClearClock Then myClock.ClearSegments"; +if (_clearclock) { +mostCurrent._myclock._clearsegments /*String*/ ();}; + //BA.debugLineNum = 456;BA.debugLine="myClock.ClearActiveSegment"; +mostCurrent._myclock._clearactivesegment /*String*/ (); + //BA.debugLineNum = 457;BA.debugLine="UpdateElapsedLabel"; +_updateelapsedlabel(); + //BA.debugLineNum = 458;BA.debugLine="End Sub"; +return ""; +} +public static String _resizeclockpanel() throws Exception{ +int _clocksize = 0; + //BA.debugLineNum = 144;BA.debugLine="Private Sub ResizeClockPanel"; + //BA.debugLineNum = 145;BA.debugLine="Dim clockSize As Int = Activity.Width"; +_clocksize = mostCurrent._activity.getWidth(); + //BA.debugLineNum = 146;BA.debugLine="pnlClock.SetLayout(0, 0, clockSize, clockSize)"; +mostCurrent._pnlclock.SetLayout((int) (0),(int) (0),_clocksize,_clocksize); + //BA.debugLineNum = 147;BA.debugLine="End Sub"; +return ""; +} +public static String _restoreactivestate() throws Exception{ +anywheresoftware.b4a.objects.collections.List _lines = null; +long _now = 0L; + //BA.debugLineNum = 752;BA.debugLine="Private Sub RestoreActiveState"; + //BA.debugLineNum = 753;BA.debugLine="If SessionActive Then Return"; +if (_sessionactive) { +if (true) return "";}; + //BA.debugLineNum = 754;BA.debugLine="If File.Exists(File.DirInternal, StateFileName) ="; +if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename)==anywheresoftware.b4a.keywords.Common.False) { +if (true) return "";}; + //BA.debugLineNum = 755;BA.debugLine="Dim lines As List = File.ReadList(File.DirInterna"; +_lines = new anywheresoftware.b4a.objects.collections.List(); +_lines = anywheresoftware.b4a.keywords.Common.File.ReadList(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename); + //BA.debugLineNum = 756;BA.debugLine="If lines.Size < 5 Then Return"; +if (_lines.getSize()<5) { +if (true) return "";}; + //BA.debugLineNum = 758;BA.debugLine="CurrentWorkDayStart = lines.Get(0)"; +_currentworkdaystart = BA.ObjectToLongNumber(_lines.Get((int) (0))); + //BA.debugLineNum = 759;BA.debugLine="CurrentWorkDayKey = CurrentWorkDayStart"; +_currentworkdaykey = _currentworkdaystart; + //BA.debugLineNum = 760;BA.debugLine="CurrentSegmentStart = lines.Get(1)"; +_currentsegmentstart = BA.ObjectToLongNumber(_lines.Get((int) (1))); + //BA.debugLineNum = 761;BA.debugLine="ProductiveElapsedMs = lines.Get(2)"; +_productiveelapsedms = BA.ObjectToLongNumber(_lines.Get((int) (2))); + //BA.debugLineNum = 762;BA.debugLine="ProductiveElapsedMs = Max(ProductiveElapsedMs, Ge"; +_productiveelapsedms = (long) (anywheresoftware.b4a.keywords.Common.Max(_productiveelapsedms,_getproductivetotalforworkday(_currentworkdaykey))); + //BA.debugLineNum = 763;BA.debugLine="PauseActive = lines.Get(3)"; +_pauseactive = BA.ObjectToBoolean(_lines.Get((int) (3))); + //BA.debugLineNum = 764;BA.debugLine="CurrentSegmentColor = lines.Get(4)"; +_currentsegmentcolor = (int)(BA.ObjectToNumber(_lines.Get((int) (4)))); + //BA.debugLineNum = 766;BA.debugLine="Dim now As Long = DateTime.Now"; +_now = anywheresoftware.b4a.keywords.Common.DateTime.getNow(); + //BA.debugLineNum = 767;BA.debugLine="If now >= GetNextMidnight(CurrentSegmentStart) Th"; +if (_now>=_getnextmidnight(_currentsegmentstart)) { + //BA.debugLineNum = 768;BA.debugLine="SessionActive = True"; +_sessionactive = anywheresoftware.b4a.keywords.Common.True; + //BA.debugLineNum = 769;BA.debugLine="EndSession(GetNextMidnight(CurrentSegmentStart),"; +_endsession(_getnextmidnight(_currentsegmentstart),anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 770;BA.debugLine="If File.Exists(File.DirInternal, StateFileName)"; +if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename)) { +anywheresoftware.b4a.keywords.Common.File.Delete(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename);}; + //BA.debugLineNum = 771;BA.debugLine="Return"; +if (true) return ""; + }; + //BA.debugLineNum = 773;BA.debugLine="If ProductiveElapsedMs >= MaxProductiveMs Then"; +if (_productiveelapsedms>=_maxproductivems) { + //BA.debugLineNum = 774;BA.debugLine="If File.Exists(File.DirInternal, StateFileName)"; +if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename)) { +anywheresoftware.b4a.keywords.Common.File.Delete(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename);}; + //BA.debugLineNum = 775;BA.debugLine="Return"; +if (true) return ""; + }; + //BA.debugLineNum = 778;BA.debugLine="SessionActive = True"; +_sessionactive = anywheresoftware.b4a.keywords.Common.True; + //BA.debugLineNum = 779;BA.debugLine="BtnStart.Text = Localization.T(\"end\")"; +mostCurrent._btnstart.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"end"))); + //BA.debugLineNum = 780;BA.debugLine="If PauseActive Then"; +if (_pauseactive) { + //BA.debugLineNum = 781;BA.debugLine="BtnPause.Text = Localization.T(\"end_pause\")"; +mostCurrent._btnpause.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"end_pause"))); + //BA.debugLineNum = 782;BA.debugLine="BtnPause.Enabled = True"; +mostCurrent._btnpause.setEnabled(anywheresoftware.b4a.keywords.Common.True); + }else { + //BA.debugLineNum = 784;BA.debugLine="BtnPause.Text = Localization.T(\"pause\")"; +mostCurrent._btnpause.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"pause"))); + //BA.debugLineNum = 785;BA.debugLine="BtnPause.Enabled = True"; +mostCurrent._btnpause.setEnabled(anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 786;BA.debugLine="CurrentSegmentColor = GetCurrentWorkColor"; +_currentsegmentcolor = _getcurrentworkcolor(); + }; + //BA.debugLineNum = 788;BA.debugLine="UpdateMainControlState"; +_updatemaincontrolstate(); + //BA.debugLineNum = 789;BA.debugLine="myClock.ClearSegments"; +mostCurrent._myclock._clearsegments /*String*/ (); + //BA.debugLineNum = 790;BA.debugLine="LoadWorkDaySegmentsIntoClock(CurrentWorkDayKey)"; +_loadworkdaysegmentsintoclock(_currentworkdaykey); + //BA.debugLineNum = 791;BA.debugLine="myClock.SetActiveSegment(Max(0, now - CurrentSegm"; +mostCurrent._myclock._setactivesegment /*String*/ ((long) (anywheresoftware.b4a.keywords.Common.Max(0,_now-_currentsegmentstart)),_currentsegmentcolor,_pauseactive); + //BA.debugLineNum = 792;BA.debugLine="UpdateElapsedLabel"; +_updateelapsedlabel(); + //BA.debugLineNum = 793;BA.debugLine="End Sub"; +return ""; +} +public static String _restorelastcloseddaystate() throws Exception{ +long _latestdaystart = 0L; + //BA.debugLineNum = 795;BA.debugLine="Private Sub RestoreLastClosedDayState"; + //BA.debugLineNum = 796;BA.debugLine="If SessionActive Then Return"; +if (_sessionactive) { +if (true) return "";}; + //BA.debugLineNum = 797;BA.debugLine="Dim latestDayStart As Long = GetLatestWorkDayStar"; +_latestdaystart = _getlatestworkdaystart(); + //BA.debugLineNum = 798;BA.debugLine="If latestDayStart = 0 Then Return"; +if (_latestdaystart==0) { +if (true) return "";}; + //BA.debugLineNum = 799;BA.debugLine="If CurrentWorkDayStart = latestDayStart And Produ"; +if (_currentworkdaystart==_latestdaystart && _productiveelapsedms>0) { +if (true) return "";}; + //BA.debugLineNum = 800;BA.debugLine="CurrentWorkDayStart = latestDayStart"; +_currentworkdaystart = _latestdaystart; + //BA.debugLineNum = 801;BA.debugLine="CurrentWorkDayKey = latestDayStart"; +_currentworkdaykey = _latestdaystart; + //BA.debugLineNum = 802;BA.debugLine="ProductiveElapsedMs = GetProductiveTotalForWorkDa"; +_productiveelapsedms = _getproductivetotalforworkday(_currentworkdaykey); + //BA.debugLineNum = 803;BA.debugLine="CurrentSegmentStart = 0"; +_currentsegmentstart = (long) (0); + //BA.debugLineNum = 804;BA.debugLine="PauseActive = False"; +_pauseactive = anywheresoftware.b4a.keywords.Common.False; + //BA.debugLineNum = 805;BA.debugLine="CurrentSegmentColor = GetCurrentWorkColor"; +_currentsegmentcolor = _getcurrentworkcolor(); + //BA.debugLineNum = 806;BA.debugLine="myClock.ClearSegments"; +mostCurrent._myclock._clearsegments /*String*/ (); + //BA.debugLineNum = 807;BA.debugLine="LoadWorkDaySegmentsIntoClock(CurrentWorkDayKey)"; +_loadworkdaysegmentsintoclock(_currentworkdaykey); + //BA.debugLineNum = 808;BA.debugLine="myClock.ClearActiveSegment"; +mostCurrent._myclock._clearactivesegment /*String*/ (); + //BA.debugLineNum = 809;BA.debugLine="UpdateElapsedLabel"; +_updateelapsedlabel(); + //BA.debugLineNum = 810;BA.debugLine="End Sub"; +return ""; +} +public static String _saveactivestate() throws Exception{ +anywheresoftware.b4a.objects.collections.List _lines = null; + //BA.debugLineNum = 735;BA.debugLine="Private Sub SaveActiveState"; + //BA.debugLineNum = 736;BA.debugLine="If SessionActive = False Then"; +if (_sessionactive==anywheresoftware.b4a.keywords.Common.False) { + //BA.debugLineNum = 737;BA.debugLine="If File.Exists(File.DirInternal, StateFileName)"; +if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename)) { +anywheresoftware.b4a.keywords.Common.File.Delete(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename);}; + //BA.debugLineNum = 738;BA.debugLine="LastActiveStateSaveAt = 0"; +_lastactivestatesaveat = (long) (0); + //BA.debugLineNum = 739;BA.debugLine="Return"; +if (true) return ""; + }; + //BA.debugLineNum = 741;BA.debugLine="Dim lines As List"; +_lines = new anywheresoftware.b4a.objects.collections.List(); + //BA.debugLineNum = 742;BA.debugLine="lines.Initialize"; +_lines.Initialize(); + //BA.debugLineNum = 743;BA.debugLine="lines.Add(CurrentWorkDayStart)"; +_lines.Add((Object)(_currentworkdaystart)); + //BA.debugLineNum = 744;BA.debugLine="lines.Add(CurrentSegmentStart)"; +_lines.Add((Object)(_currentsegmentstart)); + //BA.debugLineNum = 745;BA.debugLine="lines.Add(ProductiveElapsedMs)"; +_lines.Add((Object)(_productiveelapsedms)); + //BA.debugLineNum = 746;BA.debugLine="lines.Add(PauseActive)"; +_lines.Add((Object)(_pauseactive)); + //BA.debugLineNum = 747;BA.debugLine="lines.Add(CurrentSegmentColor)"; +_lines.Add((Object)(_currentsegmentcolor)); + //BA.debugLineNum = 748;BA.debugLine="File.WriteList(File.DirInternal, StateFileName, l"; +anywheresoftware.b4a.keywords.Common.File.WriteList(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename,_lines); + //BA.debugLineNum = 749;BA.debugLine="LastActiveStateSaveAt = DateTime.Now"; +_lastactivestatesaveat = anywheresoftware.b4a.keywords.Common.DateTime.getNow(); + //BA.debugLineNum = 750;BA.debugLine="End Sub"; +return ""; +} +public static String _saveautoconfig() throws Exception{ +anywheresoftware.b4a.objects.collections.List _lines = null; + //BA.debugLineNum = 959;BA.debugLine="Private Sub SaveAutoConfig"; + //BA.debugLineNum = 960;BA.debugLine="Dim lines As List"; +_lines = new anywheresoftware.b4a.objects.collections.List(); + //BA.debugLineNum = 961;BA.debugLine="lines.Initialize"; +_lines.Initialize(); + //BA.debugLineNum = 962;BA.debugLine="lines.Add(AutoStartMinutes)"; +_lines.Add((Object)(_autostartminutes)); + //BA.debugLineNum = 963;BA.debugLine="lines.Add(AutoPauseStartMinutes)"; +_lines.Add((Object)(_autopausestartminutes)); + //BA.debugLineNum = 964;BA.debugLine="lines.Add(AutoPauseEndMinutes)"; +_lines.Add((Object)(_autopauseendminutes)); + //BA.debugLineNum = 965;BA.debugLine="lines.Add(AutoEndMinutes)"; +_lines.Add((Object)(_autoendminutes)); + //BA.debugLineNum = 966;BA.debugLine="File.WriteList(File.DirInternal, AutoConfigFileNa"; +anywheresoftware.b4a.keywords.Common.File.WriteList(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_autoconfigfilename,_lines); + //BA.debugLineNum = 967;BA.debugLine="End Sub"; +return ""; +} +public static String _savestatsrows() throws Exception{ +anywheresoftware.b4a.objects.collections.List _lines = null; +anywheresoftware.b4a.objects.collections.Map _row = null; +String _source = ""; + //BA.debugLineNum = 710;BA.debugLine="Private Sub SaveStatsRows"; + //BA.debugLineNum = 711;BA.debugLine="Dim lines As List"; +_lines = new anywheresoftware.b4a.objects.collections.List(); + //BA.debugLineNum = 712;BA.debugLine="lines.Initialize"; +_lines.Initialize(); + //BA.debugLineNum = 713;BA.debugLine="For Each row As Map In StatsRows"; +_row = new anywheresoftware.b4a.objects.collections.Map(); +{ +final anywheresoftware.b4a.BA.IterableList group3 = mostCurrent._statsrows; +final int groupLen3 = group3.getSize() +;int index3 = 0; +; +for (; index3 < groupLen3;index3++){ +_row = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group3.Get(index3))); + //BA.debugLineNum = 714;BA.debugLine="Dim source As String = \"manual\""; +_source = "manual"; + //BA.debugLineNum = 715;BA.debugLine="If row.ContainsKey(\"source\") Then source = row.G"; +if (_row.ContainsKey((Object)("source"))) { +_source = BA.ObjectToString(_row.Get((Object)("source")));}; + //BA.debugLineNum = 716;BA.debugLine="lines.Add(row.Get(\"dayStart\") & \"|\" & row.Get(\"s"; +_lines.Add((Object)(BA.ObjectToString(_row.Get((Object)("dayStart")))+"|"+BA.ObjectToString(_row.Get((Object)("segmentStart")))+"|"+BA.ObjectToString(_row.Get((Object)("duration")))+"|"+BA.ObjectToString(_row.Get((Object)("category")))+"|"+_source)); + } +}; + //BA.debugLineNum = 718;BA.debugLine="File.WriteList(File.DirInternal, StatsFileName, l"; +anywheresoftware.b4a.keywords.Common.File.WriteList(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statsfilename,_lines); + //BA.debugLineNum = 719;BA.debugLine="End Sub"; +return ""; +} +public static String _setautomaticconfig() throws Exception{ +int _startminutes = 0; +int _pausestartminutes = 0; +int _pauseendminutes = 0; +int _endminutes = 0; +int _workminutes = 0; + //BA.debugLineNum = 919;BA.debugLine="Private Sub SetAutomaticConfig"; + //BA.debugLineNum = 920;BA.debugLine="Dim startMinutes As Int = ParseTimeToMinutes(txtC"; +_startminutes = _parsetimetominutes(mostCurrent._txtcfgstart.getText()); + //BA.debugLineNum = 921;BA.debugLine="Dim pauseStartMinutes As Int = ParseTimeToMinutes"; +_pausestartminutes = _parsetimetominutes(mostCurrent._txtcfgpausestart.getText()); + //BA.debugLineNum = 922;BA.debugLine="Dim pauseEndMinutes As Int = ParseTimeToMinutes(t"; +_pauseendminutes = _parsetimetominutes(mostCurrent._txtcfgpauseend.getText()); + //BA.debugLineNum = 923;BA.debugLine="Dim endMinutes As Int = ParseTimeToMinutes(txtCfg"; +_endminutes = _parsetimetominutes(mostCurrent._txtcfgend.getText()); + //BA.debugLineNum = 924;BA.debugLine="If startMinutes < 0 Or pauseStartMinutes < 0 Or p"; +if (_startminutes<0 || _pausestartminutes<0 || _pauseendminutes<0 || _endminutes<0) { + //BA.debugLineNum = 925;BA.debugLine="ToastMessageShow(Localization.T(\"use_hhmm\"), Fal"; +anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"use_hhmm")),anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 926;BA.debugLine="Return"; +if (true) return ""; + }; + //BA.debugLineNum = 928;BA.debugLine="If startMinutes >= pauseStartMinutes Or pauseStar"; +if (_startminutes>=_pausestartminutes || _pausestartminutes>=_pauseendminutes || _pauseendminutes>=_endminutes) { + //BA.debugLineNum = 929;BA.debugLine="ToastMessageShow(Localization.T(\"times_order\"),"; +anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"times_order")),anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 930;BA.debugLine="Return"; +if (true) return ""; + }; + //BA.debugLineNum = 932;BA.debugLine="Dim workMinutes As Int = (pauseStartMinutes - sta"; +_workminutes = (int) ((_pausestartminutes-_startminutes)+(_endminutes-_pauseendminutes)); + //BA.debugLineNum = 933;BA.debugLine="If workMinutes > 480 Then"; +if (_workminutes>480) { + //BA.debugLineNum = 934;BA.debugLine="ToastMessageShow(Localization.T(\"work_exceed\"),"; +anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"work_exceed")),anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 935;BA.debugLine="Return"; +if (true) return ""; + }; + //BA.debugLineNum = 937;BA.debugLine="AutoStartMinutes = startMinutes"; +_autostartminutes = _startminutes; + //BA.debugLineNum = 938;BA.debugLine="AutoPauseStartMinutes = pauseStartMinutes"; +_autopausestartminutes = _pausestartminutes; + //BA.debugLineNum = 939;BA.debugLine="AutoPauseEndMinutes = pauseEndMinutes"; +_autopauseendminutes = _pauseendminutes; + //BA.debugLineNum = 940;BA.debugLine="AutoEndMinutes = endMinutes"; +_autoendminutes = _endminutes; + //BA.debugLineNum = 941;BA.debugLine="AutoModeEnabled = True"; +_automodeenabled = anywheresoftware.b4a.keywords.Common.True; + //BA.debugLineNum = 942;BA.debugLine="SaveAutoConfig"; +_saveautoconfig(); + //BA.debugLineNum = 943;BA.debugLine="If SessionActive Then EndSession(DateTime.Now, Fa"; +if (_sessionactive) { +_endsession(anywheresoftware.b4a.keywords.Common.DateTime.getNow(),anywheresoftware.b4a.keywords.Common.False);}; + //BA.debugLineNum = 944;BA.debugLine="If File.Exists(File.DirInternal, StateFileName) T"; +if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename)) { +anywheresoftware.b4a.keywords.Common.File.Delete(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),_statefilename);}; + //BA.debugLineNum = 945;BA.debugLine="UpdateAutomaticState(DateTime.Now)"; +_updateautomaticstate(anywheresoftware.b4a.keywords.Common.DateTime.getNow()); + //BA.debugLineNum = 946;BA.debugLine="ToastMessageShow(Localization.T(\"auto_enabled\"),"; +anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"auto_enabled")),anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 947;BA.debugLine="End Sub"; +return ""; +} +public static String _setmaincontrolsvisible(boolean _visible) throws Exception{ +int _i = 0; +anywheresoftware.b4a.objects.ConcreteViewWrapper _v = null; + //BA.debugLineNum = 820;BA.debugLine="Private Sub SetMainControlsVisible(Visible As Bool"; + //BA.debugLineNum = 821;BA.debugLine="For i = 0 To Activity.NumberOfViews - 1"; +{ +final int step1 = 1; +final int limit1 = (int) (mostCurrent._activity.getNumberOfViews()-1); +_i = (int) (0) ; +for (;_i <= limit1 ;_i = _i + step1 ) { + //BA.debugLineNum = 822;BA.debugLine="Dim v As View = Activity.GetView(i)"; +_v = new anywheresoftware.b4a.objects.ConcreteViewWrapper(); +_v = mostCurrent._activity.GetView(_i); + //BA.debugLineNum = 823;BA.debugLine="v.Visible = Visible"; +_v.setVisible(_visible); + } +}; + //BA.debugLineNum = 825;BA.debugLine="HideLegacyButtons"; +_hidelegacybuttons(); + //BA.debugLineNum = 826;BA.debugLine="pnlStats.Visible = False"; +mostCurrent._pnlstats.setVisible(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 827;BA.debugLine="pnlConfig.Visible = False"; +mostCurrent._pnlconfig.setVisible(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 828;BA.debugLine="End Sub"; +return ""; +} +public static String _showconfigpage() throws Exception{ + //BA.debugLineNum = 852;BA.debugLine="Private Sub ShowConfigPage"; + //BA.debugLineNum = 853;BA.debugLine="SetMainControlsVisible(False)"; +_setmaincontrolsvisible(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 854;BA.debugLine="pnlStats.Visible = False"; +mostCurrent._pnlstats.setVisible(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 855;BA.debugLine="pnlConfig.Visible = True"; +mostCurrent._pnlconfig.setVisible(anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 856;BA.debugLine="pnlConfig.BringToFront"; +mostCurrent._pnlconfig.BringToFront(); + //BA.debugLineNum = 857;BA.debugLine="End Sub"; +return ""; +} +public static String _showmainpage() throws Exception{ + //BA.debugLineNum = 859;BA.debugLine="Private Sub ShowMainPage"; + //BA.debugLineNum = 860;BA.debugLine="SetMainControlsVisible(True)"; +_setmaincontrolsvisible(anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 861;BA.debugLine="pnlStats.Visible = False"; +mostCurrent._pnlstats.setVisible(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 862;BA.debugLine="pnlConfig.Visible = False"; +mostCurrent._pnlconfig.setVisible(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 863;BA.debugLine="End Sub"; +return ""; +} +public static String _showstatspage() throws Exception{ + //BA.debugLineNum = 812;BA.debugLine="Private Sub ShowStatsPage"; + //BA.debugLineNum = 813;BA.debugLine="BuildStatsTable"; +_buildstatstable(); + //BA.debugLineNum = 814;BA.debugLine="SetMainControlsVisible(False)"; +_setmaincontrolsvisible(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 815;BA.debugLine="pnlStats.Visible = True"; +mostCurrent._pnlstats.setVisible(anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 816;BA.debugLine="pnlConfig.Visible = False"; +mostCurrent._pnlconfig.setVisible(anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 817;BA.debugLine="pnlStats.BringToFront"; +mostCurrent._pnlstats.BringToFront(); + //BA.debugLineNum = 818;BA.debugLine="End Sub"; +return ""; +} +public static String _startsession() throws Exception{ + //BA.debugLineNum = 398;BA.debugLine="Private Sub StartSession"; + //BA.debugLineNum = 399;BA.debugLine="CurrentWorkDayStart = GetWorkDayStart(DateTime.No"; +_currentworkdaystart = _getworkdaystart(anywheresoftware.b4a.keywords.Common.DateTime.getNow()); + //BA.debugLineNum = 400;BA.debugLine="CurrentWorkDayKey = CurrentWorkDayStart"; +_currentworkdaykey = _currentworkdaystart; + //BA.debugLineNum = 401;BA.debugLine="ProductiveElapsedMs = GetProductiveTotalForWorkDa"; +_productiveelapsedms = _getproductivetotalforworkday(_currentworkdaykey); + //BA.debugLineNum = 402;BA.debugLine="If ProductiveElapsedMs >= MaxProductiveMs Then"; +if (_productiveelapsedms>=_maxproductivems) { + //BA.debugLineNum = 403;BA.debugLine="ToastMessageShow(Localization.T(\"limit_reached\")"; +anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"limit_reached")),anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 404;BA.debugLine="UpdateElapsedLabel"; +_updateelapsedlabel(); + //BA.debugLineNum = 405;BA.debugLine="Log(\"Start ignored: 9-hour limit already reached"; +anywheresoftware.b4a.keywords.Common.LogImpl("1966087","Start ignored: 9-hour limit already reached.",0); + //BA.debugLineNum = 406;BA.debugLine="Return"; +if (true) return ""; + }; + //BA.debugLineNum = 408;BA.debugLine="SessionActive = True"; +_sessionactive = anywheresoftware.b4a.keywords.Common.True; + //BA.debugLineNum = 409;BA.debugLine="PauseActive = False"; +_pauseactive = anywheresoftware.b4a.keywords.Common.False; + //BA.debugLineNum = 410;BA.debugLine="CurrentSegmentStart = DateTime.Now"; +_currentsegmentstart = anywheresoftware.b4a.keywords.Common.DateTime.getNow(); + //BA.debugLineNum = 411;BA.debugLine="CurrentSegmentColor = GetCurrentWorkColor"; +_currentsegmentcolor = _getcurrentworkcolor(); + //BA.debugLineNum = 412;BA.debugLine="BtnStart.Text = Localization.T(\"end\")"; +mostCurrent._btnstart.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"end"))); + //BA.debugLineNum = 413;BA.debugLine="BtnPause.Text = Localization.T(\"pause\")"; +mostCurrent._btnpause.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"pause"))); + //BA.debugLineNum = 414;BA.debugLine="BtnPause.Enabled = True"; +mostCurrent._btnpause.setEnabled(anywheresoftware.b4a.keywords.Common.True); + //BA.debugLineNum = 415;BA.debugLine="UpdateMainControlState"; +_updatemaincontrolstate(); + //BA.debugLineNum = 416;BA.debugLine="myClock.ClearSegments"; +mostCurrent._myclock._clearsegments /*String*/ (); + //BA.debugLineNum = 417;BA.debugLine="LoadWorkDaySegmentsIntoClock(CurrentWorkDayKey)"; +_loadworkdaysegmentsintoclock(_currentworkdaykey); + //BA.debugLineNum = 418;BA.debugLine="myClock.SetActiveSegment(0, CurrentSegmentColor,"; +mostCurrent._myclock._setactivesegment /*String*/ ((long) (0),_currentsegmentcolor,anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 419;BA.debugLine="UpdateElapsedLabel"; +_updateelapsedlabel(); + //BA.debugLineNum = 420;BA.debugLine="SaveActiveState"; +_saveactivestate(); + //BA.debugLineNum = 421;BA.debugLine="Log(\"Workday started.\")"; +anywheresoftware.b4a.keywords.Common.LogImpl("1966103","Workday started.",0); + //BA.debugLineNum = 422;BA.debugLine="End Sub"; +return ""; +} +public static String _styleneutralbutton(anywheresoftware.b4a.objects.LabelWrapper _btn) throws Exception{ + //BA.debugLineNum = 219;BA.debugLine="Private Sub StyleNeutralButton(btn As Label)"; + //BA.debugLineNum = 220;BA.debugLine="If btn.IsInitialized = False Then Return"; +if (_btn.IsInitialized()==anywheresoftware.b4a.keywords.Common.False) { +if (true) return "";}; + //BA.debugLineNum = 221;BA.debugLine="btn.Color = Colors.RGB(230, 230, 230)"; +_btn.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (230),(int) (230),(int) (230))); + //BA.debugLineNum = 222;BA.debugLine="btn.TextColor = Colors.Black"; +_btn.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black); + //BA.debugLineNum = 223;BA.debugLine="btn.Gravity = Gravity.CENTER"; +_btn.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER); + //BA.debugLineNum = 224;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"; + //BA.debugLineNum = 394;BA.debugLine="Sub SynchronizeClock"; + //BA.debugLineNum = 395;BA.debugLine="myClock.DrawClock"; +mostCurrent._myclock._drawclock /*String*/ (); + //BA.debugLineNum = 396;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"; +long _now = 0L; + //BA.debugLineNum = 111;BA.debugLine="Sub Timer1_Tick"; + //BA.debugLineNum = 112;BA.debugLine="If AutoModeEnabled Then"; +if (_automodeenabled) { + //BA.debugLineNum = 113;BA.debugLine="UpdateAutomaticState(DateTime.Now)"; +_updateautomaticstate(anywheresoftware.b4a.keywords.Common.DateTime.getNow()); + //BA.debugLineNum = 114;BA.debugLine="Return"; +if (true) return ""; + }; + //BA.debugLineNum = 116;BA.debugLine="If SessionActive Then"; +if (_sessionactive) { + //BA.debugLineNum = 117;BA.debugLine="Dim now As Long = DateTime.Now"; +_now = anywheresoftware.b4a.keywords.Common.DateTime.getNow(); + //BA.debugLineNum = 118;BA.debugLine="If PauseActive Then"; +if (_pauseactive) { + //BA.debugLineNum = 119;BA.debugLine="ProcessActivePauseSegment(now)"; +_processactivepausesegment(_now); + //BA.debugLineNum = 120;BA.debugLine="If SessionActive = False Then Return"; +if (_sessionactive==anywheresoftware.b4a.keywords.Common.False) { +if (true) return "";}; + //BA.debugLineNum = 121;BA.debugLine="myClock.SetActiveSegment(now - CurrentSegmentSt"; +mostCurrent._myclock._setactivesegment /*String*/ ((long) (_now-_currentsegmentstart),anywheresoftware.b4a.keywords.Common.Colors.Yellow,anywheresoftware.b4a.keywords.Common.True); + }else { + //BA.debugLineNum = 123;BA.debugLine="ProcessActiveWorkSegment(now)"; +_processactiveworksegment(_now); + //BA.debugLineNum = 124;BA.debugLine="If SessionActive Then"; +if (_sessionactive) { + //BA.debugLineNum = 125;BA.debugLine="myClock.SetActiveSegment(now - CurrentSegmentS"; +mostCurrent._myclock._setactivesegment /*String*/ ((long) (_now-_currentsegmentstart),_currentsegmentcolor,anywheresoftware.b4a.keywords.Common.False); + }; + }; + //BA.debugLineNum = 128;BA.debugLine="If SessionActive And now - LastActiveStateSaveAt"; +if (_sessionactive && _now-_lastactivestatesaveat>=30*anywheresoftware.b4a.keywords.Common.DateTime.TicksPerSecond) { +_saveactivestate();}; + //BA.debugLineNum = 129;BA.debugLine="UpdateElapsedLabel"; +_updateelapsedlabel(); + }else { + //BA.debugLineNum = 131;BA.debugLine="myClock.DrawClock"; +mostCurrent._myclock._drawclock /*String*/ (); + }; + //BA.debugLineNum = 133;BA.debugLine="End Sub"; return ""; } -} \ No newline at end of file +public static String _trimstatsrows() throws Exception{ +long _retention = 0L; +long _cutoff = 0L; +anywheresoftware.b4a.objects.collections.List _kept = null; +anywheresoftware.b4a.objects.collections.Map _row = null; +long _daystart = 0L; + //BA.debugLineNum = 721;BA.debugLine="Private Sub TrimStatsRows"; + //BA.debugLineNum = 722;BA.debugLine="Dim retention As Long = MaxStoredDays"; +_retention = (long) (_maxstoreddays); + //BA.debugLineNum = 723;BA.debugLine="retention = retention * DateTime.TicksPerDay"; +_retention = (long) (_retention*anywheresoftware.b4a.keywords.Common.DateTime.TicksPerDay); + //BA.debugLineNum = 724;BA.debugLine="Dim cutoff As Long = DateTime.Now - retention"; +_cutoff = (long) (anywheresoftware.b4a.keywords.Common.DateTime.getNow()-_retention); + //BA.debugLineNum = 725;BA.debugLine="Dim kept As List"; +_kept = new anywheresoftware.b4a.objects.collections.List(); + //BA.debugLineNum = 726;BA.debugLine="kept.Initialize"; +_kept.Initialize(); + //BA.debugLineNum = 727;BA.debugLine="For Each row As Map In StatsRows"; +_row = new anywheresoftware.b4a.objects.collections.Map(); +{ +final anywheresoftware.b4a.BA.IterableList group6 = mostCurrent._statsrows; +final int groupLen6 = group6.getSize() +;int index6 = 0; +; +for (; index6 < groupLen6;index6++){ +_row = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group6.Get(index6))); + //BA.debugLineNum = 728;BA.debugLine="Dim dayStart As Long = row.Get(\"dayStart\")"; +_daystart = BA.ObjectToLongNumber(_row.Get((Object)("dayStart"))); + //BA.debugLineNum = 729;BA.debugLine="If dayStart >= cutoff Then kept.Add(row)"; +if (_daystart>=_cutoff) { +_kept.Add((Object)(_row.getObject()));}; + } +}; + //BA.debugLineNum = 731;BA.debugLine="StatsRows.Clear"; +mostCurrent._statsrows.Clear(); + //BA.debugLineNum = 732;BA.debugLine="StatsRows.AddAll(kept)"; +mostCurrent._statsrows.AddAll(_kept); + //BA.debugLineNum = 733;BA.debugLine="End Sub"; +return ""; +} +public static String _updateautomaticstate(long _now) throws Exception{ +long _daystart = 0L; +int _minuteofday = 0; + //BA.debugLineNum = 1000;BA.debugLine="Private Sub UpdateAutomaticState(now As Long)"; + //BA.debugLineNum = 1001;BA.debugLine="Dim dayStart As Long = DateTime.DateParse(DateTim"; +_daystart = anywheresoftware.b4a.keywords.Common.DateTime.DateParse(anywheresoftware.b4a.keywords.Common.DateTime.Date(_now)); + //BA.debugLineNum = 1002;BA.debugLine="Dim minuteOfDay As Int = DateTime.GetHour(now) *"; +_minuteofday = (int) (anywheresoftware.b4a.keywords.Common.DateTime.GetHour(_now)*60+anywheresoftware.b4a.keywords.Common.DateTime.GetMinute(_now)); + //BA.debugLineNum = 1003;BA.debugLine="CurrentWorkDayStart = dayStart"; +_currentworkdaystart = _daystart; + //BA.debugLineNum = 1004;BA.debugLine="CurrentWorkDayKey = dayStart"; +_currentworkdaykey = _daystart; + //BA.debugLineNum = 1005;BA.debugLine="RegenerateAutoSegmentsForDay(dayStart, minuteOfDa"; +_regenerateautosegmentsforday(_daystart,_minuteofday); + //BA.debugLineNum = 1006;BA.debugLine="ProductiveElapsedMs = GetProductiveTotalForWorkDa"; +_productiveelapsedms = _getproductivetotalforworkday(_currentworkdaykey); + //BA.debugLineNum = 1007;BA.debugLine="SessionActive = minuteOfDay >= AutoStartMinutes A"; +_sessionactive = _minuteofday>=_autostartminutes && _minuteofday<_autoendminutes && _productiveelapsedms<_worklimitms; + //BA.debugLineNum = 1008;BA.debugLine="PauseActive = minuteOfDay >= AutoPauseStartMinute"; +_pauseactive = _minuteofday>=_autopausestartminutes && _minuteofday<_autopauseendminutes; + //BA.debugLineNum = 1009;BA.debugLine="If SessionActive And PauseActive = False Then"; +if (_sessionactive && _pauseactive==anywheresoftware.b4a.keywords.Common.False) { + //BA.debugLineNum = 1010;BA.debugLine="AutoState = \"recording\""; +mostCurrent._autostate = "recording"; + }else if(_sessionactive && _pauseactive) { + //BA.debugLineNum = 1012;BA.debugLine="AutoState = \"paused\""; +mostCurrent._autostate = "paused"; + }else { + //BA.debugLineNum = 1014;BA.debugLine="AutoState = \"stopped\""; +mostCurrent._autostate = "stopped"; + }; + //BA.debugLineNum = 1016;BA.debugLine="BtnStart.Text = IIf(SessionActive, Localization.T"; +mostCurrent._btnstart.setText(BA.ObjectToCharSequence(((_sessionactive) ? ((Object)(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"end"))) : ((Object)(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"start")))))); + //BA.debugLineNum = 1017;BA.debugLine="BtnPause.Text = IIf(PauseActive, Localization.T(\""; +mostCurrent._btnpause.setText(BA.ObjectToCharSequence(((_pauseactive) ? ((Object)(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"end_pause"))) : ((Object)(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"pause")))))); + //BA.debugLineNum = 1018;BA.debugLine="CurrentSegmentStart = now"; +_currentsegmentstart = _now; + //BA.debugLineNum = 1019;BA.debugLine="CurrentSegmentColor = GetCurrentWorkColor"; +_currentsegmentcolor = _getcurrentworkcolor(); + //BA.debugLineNum = 1020;BA.debugLine="myClock.ClearSegments"; +mostCurrent._myclock._clearsegments /*String*/ (); + //BA.debugLineNum = 1021;BA.debugLine="LoadWorkDaySegmentsIntoClock(CurrentWorkDayKey)"; +_loadworkdaysegmentsintoclock(_currentworkdaykey); + //BA.debugLineNum = 1022;BA.debugLine="myClock.ClearActiveSegment"; +mostCurrent._myclock._clearactivesegment /*String*/ (); + //BA.debugLineNum = 1023;BA.debugLine="UpdateElapsedLabel"; +_updateelapsedlabel(); + //BA.debugLineNum = 1024;BA.debugLine="UpdateMainControlState"; +_updatemaincontrolstate(); + //BA.debugLineNum = 1025;BA.debugLine="End Sub"; +return ""; +} +public static String _updateelapsedlabel() throws Exception{ +String _labelprefix = ""; +long _daystart = 0L; + //BA.debugLineNum = 546;BA.debugLine="Private Sub UpdateElapsedLabel"; + //BA.debugLineNum = 547;BA.debugLine="If lblElapsedTime.IsInitialized Then"; +if (mostCurrent._lblelapsedtime.IsInitialized()) { + //BA.debugLineNum = 548;BA.debugLine="Dim labelPrefix As String = Localization.T(\"work"; +_labelprefix = mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"work"); + //BA.debugLineNum = 549;BA.debugLine="Dim dayStart As Long = GetDisplayedWorkDayStart"; +_daystart = _getdisplayedworkdaystart(); + //BA.debugLineNum = 550;BA.debugLine="If dayStart > 0 Then labelPrefix = FormatDayShor"; +if (_daystart>0) { +_labelprefix = _formatdayshort(_daystart)+" "+mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"work");}; + //BA.debugLineNum = 551;BA.debugLine="lblElapsedTime.Text = labelPrefix & \": \" & Forma"; +mostCurrent._lblelapsedtime.setText(BA.ObjectToCharSequence(_labelprefix+": "+_formatelapsedtime(_getdisplayedproductiveelapsed(anywheresoftware.b4a.keywords.Common.DateTime.getNow())))); + }; + //BA.debugLineNum = 553;BA.debugLine="End Sub"; +return ""; +} +public static String _updatemaincontrolstate() throws Exception{ + //BA.debugLineNum = 555;BA.debugLine="Private Sub UpdateMainControlState"; + //BA.debugLineNum = 556;BA.debugLine="If BtnStart.IsInitialized = False Then Return"; +if (mostCurrent._btnstart.IsInitialized()==anywheresoftware.b4a.keywords.Common.False) { +if (true) return "";}; + //BA.debugLineNum = 557;BA.debugLine="BtnStart.Enabled = AutoModeEnabled = False"; +mostCurrent._btnstart.setEnabled(_automodeenabled==anywheresoftware.b4a.keywords.Common.False); + //BA.debugLineNum = 558;BA.debugLine="If SessionActive Or (AutoModeEnabled And AutoStat"; +if (_sessionactive || (_automodeenabled && (mostCurrent._autostate).equals("recording"))) { + //BA.debugLineNum = 559;BA.debugLine="BtnStart.Color = Colors.RGB(0, 150, 70)"; +mostCurrent._btnstart.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (0),(int) (150),(int) (70))); + //BA.debugLineNum = 560;BA.debugLine="BtnStart.TextColor = Colors.White"; +mostCurrent._btnstart.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White); + }else { + //BA.debugLineNum = 562;BA.debugLine="BtnStart.Color = Colors.RGB(190, 40, 40)"; +mostCurrent._btnstart.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (190),(int) (40),(int) (40))); + //BA.debugLineNum = 563;BA.debugLine="BtnStart.TextColor = Colors.White"; +mostCurrent._btnstart.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White); + }; + //BA.debugLineNum = 565;BA.debugLine="If AutoModeEnabled Then"; +if (_automodeenabled) { + //BA.debugLineNum = 566;BA.debugLine="BtnPause.Enabled = False"; +mostCurrent._btnpause.setEnabled(anywheresoftware.b4a.keywords.Common.False); + }else if(_sessionactive) { + //BA.debugLineNum = 568;BA.debugLine="BtnPause.Enabled = True"; +mostCurrent._btnpause.setEnabled(anywheresoftware.b4a.keywords.Common.True); + }; + //BA.debugLineNum = 570;BA.debugLine="If lblAutoStatus.IsInitialized Then"; +if (mostCurrent._lblautostatus.IsInitialized()) { + //BA.debugLineNum = 571;BA.debugLine="If AutoModeEnabled Then"; +if (_automodeenabled) { + //BA.debugLineNum = 572;BA.debugLine="Select AutoState"; +switch (BA.switchObjectToInt(mostCurrent._autostate,"recording","paused")) { +case 0: { + //BA.debugLineNum = 574;BA.debugLine="lblAutoStatus.Text = Localization.T(\"auto_rec"; +mostCurrent._lblautostatus.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"auto_recording"))); + break; } +case 1: { + //BA.debugLineNum = 576;BA.debugLine="lblAutoStatus.Text = Localization.T(\"auto_pau"; +mostCurrent._lblautostatus.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"auto_paused"))); + break; } +default: { + //BA.debugLineNum = 578;BA.debugLine="lblAutoStatus.Text = Localization.T(\"auto_sto"; +mostCurrent._lblautostatus.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"auto_stopped"))); + break; } +} +; + }else { + //BA.debugLineNum = 581;BA.debugLine="lblAutoStatus.Text = Localization.T(\"manual_mod"; +mostCurrent._lblautostatus.setText(BA.ObjectToCharSequence(mostCurrent._localization._t /*String*/ (mostCurrent.activityBA,"manual_mode"))); + }; + }; + //BA.debugLineNum = 584;BA.debugLine="End Sub"; +return ""; +} +} diff --git a/Objects/src/b4a/example/starter.java b/Objects/src/b4a/example/starter.java index d724ce3..7b7d1fa 100644 --- a/Objects/src/b4a/example/starter.java +++ b/Objects/src/b4a/example/starter.java @@ -14,7 +14,7 @@ public class starter extends android.app.Service{ 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); + ServiceHelper.StarterHelper.startServiceFromReceiver (context, in, true, BA.class); } } @@ -29,7 +29,7 @@ public class starter extends android.app.Service{ super.onCreate(); mostCurrent = this; if (processBA == null) { - processBA = new anywheresoftware.b4a.ShellBA(this, null, null, "b4a.example", "b4a.example.starter"); + processBA = new BA(this, null, null, "b4a.example", "b4a.example.starter"); if (BA.isShellModeRuntimeCheck(processBA)) { processBA.raiseEvent2(null, true, "SHELL", false); } @@ -135,63 +135,41 @@ public class starter extends android.app.Service{ @Override public android.os.IBinder onBind(android.content.Intent intent) { return null; - } -public anywheresoftware.b4a.keywords.Common __c = null; + }public anywheresoftware.b4a.keywords.Common __c = null; public b4a.example.main _main = null; +public b4a.example.localization _localization = 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"; + //BA.debugLineNum = 27;BA.debugLine="Sub Application_Error (Error As Exception, StackTr"; + //BA.debugLineNum = 28;BA.debugLine="Return True"; if (true) return anywheresoftware.b4a.keywords.Common.True; -RDebugUtils.currentLine=1179650; - //BA.debugLineNum = 1179650;BA.debugLine="End Sub"; + //BA.debugLineNum = 29;BA.debugLine="End Sub"; return false; } +public static String _process_globals() throws Exception{ + //BA.debugLineNum = 6;BA.debugLine="Sub Process_Globals"; + //BA.debugLineNum = 10;BA.debugLine="End Sub"; +return ""; +} 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"; + //BA.debugLineNum = 12;BA.debugLine="Sub Service_Create"; + //BA.debugLineNum = 16;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"; + //BA.debugLineNum = 31;BA.debugLine="Sub Service_Destroy"; + //BA.debugLineNum = 33;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"; + //BA.debugLineNum = 18;BA.debugLine="Sub Service_Start (StartingIntent As Intent)"; + //BA.debugLineNum = 19;BA.debugLine="Service.StopAutomaticForeground 'Starter service"; mostCurrent._service.StopAutomaticForeground(); -RDebugUtils.currentLine=1048578; - //BA.debugLineNum = 1048578;BA.debugLine="End Sub"; + //BA.debugLineNum = 20;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"; + //BA.debugLineNum = 22;BA.debugLine="Sub Service_TaskRemoved"; + //BA.debugLineNum = 24;BA.debugLine="End Sub"; return ""; } -} \ No newline at end of file +} diff --git a/README.md b/README.md index c136f56..27d9e36 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,25 @@ -# b4a_orologio_marcatempo -orologio analogico con fasce che indicano il trascorrere di intervalli di tempo riempiendosi nel tempo (segmenti d'arco) predefiniti, per ora due : mattino e pomeriggio +# Overtime Guard + +Minimal B4A Android app for tracking work time, breaks, and overtime without project-based time sheets. + +## Current features + +- Large analog clock with filled pie slices for work, break, and overtime +- Manual `Start/End` and `Pause/End Pause` workflow +- Automatic timezone-aware clock display based on the device locale/time settings +- Daily stats grouped by date +- Config page for preset workday intervals +- Automatic/manual state indicator +- Daily persistence with restore after app restart +- Localization with automatic device-language selection + - English + - Italian + - French + - German + - Spanish + +## Project + +- Platform: B4A / Android +- Main project file: `b4a_orologio_marcatempo.b4a` +- Custom modules: `AnalogClock.bas`, `Starter.bas`, `Localization.bas` diff --git a/b4a_orologio_marcatempo.b4a b/b4a_orologio_marcatempo.b4a index aa6f889..96c386e 100644 --- a/b4a_orologio_marcatempo.b4a +++ b/b4a_orologio_marcatempo.b4a @@ -1,19 +1,21 @@ -Build1=Default,b4a.example +Build1=Default,b4a.example File1=Main_Layout.bal FileGroup1=Default Group Group=Default Group Library1=core Library2=xui +Library3=javaobject 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~~\n~)~\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 +Module3=Localization NumberOfFiles=1 -NumberOfLibraries=2 -NumberOfModules=2 +NumberOfLibraries=3 +NumberOfModules=3 Version=13 @EndOfDesignText@ #Region Project Attributes - #ApplicationLabel: Orologio Marcatempo + #ApplicationLabel: Overtime Guard #VersionCode: 1 #VersionName: 1.0 #CanInstallToExternalStorage: False @@ -21,142 +23,294 @@ Version=13 #Region Activity Attributes #FullScreen: False - #IncludeTitle: True + #IncludeTitle: False #End Region Sub Process_Globals - Private Timer1 As Timer - Private Running As Boolean = False - Private StartTime As Long = 0 - Private ElapsedTime As Long = 0 - + Private Timer1 As Timer + Private FirstWorkLimitMs As Long + Private WorkLimitMs As Long + Private OvertimeLimitMs As Long + Private MaxProductiveMs As Long + Private StatsFileName As String + Private StateFileName As String + Private AutoConfigFileName As String + Private MaxStoredDays As Int 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 BtnStart As Button + Private BtnPause As Button + Private BtnReset As Button + Private BtnSync As Button + Private BtnStats As Label + Private BtnStatsClose As Button + Private BtnConfig As Label + Private BtnConfigClose As Button + Private BtnConfigSave As Button + Private BtnConfigReset As Button + Private BtnClearToday As Button + Private BtnBackground As Label Private lblElapsedTime As Label + Private lblAutoStatus As Label Private pnlClock As Panel - Private Timer1 As Timer + Private pnlStats As Panel + Private pnlConfig As Panel + Private svStats As ScrollView + Private txtCfgStart As EditText + Private txtCfgPauseStart As EditText + Private txtCfgPauseEnd As EditText + Private txtCfgEnd As EditText 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 + Private SessionActive As Boolean + Private PauseActive As Boolean + Private ProductiveElapsedMs As Long + Private CurrentSegmentStart As Long + Private CurrentSegmentColor As Int + Private StatsRows As List + Private WorkMorningColor As Int + Private CurrentWorkDayStart As Long + Private CurrentWorkDayKey As Long + Private AutoModeEnabled As Boolean + Private AutoStartMinutes As Int + Private AutoPauseStartMinutes As Int + Private AutoPauseEndMinutes As Int + Private AutoEndMinutes As Int + Private AutoState As String + Private LastActiveStateSaveAt As Long +End Sub Sub Activity_Create(FirstTime As Boolean) + Localization.Initialize Activity.LoadLayout("Main_Layout") - Log("Layout caricato correttamente.") + Activity.Title = Localization.T("app_title") + Log("Layout loaded successfully.") + ResizeClockPanel - 'Inizializza l'orologio - myClock.Initialize(pnlClock, 50) ' L'orologio avrà un diametro pari al 50% della larghezza del pannello + FirstWorkLimitMs = 4 * DateTime.TicksPerHour + WorkLimitMs = 8 * DateTime.TicksPerHour + OvertimeLimitMs = DateTime.TicksPerHour + MaxProductiveMs = WorkLimitMs + OvertimeLimitMs + WorkMorningColor = Colors.RGB(0, 190, 255) + StatsFileName = "work_segments.txt" + StateFileName = "active_state.txt" + AutoConfigFileName = "auto_config.txt" + MaxStoredDays = 62 - ' Imposta il timer per aggiornare l'orologio - Timer1.Initialize("Timer1", 1000) ' Aggiornamento ogni secondo + myClock.Initialize(pnlClock, 96) + myClock.SetBaseDuration(12 * DateTime.TicksPerHour) + + Timer1.Initialize("Timer1", 1000) 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 + + StatsRows.Initialize + LoadStatsRows + HideLegacyButtons + CreateStatsButton + CreateStatsPage + CreateConfigButton + CreateConfigPage + CreateBackgroundButton + CreateAutoStatusLabel + LayoutMainButtons + LoadAutoConfig + ResetSessionState(False) + If AutoModeEnabled Then + UpdateAutomaticState(DateTime.Now) + Else + RestoreActiveState + If SessionActive = False Then RestoreLastClosedDayState + End If End Sub - - - Sub Timer1_Tick - myClock.DrawClock + If AutoModeEnabled Then + UpdateAutomaticState(DateTime.Now) + Return + End If + If SessionActive Then + Dim now As Long = DateTime.Now + If PauseActive Then + ProcessActivePauseSegment(now) + If SessionActive = False Then Return + myClock.SetActiveSegment(now - CurrentSegmentStart, Colors.Yellow, True) + Else + ProcessActiveWorkSegment(now) + If SessionActive Then + myClock.SetActiveSegment(now - CurrentSegmentStart, CurrentSegmentColor, False) + End If + End If + If SessionActive And now - LastActiveStateSaveAt >= 30 * DateTime.TicksPerSecond Then SaveActiveState + UpdateElapsedLabel + Else + myClock.DrawClock + End If End Sub Sub Activity_Resume + If AutoModeEnabled Then + UpdateAutomaticState(DateTime.Now) + Else + RestoreActiveState + If SessionActive = False Then RestoreLastClosedDayState + End If +End Sub +Private Sub ResizeClockPanel + Dim clockSize As Int = Activity.Width + pnlClock.SetLayout(0, 0, clockSize, clockSize) +End Sub + +Private Sub CreateStatsButton + BtnStats.Initialize("BtnStats") + BtnStats.Text = Localization.T("stats") + Activity.AddView(BtnStats, BtnReset.Left, BtnReset.Top, BtnReset.Width, BtnReset.Height) +End Sub + +Private Sub CreateStatsPage + pnlStats.Initialize("") + pnlStats.Color = Colors.White + pnlStats.Visible = False + Activity.AddView(pnlStats, 0, 0, Activity.Width, Activity.Height) + + Dim title As Label + title.Initialize("") + title.Text = Localization.T("statistics") + title.TextSize = 22 + title.TextColor = Colors.Black + title.Gravity = Gravity.CENTER_VERTICAL + pnlStats.AddView(title, 12dip, 8dip, Activity.Width - 110dip, 46dip) + + BtnStatsClose.Initialize("BtnStatsClose") + BtnStatsClose.Text = Localization.T("close") + pnlStats.AddView(BtnStatsClose, Activity.Width - 94dip, 8dip, 84dip, 46dip) + + svStats.Initialize(0) + pnlStats.AddView(svStats, 0, 62dip, Activity.Width, Activity.Height - 62dip) +End Sub + +Private Sub CreateConfigButton + BtnConfig.Initialize("BtnConfig") + BtnConfig.Text = Localization.T("config") + Activity.AddView(BtnConfig, BtnReset.Left, BtnReset.Top, BtnReset.Width, BtnReset.Height) +End Sub + +Private Sub CreateBackgroundButton + BtnBackground.Initialize("BtnBackground") + BtnBackground.Text = Localization.T("bg") + Activity.AddView(BtnBackground, BtnPause.Left, BtnPause.Top, BtnPause.Width, BtnPause.Height) +End Sub + +Private Sub LayoutMainButtons + Dim margin As Int = 8dip + Dim gap As Int = 8dip + Dim rowGap As Int = 8dip + Dim buttonHeight As Int = 48dip + Dim labelTop As Int = Activity.Height - 28dip + Dim row2Top As Int = labelTop - gap - buttonHeight + Dim row1Top As Int = row2Top - rowGap - buttonHeight + Dim wideButtonWidth As Int = (Activity.Width - (2 * margin) - gap) / 2 + Dim smallButtonWidth As Int = (Activity.Width - (2 * margin) - (2 * gap)) / 3 + + BtnStart.TextSize = 16 + BtnPause.TextSize = 16 + BtnBackground.TextSize = 15 + BtnStats.TextSize = 15 + BtnConfig.TextSize = 15 + StyleNeutralButton(BtnPause) + StyleNeutralButton(BtnBackground) + StyleNeutralButton(BtnStats) + StyleNeutralButton(BtnConfig) + + BtnStart.SetLayout(margin, row1Top, wideButtonWidth, buttonHeight) + BtnPause.SetLayout(margin + wideButtonWidth + gap, row1Top, wideButtonWidth, buttonHeight) + BtnBackground.SetLayout(margin, row2Top, smallButtonWidth, buttonHeight) + BtnStats.SetLayout(margin + smallButtonWidth + gap, row2Top, smallButtonWidth, buttonHeight) + BtnConfig.SetLayout(margin + (2 * (smallButtonWidth + gap)), row2Top, smallButtonWidth, buttonHeight) + If lblElapsedTime.IsInitialized Then lblElapsedTime.SetLayout(0, labelTop, Activity.Width * 0.58, 28dip) + If lblAutoStatus.IsInitialized Then lblAutoStatus.SetLayout(Activity.Width * 0.58, labelTop, Activity.Width * 0.42, 28dip) +End Sub + +Private Sub StyleNeutralButton(btn As Label) + If btn.IsInitialized = False Then Return + btn.Color = Colors.RGB(230, 230, 230) + btn.TextColor = Colors.Black + btn.Gravity = Gravity.CENTER +End Sub + +Private Sub CreateAutoStatusLabel + lblAutoStatus.Initialize("") + lblAutoStatus.TextColor = Colors.DarkGray + lblAutoStatus.TextSize = 13 + lblAutoStatus.Gravity = Bit.Or(Gravity.RIGHT, Gravity.CENTER_VERTICAL) + lblAutoStatus.Text = Localization.T("manual_mode") + Activity.AddView(lblAutoStatus, 0, 0, 10dip, 10dip) +End Sub + +Private Sub CreateConfigPage + pnlConfig.Initialize("") + pnlConfig.Color = Colors.White + pnlConfig.Visible = False + Activity.AddView(pnlConfig, 0, 0, Activity.Width, Activity.Height) + + Dim title As Label + title.Initialize("") + title.Text = Localization.T("config") + title.TextSize = 22 + title.TextColor = Colors.Black + title.Gravity = Gravity.CENTER_VERTICAL + pnlConfig.AddView(title, 12dip, 8dip, Activity.Width - 110dip, 46dip) + + BtnConfigClose.Initialize("BtnConfigClose") + BtnConfigClose.Text = Localization.T("close") + pnlConfig.AddView(BtnConfigClose, Activity.Width - 94dip, 8dip, 84dip, 46dip) + + Dim y As Int = 78dip + txtCfgStart = AddConfigField(Localization.T("work_start"), "08:30", y) + y = y + 58dip + txtCfgPauseStart = AddConfigField(Localization.T("pause_start"), "12:30", y) + y = y + 58dip + txtCfgPauseEnd = AddConfigField(Localization.T("pause_end"), "13:00", y) + y = y + 58dip + txtCfgEnd = AddConfigField(Localization.T("work_end"), "17:00", y) + + BtnConfigSave.Initialize("BtnConfigSave") + BtnConfigSave.Text = Localization.T("set_config") + pnlConfig.AddView(BtnConfigSave, 12dip, y + 70dip, (Activity.Width - 32dip) / 2, 48dip) + + BtnConfigReset.Initialize("BtnConfigReset") + BtnConfigReset.Text = Localization.T("reset_config") + pnlConfig.AddView(BtnConfigReset, 20dip + ((Activity.Width - 32dip) / 2), y + 70dip, (Activity.Width - 32dip) / 2, 48dip) + + BtnClearToday.Initialize("BtnClearToday") + BtnClearToday.Text = Localization.T("clear_today") + pnlConfig.AddView(BtnClearToday, 12dip, y + 126dip, Activity.Width - 24dip, 48dip) +End Sub + +Private Sub AddConfigField(LabelText As String, ValueText As String, y As Int) As EditText + Dim lbl As Label + lbl.Initialize("") + lbl.Text = LabelText + lbl.TextSize = 16 + lbl.TextColor = Colors.Black + lbl.Gravity = Gravity.CENTER_VERTICAL + pnlConfig.AddView(lbl, 12dip, y, 140dip, 46dip) + + Dim txt As EditText + txt.Initialize("") + txt.Text = ValueText + txt.TextSize = 18 + txt.SingleLine = True + txt.InputType = txt.INPUT_TYPE_NUMBERS + pnlConfig.AddView(txt, 160dip, y, Activity.Width - 172dip, 46dip) + Return txt End Sub Sub Activity_Pause (UserClosed As Boolean) - + If AutoModeEnabled = False Then SaveActiveState 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 @@ -169,34 +323,819 @@ 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 + If AutoModeEnabled Then Return + If SessionActive = False Then + StartSession + Else + EndSession(DateTime.Now, False) + End If End Sub ' Pulsante Pause Sub BtnPause_Click - Running = False + If AutoModeEnabled Then Return + If SessionActive = False Then Return + Dim now As Long = DateTime.Now + If PauseActive Then + CloseCurrentSegment(now) + PauseActive = False + BtnPause.Text = Localization.T("pause") + CurrentSegmentStart = now + CurrentSegmentColor = GetCurrentWorkColor + myClock.SetActiveSegment(0, CurrentSegmentColor, False) + SaveActiveState + Log("Pause ended.") + Else + ProcessActiveWorkSegment(now) + If SessionActive = False Then Return + CloseCurrentSegment(now) + PauseActive = True + BtnPause.Text = Localization.T("end_pause") + CurrentSegmentStart = now + CurrentSegmentColor = Colors.Yellow + myClock.SetActiveSegment(0, CurrentSegmentColor, True) + SaveActiveState + Log("Pause started.") + End If End Sub ' Pulsante Reset Sub BtnReset_Click - Running = False - ElapsedTime = 0 - lblElapsedTime.Text = "Tempo: 00:00:00" + ShowStatsPage End Sub ' Pulsante Sync Sub BtnSync_Click - SynchronizeClock + ShowConfigPage +End Sub + +Sub BtnStats_Click + ShowStatsPage +End Sub + +Sub BtnStatsClose_Click + ShowMainPage +End Sub + +Sub BtnConfig_Click + ShowConfigPage +End Sub + +Sub BtnConfigClose_Click + ShowMainPage +End Sub + +Sub BtnConfigSave_Click + SetAutomaticConfig +End Sub + +Sub BtnConfigReset_Click + ResetAutomaticConfig +End Sub + +Sub BtnClearToday_Click + ClearDisplayedDay +End Sub + +Sub BtnBackground_Click + SaveActiveState + Dim home As Intent + home.Initialize("android.intent.action.MAIN", "") + home.AddCategory("android.intent.category.HOME") + home.Flags = 268435456 + StartActivity(home) End Sub ' Sincronizza l'orologio Sub SynchronizeClock - DrawClock + myClock.DrawClock +End Sub + +Private Sub StartSession + CurrentWorkDayStart = GetWorkDayStart(DateTime.Now) + CurrentWorkDayKey = CurrentWorkDayStart + ProductiveElapsedMs = GetProductiveTotalForWorkDay(CurrentWorkDayKey) + If ProductiveElapsedMs >= MaxProductiveMs Then + ToastMessageShow(Localization.T("limit_reached"), False) + UpdateElapsedLabel + Log("Start ignored: 9-hour limit already reached.") + Return + End If + SessionActive = True + PauseActive = False + CurrentSegmentStart = DateTime.Now + CurrentSegmentColor = GetCurrentWorkColor + BtnStart.Text = Localization.T("end") + BtnPause.Text = Localization.T("pause") + BtnPause.Enabled = True + UpdateMainControlState + myClock.ClearSegments + LoadWorkDaySegmentsIntoClock(CurrentWorkDayKey) + myClock.SetActiveSegment(0, CurrentSegmentColor, False) + UpdateElapsedLabel + SaveActiveState + Log("Workday started.") +End Sub + +Private Sub EndSession(FinalTime As Long, Automatic As Boolean) + If SessionActive Then CloseCurrentSegment(FinalTime) + SessionActive = False + PauseActive = False + BtnStart.Text = Localization.T("start") + BtnPause.Text = Localization.T("pause") + BtnPause.Enabled = False + UpdateMainControlState + myClock.ClearActiveSegment + UpdateElapsedLabel + If File.Exists(File.DirInternal, StateFileName) Then File.Delete(File.DirInternal, StateFileName) + If Automatic Then + Log("Workday stopped automatically.") + Else + Log("Workday closed manually.") + End If +End Sub + +Private Sub ResetSessionState(ClearClock As Boolean) + SessionActive = False + PauseActive = False + ProductiveElapsedMs = 0 + CurrentSegmentStart = 0 + CurrentWorkDayStart = 0 + CurrentWorkDayKey = 0 + CurrentSegmentColor = WorkMorningColor + LastActiveStateSaveAt = 0 + BtnStart.Text = Localization.T("start") + BtnPause.Text = Localization.T("pause") + BtnPause.Enabled = False + UpdateMainControlState + If ClearClock Then myClock.ClearSegments + myClock.ClearActiveSegment + UpdateElapsedLabel +End Sub + +Private Sub ProcessActiveWorkSegment(now As Long) + Do While SessionActive And PauseActive = False + Dim midnight As Long = GetNextMidnight(CurrentSegmentStart) + If now >= midnight Then + EndSession(midnight, True) + Log("Workday stopped automatically: midnight reached.") + Return + End If + Dim segmentDuration As Long = now - CurrentSegmentStart + If segmentDuration <= 0 Then Return + Dim nextBoundary As Long = GetNextWorkBoundary + Dim durationToBoundary As Long = nextBoundary - ProductiveElapsedMs + If segmentDuration < durationToBoundary Then + CurrentSegmentColor = GetCurrentWorkColor + Return + End If + + RecordSegment(CurrentSegmentStart, durationToBoundary, GetCurrentWorkColor, False) + ProductiveElapsedMs = ProductiveElapsedMs + durationToBoundary + CurrentSegmentStart = CurrentSegmentStart + durationToBoundary + CurrentSegmentColor = GetCurrentWorkColor + + If ProductiveElapsedMs >= MaxProductiveMs Then + EndSession(CurrentSegmentStart, True) + Return + End If + Loop +End Sub + +Private Sub CloseCurrentSegment(FinalTime As Long) + Dim duration As Long = FinalTime - CurrentSegmentStart + If duration <= 0 Then Return + If PauseActive Then + RecordSegment(CurrentSegmentStart, duration, Colors.Yellow, True) + Else + RecordSegment(CurrentSegmentStart, duration, GetCurrentWorkColor, False) + ProductiveElapsedMs = ProductiveElapsedMs + duration + End If +End Sub + +Private Sub RecordSegment(SegmentStart As Long, Duration As Long, SegmentColor As Int, IsPauseSegment As Boolean) + myClock.AddSegment(Duration, SegmentColor, IsPauseSegment) + AddStatsSegment(CurrentWorkDayStart, CurrentWorkDayKey, SegmentStart, Duration, GetSegmentCategory(SegmentColor, IsPauseSegment), "manual") +End Sub + +Private Sub AddStatsSegment(DayStart As Long, DayKey As Long, SegmentStart As Long, Duration As Long, Category As String, Source As String) + Dim row As Map + row.Initialize + row.Put("dayStart", DayStart) + row.Put("dayKey", DayKey) + row.Put("segmentStart", SegmentStart) + row.Put("date", DateTime.Date(DayStart)) + row.Put("duration", Duration) + row.Put("category", Category) + row.Put("source", Source) + StatsRows.Add(row) + TrimStatsRows + SaveStatsRows +End Sub + +Private Sub ProcessActivePauseSegment(now As Long) + Dim midnight As Long = GetNextMidnight(CurrentSegmentStart) + If now >= midnight Then + EndSession(midnight, True) + Log("Workday stopped automatically during pause: midnight reached.") + End If +End Sub + +Private Sub GetSegmentCategory(SegmentColor As Int, IsPauseSegment As Boolean) As String + If IsPauseSegment Then Return "pausa" + If SegmentColor = Colors.Red Then Return "straordinario" + Return "lavoro" +End Sub + +Private Sub GetCurrentWorkColor As Int + If ProductiveElapsedMs < FirstWorkLimitMs Then Return WorkMorningColor + If ProductiveElapsedMs < WorkLimitMs Then Return Colors.Green + Return Colors.Red +End Sub + +Private Sub GetNextWorkBoundary As Long + If ProductiveElapsedMs < FirstWorkLimitMs Then Return FirstWorkLimitMs + If ProductiveElapsedMs < WorkLimitMs Then Return WorkLimitMs + Return MaxProductiveMs +End Sub + +Private Sub UpdateElapsedLabel + If lblElapsedTime.IsInitialized Then + Dim labelPrefix As String = Localization.T("work") + Dim dayStart As Long = GetDisplayedWorkDayStart + If dayStart > 0 Then labelPrefix = FormatDayShort(dayStart) & " " & Localization.T("work") + lblElapsedTime.Text = labelPrefix & ": " & FormatElapsedTime(GetDisplayedProductiveElapsed(DateTime.Now)) + End If +End Sub + +Private Sub UpdateMainControlState + If BtnStart.IsInitialized = False Then Return + BtnStart.Enabled = AutoModeEnabled = False + If SessionActive Or (AutoModeEnabled And AutoState = "recording") Then + BtnStart.Color = Colors.RGB(0, 150, 70) + BtnStart.TextColor = Colors.White + Else + BtnStart.Color = Colors.RGB(190, 40, 40) + BtnStart.TextColor = Colors.White + End If + If AutoModeEnabled Then + BtnPause.Enabled = False + Else If SessionActive Then + BtnPause.Enabled = True + End If + If lblAutoStatus.IsInitialized Then + If AutoModeEnabled Then + Select AutoState + Case "recording" + lblAutoStatus.Text = Localization.T("auto_recording") + Case "paused" + lblAutoStatus.Text = Localization.T("auto_paused") + Case Else + lblAutoStatus.Text = Localization.T("auto_stopped") + End Select + Else + lblAutoStatus.Text = Localization.T("manual_mode") + End If + End If +End Sub + +Private Sub GetDisplayedWorkDayStart As Long + If CurrentWorkDayStart > 0 Then Return CurrentWorkDayStart + Return GetLatestWorkDayStart +End Sub + +Private Sub FormatDayShort(ticks As Long) As String + Return NumberFormat(DateTime.GetDayOfMonth(ticks), 2, 0) & "/" & NumberFormat(DateTime.GetMonth(ticks), 2, 0) +End Sub + +Private Sub GetDisplayedProductiveElapsed(now As Long) As Long + Dim total As Long = ProductiveElapsedMs + If SessionActive And PauseActive = False Then total = total + Max(0, now - CurrentSegmentStart) + Return total +End Sub + +Private Sub GetProductiveTotalForWorkDay(DayKey As Long) As Long + Dim total As Long = 0 + For Each row As Map In StatsRows + If row.Get("dayKey") = DayKey Then + Dim category As String = row.Get("category") + If category = "lavoro" Or category = "straordinario" Then total = total + row.Get("duration") + End If + Next + Return total +End Sub + +Private Sub LoadWorkDaySegmentsIntoClock(DayKey As Long) + Dim productiveCursor As Long = 0 + For Each row As Map In StatsRows + If row.Get("dayKey") = DayKey Then + Dim category As String = row.Get("category") + Dim duration As Long = row.Get("duration") + If category = "pausa" Then + myClock.AddSegment(duration, Colors.Yellow, True) + Else + AddDisplayProductiveSegment(duration, productiveCursor) + productiveCursor = productiveCursor + duration + End If + End If + Next +End Sub + +Private Sub AddDisplayProductiveSegment(Duration As Long, StartProductiveMs As Long) + Dim remaining As Long = Duration + Dim cursor As Long = StartProductiveMs + Do While remaining > 0 + Dim segmentColor As Int + Dim boundary As Long + If cursor < FirstWorkLimitMs Then + segmentColor = WorkMorningColor + boundary = FirstWorkLimitMs + Else If cursor < WorkLimitMs Then + segmentColor = Colors.Green + boundary = WorkLimitMs + Else + segmentColor = Colors.Red + boundary = MaxProductiveMs + End If + Dim chunk As Long = remaining + If cursor < boundary Then chunk = Min(chunk, boundary - cursor) + myClock.AddSegment(chunk, segmentColor, False) + remaining = remaining - chunk + cursor = cursor + chunk + Loop +End Sub + +Private Sub GetWorkDayStart(now As Long) As Long + Dim latestDayStart As Long = 0 + Dim today As String = DateTime.Date(now) + For Each row As Map In StatsRows + Dim dayStart As Long = row.Get("dayStart") + If dayStart > latestDayStart And DateTime.Date(dayStart) = today Then + latestDayStart = dayStart + End If + Next + If latestDayStart > 0 Then Return latestDayStart + Return now +End Sub + +Private Sub GetLatestWorkDayStart As Long + Dim latestDayStart As Long = 0 + For Each row As Map In StatsRows + Dim dayStart As Long = row.Get("dayStart") + If dayStart > latestDayStart Then latestDayStart = dayStart + Next + Return latestDayStart +End Sub + +Private Sub GetNextMidnight(ticks As Long) As Long + Return DateTime.DateParse(DateTime.Date(ticks)) + DateTime.TicksPerDay +End Sub + +Private Sub LoadStatsRows + StatsRows.Clear + If File.Exists(File.DirInternal, StatsFileName) = False Then Return + Dim lines As List = File.ReadList(File.DirInternal, StatsFileName) + For Each line As String In lines + If line.Trim.Length > 0 Then + Dim parts() As String = Regex.Split("\|", line) + If parts.Length >= 4 Then + Dim row As Map + row.Initialize + Dim dayStart As Long = parts(0) + Dim segmentStart As Long = parts(1) + Dim duration As Long = parts(2) + row.Put("dayStart", dayStart) + row.Put("dayKey", dayStart) + row.Put("segmentStart", segmentStart) + row.Put("date", DateTime.Date(dayStart)) + row.Put("duration", duration) + row.Put("category", parts(3)) + If parts.Length >= 5 Then + row.Put("source", parts(4)) + Else + row.Put("source", "manual") + End If + StatsRows.Add(row) + End If + End If + Next + TrimStatsRows + SaveStatsRows +End Sub + +Private Sub SaveStatsRows + Dim lines As List + lines.Initialize + For Each row As Map In StatsRows + Dim source As String = "manual" + If row.ContainsKey("source") Then source = row.Get("source") + lines.Add(row.Get("dayStart") & "|" & row.Get("segmentStart") & "|" & row.Get("duration") & "|" & row.Get("category") & "|" & source) + Next + File.WriteList(File.DirInternal, StatsFileName, lines) +End Sub + +Private Sub TrimStatsRows + Dim retention As Long = MaxStoredDays + retention = retention * DateTime.TicksPerDay + Dim cutoff As Long = DateTime.Now - retention + Dim kept As List + kept.Initialize + For Each row As Map In StatsRows + Dim dayStart As Long = row.Get("dayStart") + If dayStart >= cutoff Then kept.Add(row) + Next + StatsRows.Clear + StatsRows.AddAll(kept) +End Sub + +Private Sub SaveActiveState + If SessionActive = False Then + If File.Exists(File.DirInternal, StateFileName) Then File.Delete(File.DirInternal, StateFileName) + LastActiveStateSaveAt = 0 + Return + End If + Dim lines As List + lines.Initialize + lines.Add(CurrentWorkDayStart) + lines.Add(CurrentSegmentStart) + lines.Add(ProductiveElapsedMs) + lines.Add(PauseActive) + lines.Add(CurrentSegmentColor) + File.WriteList(File.DirInternal, StateFileName, lines) + LastActiveStateSaveAt = DateTime.Now +End Sub + +Private Sub RestoreActiveState + If SessionActive Then Return + If File.Exists(File.DirInternal, StateFileName) = False Then Return + Dim lines As List = File.ReadList(File.DirInternal, StateFileName) + If lines.Size < 5 Then Return + + CurrentWorkDayStart = lines.Get(0) + CurrentWorkDayKey = CurrentWorkDayStart + CurrentSegmentStart = lines.Get(1) + ProductiveElapsedMs = lines.Get(2) + ProductiveElapsedMs = Max(ProductiveElapsedMs, GetProductiveTotalForWorkDay(CurrentWorkDayKey)) + PauseActive = lines.Get(3) + CurrentSegmentColor = lines.Get(4) + + Dim now As Long = DateTime.Now + If now >= GetNextMidnight(CurrentSegmentStart) Then + SessionActive = True + EndSession(GetNextMidnight(CurrentSegmentStart), True) + If File.Exists(File.DirInternal, StateFileName) Then File.Delete(File.DirInternal, StateFileName) + Return + End If + If ProductiveElapsedMs >= MaxProductiveMs Then + If File.Exists(File.DirInternal, StateFileName) Then File.Delete(File.DirInternal, StateFileName) + Return + End If + + SessionActive = True + BtnStart.Text = Localization.T("end") + If PauseActive Then + BtnPause.Text = Localization.T("end_pause") + BtnPause.Enabled = True + Else + BtnPause.Text = Localization.T("pause") + BtnPause.Enabled = True + CurrentSegmentColor = GetCurrentWorkColor + End If + UpdateMainControlState + myClock.ClearSegments + LoadWorkDaySegmentsIntoClock(CurrentWorkDayKey) + myClock.SetActiveSegment(Max(0, now - CurrentSegmentStart), CurrentSegmentColor, PauseActive) + UpdateElapsedLabel +End Sub + +Private Sub RestoreLastClosedDayState + If SessionActive Then Return + Dim latestDayStart As Long = GetLatestWorkDayStart + If latestDayStart = 0 Then Return + If CurrentWorkDayStart = latestDayStart And ProductiveElapsedMs > 0 Then Return + CurrentWorkDayStart = latestDayStart + CurrentWorkDayKey = latestDayStart + ProductiveElapsedMs = GetProductiveTotalForWorkDay(CurrentWorkDayKey) + CurrentSegmentStart = 0 + PauseActive = False + CurrentSegmentColor = GetCurrentWorkColor + myClock.ClearSegments + LoadWorkDaySegmentsIntoClock(CurrentWorkDayKey) + myClock.ClearActiveSegment + UpdateElapsedLabel +End Sub + +Private Sub ShowStatsPage + BuildStatsTable + SetMainControlsVisible(False) + pnlStats.Visible = True + pnlConfig.Visible = False + pnlStats.BringToFront +End Sub + +Private Sub SetMainControlsVisible(Visible As Boolean) + For i = 0 To Activity.NumberOfViews - 1 + Dim v As View = Activity.GetView(i) + v.Visible = Visible + Next + HideLegacyButtons + pnlStats.Visible = False + pnlConfig.Visible = False +End Sub + +Private Sub HideLegacyButtons + If BtnReset.IsInitialized Then + BtnReset.Enabled = False + BtnReset.Visible = False + BtnReset.SetLayout(-200dip, -200dip, 1dip, 1dip) + End If + If BtnSync.IsInitialized Then + BtnSync.Enabled = False + BtnSync.Visible = False + BtnSync.SetLayout(-200dip, -200dip, 1dip, 1dip) + End If + For i = Activity.NumberOfViews - 1 To 0 Step -1 + Dim v As View = Activity.GetView(i) + If v Is Button Then + Dim legacy As Button = v + If legacy.Text = "Sync" Or legacy.Text = "Reset" Then + legacy.RemoveView + End If + End If + Next +End Sub + +Private Sub ShowConfigPage + SetMainControlsVisible(False) + pnlStats.Visible = False + pnlConfig.Visible = True + pnlConfig.BringToFront +End Sub + +Private Sub ShowMainPage + SetMainControlsVisible(True) + pnlStats.Visible = False + pnlConfig.Visible = False +End Sub + +Private Sub BuildStatsTable + svStats.Panel.RemoveAllViews + Dim y As Int = 0 + AddStatsRow(y, Localization.T("date"), Localization.T("work"), Localization.T("pause_col"), Localization.T("overtime"), True) + y = y + 34dip + + Dim totalWork As Long = 0 + Dim totalPause As Long = 0 + Dim totalOvertime As Long = 0 + Dim dailyRows As Map + dailyRows.Initialize + For Each row As Map In StatsRows + AddStatsDuration(dailyRows, row.Get("date"), row.Get("category"), row.Get("duration")) + Next + If SessionActive Then + Dim activeDuration As Long = Max(0, DateTime.Now - CurrentSegmentStart) + If activeDuration > 0 Then + AddStatsDuration(dailyRows, DateTime.Date(CurrentWorkDayStart), GetSegmentCategory(CurrentSegmentColor, PauseActive), activeDuration) + End If + End If + + For Each dateText As String In dailyRows.Keys + Dim dailyTotals As Map = dailyRows.Get(dateText) + totalWork = totalWork + dailyTotals.Get("lavoro") + totalPause = totalPause + dailyTotals.Get("pausa") + totalOvertime = totalOvertime + dailyTotals.Get("straordinario") + Next + + For Each dateText As String In dailyRows.Keys + Dim dailyTotals As Map = dailyRows.Get(dateText) + AddStatsRow(y, dateText, FormatElapsedTime(dailyTotals.Get("lavoro")), FormatElapsedTime(dailyTotals.Get("pausa")), FormatElapsedTime(dailyTotals.Get("straordinario")), False) + y = y + 30dip + Next + + y = y + 8dip + AddStatsRow(y, Localization.T("totals"), FormatElapsedTime(totalWork), FormatElapsedTime(totalPause), FormatElapsedTime(totalOvertime), True) + y = y + 40dip + svStats.Panel.Height = Max(y, svStats.Height + 1dip) +End Sub + +Private Sub AddStatsDuration(dailyRows As Map, DateText As String, Category As String, Duration As Long) + Dim dailyTotals As Map + If dailyRows.ContainsKey(DateText) Then + dailyTotals = dailyRows.Get(DateText) + Else + dailyTotals.Initialize + dailyTotals.Put("lavoro", 0) + dailyTotals.Put("pausa", 0) + dailyTotals.Put("straordinario", 0) + dailyRows.Put(DateText, dailyTotals) + End If + dailyTotals.Put(Category, dailyTotals.Get(Category) + Duration) +End Sub + +Private Sub SetAutomaticConfig + Dim startMinutes As Int = ParseTimeToMinutes(txtCfgStart.Text) + Dim pauseStartMinutes As Int = ParseTimeToMinutes(txtCfgPauseStart.Text) + Dim pauseEndMinutes As Int = ParseTimeToMinutes(txtCfgPauseEnd.Text) + Dim endMinutes As Int = ParseTimeToMinutes(txtCfgEnd.Text) + If startMinutes < 0 Or pauseStartMinutes < 0 Or pauseEndMinutes < 0 Or endMinutes < 0 Then + ToastMessageShow(Localization.T("use_hhmm"), False) + Return + End If + If startMinutes >= pauseStartMinutes Or pauseStartMinutes >= pauseEndMinutes Or pauseEndMinutes >= endMinutes Then + ToastMessageShow(Localization.T("times_order"), False) + Return + End If + Dim workMinutes As Int = (pauseStartMinutes - startMinutes) + (endMinutes - pauseEndMinutes) + If workMinutes > 480 Then + ToastMessageShow(Localization.T("work_exceed"), False) + Return + End If + AutoStartMinutes = startMinutes + AutoPauseStartMinutes = pauseStartMinutes + AutoPauseEndMinutes = pauseEndMinutes + AutoEndMinutes = endMinutes + AutoModeEnabled = True + SaveAutoConfig + If SessionActive Then EndSession(DateTime.Now, False) + If File.Exists(File.DirInternal, StateFileName) Then File.Delete(File.DirInternal, StateFileName) + UpdateAutomaticState(DateTime.Now) + ToastMessageShow(Localization.T("auto_enabled"), False) +End Sub + +Private Sub ResetAutomaticConfig + AutoModeEnabled = False + AutoState = "stopped" + If File.Exists(File.DirInternal, AutoConfigFileName) Then File.Delete(File.DirInternal, AutoConfigFileName) + ResetSessionState(False) + RestoreLastClosedDayState + UpdateMainControlState + ToastMessageShow(Localization.T("auto_disabled"), False) +End Sub + +Private Sub SaveAutoConfig + Dim lines As List + lines.Initialize + lines.Add(AutoStartMinutes) + lines.Add(AutoPauseStartMinutes) + lines.Add(AutoPauseEndMinutes) + lines.Add(AutoEndMinutes) + File.WriteList(File.DirInternal, AutoConfigFileName, lines) +End Sub + +Private Sub LoadAutoConfig + AutoModeEnabled = False + AutoState = "stopped" + If File.Exists(File.DirInternal, AutoConfigFileName) = False Then Return + Dim lines As List = File.ReadList(File.DirInternal, AutoConfigFileName) + If lines.Size < 4 Then Return + AutoStartMinutes = lines.Get(0) + AutoPauseStartMinutes = lines.Get(1) + AutoPauseEndMinutes = lines.Get(2) + AutoEndMinutes = lines.Get(3) + AutoModeEnabled = True + txtCfgStart.Text = MinutesToTime(AutoStartMinutes) + txtCfgPauseStart.Text = MinutesToTime(AutoPauseStartMinutes) + txtCfgPauseEnd.Text = MinutesToTime(AutoPauseEndMinutes) + txtCfgEnd.Text = MinutesToTime(AutoEndMinutes) +End Sub + +Private Sub ParseTimeToMinutes(Value As String) As Int + Dim parts() As String = Regex.Split(":", Value.Trim) + If parts.Length <> 2 Then Return -1 + If IsNumber(parts(0)) = False Or IsNumber(parts(1)) = False Then Return -1 + Dim h As Int = parts(0) + Dim m As Int = parts(1) + If h < 0 Or h > 23 Or m < 0 Or m > 59 Then Return -1 + Return h * 60 + m +End Sub + +Private Sub MinutesToTime(Minutes As Int) As String + Return NumberFormat(Minutes / 60, 2, 0) & ":" & NumberFormat(Minutes Mod 60, 2, 0) +End Sub + +Private Sub UpdateAutomaticState(now As Long) + Dim dayStart As Long = DateTime.DateParse(DateTime.Date(now)) + Dim minuteOfDay As Int = DateTime.GetHour(now) * 60 + DateTime.GetMinute(now) + CurrentWorkDayStart = dayStart + CurrentWorkDayKey = dayStart + RegenerateAutoSegmentsForDay(dayStart, minuteOfDay) + ProductiveElapsedMs = GetProductiveTotalForWorkDay(CurrentWorkDayKey) + SessionActive = minuteOfDay >= AutoStartMinutes And minuteOfDay < AutoEndMinutes And ProductiveElapsedMs < WorkLimitMs + PauseActive = minuteOfDay >= AutoPauseStartMinutes And minuteOfDay < AutoPauseEndMinutes + If SessionActive And PauseActive = False Then + AutoState = "recording" + Else If SessionActive And PauseActive Then + AutoState = "paused" + Else + AutoState = "stopped" + End If + BtnStart.Text = IIf(SessionActive, Localization.T("end"), Localization.T("start")) + BtnPause.Text = IIf(PauseActive, Localization.T("end_pause"), Localization.T("pause")) + CurrentSegmentStart = now + CurrentSegmentColor = GetCurrentWorkColor + myClock.ClearSegments + LoadWorkDaySegmentsIntoClock(CurrentWorkDayKey) + myClock.ClearActiveSegment + UpdateElapsedLabel + UpdateMainControlState +End Sub + +Private Sub RegenerateAutoSegmentsForDay(DayStart As Long, MinuteOfDay As Int) + RemoveAutoRowsForDay(DayStart) + Dim firstWorkEnd As Int = Min(MinuteOfDay, AutoPauseStartMinutes) + If firstWorkEnd > AutoStartMinutes Then + AddAutoSegmentNoSave(DayStart, AutoStartMinutes, firstWorkEnd, "lavoro") + End If + Dim pauseEnd As Int = Min(MinuteOfDay, AutoPauseEndMinutes) + If pauseEnd > AutoPauseStartMinutes Then + AddAutoSegmentNoSave(DayStart, AutoPauseStartMinutes, pauseEnd, "pausa") + End If + Dim secondWorkEnd As Int = Min(MinuteOfDay, AutoEndMinutes) + If secondWorkEnd > AutoPauseEndMinutes Then + AddAutoSegmentNoSave(DayStart, AutoPauseEndMinutes, secondWorkEnd, "lavoro") + End If + TrimStatsRows + SaveStatsRows +End Sub + +Private Sub AddAutoSegmentNoSave(DayStart As Long, FromMinutes As Int, ToMinutes As Int, Category As String) + Dim duration As Long = (ToMinutes - FromMinutes) * DateTime.TicksPerMinute + If duration <= 0 Then Return + Dim row As Map + row.Initialize + row.Put("dayStart", DayStart) + row.Put("dayKey", DayStart) + row.Put("segmentStart", DayStart + FromMinutes * DateTime.TicksPerMinute) + row.Put("date", DateTime.Date(DayStart)) + row.Put("duration", duration) + row.Put("category", Category) + row.Put("source", "auto") + StatsRows.Add(row) +End Sub + +Private Sub RemoveAutoRowsForDay(DayStart As Long) + Dim kept As List + kept.Initialize + For Each row As Map In StatsRows + Dim source As String = "manual" + If row.ContainsKey("source") Then source = row.Get("source") + If row.Get("dayStart") = DayStart And source = "auto" Then + ' skip regenerated automatic segment + Else + kept.Add(row) + End If + Next + StatsRows.Clear + StatsRows.AddAll(kept) +End Sub + +Private Sub ClearDisplayedDay + Dim dayStart As Long = GetDisplayedWorkDayStart + If dayStart = 0 Then + ToastMessageShow(Localization.T("no_day_to_clear"), False) + Return + End If + Dim result As Int = Msgbox2(Localization.T("clear_today_confirm") & " " & FormatDayShort(dayStart) & "?", Localization.T("clear_today_title"), Localization.T("clear_button"), Localization.T("cancel"), "", Null) + If result <> DialogResponse.POSITIVE Then Return + Dim kept As List + kept.Initialize + For Each row As Map In StatsRows + If row.Get("dayStart") <> dayStart Then kept.Add(row) + Next + StatsRows.Clear + StatsRows.AddAll(kept) + SaveStatsRows + If File.Exists(File.DirInternal, StateFileName) Then File.Delete(File.DirInternal, StateFileName) + ResetSessionState(True) + If AutoModeEnabled Then + UpdateAutomaticState(DateTime.Now) + Else + RestoreLastClosedDayState + End If + ToastMessageShow(Localization.T("today_cleared"), False) +End Sub + +Private Sub AddStatsRow(y As Int, DateText As String, WorkText As String, PauseText As String, OvertimeText As String, Header As Boolean) + Dim rowHeight As Int = 30dip + Dim col1 As Int = 104dip + Dim col As Int = (Activity.Width - col1) / 3 + AddCell(DateText, 0, y, col1, rowHeight, Header) + AddCell(WorkText, col1, y, col, rowHeight, Header) + AddCell(PauseText, col1 + col, y, col, rowHeight, Header) + AddCell(OvertimeText, col1 + 2 * col, y, col, rowHeight, Header) +End Sub + +Private Sub AddCell(Text As String, x As Int, y As Int, w As Int, h As Int, Header As Boolean) + Dim lbl As Label + lbl.Initialize("") + lbl.Text = Text + lbl.TextSize = 12 + lbl.TextColor = Colors.Black + lbl.Gravity = Gravity.CENTER + If Header Then + lbl.Color = Colors.RGB(230, 230, 230) + Else + lbl.Color = Colors.White + End If + svStats.Panel.AddView(lbl, x, y, w, h) End Sub diff --git a/b4a_orologio_marcatempo.b4a.meta b/b4a_orologio_marcatempo.b4a.meta index e5ef38e..f9712c5 100644 --- a/b4a_orologio_marcatempo.b4a.meta +++ b/b4a_orologio_marcatempo.b4a.meta @@ -7,6 +7,6 @@ ModuleBreakpoints2= ModuleClosedNodes0= ModuleClosedNodes1= ModuleClosedNodes2= -NavigationStack=Main,Activity_Resume,79,0,Main,Timer1_Tick,77,0,Main,Activity_Create,74,0,Main,DrawHand,140,0,Designer Visuale,Main_Layout.bal,-100,4,Main,Globals,36,0,AnalogClock,DrawClock,94,0,AnalogClock,SetClockSize,53,0,AnalogClock,Class_Globals,5,0,AnalogClock,Initialize,43,6 +NavigationStack=Main,Activity_Resume,79,0,Main,Timer1_Tick,77,0,Main,Activity_Create,74,0,Main,DrawHand,140,0,Designer Visuale,Main_Layout.bal,-100,4,AnalogClock,DrawClock,94,0,AnalogClock,SetClockSize,53,0,AnalogClock,Class_Globals,5,0,AnalogClock,Initialize,43,6,Main,Globals,45,0 SelectedBuild=0 VisibleModules=2,1