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 = " + isFirst + " **");
        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 boolean _actionbarhomeclicked = false;
public static anywheresoftware.b4a.objects.Timer _timer1 = null;
public static int _timeautochange = 0;
public anywheresoftware.b4a.objects.B4XViewWrapper _button1 = null;
public anywheresoftware.b4a.objects.B4XViewWrapper _label1 = null;
public anywheresoftware.b4a.objects.B4XViewWrapper _lbl_changement = null;
public anywheresoftware.b4a.objects.B4XViewWrapper _button2 = null;
public b4a.example.starter _starter = null;
public b4a.example.b4xpages _b4xpages = null;
public b4a.example.b4xcollections _b4xcollections = null;
public static String  _activity_actionbarhomeclick() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "activity_actionbarhomeclick", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "activity_actionbarhomeclick", null));}
RDebugUtils.currentLine=196608;
 //BA.debugLineNum = 196608;BA.debugLine="Sub Activity_ActionBarHomeClick";
RDebugUtils.currentLine=196609;
 //BA.debugLineNum = 196609;BA.debugLine="ActionBarHomeClicked = True";
_actionbarhomeclicked = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=196610;
 //BA.debugLineNum = 196610;BA.debugLine="B4XPages.Delegate.Activity_ActionBarHomeClick";
mostCurrent._b4xpages._delegate /*b4a.example.b4xpagesdelegator*/ ._activity_actionbarhomeclick /*String*/ (null);
RDebugUtils.currentLine=196611;
 //BA.debugLineNum = 196611;BA.debugLine="ActionBarHomeClicked = False";
_actionbarhomeclicked = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=196612;
 //BA.debugLineNum = 196612;BA.debugLine="End Sub";
return "";
}
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}));}
b4a.example.b4xpagesmanager _pm = null;
RDebugUtils.currentLine=131072;
 //BA.debugLineNum = 131072;BA.debugLine="Sub Activity_Create(FirstTime As Boolean)";
RDebugUtils.currentLine=131073;
 //BA.debugLineNum = 131073;BA.debugLine="Dim pm As B4XPagesManager";
_pm = new b4a.example.b4xpagesmanager();
RDebugUtils.currentLine=131074;
 //BA.debugLineNum = 131074;BA.debugLine="pm.Initialize(Activity)";
_pm._initialize /*String*/ (null,mostCurrent.activityBA,mostCurrent._activity);
RDebugUtils.currentLine=131075;
 //BA.debugLineNum = 131075;BA.debugLine="Activity.LoadLayout(\"MainPage\")";
mostCurrent._activity.LoadLayout("MainPage",mostCurrent.activityBA);
RDebugUtils.currentLine=131076;
 //BA.debugLineNum = 131076;BA.debugLine="Timer1.Initialize(\"Timer1\",5000)";
_timer1.Initialize(processBA,"Timer1",(long) (5000));
RDebugUtils.currentLine=131077;
 //BA.debugLineNum = 131077;BA.debugLine="Timer1.Enabled=True";
_timer1.setEnabled(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=131079;
 //BA.debugLineNum = 131079;BA.debugLine="End Sub";
return "";
}
public static boolean  _activity_keypress(int _keycode) throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "activity_keypress", false))
	 {return ((Boolean) Debug.delegate(mostCurrent.activityBA, "activity_keypress", new Object[] {_keycode}));}
RDebugUtils.currentLine=262144;
 //BA.debugLineNum = 262144;BA.debugLine="Sub Activity_KeyPress (KeyCode As Int) As Boolean";
RDebugUtils.currentLine=262145;
 //BA.debugLineNum = 262145;BA.debugLine="Return B4XPages.Delegate.Activity_KeyPress(KeyCod";
if (true) return mostCurrent._b4xpages._delegate /*b4a.example.b4xpagesdelegator*/ ._activity_keypress /*boolean*/ (null,_keycode);
RDebugUtils.currentLine=262146;
 //BA.debugLineNum = 262146;BA.debugLine="End Sub";
