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 mapmod extends Activity implements B4AActivity{
	public static mapmod 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.mapmod");
			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 (mapmod).");
				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.mapmod");
        
        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.mapmod", processBA, activityBA, _activity, anywheresoftware.b4a.keywords.Common.Density, mostCurrent);
			_activity.reinitializeForShell(activityBA, "activity");
		}
        initializeProcessGlobals();		
        initializeGlobals();
        
        BA.LogInfo("** Activity (mapmod) Create, isFirst = " + isFirst + " **");
        processBA.raiseEvent2(null, true, "activity_create", false, isFirst);
		isFirst = false;
		if (this != mostCurrent)
			return;
        processBA.setActivityPaused(false);
        BA.LogInfo("** Activity (mapmod) 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 mapmod.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 (mapmod) Pause, UserClosed = " + activityBA.activity.isFinishing() + " **");
        else
            BA.LogInfo("** Activity (mapmod) 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() {
            mapmod mc = mostCurrent;
			if (mc == null || mc != activity.get())
				return;
			processBA.setActivityPaused(false);
            BA.LogInfo("** Activity (mapmod) 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 anywheresoftware.b4a.objects.RuntimePermissions _rp = null;
public anywheresoftware.b4a.objects.MapFragmentWrapper.GoogleMapWrapper _gmap = null;
public anywheresoftware.b4a.objects.MapFragmentWrapper _mapfragment1 = null;
public anywheresoftware.b4a.objects.MapFragmentWrapper.CameraPositionWrapper _centerloc = null;
public anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper _bmp = null;
public uk.co.martinpearman.b4a.googlemapsextras.GoogleMapsExtras _gmapx = null;
public b4a.rocklogster.main _main = null;
public b4a.rocklogster.starter _starter = null;

public static void initializeProcessGlobals() {
             try {
                Class.forName(BA.applicationContext.getPackageName() + ".main").getMethod("initializeProcessGlobals").invoke(null, null);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
}
public static void  _activity_create(boolean _firsttime) throws Exception{
ResumableSub_Activity_Create rsub = new ResumableSub_Activity_Create(null,_firsttime);
rsub.resume(processBA, null);
}
public static class ResumableSub_Activity_Create extends BA.ResumableSub {
public ResumableSub_Activity_Create(b4a.rocklogster.mapmod parent,boolean _firsttime) {
this.parent = parent;
this._firsttime = _firsttime;
}
b4a.rocklogster.mapmod parent;
boolean _firsttime;
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 = 21;BA.debugLine="Activity.LoadLayout(\"mapfrag\")";
parent.mostCurrent._activity.LoadLayout("mapfrag",mostCurrent.activityBA);
 //BA.debugLineNum = 22;BA.debugLine="bmp = LoadBitmapResize(File.DirAssets, \"marker2.p";
parent.mostCurrent._bmp = anywheresoftware.b4a.keywords.Common.LoadBitmapResize(anywheresoftware.b4a.keywords.Common.File.getDirAssets(),"marker2.png",anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (20)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (20)),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 23;BA.debugLine="Wait For MapFragment1_Ready";
anywheresoftware.b4a.keywords.Common.WaitFor("mapfragment1_ready", processBA, this, null);
this.state = 7;
return;
case 7:
//C
this.state = 1;
;
 //BA.debugLineNum = 24;BA.debugLine="gmap = MapFragment1.GetMap";
parent.mostCurrent._gmap = parent.mostCurrent._mapfragment1.GetMap();
 //BA.debugLineNum = 25;BA.debugLine="rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCA";
parent._rp.CheckAndRequest(processBA,parent._rp.PERMISSION_ACCESS_FINE_LOCATION);
 //BA.debugLineNum = 26;BA.debugLine="Wait For Activity_PermissionResult (Permission As";
anywheresoftware.b4a.keywords.Common.WaitFor("activity_permissionresult", processBA, this, null);
this.state = 8;
return;
case 8:
//C
this.state = 1;
_permission = (String) result[0];
_result = (Boolean) result[1];
;
 //BA.debugLineNum = 27;BA.debugLine="If Result Then";
if (true) break;

case 1:
//if
this.state = 6;
if (_result) { 
this.state = 3;
}else {
this.state = 5;
}if (true) break;

case 3:
//C
this.state = 6;
 //BA.debugLineNum = 28;BA.debugLine="gmap.MyLocationEnabled = True";
parent.mostCurrent._gmap.setMyLocationEnabled(anywheresoftware.b4a.keywords.Common.True);
 if (true) break;

case 5:
//C
this.state = 6;
 //BA.debugLineNum = 30;BA.debugLine="Log(\"No permission!\")";
anywheresoftware.b4a.keywords.Common.LogImpl("71835019","No permission!",0);
 if (true) break;

case 6:
//C
this.state = -1;
;
 //BA.debugLineNum = 34;BA.debugLine="add_line";
_add_line();
 //BA.debugLineNum = 36;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public static void  _mapfragment1_ready() throws Exception{
}
public static void  _activity_permissionresult(String _permission,boolean _result) throws Exception{
}
public static String  _activity_pause(boolean _userclosed) throws Exception{
 //BA.debugLineNum = 127;BA.debugLine="Sub Activity_Pause (UserClosed As Boolean)";
 //BA.debugLineNum = 129;BA.debugLine="End Sub";
return "";
}
public static String  _activity_resume() throws Exception{
 //BA.debugLineNum = 122;BA.debugLine="Sub Activity_Resume";
 //BA.debugLineNum = 124;BA.debugLine="matchingsub";
_matchingsub();
 //BA.debugLineNum = 125;BA.debugLine="End Sub";
return "";
}
public static String  _add_line() throws Exception{
anywheresoftware.b4a.objects.MapFragmentWrapper.PolylineWrapper _line = null;
anywheresoftware.b4a.objects.collections.List _points = null;
anywheresoftware.b4a.objects.MapFragmentWrapper.LatLngWrapper _point = null;
uk.co.martinpearman.b4a.com.google.android.gms.maps.model.GroundOverlayOptions _grpvop = null;
uk.co.martinpearman.b4a.com.google.android.gms.maps.model.GroundOverlay _grov = null;
anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper _overlay4 = null;
anywheresoftware.b4a.objects.MapFragmentWrapper.LatLngWrapper _centr = null;
 //BA.debugLineNum = 78;BA.debugLine="Sub add_line";
 //BA.debugLineNum = 79;BA.debugLine="Dim line As Polyline";
_line = new anywheresoftware.b4a.objects.MapFragmentWrapper.PolylineWrapper();
 //BA.debugLineNum = 80;BA.debugLine="Dim points As List";
_points = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 81;BA.debugLine="Dim point As LatLng";
_point = new anywheresoftware.b4a.objects.MapFragmentWrapper.LatLngWrapper();
 //BA.debugLineNum = 82;BA.debugLine="Dim grpvop As GroundOverlayOptions";
_grpvop = new uk.co.martinpearman.b4a.com.google.android.gms.maps.model.GroundOverlayOptions();
 //BA.debugLineNum = 83;BA.debugLine="Dim grov As GroundOverlay";
_grov = new uk.co.martinpearman.b4a.com.google.android.gms.maps.model.GroundOverlay();
 //BA.debugLineNum = 84;BA.debugLine="Dim overlay4 As Bitmap";
_overlay4 = new anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper();
 //BA.debugLineNum = 85;BA.debugLine="Dim centr As LatLng";
_centr = new anywheresoftware.b4a.objects.MapFragmentWrapper.LatLngWrapper();
 //BA.debugLineNum = 86;BA.debugLine="grpvop.Initialize";
_grpvop.Initialize();
 //BA.debugLineNum = 87;BA.debugLine="overlay4 = LoadBitmap(File.DirAssets, \"overlaywhi";
_overlay4 = anywheresoftware.b4a.keywords.Common.LoadBitmap(anywheresoftware.b4a.keywords.Common.File.getDirAssets(),"overlaywhite.png");
 //BA.debugLineNum = 88;BA.debugLine="grpvop.Image(overlay4)";
_grpvop.Image((android.graphics.Bitmap)(_overlay4.getObject()));
 //BA.debugLineNum = 89;BA.debugLine="centr.Initialize(-32.6972,118.1908)";
_centr.Initialize(-32.6972,118.1908);
 //BA.debugLineNum = 90;BA.debugLine="grpvop.Position(centr,29000,16000)";
_grpvop.Position((com.google.android.gms.maps.model.LatLng)(_centr.getObject()),(float) (29000),(float) (16000));
 //BA.debugLineNum = 91;BA.debugLine="grpvop.SetTransparency(.5)";
_grpvop.SetTransparency((float) (.5));
 //BA.debugLineNum = 93;BA.debugLine="gmapx.AddGroundOverlay(gmap,grpvop)";
mostCurrent._gmapx.AddGroundOverlay((com.google.android.gms.maps.GoogleMap)(mostCurrent._gmap.getObject()),(com.google.android.gms.maps.model.GroundOverlayOptions)(_grpvop.getObject()));
 //BA.debugLineNum = 94;BA.debugLine="line=gmap.AddPolyline";
_line = mostCurrent._gmap.AddPolyline();
 //BA.debugLineNum = 95;BA.debugLine="points.Initialize";
_points.Initialize();
 //BA.debugLineNum = 97;BA.debugLine="line.Color=Colors.Red";
_line.setColor(anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 98;BA.debugLine="line.Visible=True";
_line.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 99;BA.debugLine="line.Width=2";
_line.setWidth((float) (2));
 //BA.debugLineNum = 100;BA.debugLine="point.Initialize(-32.6758, 118.1967)";
_point.Initialize(-32.6758,118.1967);
 //BA.debugLineNum = 101;BA.debugLine="points.Add(point)";
_points.Add((Object)(_point.getObject()));
 //BA.debugLineNum = 102;BA.debugLine="point.Initialize(-32.6757, 118.1756)";
_point.Initialize(-32.6757,118.1756);
 //BA.debugLineNum = 103;BA.debugLine="points.Add(point)";
_points.Add((Object)(_point.getObject()));
 //BA.debugLineNum = 104;BA.debugLine="point.Initialize(-32.6608, 118.1756)";
_point.Initialize(-32.6608,118.1756);
 //BA.debugLineNum = 105;BA.debugLine="points.Add(point)";
_points.Add((Object)(_point.getObject()));
 //BA.debugLineNum = 106;BA.debugLine="point.Initialize(-32.6564, 118.182)";
_point.Initialize(-32.6564,118.182);
 //BA.debugLineNum = 107;BA.debugLine="points.Add(point)";
_points.Add((Object)(_point.getObject()));
 //BA.debugLineNum = 108;BA.debugLine="point.Initialize(-32.6564, 118.1963)";
_point.Initialize(-32.6564,118.1963);
 //BA.debugLineNum = 109;BA.debugLine="points.Add(point)";
_points.Add((Object)(_point.getObject()));
 //BA.debugLineNum = 110;BA.debugLine="point.Initialize(-32.6758, 118.1967)";
_point.Initialize(-32.6758,118.1967);
 //BA.debugLineNum = 111;BA.debugLine="points.Add(point)";
_points.Add((Object)(_point.getObject()));
 //BA.debugLineNum = 112;BA.debugLine="line.Points=points";
_line.setPoints(_points);
 //BA.debugLineNum = 114;BA.debugLine="End Sub";
return "";
}
public static String  _button1_click() throws Exception{
 //BA.debugLineNum = 131;BA.debugLine="Sub button1_Click";
 //BA.debugLineNum = 132;BA.debugLine="StartActivity(Main)";
anywheresoftware.b4a.keywords.Common.StartActivity(processBA,(Object)(mostCurrent._main.getObject()));
 //BA.debugLineNum = 133;BA.debugLine="End Sub";
return "";
}
public static String  _globals() throws Exception{
 //BA.debugLineNum = 10;BA.debugLine="Sub Globals";
 //BA.debugLineNum = 11;BA.debugLine="Private gmap As GoogleMap";
mostCurrent._gmap = new anywheresoftware.b4a.objects.MapFragmentWrapper.GoogleMapWrapper();
 //BA.debugLineNum = 12;BA.debugLine="Private MapFragment1 As MapFragment";
mostCurrent._mapfragment1 = new anywheresoftware.b4a.objects.MapFragmentWrapper();
 //BA.debugLineNum = 13;BA.debugLine="Private centerloc As CameraPosition";
mostCurrent._centerloc = new anywheresoftware.b4a.objects.MapFragmentWrapper.CameraPositionWrapper();
 //BA.debugLineNum = 14;BA.debugLine="Private bmp As Bitmap";
mostCurrent._bmp = new anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper();
 //BA.debugLineNum = 15;BA.debugLine="Private gmapx As GoogleMapsExtras";
mostCurrent._gmapx = new uk.co.martinpearman.b4a.googlemapsextras.GoogleMapsExtras();
 //BA.debugLineNum = 17;BA.debugLine="End Sub";
return "";
}
public static String  _log_markers() throws Exception{
 //BA.debugLineNum = 38;BA.debugLine="Sub Log_Markers";
 //BA.debugLineNum = 42;BA.debugLine="End Sub";
return "";
}
public static String  _mapfragment1_click(anywheresoftware.b4a.objects.MapFragmentWrapper.LatLngWrapper _point) throws Exception{
 //BA.debugLineNum = 116;BA.debugLine="Sub MapFragment1_Click (Point As LatLng)";
 //BA.debugLineNum = 117;BA.debugLine="gmap.AddMarker(Point.Latitude, Point.Longitude, \"";
mostCurrent._gmap.AddMarker(_point.getLatitude(),_point.getLongitude(),"New Marker");
 //BA.debugLineNum = 118;BA.debugLine="Log(Point)";
anywheresoftware.b4a.keywords.Common.LogImpl("72097154",BA.ObjectToString(_point),0);
 //BA.debugLineNum = 120;BA.debugLine="End Sub";
return "";
}
public static void  _matchingsub() throws Exception{
ResumableSub_matchingsub rsub = new ResumableSub_matchingsub(null);
rsub.resume(processBA, null);
}
public static class ResumableSub_matchingsub extends BA.ResumableSub {
public ResumableSub_matchingsub(b4a.rocklogster.mapmod parent) {
this.parent = parent;
}
b4a.rocklogster.mapmod parent;
int _i = 0;
anywheresoftware.b4a.keywords.Regex.MatcherWrapper _m = null;
int step8;
int limit8;
int step10;
int limit10;

@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 = 45;BA.debugLine="Do Until MapFragment1.GetMap.IsInitialized 'necis";
if (true) break;

case 1:
//do until
this.state = 4;
while (!(parent.mostCurrent._mapfragment1.GetMap().IsInitialized())) {
this.state = 3;
if (true) break;
}
if (true) break;

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

case 4:
//C
this.state = 5;
;
 //BA.debugLineNum = 48;BA.debugLine="gmap.MapType = gmap.MAP_TYPE_SATELLITE";
parent.mostCurrent._gmap.setMapType(parent.mostCurrent._gmap.MAP_TYPE_SATELLITE);
 //BA.debugLineNum = 49;BA.debugLine="centerloc.initialize (-32.676910,118.211034,14)";
parent.mostCurrent._centerloc.Initialize(-32.676910,118.211034,(float) (14));
 //BA.debugLineNum = 50;BA.debugLine="gmap.MoveCamera(centerloc)";
parent.mostCurrent._gmap.MoveCamera((com.google.android.gms.maps.model.CameraPosition)(parent.mostCurrent._centerloc.getObject()));
 //BA.debugLineNum = 52;BA.debugLine="If Main.headerlist.Size >0 Then";
if (true) break;

case 5:
//if
this.state = 19;
if (parent.mostCurrent._main._headerlist /*anywheresoftware.b4a.objects.collections.List*/ .getSize()>0) { 
this.state = 7;
}if (true) break;

case 7:
//C
this.state = 8;
 //BA.debugLineNum = 53;BA.debugLine="For i = 0 To Main.headerlist.Size - 1";
if (true) break;

case 8:
//for
this.state = 11;
step8 = 1;
limit8 = (int) (parent.mostCurrent._main._headerlist /*anywheresoftware.b4a.objects.collections.List*/ .getSize()-1);
_i = (int) (0) ;
this.state = 21;
if (true) break;

case 21:
//C
this.state = 11;
if ((step8 > 0 && _i <= limit8) || (step8 < 0 && _i >= limit8)) this.state = 10;
if (true) break;

case 22:
//C
this.state = 21;
_i = ((int)(0 + _i + step8)) ;
if (true) break;

case 10:
//C
this.state = 22;
 if (true) break;
if (true) break;
;
 //BA.debugLineNum = 57;BA.debugLine="For i = 0 To Main.headerlist.size-1";

case 11:
//for
this.state = 18;
step10 = 1;
limit10 = (int) (parent.mostCurrent._main._headerlist /*anywheresoftware.b4a.objects.collections.List*/ .getSize()-1);
_i = (int) (0) ;
this.state = 23;
if (true) break;

case 23:
//C
this.state = 18;
if ((step10 > 0 && _i <= limit10) || (step10 < 0 && _i >= limit10)) this.state = 13;
if (true) break;

case 24:
//C
this.state = 23;
_i = ((int)(0 + _i + step10)) ;
if (true) break;

case 13:
//C
this.state = 14;
 //BA.debugLineNum = 58;BA.debugLine="Dim m As Matcher =Regex.Matcher(\",(.+?) (.+?),\",";
_m = new anywheresoftware.b4a.keywords.Regex.MatcherWrapper();
_m = anywheresoftware.b4a.keywords.Common.Regex.Matcher(",(.+?) (.+?),",BA.ObjectToString(parent.mostCurrent._main._locationstringlist /*anywheresoftware.b4a.objects.collections.List*/ .Get((int) (_i+1))));
 //BA.debugLineNum = 59;BA.debugLine="Do While m.Find";
if (true) break;

case 14:
//do while
this.state = 17;
while (_m.Find()) {
this.state = 16;
if (true) break;
}
if (true) break;

case 16:
//C
this.state = 14;
 //BA.debugLineNum = 60;BA.debugLine="gmap.AddMarker3(m.group(1),m.group(2),Main.heade";
parent.mostCurrent._gmap.AddMarker3((double)(Double.parseDouble(_m.Group((int) (1)))),(double)(Double.parseDouble(_m.Group((int) (2)))),BA.ObjectToString(parent.mostCurrent._main._headerlist /*anywheresoftware.b4a.objects.collections.List*/ .Get(_i)),(android.graphics.Bitmap)(parent.mostCurrent._bmp.getObject()));
 if (true) break;

case 17:
//C
this.state = 24;
;
 if (true) break;
if (true) break;

case 18:
//C
this.state = 19;
;
 if (true) break;

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

            }
        }
    }
}
public static String  _process_globals() throws Exception{
 //BA.debugLineNum = 6;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 7;BA.debugLine="Private rp As RuntimePermissions";
_rp = new anywheresoftware.b4a.objects.RuntimePermissions();
 //BA.debugLineNum = 8;BA.debugLine="End Sub";
return "";
}
}
