package b4a.rocklogster;


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 BA(this.getApplicationContext(), null, null, "b4a.rocklogster", "b4a.rocklogster.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.rocklogster", "b4a.rocklogster.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.rocklogster.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 anywheresoftware.b4a.keywords.Common __c = null;
public static boolean _updateclick = false;
public static anywheresoftware.b4a.objects.collections.List _rocklist = null;
public static anywheresoftware.b4a.objects.collections.List _weedlist = null;
public static anywheresoftware.b4a.objects.collections.List _pointlist = null;
public static anywheresoftware.b4a.objects.collections.List _headerlist = null;
public static anywheresoftware.b4a.objects.collections.List _locationstringlist = null;
public static anywheresoftware.b4a.objects.collections.Map _headerposition = null;
public static String[] _locationstrings = null;
public anywheresoftware.b4a.keywords.Regex.MatcherWrapper _headerstringget = null;
public b4a.rocklogster.main._loggedentry _lbllon = null;
public anywheresoftware.b4a.objects.LabelWrapper _lblpnlrock = null;
public anywheresoftware.b4a.objects.LabelWrapper _lblspeed = null;
public anywheresoftware.b4a.objects.LabelWrapper _lblsatellites = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btnrock = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btnweed = null;
public anywheresoftware.b4a.objects.EditTextWrapper _editxt = null;
public anywheresoftware.b4a.objects.LabelWrapper _lblsatindicator = null;
public static double _stime = 0;
public static String _slong = "";
public static String _slat = "";
public static double _btndowntime = 0;
public static double _btnuptime = 0;
public static String _flong = "";
public static String _flat = "";
public static double _ftime = 0;
public anywheresoftware.b4a.keywords.StringBuilderWrapper _filestringbuilder = null;
public anywheresoftware.b4a.keywords.StringBuilderWrapper _estimatorstringbuilder = null;
public static String _filestring = "";
public anywheresoftware.b4a.objects.collections.List _filelist = null;
public static boolean _delayedsat = false;
public anywheresoftware.b4a.objects.LabelWrapper _lbl2secwarn = null;
public static String _estimatorstring = "";
public anywheresoftware.b4a.objects.PanelWrapper _pnlrock = null;
public anywheresoftware.b4a.objects.LabelWrapper _lblpnlpoint = null;
public anywheresoftware.b4a.objects.LabelWrapper _lblpnlweed = null;
public anywheresoftware.b4a.objects.RuntimePermissions _rp = null;
public b4a.rocklogster.main._loggedentry _cust2 = null;
public anywheresoftware.b4a.randomaccessfile.B4XSerializator _raf2 = null;
public anywheresoftware.b4a.objects.collections.List _cust2list = null;
public anywheresoftware.b4a.objects.ButtonWrapper _printbut = null;
public anywheresoftware.b4a.objects.ButtonWrapper _savebut = null;
public static long _butdowntime = 0L;
public static long _butuptime = 0L;
public anywheresoftware.b4a.gps.LocationWrapper _locdown = null;
public anywheresoftware.b4a.gps.LocationWrapper _locup = null;
public static double _elong = 0;
public static double _elat = 0;
public static boolean _paneldowncomplete = false;
public anywheresoftware.b4a.objects.ButtonWrapper _butviewmap = null;
public anywheresoftware.b4a.objects.LabelWrapper _lblpnlcust = null;
public b4a.rocklogster.starter _starter = null;
public b4a.rocklogster.mapmod _mapmod = null;
public static class _loggedentry{
public boolean IsInitialized;
public String Date;
public double Lat;
public double Lot;
public String obstacle;
public String comment;
public void Initialize() {
IsInitialized = true;
Date = "";
Lat = 0;
Lot = 0;
obstacle = "";
comment = "";
}
@Override
		public String toString() {
			return BA.TypeToString(this, false);
		}}

public static boolean isAnyActivityVisible() {
    boolean vis = false;
vis = vis | (main.mostCurrent != null);
vis = vis | (mapmod.mostCurrent != null);
return vis;}
public static String  _activity_create(boolean _firsttime) throws Exception{
 //BA.debugLineNum = 83;BA.debugLine="Sub Activity_Create(FirstTime As Boolean)";
 //BA.debugLineNum = 84;BA.debugLine="Activity.LoadLayout(\"Rockloggervisual\")";
mostCurrent._activity.LoadLayout("Rockloggervisual",mostCurrent.activityBA);
 //BA.debugLineNum = 85;BA.debugLine="Activity.AddMenuItem(\"Clear Log\", \"Clearlog\")";
mostCurrent._activity.AddMenuItem(BA.ObjectToCharSequence("Clear Log"),"Clearlog");
 //BA.debugLineNum = 86;BA.debugLine="FileStringBuilder.Initialize";
mostCurrent._filestringbuilder.Initialize();
 //BA.debugLineNum = 87;BA.debugLine="EstimatorStringBuilder.Initialize";
mostCurrent._estimatorstringbuilder.Initialize();
 //BA.debugLineNum = 88;BA.debugLine="FileList.Initialize";
mostCurrent._filelist.Initialize();
 //BA.debugLineNum = 89;BA.debugLine="RockList.Initialize";
_rocklist.Initialize();
 //BA.debugLineNum = 90;BA.debugLine="WeedList.Initialize";
_weedlist.Initialize();
 //BA.debugLineNum = 91;BA.debugLine="PointList.Initialize";
_pointlist.Initialize();
 //BA.debugLineNum = 95;BA.debugLine="rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_S";
mostCurrent._rp.CheckAndRequest(processBA,mostCurrent._rp.PERMISSION_WRITE_EXTERNAL_STORAGE);
 //BA.debugLineNum = 96;BA.debugLine="rp.CheckAndRequest(rp.PERMISSION_READ_EXTERNAL_ST";
mostCurrent._rp.CheckAndRequest(processBA,mostCurrent._rp.PERMISSION_READ_EXTERNAL_STORAGE);
 //BA.debugLineNum = 97;BA.debugLine="If File.Exists(rp.GetSafeDirdefaultExternal(\"\"),";
if (anywheresoftware.b4a.keywords.Common.File.Exists(mostCurrent._rp.GetSafeDirDefaultExternal(""),"Editxt.txt")) { 
 //BA.debugLineNum = 98;BA.debugLine="editxt.text = File.Readstring(rp.GetSafeDirDefau";
mostCurrent._editxt.setText(BA.ObjectToCharSequence(anywheresoftware.b4a.keywords.Common.File.ReadString(mostCurrent._rp.GetSafeDirDefaultExternal(""),"editxt.txt")));
 };
 //BA.debugLineNum = 106;BA.debugLine="convert_texttolists";
_convert_texttolists();
 //BA.debugLineNum = 107;BA.debugLine="End Sub";
return "";
}
public static String  _activity_pause(boolean _userclosed) throws Exception{
 //BA.debugLineNum = 208;BA.debugLine="Sub Activity_Pause (UserClosed As Boolean)";
 //BA.debugLineNum = 209;BA.debugLine="File.WriteList(rp.GetSafeDirDefaultExternal(\"\"),";
anywheresoftware.b4a.keywords.Common.File.WriteList(mostCurrent._rp.GetSafeDirDefaultExternal(""),"Rocklist.txt",_rocklist);
 //BA.debugLineNum = 210;BA.debugLine="File.WriteList(rp.GetSafeDirDefaultExternal(\"\"),";
anywheresoftware.b4a.keywords.Common.File.WriteList(mostCurrent._rp.GetSafeDirDefaultExternal(""),"Weedlist.txt",_weedlist);
 //BA.debugLineNum = 211;BA.debugLine="File.WriteList(rp.GetSafeDirDefaultExternal(\"\"),";
anywheresoftware.b4a.keywords.Common.File.WriteList(mostCurrent._rp.GetSafeDirDefaultExternal(""),"Pointlist.txt",_pointlist);
 //BA.debugLineNum = 212;BA.debugLine="File.WriteString(rp.GetSafeDirDefaultExternal(\"\")";
anywheresoftware.b4a.keywords.Common.File.WriteString(mostCurrent._rp.GetSafeDirDefaultExternal(""),"editext.txt",mostCurrent._editxt.getText());
 //BA.debugLineNum = 213;BA.debugLine="Log(\"writelists\")";
anywheresoftware.b4a.keywords.Common.LogImpl("7393221","writelists",0);
 //BA.debugLineNum = 214;BA.debugLine="CallSubDelayed(Starter, \"StopGPS\")";
anywheresoftware.b4a.keywords.Common.CallSubDelayed(processBA,(Object)(mostCurrent._starter.getObject()),"StopGPS");
 //BA.debugLineNum = 218;BA.debugLine="End Sub";
return "";
}
public static void  _activity_resume() throws Exception{
ResumableSub_Activity_Resume rsub = new ResumableSub_Activity_Resume(null);
rsub.resume(processBA, null);
}
public static class ResumableSub_Activity_Resume extends BA.ResumableSub {
public ResumableSub_Activity_Resume(b4a.rocklogster.main parent) {
this.parent = parent;
}
b4a.rocklogster.main parent;
String _permission = "";
boolean _result = false;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 197;BA.debugLine="If Starter.GPS1.GPSEnabled = False Then";
if (true) break;

case 1:
//if
this.state = 12;
if (parent.mostCurrent._starter._gps1 /*anywheresoftware.b4a.gps.GPS*/ .getGPSEnabled()==anywheresoftware.b4a.keywords.Common.False) { 
this.state = 3;
}else {
this.state = 5;
}if (true) break;

case 3:
//C
this.state = 12;
 //BA.debugLineNum = 198;BA.debugLine="ToastMessageShow(\"Please enable the GPS device.\"";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Please enable the GPS device."),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 199;BA.debugLine="StartActivity(Starter.GPS1.LocationSettingsInten";
anywheresoftware.b4a.keywords.Common.StartActivity(processBA,(Object)(parent.mostCurrent._starter._gps1 /*anywheresoftware.b4a.gps.GPS*/ .getLocationSettingsIntent()));
 if (true) break;

case 5:
//C
this.state = 6;
 //BA.debugLineNum = 201;BA.debugLine="Starter.rp.CheckAndRequest(Starter.rp.PERMISSION";
parent.mostCurrent._starter._rp /*anywheresoftware.b4a.objects.RuntimePermissions*/ .CheckAndRequest(processBA,parent.mostCurrent._starter._rp /*anywheresoftware.b4a.objects.RuntimePermissions*/ .PERMISSION_ACCESS_FINE_LOCATION);
 //BA.debugLineNum = 202;BA.debugLine="Wait For Activity_PermissionResult (Permission A";
anywheresoftware.b4a.keywords.Common.WaitFor("activity_permissionresult", processBA, this, null);
this.state = 13;
return;
case 13:
//C
this.state = 6;
_permission = (String) result[0];
_result = (Boolean) result[1];
;
 //BA.debugLineNum = 203;BA.debugLine="If Result Then CallSubDelayed(Starter, \"StartGPS";
if (true) break;

case 6:
//if
this.state = 11;
if (_result) { 
this.state = 8;
;}if (true) break;

case 8:
//C
this.state = 11;
anywheresoftware.b4a.keywords.Common.CallSubDelayed(processBA,(Object)(parent.mostCurrent._starter.getObject()),"StartGPS");
if (true) break;

case 11:
//C
this.state = 12;
;
 if (true) break;

case 12:
//C
this.state = -1;
;
 //BA.debugLineNum = 205;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public static void  _activity_permissionresult(String _permission,boolean _result) throws Exception{
}
public static String  _butviewmap_click() throws Exception{
 //BA.debugLineNum = 378;BA.debugLine="Sub butviewmap_click";
 //BA.debugLineNum = 379;BA.debugLine="StartActivity(Mapmod)";
anywheresoftware.b4a.keywords.Common.StartActivity(processBA,(Object)(mostCurrent._mapmod.getObject()));
 //BA.debugLineNum = 380;BA.debugLine="End Sub";
return "";
}
public static String  _clearlog_click() throws Exception{
 //BA.debugLineNum = 178;BA.debugLine="Sub Clearlog_Click";
 //BA.debugLineNum = 180;BA.debugLine="locationstringlist.Clear";
_locationstringlist.Clear();
 //BA.debugLineNum = 181;BA.debugLine="headerlist.Clear";
_headerlist.Clear();
 //BA.debugLineNum = 182;BA.debugLine="headerposition.clear";
_headerposition.Clear();
 //BA.debugLineNum = 184;BA.debugLine="FileList.Clear";
mostCurrent._filelist.Clear();
 //BA.debugLineNum = 185;BA.debugLine="FileString = \"\"";
mostCurrent._filestring = "";
 //BA.debugLineNum = 186;BA.debugLine="editxt.Text = \"\"";
mostCurrent._editxt.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 187;BA.debugLine="EstimatorString = \"\"";
mostCurrent._estimatorstring = "";
 //BA.debugLineNum = 188;BA.debugLine="FileStringBuilder.Initialize";
mostCurrent._filestringbuilder.Initialize();
 //BA.debugLineNum = 189;BA.debugLine="RockList.Clear";
_rocklist.Clear();
 //BA.debugLineNum = 190;BA.debugLine="WeedList.Clear";
_weedlist.Clear();
 //BA.debugLineNum = 191;BA.debugLine="PointList.Clear";
_pointlist.Clear();
 //BA.debugLineNum = 192;BA.debugLine="Log (\"Clear\")";
anywheresoftware.b4a.keywords.Common.LogImpl("7262158","Clear",0);
 //BA.debugLineNum = 193;BA.debugLine="convert_texttolists";
_convert_texttolists();
 //BA.debugLineNum = 194;BA.debugLine="End Sub";
return "";
}
public static String  _convert_texttolists() throws Exception{
int _i = 0;
 //BA.debugLineNum = 135;BA.debugLine="Sub convert_texttolists";
 //BA.debugLineNum = 137;BA.debugLine="headerposition.Initialize";
_headerposition.Initialize();
 //BA.debugLineNum = 138;BA.debugLine="headerlist.Initialize";
_headerlist.Initialize();
 //BA.debugLineNum = 139;BA.debugLine="headerstringget = Regex.matcher2(\"^\\D+$\",Regex.MU";
mostCurrent._headerstringget = anywheresoftware.b4a.keywords.Common.Regex.Matcher2("^\\D+$",anywheresoftware.b4a.keywords.Common.Regex.MULTILINE,mostCurrent._editxt.getText());
 //BA.debugLineNum = 140;BA.debugLine="Do While headerstringget.Find = True";
while (mostCurrent._headerstringget.Find()==anywheresoftware.b4a.keywords.Common.True) {
 //BA.debugLineNum = 141;BA.debugLine="headerlist.Add(headerstringget.Match)";
_headerlist.Add((Object)(mostCurrent._headerstringget.getMatch()));
 //BA.debugLineNum = 142;BA.debugLine="headerposition.Put(headerstringget.Match,headerl";
_headerposition.Put((Object)(mostCurrent._headerstringget.getMatch()),(Object)(_headerlist.getSize()));
 //BA.debugLineNum = 144;BA.debugLine="Log($\"headerstringsize${headerlist.size}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("74128777",("headerstringsize"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_headerlist.getSize()))+""),0);
 }
;
 //BA.debugLineNum = 146;BA.debugLine="For i = 0 To headerlist.Size-1";
{
final int step9 = 1;
final int limit9 = (int) (_headerlist.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit9 ;_i = _i + step9 ) {
 //BA.debugLineNum = 147;BA.debugLine="Log(headerlist.Get(i))";
anywheresoftware.b4a.keywords.Common.LogImpl("74128780",BA.ObjectToString(_headerlist.Get(_i)),0);
 }
};
 //BA.debugLineNum = 149;BA.debugLine="locationstringlist.Initialize";
_locationstringlist.Initialize();
 //BA.debugLineNum = 151;BA.debugLine="locationstrings = Regex.Split2(\"\\n^\\D+$\\n\",Regex.";
mostCurrent._locationstrings = anywheresoftware.b4a.keywords.Common.Regex.Split2("\\n^\\D+$\\n",anywheresoftware.b4a.keywords.Common.Regex.MULTILINE,mostCurrent._editxt.getText());
 //BA.debugLineNum = 152;BA.debugLine="For i=0 To locationstrings.Length - 1";
{
final int step14 = 1;
final int limit14 = (int) (mostCurrent._locationstrings.length-1);
_i = (int) (0) ;
for (;_i <= limit14 ;_i = _i + step14 ) {
 //BA.debugLineNum = 153;BA.debugLine="locationstringlist.Add(locationstrings(i))";
_locationstringlist.Add((Object)(mostCurrent._locationstrings[_i]));
 }
};
 //BA.debugLineNum = 156;BA.debugLine="Log($\"Splitted Size: ${locationstrings.Length} \"$";
anywheresoftware.b4a.keywords.Common.LogImpl("74128789",("Splitted Size: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._locationstrings.length))+" "),0);
 //BA.debugLineNum = 174;BA.debugLine="Print_rocks";
_print_rocks();
 //BA.debugLineNum = 176;BA.debugLine="End Sub";
return "";
}
public static String  _estimator(String _obstacle) throws Exception{
anywheresoftware.b4a.keywords.StringBuilderWrapper _sb2 = null;
 //BA.debugLineNum = 282;BA.debugLine="Sub Estimator(obstacle As String)";
 //BA.debugLineNum = 283;BA.debugLine="DateTime.DateFormat = (\"dd/MM/yyyy\")";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(("dd/MM/yyyy"));
 //BA.debugLineNum = 284;BA.debugLine="If (LocDown.Time = LocUp.Time) Then";
if ((mostCurrent._locdown.getTime()==mostCurrent._locup.getTime())) { 
 //BA.debugLineNum = 285;BA.debugLine="ELat = LocUp.Latitude";
_elat = mostCurrent._locup.getLatitude();
 //BA.debugLineNum = 286;BA.debugLine="ELong = LocUp.Longitude";
_elong = mostCurrent._locup.getLongitude();
 }else {
 //BA.debugLineNum = 288;BA.debugLine="ELat =LocDown.Latitude - (LocDown.Latitude - LocU";
_elat = mostCurrent._locdown.getLatitude()-(mostCurrent._locdown.getLatitude()-mostCurrent._locup.getLatitude())*(mostCurrent._locdown.getTime()-2*_butdowntime+_butuptime)/(double)(mostCurrent._locdown.getTime()-mostCurrent._locup.getTime());
 //BA.debugLineNum = 289;BA.debugLine="ELong = (LocDown.Longitude - LocUp.Longitude)*(2*";
_elong = (mostCurrent._locdown.getLongitude()-mostCurrent._locup.getLongitude())*(2*_butdowntime-mostCurrent._locup.getTime()-_butuptime)/(double)(mostCurrent._locdown.getTime()-mostCurrent._locup.getTime())+mostCurrent._locup.getLongitude();
 };
 //BA.debugLineNum = 291;BA.debugLine="Log(ELong)";
anywheresoftware.b4a.keywords.Common.LogImpl("7786441",BA.NumberToString(_elong),0);
 //BA.debugLineNum = 292;BA.debugLine="Log(obstacle)";
anywheresoftware.b4a.keywords.Common.LogImpl("7786442",_obstacle,0);
 //BA.debugLineNum = 293;BA.debugLine="Log(headerposition.Get(obstacle))";
anywheresoftware.b4a.keywords.Common.LogImpl("7786443",BA.ObjectToString(_headerposition.Get((Object)(_obstacle))),0);
 //BA.debugLineNum = 294;BA.debugLine="Log(headerposition.ContainsKey(obstacle))";
anywheresoftware.b4a.keywords.Common.LogImpl("7786444",BA.ObjectToString(_headerposition.ContainsKey((Object)(_obstacle))),0);
 //BA.debugLineNum = 297;BA.debugLine="Dim sb2 As StringBuilder";
_sb2 = new anywheresoftware.b4a.keywords.StringBuilderWrapper();
 //BA.debugLineNum = 298;BA.debugLine="sb2.Initialize";
_sb2.Initialize();
 //BA.debugLineNum = 299;BA.debugLine="If headerposition.ContainsKey(obstacle) = False Th";
if (_headerposition.ContainsKey((Object)(_obstacle))==anywheresoftware.b4a.keywords.Common.False) { 
 //BA.debugLineNum = 300;BA.debugLine="Log(\"false\")";
anywheresoftware.b4a.keywords.Common.LogImpl("7786450","false",0);
 //BA.debugLineNum = 301;BA.debugLine="headerlist.Add(obstacle)";
_headerlist.Add((Object)(_obstacle));
 //BA.debugLineNum = 302;BA.debugLine="headerposition.Put(obstacle,headerlist.Size)";
_headerposition.Put((Object)(_obstacle),(Object)(_headerlist.getSize()));
 //BA.debugLineNum = 303;BA.debugLine="sb2.Append($\",$2.6{ELat} $2.6{ELong},\"$)";
_sb2.Append((","+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("2.6",(Object)(_elat))+" "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("2.6",(Object)(_elong))+","));
 //BA.debugLineNum = 304;BA.debugLine="locationstringlist.Add(sb2.tostring)";
_locationstringlist.Add((Object)(_sb2.ToString()));
 }else {
 //BA.debugLineNum = 307;BA.debugLine="Log(\"true\")";
anywheresoftware.b4a.keywords.Common.LogImpl("7786457","true",0);
 //BA.debugLineNum = 308;BA.debugLine="sb2.Append(locationstringlist.get(headerposition";
_sb2.Append(BA.ObjectToString(_locationstringlist.Get((int)(BA.ObjectToNumber(_headerposition.Get((Object)(_obstacle))))))).Append((","+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("2.6",(Object)(_elat))+" "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("2.6",(Object)(_elong))+","));
 //BA.debugLineNum = 309;BA.debugLine="locationstringlist.InsertAt(headerposition.Get(o";
_locationstringlist.InsertAt((int)(BA.ObjectToNumber(_headerposition.Get((Object)(_obstacle)))),(Object)(_sb2.ToString()));
 //BA.debugLineNum = 310;BA.debugLine="locationstringlist.RemoveAt(headerposition.Get(o";
_locationstringlist.RemoveAt((int) ((double)(BA.ObjectToNumber(_headerposition.Get((Object)(_obstacle))))+1));
 };
 //BA.debugLineNum = 329;BA.debugLine="Print_rocks";
_print_rocks();
 //BA.debugLineNum = 330;BA.debugLine="End Sub";
return "";
}
public static String  _globals() throws Exception{
 //BA.debugLineNum = 27;BA.debugLine="Sub Globals";
 //BA.debugLineNum = 30;BA.debugLine="Dim locationstrings() As String";
mostCurrent._locationstrings = new String[(int) (0)];
java.util.Arrays.fill(mostCurrent._locationstrings,"");
 //BA.debugLineNum = 31;BA.debugLine="Dim headerstringget As Matcher";
mostCurrent._headerstringget = new anywheresoftware.b4a.keywords.Regex.MatcherWrapper();
 //BA.debugLineNum = 33;BA.debugLine="Type LoggedEntry (Date As String, Lat As Double,";
;
 //BA.debugLineNum = 34;BA.debugLine="Private lblLon As LoggedEntry";
mostCurrent._lbllon = new b4a.rocklogster.main._loggedentry();
 //BA.debugLineNum = 35;BA.debugLine="Public lblpnlrock As Label";
mostCurrent._lblpnlrock = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 36;BA.debugLine="Dim lblSpeed As Label";
mostCurrent._lblspeed = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 37;BA.debugLine="Dim lblSatellites As Label";
mostCurrent._lblsatellites = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 38;BA.debugLine="Private btnRock As Button";
mostCurrent._btnrock = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 39;BA.debugLine="Private btnWeed As Button";
mostCurrent._btnweed = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 40;BA.debugLine="Private editxt As EditText";
mostCurrent._editxt = new anywheresoftware.b4a.objects.EditTextWrapper();
 //BA.debugLineNum = 41;BA.debugLine="Private lblSatIndicator As Label";
mostCurrent._lblsatindicator = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 42;BA.debugLine="Private STime As Double";
_stime = 0;
 //BA.debugLineNum = 43;BA.debugLine="Private SLong As String";
mostCurrent._slong = "";
 //BA.debugLineNum = 44;BA.debugLine="Private SLat As String";
mostCurrent._slat = "";
 //BA.debugLineNum = 45;BA.debugLine="Private BtnDownTime As Double";
_btndowntime = 0;
 //BA.debugLineNum = 46;BA.debugLine="Private BtnUpTime As Double";
_btnuptime = 0;
 //BA.debugLineNum = 47;BA.debugLine="Public FLong As String";
mostCurrent._flong = "";
 //BA.debugLineNum = 48;BA.debugLine="Public FLat As String";
mostCurrent._flat = "";
 //BA.debugLineNum = 49;BA.debugLine="Public FTime As Double";
_ftime = 0;
 //BA.debugLineNum = 51;BA.debugLine="Public FileStringBuilder As StringBuilder";
mostCurrent._filestringbuilder = new anywheresoftware.b4a.keywords.StringBuilderWrapper();
 //BA.debugLineNum = 52;BA.debugLine="Public EstimatorStringBuilder As StringBuilder";
mostCurrent._estimatorstringbuilder = new anywheresoftware.b4a.keywords.StringBuilderWrapper();
 //BA.debugLineNum = 53;BA.debugLine="Public FileString As String";
mostCurrent._filestring = "";
 //BA.debugLineNum = 54;BA.debugLine="Private FileList As List";
mostCurrent._filelist = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 55;BA.debugLine="Public DelayedSat As Boolean";
_delayedsat = false;
 //BA.debugLineNum = 56;BA.debugLine="Public lbl2secwarn As Label";
mostCurrent._lbl2secwarn = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 57;BA.debugLine="Public EstimatorString As String";
mostCurrent._estimatorstring = "";
 //BA.debugLineNum = 58;BA.debugLine="Private pnlrock As Panel";
mostCurrent._pnlrock = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 59;BA.debugLine="Private lblpnlpoint As Label";
mostCurrent._lblpnlpoint = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 60;BA.debugLine="Private lblpnlweed As Label";
mostCurrent._lblpnlweed = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 61;BA.debugLine="Private rp As RuntimePermissions";
mostCurrent._rp = new anywheresoftware.b4a.objects.RuntimePermissions();
 //BA.debugLineNum = 62;BA.debugLine="Dim cust2 As LoggedEntry";
mostCurrent._cust2 = new b4a.rocklogster.main._loggedentry();
 //BA.debugLineNum = 63;BA.debugLine="Dim raf2 As B4XSerializator";
mostCurrent._raf2 = new anywheresoftware.b4a.randomaccessfile.B4XSerializator();
 //BA.debugLineNum = 64;BA.debugLine="Dim cust2list As List";
mostCurrent._cust2list = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 65;BA.debugLine="Private printbut As Button";
mostCurrent._printbut = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 66;BA.debugLine="Private savebut As Button";
mostCurrent._savebut = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 68;BA.debugLine="Private ButDownTime As Long";
_butdowntime = 0L;
 //BA.debugLineNum = 69;BA.debugLine="Private ButUpTime As Long";
_butuptime = 0L;
 //BA.debugLineNum = 70;BA.debugLine="Private LocDown As Location";
mostCurrent._locdown = new anywheresoftware.b4a.gps.LocationWrapper();
 //BA.debugLineNum = 71;BA.debugLine="Private LocUp As Location";
mostCurrent._locup = new anywheresoftware.b4a.gps.LocationWrapper();
 //BA.debugLineNum = 72;BA.debugLine="Public ELong As Double";
_elong = 0;
 //BA.debugLineNum = 73;BA.debugLine="Public ELat As Double";
_elat = 0;
 //BA.debugLineNum = 77;BA.debugLine="Public paneldowncomplete As Boolean";
_paneldowncomplete = false;
 //BA.debugLineNum = 79;BA.debugLine="Private butviewmap As Button";
mostCurrent._butviewmap = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 80;BA.debugLine="Private lblpnlcust As Label";
mostCurrent._lblpnlcust = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 81;BA.debugLine="End Sub";
return "";
}
public static String  _gpsstatus(anywheresoftware.b4a.objects.collections.List _satellites) throws Exception{
 //BA.debugLineNum = 220;BA.debugLine="Public Sub GpsStatus (Satellites As List)";
 //BA.debugLineNum = 231;BA.debugLine="End Sub";
return "";
}
public static String  _locationchanged(anywheresoftware.b4a.gps.LocationWrapper _location1) throws Exception{
 //BA.debugLineNum = 232;BA.debugLine="Public Sub LocationChanged(Location1 As Location)";
 //BA.debugLineNum = 236;BA.debugLine="lblSatIndicator.Color = 0xff7fff00";
mostCurrent._lblsatindicator.setColor((int) (0xff7fff00));
 //BA.debugLineNum = 237;BA.debugLine="End Sub";
return "";
}
public static void  _panel_down() throws Exception{
ResumableSub_Panel_down rsub = new ResumableSub_Panel_down(null);
rsub.resume(processBA, null);
}
public static class ResumableSub_Panel_down extends BA.ResumableSub {
public ResumableSub_Panel_down(b4a.rocklogster.main parent) {
this.parent = parent;
}
b4a.rocklogster.main parent;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 254;BA.debugLine="ButDownTime = DateTime.Now";
parent._butdowntime = anywheresoftware.b4a.keywords.Common.DateTime.getNow();
 //BA.debugLineNum = 255;BA.debugLine="paneldowncomplete = False";
parent._paneldowncomplete = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 256;BA.debugLine="Do While Starter.ValidGPS = False";
if (true) break;

case 1:
//do while
this.state = 4;
while (parent.mostCurrent._starter._validgps /*boolean*/ ==anywheresoftware.b4a.keywords.Common.False) {
this.state = 3;
if (true) break;
}
if (true) break;

case 3:
//C
this.state = 1;
 //BA.debugLineNum = 257;BA.debugLine="Sleep (100)";
anywheresoftware.b4a.keywords.Common.Sleep(mostCurrent.activityBA,this,(int) (100));
this.state = 5;
return;
case 5:
//C
this.state = 1;
;
 if (true) break;

case 4:
//C
this.state = -1;
;
 //BA.debugLineNum = 260;BA.debugLine="LocDown = Starter.Location2";
parent.mostCurrent._locdown = parent.mostCurrent._starter._location2 /*anywheresoftware.b4a.gps.LocationWrapper*/ ;
 //BA.debugLineNum = 261;BA.debugLine="paneldowncomplete = True";
parent._paneldowncomplete = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 265;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public static void  _panel_up(String _obstacle) throws Exception{
ResumableSub_Panel_up rsub = new ResumableSub_Panel_up(null,_obstacle);
rsub.resume(processBA, null);
}
public static class ResumableSub_Panel_up extends BA.ResumableSub {
public ResumableSub_Panel_up(b4a.rocklogster.main parent,String _obstacle) {
this.parent = parent;
this._obstacle = _obstacle;
}
b4a.rocklogster.main parent;
String _obstacle;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 267;BA.debugLine="ButUpTime = DateTime.Now";
parent._butuptime = anywheresoftware.b4a.keywords.Common.DateTime.getNow();
 //BA.debugLineNum = 268;BA.debugLine="Log(\"panelup\")";
anywheresoftware.b4a.keywords.Common.LogImpl("7720898","panelup",0);
 //BA.debugLineNum = 269;BA.debugLine="Do While Starter.ValidGPS = False Or paneldowncom";
if (true) break;

case 1:
//do while
this.state = 4;
while (parent.mostCurrent._starter._validgps /*boolean*/ ==anywheresoftware.b4a.keywords.Common.False || parent._paneldowncomplete==anywheresoftware.b4a.keywords.Common.False) {
this.state = 3;
if (true) break;
}
if (true) break;

case 3:
//C
this.state = 1;
 //BA.debugLineNum = 270;BA.debugLine="Sleep (200)";
anywheresoftware.b4a.keywords.Common.Sleep(mostCurrent.activityBA,this,(int) (200));
this.state = 8;
return;
case 8:
//C
this.state = 1;
;
 if (true) break;
;
 //BA.debugLineNum = 272;BA.debugLine="If (ButUpTime - LocDown.Time < 2000) And (ButUpTi";

case 4:
//if
this.state = 7;
if ((parent._butuptime-parent.mostCurrent._locdown.getTime()<2000) && (parent._butuptime-parent._butdowntime>500)) { 
this.state = 6;
}if (true) break;

case 6:
//C
this.state = 7;
 //BA.debugLineNum = 273;BA.debugLine="lbl2secwarn.Visible = True";
parent.mostCurrent._lbl2secwarn.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 274;BA.debugLine="Sleep (2000)";
anywheresoftware.b4a.keywords.Common.Sleep(mostCurrent.activityBA,this,(int) (2000));
this.state = 9;
return;
case 9:
//C
this.state = 7;
;
 //BA.debugLineNum = 275;BA.debugLine="lbl2secwarn.Visible = False";
parent.mostCurrent._lbl2secwarn.setVisible(anywheresoftware.b4a.keywords.Common.False);
 if (true) break;

case 7:
//C
this.state = -1;
;
 //BA.debugLineNum = 278;BA.debugLine="LocUp = Starter.Location2";
parent.mostCurrent._locup = parent.mostCurrent._starter._location2 /*anywheresoftware.b4a.gps.LocationWrapper*/ ;
 //BA.debugLineNum = 279;BA.debugLine="Estimator(obstacle)";
_estimator(_obstacle);
 //BA.debugLineNum = 280;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public static String  _pnlcust_touch(int _action,float _x,float _y) throws Exception{
int _i = 0;
 //BA.debugLineNum = 394;BA.debugLine="Sub pnlcust_Touch (Action As Int, X As Float, Y As";
 //BA.debugLineNum = 395;BA.debugLine="Select Action";
switch (BA.switchObjectToInt(_action,mostCurrent._activity.ACTION_DOWN,mostCurrent._activity.ACTION_UP,mostCurrent._activity.ACTION_MOVE)) {
case 0: {
 //BA.debugLineNum = 398;BA.debugLine="Panel_down";
_panel_down();
 //BA.debugLineNum = 399;BA.debugLine="For i = 0 To headerlist.Size - 1";
{
final int step4 = 1;
final int limit4 = (int) (_headerlist.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit4 ;_i = _i + step4 ) {
 //BA.debugLineNum = 400;BA.debugLine="If headerlist.Get(i) <> \"Rocks\" Then";
if ((_headerlist.Get(_i)).equals((Object)("Rocks")) == false) { 
 //BA.debugLineNum = 401;BA.debugLine="If headerlist.Get(i) <> \"Weed\" Then";
if ((_headerlist.Get(_i)).equals((Object)("Weed")) == false) { 
 //BA.debugLineNum = 402;BA.debugLine="If headerlist.Get(i) <> \"Point\" Then";
if ((_headerlist.Get(_i)).equals((Object)("Point")) == false) { 
 //BA.debugLineNum = 403;BA.debugLine="lblpnlcust.Text = headerlist.Get(i)";
mostCurrent._lblpnlcust.setText(BA.ObjectToCharSequence(_headerlist.Get(_i)));
 //BA.debugLineNum = 404;BA.debugLine="Exit";
if (true) break;
 };
 };
 };
 }
};
 break; }
case 1: {
 //BA.debugLineNum = 412;BA.debugLine="Panel_up(lblpnlcust.text)";
_panel_up(mostCurrent._lblpnlcust.getText());
 break; }
case 2: {
 break; }
}
;
 //BA.debugLineNum = 417;BA.debugLine="End Sub";
return "";
}
public static String  _pnlpoint_touch(int _action,float _x,float _y) throws Exception{
 //BA.debugLineNum = 349;BA.debugLine="Sub pnlpoint_Touch (Action As Int, X As Float, Y A";
 //BA.debugLineNum = 350;BA.debugLine="Select Action";
switch (BA.switchObjectToInt(_action,mostCurrent._activity.ACTION_DOWN,mostCurrent._activity.ACTION_UP,mostCurrent._activity.ACTION_MOVE)) {
case 0: {
 //BA.debugLineNum = 352;BA.debugLine="lblpnlpoint.Color = 0xFF68320d";
mostCurrent._lblpnlpoint.setColor((int) (0xff68320d));
 //BA.debugLineNum = 353;BA.debugLine="Panel_down";
_panel_down();
 break; }
case 1: {
 //BA.debugLineNum = 356;BA.debugLine="lblpnlpoint.Color = 0xff8b4513";
mostCurrent._lblpnlpoint.setColor((int) (0xff8b4513));
 //BA.debugLineNum = 358;BA.debugLine="Panel_up(\"Point\")";
_panel_up("Point");
 break; }
case 2: {
 break; }
}
;
 //BA.debugLineNum = 363;BA.debugLine="End Sub";
return "";
}
public static String  _pnlrock_touch(int _action,float _x,float _y) throws Exception{
 //BA.debugLineNum = 238;BA.debugLine="Sub pnlrock_touch(ACTION As Int,X As Float,Y As Fl";
 //BA.debugLineNum = 239;BA.debugLine="Select ACTION";
switch (BA.switchObjectToInt(_action,mostCurrent._activity.ACTION_DOWN,mostCurrent._activity.ACTION_UP,mostCurrent._activity.ACTION_MOVE)) {
case 0: {
 //BA.debugLineNum = 241;BA.debugLine="lblpnlrock.Color = 0xFFDEB887";
mostCurrent._lblpnlrock.setColor((int) (0xffdeb887));
 //BA.debugLineNum = 242;BA.debugLine="Panel_down";
_panel_down();
 break; }
case 1: {
 //BA.debugLineNum = 246;BA.debugLine="lblpnlrock.Color = 0xFFFFEBCD";
mostCurrent._lblpnlrock.setColor((int) (0xffffebcd));
 //BA.debugLineNum = 247;BA.debugLine="Panel_up(\"Rocks\")";
_panel_up("Rocks");
 break; }
case 2: {
 break; }
}
;
 //BA.debugLineNum = 252;BA.debugLine="End Sub";
return "";
}
public static String  _pnlweed_touch(int _action,float _x,float _y) throws Exception{
 //BA.debugLineNum = 333;BA.debugLine="Sub pnlweed_Touch (Action As Int, X As Float, Y As";
 //BA.debugLineNum = 334;BA.debugLine="Select Action";
switch (BA.switchObjectToInt(_action,mostCurrent._activity.ACTION_DOWN,mostCurrent._activity.ACTION_UP,mostCurrent._activity.ACTION_MOVE)) {
case 0: {
 //BA.debugLineNum = 336;BA.debugLine="lblpnlweed.Color = 0xFF61c800";
mostCurrent._lblpnlweed.setColor((int) (0xff61c800));
 //BA.debugLineNum = 337;BA.debugLine="Panel_down";
_panel_down();
 break; }
case 1: {
 //BA.debugLineNum = 340;BA.debugLine="lblpnlweed.Color = 0xFF7cfc00";
mostCurrent._lblpnlweed.setColor((int) (0xff7cfc00));
 //BA.debugLineNum = 342;BA.debugLine="Panel_up(\"Weed\")";
_panel_up("Weed");
 break; }
case 2: {
 break; }
}
;
 //BA.debugLineNum = 347;BA.debugLine="End Sub";
return "";
}
public static String  _print_rocks() throws Exception{
anywheresoftware.b4a.keywords.StringBuilderWrapper _sb = null;
int _i = 0;
 //BA.debugLineNum = 109;BA.debugLine="Sub Print_rocks";
 //BA.debugLineNum = 111;BA.debugLine="Private sb As StringBuilder";
_sb = new anywheresoftware.b4a.keywords.StringBuilderWrapper();
 //BA.debugLineNum = 112;BA.debugLine="sb.Initialize";
_sb.Initialize();
 //BA.debugLineNum = 113;BA.debugLine="sb.append(DateTime.Date(DateTime.Now))'.Append(CR";
_sb.Append(anywheresoftware.b4a.keywords.Common.DateTime.Date(anywheresoftware.b4a.keywords.Common.DateTime.getNow()));
 //BA.debugLineNum = 115;BA.debugLine="If headerlist.Size >0 Then";
if (_headerlist.getSize()>0) { 
 //BA.debugLineNum = 117;BA.debugLine="For i = 0 To headerlist.Size - 1";
{
final int step5 = 1;
final int limit5 = (int) (_headerlist.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit5 ;_i = _i + step5 ) {
 //BA.debugLineNum = 118;BA.debugLine="sb.Append(CRLF).Append(headerlist.get(i))'.Appe";
_sb.Append(anywheresoftware.b4a.keywords.Common.CRLF).Append(BA.ObjectToString(_headerlist.Get(_i)));
 //BA.debugLineNum = 119;BA.debugLine="sb.Append(CRLF).Append(locationstringlist.get(i";
_sb.Append(anywheresoftware.b4a.keywords.Common.CRLF).Append(BA.ObjectToString(_locationstringlist.Get((int) (_i+1))));
 }
};
 };
 //BA.debugLineNum = 131;BA.debugLine="updateclick = False 'flag";
_updateclick = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 132;BA.debugLine="editxt.Text = (sb.ToString)";
mostCurrent._editxt.setText(BA.ObjectToCharSequence((_sb.ToString())));
 //BA.debugLineNum = 133;BA.debugLine="End Sub";
return "";
}
public static String  _printbut_click() throws Exception{
 //BA.debugLineNum = 372;BA.debugLine="Sub printbut_Click";
 //BA.debugLineNum = 373;BA.debugLine="editxt.RequestFocus";
mostCurrent._editxt.RequestFocus();
 //BA.debugLineNum = 374;BA.debugLine="editxt.SelectAll";
mostCurrent._editxt.SelectAll();
 //BA.debugLineNum = 376;BA.debugLine="End Sub";
return "";
}

public static void initializeProcessGlobals() {
    
    if (main.processGlobalsRun == false) {
	    main.processGlobalsRun = true;
		try {
		        main._process_globals();
starter._process_globals();
mapmod._process_globals();
		
        } catch (Exception e) {
			throw new RuntimeException(e);
		}
    }
}public static String  _process_globals() throws Exception{
 //BA.debugLineNum = 10;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 11;BA.debugLine="Public updateclick As Boolean";
_updateclick = false;
 //BA.debugLineNum = 12;BA.debugLine="Public RockList As List";
_rocklist = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 13;BA.debugLine="Public WeedList As List";
_weedlist = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 14;BA.debugLine="Public PointList As List";
_pointlist = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 15;BA.debugLine="Dim headerlist As List";
_headerlist = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 16;BA.debugLine="Public locationstringlist As List";
_locationstringlist = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 17;BA.debugLine="Public headerposition As Map";
_headerposition = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 19;BA.debugLine="End Sub";
return "";
}
public static String  _savebut_click() throws Exception{
 //BA.debugLineNum = 365;BA.debugLine="Sub savebut_Click";
 //BA.debugLineNum = 366;BA.debugLine="If File.Exists(rp.GetSafeDirdefaultExternal(\"\"),";
if (anywheresoftware.b4a.keywords.Common.File.Exists(mostCurrent._rp.GetSafeDirDefaultExternal(""),"Editxt.txt")) { 
 //BA.debugLineNum = 367;BA.debugLine="editxt.text = File.Readstring(rp.GetSafeDirDefaul";
mostCurrent._editxt.setText(BA.ObjectToCharSequence(anywheresoftware.b4a.keywords.Common.File.ReadString(mostCurrent._rp.GetSafeDirDefaultExternal(""),"editxt.txt")));
 };
 //BA.debugLineNum = 369;BA.debugLine="convert_texttolists";
_convert_texttolists();
 //BA.debugLineNum = 370;BA.debugLine="End Sub";
return "";
}
public static String  _updatebtn_click() throws Exception{
 //BA.debugLineNum = 386;BA.debugLine="Sub Updatebtn_Click";
 //BA.debugLineNum = 388;BA.debugLine="convert_texttolists";
_convert_texttolists();
 //BA.debugLineNum = 392;BA.debugLine="End Sub";
return "";
}
}