return false;
}
public static String  _activity_pause(boolean _userclosed) throws Exception{
RDebugUtils.currentModule="main";
RDebugUtils.currentLine=393216;
 //BA.debugLineNum = 393216;BA.debugLine="Sub Activity_Pause (UserClosed As Boolean)";
RDebugUtils.currentLine=393217;
 //BA.debugLineNum = 393217;BA.debugLine="B4XPages.Delegate.Activity_Pause";
mostCurrent._b4xpages._delegate /*b4a.example.b4xpagesdelegator*/ ._activity_pause /*String*/ (null);
RDebugUtils.currentLine=393218;
 //BA.debugLineNum = 393218;BA.debugLine="End Sub";
return "";
}
public static String  _activity_permissionresult(String _permission,boolean _result) throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "activity_permissionresult", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "activity_permissionresult", new Object[] {_permission,_result}));}
RDebugUtils.currentLine=458752;
 //BA.debugLineNum = 458752;BA.debugLine="Sub Activity_PermissionResult (Permission As Strin";
RDebugUtils.currentLine=458753;
 //BA.debugLineNum = 458753;BA.debugLine="B4XPages.Delegate.Activity_PermissionResult(Permi";
mostCurrent._b4xpages._delegate /*b4a.example.b4xpagesdelegator*/ ._activity_permissionresult /*String*/ (null,_permission,_result);
RDebugUtils.currentLine=458754;
 //BA.debugLineNum = 458754;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=327680;
 //BA.debugLineNum = 327680;BA.debugLine="Sub Activity_Resume";
RDebugUtils.currentLine=327681;
 //BA.debugLineNum = 327681;BA.debugLine="B4XPages.Delegate.Activity_Resume";
mostCurrent._b4xpages._delegate /*b4a.example.b4xpagesdelegator*/ ._activity_resume /*String*/ (null);
RDebugUtils.currentLine=327682;
 //BA.debugLineNum = 327682;BA.debugLine="End Sub";
return "";
}
public static String  _button1_click() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "button1_click", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "button1_click", null));}
RDebugUtils.currentLine=9437184;
 //BA.debugLineNum = 9437184;BA.debugLine="Private Sub Button1_Click";
RDebugUtils.currentLine=9437185;
 //BA.debugLineNum = 9437185;BA.debugLine="ControlTimeZone";
_controltimezone();
RDebugUtils.currentLine=9437186;
 //BA.debugLineNum = 9437186;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.keywords.Common.ResumableSubWrapper  _controltimezone() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "controltimezone", false))
	 {return ((anywheresoftware.b4a.keywords.Common.ResumableSubWrapper) Debug.delegate(mostCurrent.activityBA, "controltimezone", null));}
ResumableSub_ControlTimeZone rsub = new ResumableSub_ControlTimeZone(null);
rsub.resume(processBA, null);
return (anywheresoftware.b4a.keywords.Common.ResumableSubWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.keywords.Common.ResumableSubWrapper(), rsub);
}
public static class ResumableSub_ControlTimeZone extends BA.ResumableSub {
public ResumableSub_ControlTimeZone(b4a.example.main parent) {
this.parent = parent;
}
b4a.example.main parent;
String _datestart = "";
long _dateparse = 0L;
int _ii1 = 0;
long _dateindex = 0L;
int step11;
int limit11;
int step32;
int limit32;

@Override
public void resume(BA ba, Object[] result) throws Exception{
RDebugUtils.currentModule="main";

    while (true) {
try {

        switch (state) {
            case -1:
{
anywheresoftware.b4a.keywords.Common.ReturnFromResumableSub(this,null);return;}
case 0:
//C
this.state = 1;
RDebugUtils.currentLine=9371650;
 //BA.debugLineNum = 9371650;BA.debugLine="DateTime.SetTimeZone(1)";
anywheresoftware.b4a.keywords.Common.DateTime.SetTimeZone(1);
RDebugUtils.currentLine=9371651;
 //BA.debugLineNum = 9371651;BA.debugLine="DateTime.DateFormat = \"dd.MM.yyyy\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("dd.MM.yyyy");
RDebugUtils.currentLine=9371653;
 //BA.debugLineNum = 9371653;BA.debugLine="TimeAutoChange=0";
parent._timeautochange = (int) (0);
RDebugUtils.currentLine=9371654;
 //BA.debugLineNum = 9371654;BA.debugLine="Try";
if (true) break;

case 1:
//try
this.state = 66;
this.catchState = 65;
this.state = 3;
if (true) break;

case 3:
//C
this.state = 4;
this.catchState = 65;
RDebugUtils.currentLine=9371655;
 //BA.debugLineNum = 9371655;BA.debugLine="If TimeAutoChange=0 Then 'Changement auto";
if (true) break;

case 4:
//if
this.state = 63;
if (parent._timeautochange==0) { 
this.state = 6;
}else {
this.state = 62;
}if (true) break;

case 6:
//C
this.state = 7;
RDebugUtils.currentLine=9371656;
 //BA.debugLineNum = 9371656;BA.debugLine="Log(\">>>>>>>>> Chagement d'heure auto\")";
anywheresoftware.b4a.keywords.Common.LogImpl("79371656",">>>>>>>>> Chagement d'heure auto",0);
RDebugUtils.currentLine=9371657;
 //BA.debugLineNum = 9371657;BA.debugLine="If DateTime.GetMonth(DateTime.Now)=10 Then 'Moi";
if (true) break;

case 7:
//if
this.state = 60;
if (anywheresoftware.b4a.keywords.Common.DateTime.GetMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow())==10) { 
this.state = 9;
}else 
{RDebugUtils.currentLine=9371680;
 //BA.debugLineNum = 9371680;BA.debugLine="Else If DateTime.GetMonth(DateTime.Now)=3 Then";
if (anywheresoftware.b4a.keywords.Common.DateTime.GetMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow())==3) { 
this.state = 33;
}else 
{RDebugUtils.currentLine=9371702;
 //BA.debugLineNum = 9371702;BA.debugLine="Else If DateTime.GetMonth(DateTime.Now)>10 Or D";
if (anywheresoftware.b4a.keywords.Common.DateTime.GetMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow())>10 || anywheresoftware.b4a.keywords.Common.DateTime.GetMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow())<3) { 
this.state = 57;
}else 
{RDebugUtils.currentLine=9371705;
 //BA.debugLineNum = 9371705;BA.debugLine="Else If DateTime.GetMonth(DateTime.Now)>3 Or Da";
if (anywheresoftware.b4a.keywords.Common.DateTime.GetMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow())>3 || anywheresoftware.b4a.keywords.Common.DateTime.GetMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow())<10) { 
this.state = 59;
}}}}
if (true) break;

