commit 28/12/2024 13_08

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

View File

@@ -0,0 +1,580 @@
package b4a.example;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.B4AClass;
import anywheresoftware.b4a.BALayout;
import anywheresoftware.b4a.debug.*;
public class analogclock extends B4AClass.ImplB4AClass implements BA.SubDelegator{
private static java.util.HashMap<String, java.lang.reflect.Method> htSubs;
private void innerInitialize(BA _ba) throws Exception {
if (ba == null) {
ba = new anywheresoftware.b4a.ShellBA(_ba, this, htSubs, "b4a.example.analogclock");
if (htSubs == null) {
ba.loadHtSubs(this.getClass());
htSubs = ba.htSubs;
}
}
if (BA.isShellModeRuntimeCheck(ba))
this.getClass().getMethod("_class_globals", b4a.example.analogclock.class).invoke(this, new Object[] {null});
else
ba.raiseEvent2(null, true, "class_globals", false);
}
public void innerInitializeHelper(anywheresoftware.b4a.BA _ba) throws Exception{
innerInitialize(_ba);
}
public Object callSub(String sub, Object sender, Object[] args) throws Exception {
return BA.SubDelegator.SubNotFound;
}
public anywheresoftware.b4a.keywords.Common __c = null;
public anywheresoftware.b4a.objects.B4XViewWrapper.XUI _xui = null;
public anywheresoftware.b4a.objects.PanelWrapper _pnlclock = null;
public anywheresoftware.b4a.objects.B4XCanvas _cvsclock = null;
public float _clockdiameter = 0f;
public float _centerx = 0f;
public float _centery = 0f;
public anywheresoftware.b4a.objects.collections.List _intervals = null;
public float _quadrantstrokewidth = 0f;
public float _hourtickstrokewidth = 0f;
public float _minutetickstrokewidth = 0f;
public float _intervalarcstrokewidth = 0f;
public float _hourhandstrokewidth = 0f;
public float _minutehandstrokewidth = 0f;
public b4a.example.main _main = null;
public b4a.example.starter _starter = null;
public String _initialize(b4a.example.analogclock __ref,anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.PanelWrapper _parentpanel,float _percentageofwidth) throws Exception{
__ref = this;
innerInitialize(_ba);
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "initialize", false))
{return ((String) Debug.delegate(ba, "initialize", new Object[] {_ba,_parentpanel,_percentageofwidth}));}
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";
return "";
}
public String _drawclock(b4a.example.analogclock __ref) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "drawclock", false))
{return ((String) Debug.delegate(ba, "drawclock", null));}
anywheresoftware.b4a.objects.collections.Map _interval = null;
long _now = 0L;
int _hours = 0;
int _minutes = 0;
int _seconds = 0;
float _hourangle = 0f;
float _minuteangle = 0f;
float _secondangle = 0f;
RDebugUtils.currentLine=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();
{
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")))));
}
};
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";
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; }
}
;
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";
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));}
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";
{
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";
_angle = (float) (-90+_i*6);
RDebugUtils.currentLine=1769475;
//BA.debugLineNum = 1769475;BA.debugLine="Dim startX As Float";
_startx = 0f;
RDebugUtils.currentLine=1769476;
//BA.debugLineNum = 1769476;BA.debugLine="Dim startY As Float";
_starty = 0f;
RDebugUtils.currentLine=1769477;
//BA.debugLineNum = 1769477;BA.debugLine="Dim endX As Float";
_endx = 0f;
RDebugUtils.currentLine=1769478;
//BA.debugLineNum = 1769478;BA.debugLine="Dim endY As Float";
_endy = 0f;
RDebugUtils.currentLine=1769479;
//BA.debugLineNum = 1769479;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*/ );
}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*/ );
};
}
};
RDebugUtils.currentLine=1769495;
//BA.debugLineNum = 1769495;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";
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";
return "";
}
public String _setclocksize(b4a.example.analogclock __ref,float _percentageofwidth) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "setclocksize", false))
{return ((String) Debug.delegate(ba, "setclocksize", new Object[] {_percentageofwidth}));}
RDebugUtils.currentLine=1441792;
//BA.debugLineNum = 1441792;BA.debugLine="Public Sub SetClockSize(PercentageOfWidth As Float";
RDebugUtils.currentLine=1441793;
//BA.debugLineNum = 1441793;BA.debugLine="clockDiameter = pnlClock.Width * PercentageOfW";
__ref._clockdiameter /*float*/ = (float) (__ref._pnlclock /*anywheresoftware.b4a.objects.PanelWrapper*/ .getWidth()*_percentageofwidth/(double)100);
RDebugUtils.currentLine=1441794;
//BA.debugLineNum = 1441794;BA.debugLine="centerX = pnlClock.Width / 2";
__ref._centerx /*float*/ = (float) (__ref._pnlclock /*anywheresoftware.b4a.objects.PanelWrapper*/ .getWidth()/(double)2);
RDebugUtils.currentLine=1441795;
//BA.debugLineNum = 1441795;BA.debugLine="centerY = pnlClock.Height / 2";
__ref._centery /*float*/ = (float) (__ref._pnlclock /*anywheresoftware.b4a.objects.PanelWrapper*/ .getHeight()/(double)2);
RDebugUtils.currentLine=1441796;
//BA.debugLineNum = 1441796;BA.debugLine="DrawClock";
__ref._drawclock /*String*/ (null);
RDebugUtils.currentLine=1441797;
//BA.debugLineNum = 1441797;BA.debugLine="End Sub";
return "";
}
public String _setstrokewidths(b4a.example.analogclock __ref,float _quadrantwidth,float _hourtickwidth,float _minutetickwidth,float _intervalarcwidth,float _hourhandwidth,float _minutehandwidth) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "setstrokewidths", false))
{return ((String) Debug.delegate(ba, "setstrokewidths", new Object[] {_quadrantwidth,_hourtickwidth,_minutetickwidth,_intervalarcwidth,_hourhandwidth,_minutehandwidth}));}
RDebugUtils.currentLine=1507328;
//BA.debugLineNum = 1507328;BA.debugLine="Public Sub SetStrokeWidths(quadrantWidth As Float,";
RDebugUtils.currentLine=1507329;
//BA.debugLineNum = 1507329;BA.debugLine="quadrantStrokeWidth = quadrantWidth";
__ref._quadrantstrokewidth /*float*/ = _quadrantwidth;
RDebugUtils.currentLine=1507330;
//BA.debugLineNum = 1507330;BA.debugLine="hourTickStrokeWidth = hourTickWidth";
__ref._hourtickstrokewidth /*float*/ = _hourtickwidth;
RDebugUtils.currentLine=1507331;
//BA.debugLineNum = 1507331;BA.debugLine="minuteTickStrokeWidth = minuteTickWidth";
__ref._minutetickstrokewidth /*float*/ = _minutetickwidth;
RDebugUtils.currentLine=1507332;
//BA.debugLineNum = 1507332;BA.debugLine="intervalArcStrokeWidth = intervalArcWidth";
__ref._intervalarcstrokewidth /*float*/ = _intervalarcwidth;
RDebugUtils.currentLine=1507333;
//BA.debugLineNum = 1507333;BA.debugLine="hourHandStrokeWidth = hourHandWidth";
__ref._hourhandstrokewidth /*float*/ = _hourhandwidth;
RDebugUtils.currentLine=1507334;
//BA.debugLineNum = 1507334;BA.debugLine="minuteHandStrokeWidth = minuteHandWidth";
__ref._minutehandstrokewidth /*float*/ = _minutehandwidth;
RDebugUtils.currentLine=1507335;
//BA.debugLineNum = 1507335;BA.debugLine="DrawClock";
__ref._drawclock /*String*/ (null);
RDebugUtils.currentLine=1507336;
//BA.debugLineNum = 1507336;BA.debugLine="End Sub";
return "";
}
public String _startclock(b4a.example.analogclock __ref) throws Exception{
__ref = this;
RDebugUtils.currentModule="analogclock";
if (Debug.shouldDelegate(ba, "startclock", false))
{return ((String) Debug.delegate(ba, "startclock", null));}
anywheresoftware.b4a.objects.Timer _timer = null;
RDebugUtils.currentLine=1966080;
//BA.debugLineNum = 1966080;BA.debugLine="Public Sub StartClock";
RDebugUtils.currentLine=1966081;
//BA.debugLineNum = 1966081;BA.debugLine="Dim timer As Timer";
_timer = new anywheresoftware.b4a.objects.Timer();
RDebugUtils.currentLine=1966082;
//BA.debugLineNum = 1966082;BA.debugLine="timer.Initialize(\"timer\", 1000)";
_timer.Initialize(ba,"timer",(long) (1000));
RDebugUtils.currentLine=1966083;
//BA.debugLineNum = 1966083;BA.debugLine="timer.Enabled = True";
_timer.setEnabled(__c.True);
RDebugUtils.currentLine=1966084;
//BA.debugLineNum = 1966084;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";
return "";
}
}

View File

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

View File

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

View File

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