case 9:
//C
this.state = 10;
RDebugUtils.currentLine=9371659;
 //BA.debugLineNum = 9371659;BA.debugLine="If DateTime.GetDayOfMonth(DateTime.Now)>23 And";
if (true) break;

case 10:
//if
this.state = 31;
if (anywheresoftware.b4a.keywords.Common.DateTime.GetDayOfMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow())>23 && anywheresoftware.b4a.keywords.Common.DateTime.GetDayOfMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow())<=31) { 
this.state = 12;
}if (true) break;

case 12:
//C
this.state = 13;
RDebugUtils.currentLine=9371660;
 //BA.debugLineNum = 9371660;BA.debugLine="Private datestart As String = \"23.10.\" & Date";
_datestart = "23.10."+BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.GetYear(anywheresoftware.b4a.keywords.Common.DateTime.getNow()));
RDebugUtils.currentLine=9371661;
 //BA.debugLineNum = 9371661;BA.debugLine="Private DateParse As Long = DateTime.DatePars";
_dateparse = anywheresoftware.b4a.keywords.Common.DateTime.DateParse(_datestart);
RDebugUtils.currentLine=9371662;
 //BA.debugLineNum = 9371662;BA.debugLine="For ii1= 24 To DateTime.GetDayOfMonth(DateTim";
if (true) break;

case 13:
//for
this.state = 30;
step11 = 1;
limit11 = anywheresoftware.b4a.keywords.Common.DateTime.GetDayOfMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
_ii1 = (int) (24) ;
this.state = 67;
if (true) break;

case 67:
//C
this.state = 30;
if ((step11 > 0 && _ii1 <= limit11) || (step11 < 0 && _ii1 >= limit11)) this.state = 15;
if (true) break;

case 68:
//C
this.state = 67;
_ii1 = ((int)(0 + _ii1 + step11)) ;
if (true) break;

case 15:
//C
this.state = 16;
RDebugUtils.currentLine=9371663;
 //BA.debugLineNum = 9371663;BA.debugLine="Private dateIndex As Long= DateTime.Add(Date";
_dateindex = anywheresoftware.b4a.keywords.Common.DateTime.Add(_dateparse,(int) (0),(int) (0),(int) (1));
RDebugUtils.currentLine=9371664;
 //BA.debugLineNum = 9371664;BA.debugLine="If DateTime.GetDayOfWeek(dateIndex)=1  Then";
if (true) break;

case 16:
//if
this.state = 29;
if (anywheresoftware.b4a.keywords.Common.DateTime.GetDayOfWeek(_dateindex)==1) { 
this.state = 18;
}if (true) break;

case 18:
//C
this.state = 19;
RDebugUtils.currentLine=9371665;
 //BA.debugLineNum = 9371665;BA.debugLine="If ii1= DateTime.GetDayOfMonth(DateTime.Now";
if (true) break;

case 19:
//if
this.state = 28;
if (_ii1==anywheresoftware.b4a.keywords.Common.DateTime.GetDayOfMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow())) { 
this.state = 21;
}else {
this.state = 27;
}if (true) break;

case 21:
//C
this.state = 22;
RDebugUtils.currentLine=9371666;
 //BA.debugLineNum = 9371666;BA.debugLine="If DateTime.Time(DateTime.Now)>= DateTime.";
if (true) break;

case 22:
//if
this.state = 25;
if ((double)(Double.parseDouble(anywheresoftware.b4a.keywords.Common.DateTime.Time(anywheresoftware.b4a.keywords.Common.DateTime.getNow())))>=anywheresoftware.b4a.keywords.Common.DateTime.TimeParse("03:00:00")) { 
this.state = 24;
}if (true) break;

case 24:
//C
this.state = 25;
RDebugUtils.currentLine=9371667;
 //BA.debugLineNum = 9371667;BA.debugLine="DateTime.SetTimeZone(1)";
anywheresoftware.b4a.keywords.Common.DateTime.SetTimeZone(1);
RDebugUtils.currentLine=9371668;
 //BA.debugLineNum = 9371668;BA.debugLine="lbl_changement.Text=\"1\"";
parent.mostCurrent._lbl_changement.setText(BA.ObjectToCharSequence("1"));
 if (true) break;

case 25:
//C
this.state = 28;
;
 if (true) break;

case 27:
//C
this.state = 28;
RDebugUtils.currentLine=9371671;
 //BA.debugLineNum = 9371671;BA.debugLine="DateTime.SetTimeZone(1)";
anywheresoftware.b4a.keywords.Common.DateTime.SetTimeZone(1);
RDebugUtils.currentLine=9371672;
 //BA.debugLineNum = 9371672;BA.debugLine="lbl_changement.Text=\"1\"";
parent.mostCurrent._lbl_changement.setText(BA.ObjectToCharSequence("1"));
 if (true) break;

case 28:
//C
this.state = 29;
;
RDebugUtils.currentLine=9371674;
 //BA.debugLineNum = 9371674;BA.debugLine="Exit";
this.state = 30;
if (true) break;
 if (true) break;

case 29:
//C
this.state = 68;
;
RDebugUtils.currentLine=9371676;
 //BA.debugLineNum = 9371676;BA.debugLine="DateParse=dateIndex";
_dateparse = _dateindex;
 if (true) break;
if (true) break;

case 30:
//C
this.state = 31;
;
 if (true) break;

case 31:
//C
this.state = 60;
;
 if (true) break;

case 33:
//C
this.state = 34;
RDebugUtils.currentLine=9371682;
 //BA.debugLineNum = 9371682;BA.debugLine="If DateTime.GetDayOfMonth(DateTime.Now)>22 And";
if (true) break;

case 34:
//if
this.state = 55;
if (anywheresoftware.b4a.keywords.Common.DateTime.GetDayOfMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow())>22 && anywheresoftware.b4a.keywords.Common.DateTime.GetDayOfMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow())<=30) { 
this.state = 36;
}if (true) break;

case 36:
//C
this.state = 37;
RDebugUtils.currentLine=9371683;
 //BA.debugLineNum = 9371683;BA.debugLine="Private datestart As String = \"22.03.\" & Date";
_datestart = "22.03."+BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.GetYear(anywheresoftware.b4a.keywords.Common.DateTime.getNow()));
RDebugUtils.currentLine=9371684;
 //BA.debugLineNum = 9371684;BA.debugLine="Private DateParse As Long = DateTime.DatePars";
_dateparse = anywheresoftware.b4a.keywords.Common.DateTime.DateParse(_datestart);
RDebugUtils.currentLine=9371685;
 //BA.debugLineNum = 9371685;BA.debugLine="For ii1= 23 To DateTime.GetDayOfMonth(DateTim";
if (true) break;

case 37:
//for
this.state = 54;
step32 = 1;
limit32 = anywheresoftware.b4a.keywords.Common.DateTime.GetDayOfMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
_ii1 = (int) (23) ;
this.state = 69;
if (true) break;

case 69:
//C
this.state = 54;
if ((step32 > 0 && _ii1 <= limit32) || (step32 < 0 && _ii1 >= limit32)) this.state = 39;
if (true) break;

case 70:
//C
this.state = 69;
_ii1 = ((int)(0 + _ii1 + step32)) ;
if (true) break;

case 39:
//C
this.state = 40;
RDebugUtils.currentLine=9371686;
 //BA.debugLineNum = 9371686;BA.debugLine="Private dateIndex As Long= DateTime.Add(Date";
_dateindex = anywheresoftware.b4a.keywords.Common.DateTime.Add(_dateparse,(int) (0),(int) (0),(int) (1));
RDebugUtils.currentLine=9371687;
 //BA.debugLineNum = 9371687;BA.debugLine="If DateTime.GetDayOfWeek(dateIndex)=1  Then";
if (true) break;

case 40:
//if
this.state = 53;
if (anywheresoftware.b4a.keywords.Common.DateTime.GetDayOfWeek(_dateindex)==1) { 
this.state = 42;
}if (true) break;

case 42:
//C
this.state = 43;
RDebugUtils.currentLine=9371688;
 //BA.debugLineNum = 9371688;BA.debugLine="If ii1= DateTime.GetDayOfMonth(DateTime.Now";
if (true) break;

case 43:
//if
this.state = 52;
if (_ii1==anywheresoftware.b4a.keywords.Common.DateTime.GetDayOfMonth(anywheresoftware.b4a.keywords.Common.DateTime.getNow())) { 
this.state = 45;
}else {
this.state = 51;
}if (true) break;

case 45:
//C
this.state = 46;
RDebugUtils.currentLine=9371689;
 //BA.debugLineNum = 9371689;BA.debugLine="If DateTime.Now>= DateTime.TimeParse(\"02:0";
if (true) break;

case 46:
//if
this.state = 49;
if (anywheresoftware.b4a.keywords.Common.DateTime.getNow()>=anywheresoftware.b4a.keywords.Common.DateTime.TimeParse("02:00:00")) { 
this.state = 48;
}if (true) break;

case 48:
//C
this.state = 49;
RDebugUtils.currentLine=9371690;
 //BA.debugLineNum = 9371690;BA.debugLine="DateTime.SetTimeZone(2)";
anywheresoftware.b4a.keywords.Common.DateTime.SetTimeZone(2);
RDebugUtils.currentLine=9371691;
 //BA.debugLineNum = 9371691;BA.debugLine="lbl_changement.Text=\"2\"";
parent.mostCurrent._lbl_changement.setText(BA.ObjectToCharSequence("2"));
 if (true) break;

case 49:
//C
this.state = 52;
;
 if (true) break;

case 51:
//C
this.state = 52;
RDebugUtils.currentLine=9371694;
 //BA.debugLineNum = 9371694;BA.debugLine="DateTime.SetTimeZone(2)";
anywheresoftware.b4a.keywords.Common.DateTime.SetTimeZone(2);
RDebugUtils.currentLine=9371695;
 //BA.debugLineNum = 9371695;BA.debugLine="lbl_changement.Text=\"2\"";
parent.mostCurrent._lbl_changement.setText(BA.ObjectToCharSequence("2"));
 if (true) break;

case 52:
//C
this.state = 53;
;
RDebugUtils.currentLine=9371697;
 //BA.debugLineNum = 9371697;BA.debugLine="Exit";
this.state = 54;
if (true) break;
 if (true) break;

case 53:
//C
this.state = 70;
;
RDebugUtils.currentLine=9371699;
 //BA.debugLineNum = 9371699;BA.debugLine="DateParse=dateIndex";
_dateparse = _dateindex;
 if (true) break;
if (true) break;

case 54:
//C
this.state = 55;
;
 if (true) break;

case 55:
//C
this.state = 60;
;
 if (true) break;

case 57:
//C
this.state = 60;
RDebugUtils.currentLine=9371703;
 //BA.debugLineNum = 9371703;BA.debugLine="DateTime.SetTimeZone(1)";
anywheresoftware.b4a.keywords.Common.DateTime.SetTimeZone(1);
RDebugUtils.currentLine=9371704;
 //BA.debugLineNum = 9371704;BA.debugLine="lbl_changement.Text=\"1\"";
parent.mostCurrent._lbl_changement.setText(BA.ObjectToCharSequence("1"));
 if (true) break;

case 59:
//C
this.state = 60;
RDebugUtils.currentLine=9371706;
 //BA.debugLineNum = 9371706;BA.debugLine="DateTime.SetTimeZone(2)";
anywheresoftware.b4a.keywords.Common.DateTime.SetTimeZone(2);
RDebugUtils.currentLine=9371707;
 //BA.debugLineNum = 9371707;BA.debugLine="lbl_changement.Text=\"2\"";
parent.mostCurrent._lbl_changement.setText(BA.ObjectToCharSequence("2"));
 if (true) break;

case 60:
//C
this.state = 63;
;
 if (true) break;

case 62:
//C
this.state = 63;
RDebugUtils.currentLine=9371711;
 //BA.debugLineNum = 9371711;BA.debugLine="DateTime.SetTimeZone(TimeAutoChange)";
anywheresoftware.b4a.keywords.Common.DateTime.SetTimeZone(parent._timeautochange);
RDebugUtils.currentLine=9371712;
 //BA.debugLineNum = 9371712;BA.debugLine="lbl_changement.Text=\"0\"";
parent.mostCurrent._lbl_changement.setText(BA.ObjectToCharSequence("0"));
 if (true) break;

case 63:
//C
this.state = 66;
;
RDebugUtils.currentLine=9371714;
 //BA.debugLineNum = 9371714;BA.debugLine="Log(\"<<<<<<<<<<<<<<<<<  Heure UTC + \" & DateTime";
anywheresoftware.b4a.keywords.Common.LogImpl("79371714","<<<<<<<<<<<<<<<<<  Heure UTC + "+BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getTimeZoneOffset())+"H >>>>>>>>>>>>>>>>",0);
RDebugUtils.currentLine=9371715;
 //BA.debugLineNum = 9371715;BA.debugLine="Return True";
if (true) {
anywheresoftware.b4a.keywords.Common.ReturnFromResumableSub(this,(Object)(anywheresoftware.b4a.keywords.Common.True));return;};
 if (true) break;

case 65:
//C
this.state = 66;
this.catchState = 0;
RDebugUtils.currentLine=9371717;
 //BA.debugLineNum = 9371717;BA.debugLine="Log(LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("79371717",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 if (true) break;
if (true) break;

case 66:
//C
this.state = -1;
this.catchState = 0;
;
RDebugUtils.currentLine=9371720;
 //BA.debugLineNum = 9371720;BA.debugLine="End Sub";
if (true) break;
}} 
       catch (Exception e0) {
			
if (catchState == 0)
    throw e0;
else {
    state = catchState;
processBA.setLastException(e0);}
            }
        }
    }
}
public static String  _button2_click() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "button2_click", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "button2_click", null));}
RDebugUtils.currentLine=9568256;
 //BA.debugLineNum = 9568256;BA.debugLine="Private Sub Button2_Click";
RDebugUtils.currentLine=9568257;
 //BA.debugLineNum = 9568257;BA.debugLine="ControlTimeZone";
_controltimezone();
RDebugUtils.currentLine=9568258;
 //BA.debugLineNum = 9568258;BA.debugLine="End Sub";
return "";
}
public static String  _create_menu(Object _menu) throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(mostCurrent.activityBA, "create_menu", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "create_menu", new Object[] {_menu}));}
RDebugUtils.currentLine=524288;
 //BA.debugLineNum = 524288;BA.debugLine="Sub Create_Menu (Menu As Object)";
RDebugUtils.currentLine=524289;
 //BA.debugLineNum = 524289;BA.debugLine="B4XPages.Delegate.Create_Menu(Menu)";
mostCurrent._b4xpages._delegate /*b4a.example.b4xpagesdelegator*/ ._create_menu /*String*/ (null,_menu);
RDebugUtils.currentLine=524290;
 //BA.debugLineNum = 524290;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=10289152;
 //BA.debugLineNum = 10289152;BA.debugLine="Sub Timer1_Tick";
RDebugUtils.currentLine=10289153;
 //BA.debugLineNum = 10289153;BA.debugLine="ControlTimeZone";
_controltimezone();
RDebugUtils.currentLine=10289154;
 //BA.debugLineNum = 10289154;BA.debugLine="End Sub";
return "";
}
public boolean _onCreateOptionsMenu(android.view.Menu menu) {
	 processBA.raiseEvent(null, "create_menu", menu);
	 return true;
	
}
}