package com.merosee.bustrack.driver;


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, "com.merosee.bustrack.driver", "com.merosee.bustrack.driver.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, "com.merosee.bustrack.driver", "com.merosee.bustrack.driver.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, "com.merosee.bustrack.driver.main", processBA, activityBA, _activity, anywheresoftware.b4a.keywords.Common.Density, mostCurrent);
			_activity.reinitializeForShell(activityBA, "activity");
		}
        initializeProcessGlobals();		
        initializeGlobals();
        
        BA.LogInfo("** Activity (main) Create " + (isFirst ? "(first time)" : "") + " **");
        processBA.raiseEvent2(null, true, "activity_create", false, isFirst);
		isFirst = false;
		if (this != mostCurrent)
			return;
        processBA.setActivityPaused(false);
        BA.LogInfo("** Activity (main) Resume **");
        processBA.raiseEvent(null, "activity_resume");
        if (android.os.Build.VERSION.SDK_INT >= 11) {
			try {
				android.app.Activity.class.getMethod("invalidateOptionsMenu").invoke(this,(Object[]) null);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

	}
	public void addMenuItem(B4AMenuItem item) {
		if (menuItems == null)
			menuItems = new java.util.ArrayList<B4AMenuItem>();
		menuItems.add(item);
	}
	@Override
	public boolean onCreateOptionsMenu(android.view.Menu menu) {
		super.onCreateOptionsMenu(menu);
        try {
            if (processBA.subExists("activity_actionbarhomeclick")) {
                Class.forName("android.app.ActionBar").getMethod("setHomeButtonEnabled", boolean.class).invoke(
                    getClass().getMethod("getActionBar").invoke(this), true);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (processBA.runHook("oncreateoptionsmenu", this, new Object[] {menu}))
            return true;
		if (menuItems == null)
			return false;
		for (B4AMenuItem bmi : menuItems) {
			android.view.MenuItem mi = menu.add(bmi.title);
			if (bmi.drawable != null)
				mi.setIcon(bmi.drawable);
            if (android.os.Build.VERSION.SDK_INT >= 11) {
				try {
                    if (bmi.addToBar) {
				        android.view.MenuItem.class.getMethod("setShowAsAction", int.class).invoke(mi, 1);
                    }
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			mi.setOnMenuItemClickListener(new B4AMenuItemsClickListener(bmi.eventName.toLowerCase(BA.cul)));
		}
        
		return true;
	}   
 @Override
 public boolean onOptionsItemSelected(android.view.MenuItem item) {
    if (item.getItemId() == 16908332) {
        processBA.raiseEvent(null, "activity_actionbarhomeclick");
        return true;
    }
    else
        return super.onOptionsItemSelected(item); 
}
@Override
 public boolean onPrepareOptionsMenu(android.view.Menu menu) {
    super.onPrepareOptionsMenu(menu);
    processBA.runHook("onprepareoptionsmenu", this, new Object[] {menu});
    return true;
    
 }
 protected void onStart() {
    super.onStart();
    processBA.runHook("onstart", this, null);
}
 protected void onStop() {
    super.onStop();
    processBA.runHook("onstop", this, null);
}
    public void onWindowFocusChanged(boolean hasFocus) {
       super.onWindowFocusChanged(hasFocus);
       if (processBA.subExists("activity_windowfocuschanged"))
           processBA.raiseEvent2(null, true, "activity_windowfocuschanged", false, hasFocus);
    }
	private class B4AMenuItemsClickListener implements android.view.MenuItem.OnMenuItemClickListener {
		private final String eventName;
		public B4AMenuItemsClickListener(String eventName) {
			this.eventName = eventName;
		}
		public boolean onMenuItemClick(android.view.MenuItem item) {
			processBA.raiseEventFromUI(item.getTitle(), eventName + "_click");
			return true;
		}
	}
    public static Class<?> getObject() {
		return main.class;
	}
    private Boolean onKeySubExist = null;
    private Boolean onKeyUpSubExist = null;
	@Override
	public boolean onKeyDown(int keyCode, android.view.KeyEvent event) {
        if (processBA.runHook("onkeydown", this, new Object[] {keyCode, event}))
            return true;
		if (onKeySubExist == null)
			onKeySubExist = processBA.subExists("activity_keypress");
		if (onKeySubExist) {
			if (keyCode == anywheresoftware.b4a.keywords.constants.KeyCodes.KEYCODE_BACK &&
					android.os.Build.VERSION.SDK_INT >= 18) {
				HandleKeyDelayed hk = new HandleKeyDelayed();
				hk.kc = keyCode;
				BA.handler.post(hk);
				return true;
			}
			else {
				boolean res = new HandleKeyDelayed().runDirectly(keyCode);
				if (res)
					return true;
			}
		}
		return super.onKeyDown(keyCode, event);
	}
	private class HandleKeyDelayed implements Runnable {
		int kc;
		public void run() {
			runDirectly(kc);
		}
		public boolean runDirectly(int keyCode) {
			Boolean res =  (Boolean)processBA.raiseEvent2(_activity, false, "activity_keypress", false, keyCode);
			if (res == null || res == true) {
                return true;
            }
            else if (keyCode == anywheresoftware.b4a.keywords.constants.KeyCodes.KEYCODE_BACK) {
				finish();
				return true;
			}
            return false;
		}
		
	}
    @Override
	public boolean onKeyUp(int keyCode, android.view.KeyEvent event) {
        if (processBA.runHook("onkeyup", this, new Object[] {keyCode, event}))
            return true;
		if (onKeyUpSubExist == null)
			onKeyUpSubExist = processBA.subExists("activity_keyup");
		if (onKeyUpSubExist) {
			Boolean res =  (Boolean)processBA.raiseEvent2(_activity, false, "activity_keyup", false, keyCode);
			if (res == null || res == true)
				return true;
		}
		return super.onKeyUp(keyCode, event);
	}
	@Override
	public void onNewIntent(android.content.Intent intent) {
        super.onNewIntent(intent);
		this.setIntent(intent);
        processBA.runHook("onnewintent", this, new Object[] {intent});
	}
    @Override 
	public void onPause() {
		super.onPause();
        if (_activity == null)
            return;
        if (this != mostCurrent)
			return;
		anywheresoftware.b4a.Msgbox.dismiss(true);
        if (!dontPause)
            BA.LogInfo("** Activity (main) Pause, UserClosed = " + activityBA.activity.isFinishing() + " **");
        else
            BA.LogInfo("** Activity (main) Pause event (activity is not paused). **");
        if (mostCurrent != null)
            processBA.raiseEvent2(_activity, true, "activity_pause", false, activityBA.activity.isFinishing());		
        if (!dontPause) {
            processBA.setActivityPaused(true);
            mostCurrent = null;
        }

        if (!activityBA.activity.isFinishing())
			previousOne = new WeakReference<Activity>(this);
        anywheresoftware.b4a.Msgbox.isDismissing = false;
        processBA.runHook("onpause", this, null);
	}

	@Override
	public void onDestroy() {
        super.onDestroy();
		previousOne = null;
        processBA.runHook("ondestroy", this, null);
	}
    @Override 
	public void onResume() {
		super.onResume();
        mostCurrent = this;
        anywheresoftware.b4a.Msgbox.isDismissing = false;
        if (activityBA != null) { //will be null during activity create (which waits for AfterLayout).
        	ResumeMessage rm = new ResumeMessage(mostCurrent);
        	BA.handler.post(rm);
        }
        processBA.runHook("onresume", this, null);
	}
    private static class ResumeMessage implements Runnable {
    	private final WeakReference<Activity> activity;
    	public ResumeMessage(Activity activity) {
    		this.activity = new WeakReference<Activity>(activity);
    	}
		public void run() {
            main mc = mostCurrent;
			if (mc == null || mc != activity.get())
				return;
			processBA.setActivityPaused(false);
            BA.LogInfo("** Activity (main) Resume **");
            if (mc != mostCurrent)
                return;
		    processBA.raiseEvent(mc._activity, "activity_resume", (Object[])null);
		}
    }
	@Override
	protected void onActivityResult(int requestCode, int resultCode,
	      android.content.Intent data) {
		processBA.onActivityResult(requestCode, resultCode, data);
        processBA.runHook("onactivityresult", this, new Object[] {requestCode, resultCode});
	}
	private static void initializeGlobals() {
		processBA.raiseEvent2(null, true, "globals", false, (Object[])null);
	}
    public void onRequestPermissionsResult(int requestCode,
        String permissions[], int[] grantResults) {
        for (int i = 0;i < permissions.length;i++) {
            Object[] o = new Object[] {permissions[i], grantResults[i] == 0};
            processBA.raiseEventFromDifferentThread(null,null, 0, "activity_permissionresult", true, o);
        }
            
    }

public anywheresoftware.b4a.keywords.Common __c = null;
public static anywheresoftware.b4a.objects.IntentWrapper _previntent = null;
public static long _lasttaptime = 0L;
public anywheresoftware.b4a.objects.PanelWrapper _pnllogin = null;
public anywheresoftware.b4a.objects.EditTextWrapper _txtphone = null;
public anywheresoftware.b4a.objects.EditTextWrapper _txtpass = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btnlogin = null;
public anywheresoftware.b4a.objects.PanelWrapper _pnltracking = null;
public anywheresoftware.b4a.objects.LabelWrapper _lblstatus = null;
public anywheresoftware.b4a.objects.LabelWrapper _lbldriverinfo = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btntoggle = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btnlogout = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btnattendance = null;
public anywheresoftware.b4a.objects.PanelWrapper _pnlattendance = null;
public anywheresoftware.b4a.objects.ScrollViewWrapper _clvstudents = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btnbacktotracking = null;
public anywheresoftware.b4a.objects.collections.List _studentlist = null;
public anywheresoftware.b4a.objects.RuntimePermissions _rp = null;
public anywheresoftware.b4a.objects.NFC _nfc = null;
public static int _registrationtargetid = 0;
public anywheresoftware.b4a.objects.PanelWrapper _pnltagscan = null;
public anywheresoftware.b4a.objects.LabelWrapper _lblscanstatus = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btncancelscan = null;
public anywheresoftware.b4a.objects.PanelWrapper _pnlrouteselection = null;
public anywheresoftware.b4a.objects.ListViewWrapper _lvroutes = null;
public anywheresoftware.b4a.objects.LabelWrapper _lblroutetitle = null;
public anywheresoftware.b4a.objects.ButtonWrapper _btnrefreshroutes = null;
public static int _activerouteid = 0;
public static String _activeroutename = "";
public com.merosee.bustrack.driver.starter _starter = null;
public com.merosee.bustrack.driver.trackingservice _trackingservice = null;
public com.merosee.bustrack.driver.apimodule _apimodule = null;
public com.merosee.bustrack.driver.routeselectionfunctions _routeselectionfunctions = null;
public com.merosee.bustrack.driver.httputils2service _httputils2service = null;

public static boolean isAnyActivityVisible() {
    boolean vis = false;
vis = vis | (main.mostCurrent != null);
vis = vis | (routeselectionfunctions.mostCurrent != null);
return vis;}
public static String  _activity_create(boolean _firsttime) throws Exception{
 //BA.debugLineNum = 50;BA.debugLine="Sub Activity_Create(FirstTime As Boolean)";
 //BA.debugLineNum = 51;BA.debugLine="Activity.Title = \"BusTrack Driver\"";
mostCurrent._activity.setTitle(BA.ObjectToCharSequence("BusTrack Driver"));
 //BA.debugLineNum = 52;BA.debugLine="Activity.Color = Colors.White";
mostCurrent._activity.setColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 55;BA.debugLine="InitializeLoginUI";
_initializeloginui();
 //BA.debugLineNum = 56;BA.debugLine="InitializeRouteSelectionUI";
_initializerouteselectionui();
 //BA.debugLineNum = 57;BA.debugLine="InitializeTrackingUI";
_initializetrackingui();
 //BA.debugLineNum = 58;BA.debugLine="InitializeAttendanceUI";
_initializeattendanceui();
 //BA.debugLineNum = 59;BA.debugLine="InitializeScanUI";
_initializescanui();
 //BA.debugLineNum = 62;BA.debugLine="CheckLoginState";
_checkloginstate();
 //BA.debugLineNum = 63;BA.debugLine="End Sub";
return "";
}
public static String  _activity_newintent(anywheresoftware.b4a.objects.IntentWrapper _startingintent) throws Exception{
 //BA.debugLineNum = 267;BA.debugLine="Sub Activity_NewIntent (StartingIntent As Intent)";
 //BA.debugLineNum = 268;BA.debugLine="Log(\"New Intent Received\")";
anywheresoftware.b4a.keywords.Common.LogImpl("45701633","New Intent Received",0);
 //BA.debugLineNum = 270;BA.debugLine="ProcessIntent(StartingIntent)";
_processintent(_startingintent);
 //BA.debugLineNum = 271;BA.debugLine="End Sub";
return "";
}
public static String  _activity_pause(boolean _userclosed) throws Exception{
 //BA.debugLineNum = 343;BA.debugLine="Sub Activity_Pause (UserClosed As Boolean)";
 //BA.debugLineNum = 345;BA.debugLine="nfc.DisableForegroundDispatch";
mostCurrent._nfc.DisableForegroundDispatch(mostCurrent.activityBA);
 //BA.debugLineNum = 346;BA.debugLine="End Sub";
return "";
}
public static String  _activity_resume() throws Exception{
 //BA.debugLineNum = 250;BA.debugLine="Sub Activity_Resume";
 //BA.debugLineNum = 252;BA.debugLine="If pnlTracking.IsInitialized And pnlTracking.Visi";
if (mostCurrent._pnltracking.IsInitialized() && mostCurrent._pnltracking.getVisible()) { 
 //BA.debugLineNum = 253;BA.debugLine="UpdateUI";
_updateui();
 };
 //BA.debugLineNum = 257;BA.debugLine="Try";
try { //BA.debugLineNum = 258;BA.debugLine="nfc.EnableForegroundDispatch";
mostCurrent._nfc.EnableForegroundDispatch(mostCurrent.activityBA);
 } 
       catch (Exception e7) {
			processBA.setLastException(e7); //BA.debugLineNum = 260;BA.debugLine="Log(\"NFC Dispatch Error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("4524298","NFC Dispatch Error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 };
 //BA.debugLineNum = 264;BA.debugLine="ProcessIntent(Activity.GetStartingIntent)";
_processintent(mostCurrent._activity.GetStartingIntent());
 //BA.debugLineNum = 265;BA.debugLine="End Sub";
return "";
}
public static String  _btnaction_click() throws Exception{
anywheresoftware.b4a.objects.ButtonWrapper _btn = null;
anywheresoftware.b4a.objects.collections.Map _data = null;
int _studentid = 0;
String _action = "";
anywheresoftware.b4a.objects.collections.Map _payload = null;
anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator _json = null;
com.merosee.bustrack.driver.httpjob _job = null;
 //BA.debugLineNum = 550;BA.debugLine="Sub btnAction_Click";
 //BA.debugLineNum = 551;BA.debugLine="Dim btn As Button = Sender";
_btn = new anywheresoftware.b4a.objects.ButtonWrapper();
_btn = (anywheresoftware.b4a.objects.ButtonWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.ButtonWrapper(), (android.widget.Button)(anywheresoftware.b4a.keywords.Common.Sender(mostCurrent.activityBA)));
 //BA.debugLineNum = 552;BA.debugLine="Dim data As Map = btn.Tag";
_data = new anywheresoftware.b4a.objects.collections.Map();
_data = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_btn.getTag()));
 //BA.debugLineNum = 553;BA.debugLine="Dim studentId As Int = data.Get(\"id\")";
_studentid = (int)(BA.ObjectToNumber(_data.Get((Object)("id"))));
 //BA.debugLineNum = 554;BA.debugLine="Dim action As String = data.Get(\"action\")";
_action = BA.ObjectToString(_data.Get((Object)("action")));
 //BA.debugLineNum = 556;BA.debugLine="Dim payload As Map";
_payload = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 557;BA.debugLine="payload.Initialize";
_payload.Initialize();
 //BA.debugLineNum = 558;BA.debugLine="payload.Put(\"student_id\", studentId)";
_payload.Put((Object)("student_id"),(Object)(_studentid));
 //BA.debugLineNum = 559;BA.debugLine="payload.Put(\"action\", action)";
_payload.Put((Object)("action"),(Object)(_action));
 //BA.debugLineNum = 561;BA.debugLine="Dim json As JSONGenerator";
_json = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 562;BA.debugLine="json.Initialize(payload)";
_json.Initialize(_payload);
 //BA.debugLineNum = 564;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 565;BA.debugLine="job.Initialize(\"mark_attendance\", Me)";
_job._initialize /*String*/ (processBA,"mark_attendance",main.getObject());
 //BA.debugLineNum = 566;BA.debugLine="job.PostString(APIModule.ServerURL & \"/mark_atten";
_job._poststring /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/mark_attendance.php",_json.ToString());
 //BA.debugLineNum = 567;BA.debugLine="APIModule.SetAuthHeader(job, APIModule.GetToken)";
mostCurrent._apimodule._setauthheader /*String*/ (mostCurrent.activityBA,_job,mostCurrent._apimodule._gettoken /*String*/ (mostCurrent.activityBA));
 //BA.debugLineNum = 569;BA.debugLine="btn.Enabled = False";
_btn.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 570;BA.debugLine="btn.Text = \"...\"";
_btn.setText(BA.ObjectToCharSequence("..."));
 //BA.debugLineNum = 571;BA.debugLine="End Sub";
return "";
}
public static String  _btnattendance_click() throws Exception{
 //BA.debugLineNum = 449;BA.debugLine="Sub btnAttendance_Click";
 //BA.debugLineNum = 450;BA.debugLine="ShowAttendance";
_showattendance();
 //BA.debugLineNum = 451;BA.debugLine="End Sub";
return "";
}
public static String  _btnbacktotracking_click() throws Exception{
 //BA.debugLineNum = 453;BA.debugLine="Sub btnBackToTracking_Click";
 //BA.debugLineNum = 454;BA.debugLine="ShowTracking";
_showtracking();
 //BA.debugLineNum = 455;BA.debugLine="End Sub";
return "";
}
public static String  _btncancelscan_click() throws Exception{
 //BA.debugLineNum = 245;BA.debugLine="Sub btnCancelScan_Click";
 //BA.debugLineNum = 246;BA.debugLine="RegistrationTargetID = 0";
_registrationtargetid = (int) (0);
 //BA.debugLineNum = 247;BA.debugLine="pnlTagScan.Visible = False";
mostCurrent._pnltagscan.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 248;BA.debugLine="End Sub";
return "";
}
public static String  _btnlogin_click() throws Exception{
String _phone = "";
String _password = "";
anywheresoftware.b4a.objects.collections.Map _data = null;
anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator _json = null;
com.merosee.bustrack.driver.httpjob _job = null;
 //BA.debugLineNum = 389;BA.debugLine="Sub btnLogin_Click";
 //BA.debugLineNum = 390;BA.debugLine="Dim phone As String = txtPhone.Text.Trim";
_phone = mostCurrent._txtphone.getText().trim();
 //BA.debugLineNum = 391;BA.debugLine="Dim password As String = txtPass.Text.Trim";
_password = mostCurrent._txtpass.getText().trim();
 //BA.debugLineNum = 393;BA.debugLine="If phone = \"\" Or password = \"\" Then";
if ((_phone).equals("") || (_password).equals("")) { 
 //BA.debugLineNum = 394;BA.debugLine="ToastMessageShow(\"Please enter phone and passwor";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Please enter phone and password"),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 395;BA.debugLine="Return";
if (true) return "";
 };
 //BA.debugLineNum = 398;BA.debugLine="btnLogin.Enabled = False";
mostCurrent._btnlogin.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 399;BA.debugLine="btnLogin.Text = \"Logging in...\"";
mostCurrent._btnlogin.setText(BA.ObjectToCharSequence("Logging in..."));
 //BA.debugLineNum = 401;BA.debugLine="Dim data As Map";
_data = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 402;BA.debugLine="data.Initialize";
_data.Initialize();
 //BA.debugLineNum = 403;BA.debugLine="data.Put(\"phone\", phone)";
_data.Put((Object)("phone"),(Object)(_phone));
 //BA.debugLineNum = 404;BA.debugLine="data.Put(\"password\", password)";
_data.Put((Object)("password"),(Object)(_password));
 //BA.debugLineNum = 406;BA.debugLine="Dim json As JSONGenerator";
_json = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 407;BA.debugLine="json.Initialize(data)";
_json.Initialize(_data);
 //BA.debugLineNum = 409;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 410;BA.debugLine="job.Initialize(\"login\", Me)";
_job._initialize /*String*/ (processBA,"login",main.getObject());
 //BA.debugLineNum = 411;BA.debugLine="job.PostString(APIModule.ServerURL & \"/login.php\"";
_job._poststring /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/login.php",_json.ToString());
 //BA.debugLineNum = 412;BA.debugLine="job.GetRequest.SetHeader(\"Content-Type\", \"applica";
_job._getrequest /*anywheresoftware.b4h.okhttp.OkHttpClientWrapper.OkHttpRequest*/ ().SetHeader("Content-Type","application/json");
 //BA.debugLineNum = 413;BA.debugLine="End Sub";
return "";
}
public static String  _btnlogout_click() throws Exception{
 //BA.debugLineNum = 441;BA.debugLine="Sub btnLogout_Click";
 //BA.debugLineNum = 442;BA.debugLine="APIModule.ClearToken";
mostCurrent._apimodule._cleartoken /*String*/ (mostCurrent.activityBA);
 //BA.debugLineNum = 443;BA.debugLine="CallSub(TrackingService, \"StopTracking\")";
anywheresoftware.b4a.keywords.Common.CallSubNew(processBA,(Object)(mostCurrent._trackingservice.getObject()),"StopTracking");
 //BA.debugLineNum = 444;BA.debugLine="txtPhone.Text = \"\"";
mostCurrent._txtphone.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 445;BA.debugLine="txtPass.Text = \"\"";
mostCurrent._txtpass.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 446;BA.debugLine="CheckLoginState";
_checkloginstate();
 //BA.debugLineNum = 447;BA.debugLine="End Sub";
return "";
}
public static String  _btnrefreshroutes_click() throws Exception{
 //BA.debugLineNum = 767;BA.debugLine="Sub btnRefreshRoutes_Click";
 //BA.debugLineNum = 768;BA.debugLine="LoadRoutes";
_loadroutes();
 //BA.debugLineNum = 769;BA.debugLine="End Sub";
return "";
}
public static String  _btnregtag_click() throws Exception{
anywheresoftware.b4a.objects.ButtonWrapper _btn = null;
 //BA.debugLineNum = 573;BA.debugLine="Sub btnRegTag_Click";
 //BA.debugLineNum = 574;BA.debugLine="Dim btn As Button = Sender";
_btn = new anywheresoftware.b4a.objects.ButtonWrapper();
_btn = (anywheresoftware.b4a.objects.ButtonWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.ButtonWrapper(), (android.widget.Button)(anywheresoftware.b4a.keywords.Common.Sender(mostCurrent.activityBA)));
 //BA.debugLineNum = 575;BA.debugLine="RegistrationTargetID = btn.Tag";
_registrationtargetid = (int)(BA.ObjectToNumber(_btn.getTag()));
 //BA.debugLineNum = 578;BA.debugLine="lblScanStatus.Text = \"Please tap the card against";
mostCurrent._lblscanstatus.setText(BA.ObjectToCharSequence("Please tap the card against the back of your phone..."));
 //BA.debugLineNum = 579;BA.debugLine="lblScanStatus.TextColor = Colors.LightGray";
mostCurrent._lblscanstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.LightGray);
 //BA.debugLineNum = 580;BA.debugLine="pnlTagScan.Visible = True";
mostCurrent._pnltagscan.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 581;BA.debugLine="End Sub";
return "";
}
public static void  _btntoggle_click() throws Exception{
ResumableSub_btnToggle_Click rsub = new ResumableSub_btnToggle_Click(null);
rsub.resume(processBA, null);
}
public static class ResumableSub_btnToggle_Click extends BA.ResumableSub {
public ResumableSub_btnToggle_Click(com.merosee.bustrack.driver.main parent) {
this.parent = parent;
}
com.merosee.bustrack.driver.main parent;
String _permission = "";
boolean _result = false;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
try {

        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 416;BA.debugLine="If TrackingService.IsTracking Then";
if (true) break;

case 1:
//if
this.state = 18;
if (parent.mostCurrent._trackingservice._istracking /*boolean*/ ) { 
this.state = 3;
}else {
this.state = 5;
}if (true) break;

case 3:
//C
this.state = 18;
 //BA.debugLineNum = 417;BA.debugLine="CallSub(TrackingService, \"StopTracking\")";
anywheresoftware.b4a.keywords.Common.CallSubNew(processBA,(Object)(parent.mostCurrent._trackingservice.getObject()),"StopTracking");
 //BA.debugLineNum = 418;BA.debugLine="UpdateUI";
_updateui();
 if (true) break;

case 5:
//C
this.state = 6;
 //BA.debugLineNum = 420;BA.debugLine="rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOC";
parent.mostCurrent._rp.CheckAndRequest(processBA,parent.mostCurrent._rp.PERMISSION_ACCESS_FINE_LOCATION);
 //BA.debugLineNum = 421;BA.debugLine="Wait For Activity_PermissionResult (Permission A";
anywheresoftware.b4a.keywords.Common.WaitFor("activity_permissionresult", processBA, this, null);
this.state = 19;
return;
case 19:
//C
this.state = 6;
_permission = (String) result[0];
_result = (Boolean) result[1];
;
 //BA.debugLineNum = 422;BA.debugLine="If Result Then";
if (true) break;

case 6:
//if
this.state = 17;
if (_result) { 
this.state = 8;
}else {
this.state = 16;
}if (true) break;

case 8:
//C
this.state = 9;
 //BA.debugLineNum = 424;BA.debugLine="Sleep(200)";
anywheresoftware.b4a.keywords.Common.Sleep(mostCurrent.activityBA,this,(int) (200));
this.state = 20;
return;
case 20:
//C
this.state = 9;
;
 //BA.debugLineNum = 425;BA.debugLine="Try";
if (true) break;

case 9:
//try
this.state = 14;
this.catchState = 13;
this.state = 11;
if (true) break;

case 11:
//C
this.state = 14;
this.catchState = 13;
 //BA.debugLineNum = 426;BA.debugLine="StartService(TrackingService)";
anywheresoftware.b4a.keywords.Common.StartService(processBA,(Object)(parent.mostCurrent._trackingservice.getObject()));
 //BA.debugLineNum = 427;BA.debugLine="CallSubDelayed(TrackingService, \"StartTracking";
anywheresoftware.b4a.keywords.Common.CallSubDelayed(processBA,(Object)(parent.mostCurrent._trackingservice.getObject()),"StartTracking");
 //BA.debugLineNum = 429;BA.debugLine="Sleep(200)";
anywheresoftware.b4a.keywords.Common.Sleep(mostCurrent.activityBA,this,(int) (200));
this.state = 21;
return;
case 21:
//C
this.state = 14;
;
 //BA.debugLineNum = 430;BA.debugLine="UpdateUI";
_updateui();
 if (true) break;

case 13:
//C
this.state = 14;
this.catchState = 0;
 //BA.debugLineNum = 432;BA.debugLine="Log(\"Error starting service: \" & LastException";
anywheresoftware.b4a.keywords.Common.LogImpl("41048593","Error starting service: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 //BA.debugLineNum = 433;BA.debugLine="ToastMessageShow(\"Could not start tracking ser";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Could not start tracking service"),anywheresoftware.b4a.keywords.Common.True);
 if (true) break;
if (true) break;

case 14:
//C
this.state = 17;
this.catchState = 0;
;
 if (true) break;

case 16:
//C
this.state = 17;
 //BA.debugLineNum = 436;BA.debugLine="ToastMessageShow(\"Location permission required";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Location permission required for tracking"),anywheresoftware.b4a.keywords.Common.True);
 if (true) break;

case 17:
//C
this.state = 18;
;
 if (true) break;

case 18:
//C
this.state = -1;
;
 //BA.debugLineNum = 439;BA.debugLine="End Sub";
if (true) break;
}} 
       catch (Exception e0) {
			
if (catchState == 0)
    throw e0;
else {
    state = catchState;
processBA.setLastException(e0);}
            }
        }
    }
}
public static void  _activity_permissionresult(String _permission,boolean _result) throws Exception{
}
public static String  _checkloginstate() throws Exception{
 //BA.debugLineNum = 348;BA.debugLine="Sub CheckLoginState";
 //BA.debugLineNum = 349;BA.debugLine="If APIModule.GetToken = \"\" Then";
if ((mostCurrent._apimodule._gettoken /*String*/ (mostCurrent.activityBA)).equals("")) { 
 //BA.debugLineNum = 350;BA.debugLine="ShowLogin";
_showlogin();
 }else {
 //BA.debugLineNum = 353;BA.debugLine="If ActiveRouteID = 0 Then";
if (_activerouteid==0) { 
 //BA.debugLineNum = 354;BA.debugLine="ShowRouteSelection";
_showrouteselection();
 }else {
 //BA.debugLineNum = 356;BA.debugLine="ShowTracking";
_showtracking();
 };
 };
 //BA.debugLineNum = 359;BA.debugLine="End Sub";
return "";
}
public static String  _fetchstudents() throws Exception{
com.merosee.bustrack.driver.httpjob _job = null;
 //BA.debugLineNum = 464;BA.debugLine="Sub FetchStudents";
 //BA.debugLineNum = 465;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 466;BA.debugLine="job.Initialize(\"fetch_students\", Me)";
_job._initialize /*String*/ (processBA,"fetch_students",main.getObject());
 //BA.debugLineNum = 467;BA.debugLine="job.Download(APIModule.ServerURL & \"/get_students";
_job._download /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/get_students_by_driver.php");
 //BA.debugLineNum = 468;BA.debugLine="APIModule.SetAuthHeader(job, APIModule.GetToken)";
mostCurrent._apimodule._setauthheader /*String*/ (mostCurrent.activityBA,_job,mostCurrent._apimodule._gettoken /*String*/ (mostCurrent.activityBA));
 //BA.debugLineNum = 469;BA.debugLine="End Sub";
return "";
}
public static String  _globals() throws Exception{
 //BA.debugLineNum = 12;BA.debugLine="Sub Globals";
 //BA.debugLineNum = 14;BA.debugLine="Private pnlLogin As Panel";
mostCurrent._pnllogin = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 15;BA.debugLine="Private txtPhone As EditText";
mostCurrent._txtphone = new anywheresoftware.b4a.objects.EditTextWrapper();
 //BA.debugLineNum = 16;BA.debugLine="Private txtPass As EditText";
mostCurrent._txtpass = new anywheresoftware.b4a.objects.EditTextWrapper();
 //BA.debugLineNum = 17;BA.debugLine="Private btnLogin As Button";
mostCurrent._btnlogin = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 20;BA.debugLine="Private pnlTracking As Panel";
mostCurrent._pnltracking = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 21;BA.debugLine="Private lblStatus As Label";
mostCurrent._lblstatus = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 22;BA.debugLine="Private lblDriverInfo As Label";
mostCurrent._lbldriverinfo = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 23;BA.debugLine="Private btnToggle As Button";
mostCurrent._btntoggle = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 24;BA.debugLine="Private btnLogout As Button";
mostCurrent._btnlogout = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 25;BA.debugLine="Private btnAttendance As Button";
mostCurrent._btnattendance = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 28;BA.debugLine="Private pnlAttendance As Panel";
mostCurrent._pnlattendance = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 29;BA.debugLine="Private clvStudents As ScrollView ' Using ScrollV";
mostCurrent._clvstudents = new anywheresoftware.b4a.objects.ScrollViewWrapper();
 //BA.debugLineNum = 30;BA.debugLine="Private btnBackToTracking As Button";
mostCurrent._btnbacktotracking = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 31;BA.debugLine="Private StudentList As List";
mostCurrent._studentlist = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 32;BA.debugLine="Private rp As RuntimePermissions";
mostCurrent._rp = new anywheresoftware.b4a.objects.RuntimePermissions();
 //BA.debugLineNum = 33;BA.debugLine="Private nfc As NFC";
mostCurrent._nfc = new anywheresoftware.b4a.objects.NFC();
 //BA.debugLineNum = 34;BA.debugLine="Private RegistrationTargetID As Int = 0 ' 0 means";
_registrationtargetid = (int) (0);
 //BA.debugLineNum = 37;BA.debugLine="Private pnlTagScan As Panel";
mostCurrent._pnltagscan = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 38;BA.debugLine="Private lblScanStatus As Label";
mostCurrent._lblscanstatus = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 39;BA.debugLine="Private btnCancelScan As Button";
mostCurrent._btncancelscan = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 42;BA.debugLine="Private pnlRouteSelection As Panel";
mostCurrent._pnlrouteselection = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 43;BA.debugLine="Private lvRoutes As ListView";
mostCurrent._lvroutes = new anywheresoftware.b4a.objects.ListViewWrapper();
 //BA.debugLineNum = 44;BA.debugLine="Private lblRouteTitle As Label";
mostCurrent._lblroutetitle = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 45;BA.debugLine="Private btnRefreshRoutes As Button";
mostCurrent._btnrefreshroutes = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 46;BA.debugLine="Private ActiveRouteID As Int = 0";
_activerouteid = (int) (0);
 //BA.debugLineNum = 47;BA.debugLine="Private ActiveRouteName As String = \"\"";
mostCurrent._activeroutename = "";
 //BA.debugLineNum = 48;BA.debugLine="End Sub";
return "";
}
public static String  _initializeattendanceui() throws Exception{
anywheresoftware.b4a.objects.LabelWrapper _lbltitle = null;
 //BA.debugLineNum = 165;BA.debugLine="Sub InitializeAttendanceUI";
 //BA.debugLineNum = 166;BA.debugLine="pnlAttendance.Initialize(\"\")";
mostCurrent._pnlattendance.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 167;BA.debugLine="Activity.AddView(pnlAttendance, 0, 0, 100%x, 100%";
mostCurrent._activity.AddView((android.view.View)(mostCurrent._pnlattendance.getObject()),(int) (0),(int) (0),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (100),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (100),mostCurrent.activityBA));
 //BA.debugLineNum = 168;BA.debugLine="pnlAttendance.Color = Colors.White";
mostCurrent._pnlattendance.setColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 169;BA.debugLine="pnlAttendance.Visible = False";
mostCurrent._pnlattendance.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 171;BA.debugLine="Dim lblTitle As Label";
_lbltitle = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 172;BA.debugLine="lblTitle.Initialize(\"\")";
_lbltitle.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 173;BA.debugLine="lblTitle.Text = \"Student Attendance\"";
_lbltitle.setText(BA.ObjectToCharSequence("Student Attendance"));
 //BA.debugLineNum = 174;BA.debugLine="lblTitle.TextSize = 22";
_lbltitle.setTextSize((float) (22));
 //BA.debugLineNum = 175;BA.debugLine="lblTitle.TextColor = Colors.RGB(33, 150, 243)";
_lbltitle.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (33),(int) (150),(int) (243)));
 //BA.debugLineNum = 176;BA.debugLine="lblTitle.Gravity = Gravity.CENTER";
_lbltitle.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 177;BA.debugLine="pnlAttendance.AddView(lblTitle, 5%x, 5%y, 70%x, 5";
mostCurrent._pnlattendance.AddView((android.view.View)(_lbltitle.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (5),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (5),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (70),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50)));
 //BA.debugLineNum = 179;BA.debugLine="btnBackToTracking.Initialize(\"btnBackToTracking\")";
mostCurrent._btnbacktotracking.Initialize(mostCurrent.activityBA,"btnBackToTracking");
 //BA.debugLineNum = 180;BA.debugLine="btnBackToTracking.Text = \"BACK\"";
mostCurrent._btnbacktotracking.setText(BA.ObjectToCharSequence("BACK"));
 //BA.debugLineNum = 181;BA.debugLine="btnBackToTracking.Color = Colors.DarkGray";
mostCurrent._btnbacktotracking.setColor(anywheresoftware.b4a.keywords.Common.Colors.DarkGray);
 //BA.debugLineNum = 182;BA.debugLine="btnBackToTracking.TextColor = Colors.White";
mostCurrent._btnbacktotracking.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 183;BA.debugLine="pnlAttendance.AddView(btnBackToTracking, 75%x, 5%";
mostCurrent._pnlattendance.AddView((android.view.View)(mostCurrent._btnbacktotracking.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (75),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (5),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (20),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50)));
 //BA.debugLineNum = 185;BA.debugLine="clvStudents.Initialize(0)";
mostCurrent._clvstudents.Initialize(mostCurrent.activityBA,(int) (0));
 //BA.debugLineNum = 186;BA.debugLine="pnlAttendance.AddView(clvStudents, 0, 15%y, 100%x";
mostCurrent._pnlattendance.AddView((android.view.View)(mostCurrent._clvstudents.getObject()),(int) (0),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (15),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (100),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (85),mostCurrent.activityBA));
 //BA.debugLineNum = 187;BA.debugLine="End Sub";
return "";
}
public static String  _initializeloginui() throws Exception{
anywheresoftware.b4a.objects.LabelWrapper _lbltitle = null;
anywheresoftware.b4a.objects.LabelWrapper _lblphone = null;
anywheresoftware.b4a.objects.LabelWrapper _lblpass = null;
 //BA.debugLineNum = 65;BA.debugLine="Sub InitializeLoginUI";
 //BA.debugLineNum = 67;BA.debugLine="pnlLogin.Initialize(\"\")";
mostCurrent._pnllogin.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 68;BA.debugLine="Activity.AddView(pnlLogin, 0, 0, 100%x, 100%y)";
mostCurrent._activity.AddView((android.view.View)(mostCurrent._pnllogin.getObject()),(int) (0),(int) (0),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (100),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (100),mostCurrent.activityBA));
 //BA.debugLineNum = 69;BA.debugLine="pnlLogin.Color = Colors.RGB(240, 240, 240)";
mostCurrent._pnllogin.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (240),(int) (240),(int) (240)));
 //BA.debugLineNum = 72;BA.debugLine="Dim lblTitle As Label";
_lbltitle = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 73;BA.debugLine="lblTitle.Initialize(\"\")";
_lbltitle.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 74;BA.debugLine="lblTitle.Text = \"Driver Login\"";
_lbltitle.setText(BA.ObjectToCharSequence("Driver Login"));
 //BA.debugLineNum = 75;BA.debugLine="lblTitle.TextSize = 28";
_lbltitle.setTextSize((float) (28));
 //BA.debugLineNum = 76;BA.debugLine="lblTitle.TextColor = Colors.RGB(33, 150, 243)";
_lbltitle.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (33),(int) (150),(int) (243)));
 //BA.debugLineNum = 77;BA.debugLine="lblTitle.Gravity = Gravity.CENTER";
_lbltitle.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 78;BA.debugLine="pnlLogin.AddView(lblTitle, 10%x, 15%y, 80%x, 60di";
mostCurrent._pnllogin.AddView((android.view.View)(_lbltitle.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (15),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (60)));
 //BA.debugLineNum = 81;BA.debugLine="Dim lblPhone As Label";
_lblphone = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 82;BA.debugLine="lblPhone.Initialize(\"\")";
_lblphone.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 83;BA.debugLine="lblPhone.Text = \"Phone Number\"";
_lblphone.setText(BA.ObjectToCharSequence("Phone Number"));
 //BA.debugLineNum = 84;BA.debugLine="lblPhone.TextSize = 14";
_lblphone.setTextSize((float) (14));
 //BA.debugLineNum = 85;BA.debugLine="lblPhone.TextColor = Colors.DarkGray";
_lblphone.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.DarkGray);
 //BA.debugLineNum = 86;BA.debugLine="pnlLogin.AddView(lblPhone, 10%x, 30%y, 80%x, 30di";
mostCurrent._pnllogin.AddView((android.view.View)(_lblphone.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (30),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (30)));
 //BA.debugLineNum = 88;BA.debugLine="txtPhone.Initialize(\"txtPhone\")";
mostCurrent._txtphone.Initialize(mostCurrent.activityBA,"txtPhone");
 //BA.debugLineNum = 89;BA.debugLine="txtPhone.Hint = \"Enter phone number\"";
mostCurrent._txtphone.setHint("Enter phone number");
 //BA.debugLineNum = 90;BA.debugLine="txtPhone.InputType = txtPhone.INPUT_TYPE_PHONE";
mostCurrent._txtphone.setInputType(mostCurrent._txtphone.INPUT_TYPE_PHONE);
 //BA.debugLineNum = 91;BA.debugLine="txtPhone.TextSize = 16";
mostCurrent._txtphone.setTextSize((float) (16));
 //BA.debugLineNum = 92;BA.debugLine="pnlLogin.AddView(txtPhone, 10%x, 35%y, 80%x, 50di";
mostCurrent._pnllogin.AddView((android.view.View)(mostCurrent._txtphone.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (35),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50)));
 //BA.debugLineNum = 95;BA.debugLine="Dim lblPass As Label";
_lblpass = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 96;BA.debugLine="lblPass.Initialize(\"\")";
_lblpass.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 97;BA.debugLine="lblPass.Text = \"Password\"";
_lblpass.setText(BA.ObjectToCharSequence("Password"));
 //BA.debugLineNum = 98;BA.debugLine="lblPass.TextSize = 14";
_lblpass.setTextSize((float) (14));
 //BA.debugLineNum = 99;BA.debugLine="lblPass.TextColor = Colors.DarkGray";
_lblpass.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.DarkGray);
 //BA.debugLineNum = 100;BA.debugLine="pnlLogin.AddView(lblPass, 10%x, 45%y, 80%x, 30dip";
mostCurrent._pnllogin.AddView((android.view.View)(_lblpass.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (45),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (30)));
 //BA.debugLineNum = 102;BA.debugLine="txtPass.Initialize(\"txtPass\")";
mostCurrent._txtpass.Initialize(mostCurrent.activityBA,"txtPass");
 //BA.debugLineNum = 103;BA.debugLine="txtPass.Hint = \"Enter password\"";
mostCurrent._txtpass.setHint("Enter password");
 //BA.debugLineNum = 104;BA.debugLine="txtPass.PasswordMode = True";
mostCurrent._txtpass.setPasswordMode(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 105;BA.debugLine="txtPass.TextSize = 16";
mostCurrent._txtpass.setTextSize((float) (16));
 //BA.debugLineNum = 106;BA.debugLine="pnlLogin.AddView(txtPass, 10%x, 50%y, 80%x, 50dip";
mostCurrent._pnllogin.AddView((android.view.View)(mostCurrent._txtpass.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (50),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50)));
 //BA.debugLineNum = 109;BA.debugLine="btnLogin.Initialize(\"btnLogin\")";
mostCurrent._btnlogin.Initialize(mostCurrent.activityBA,"btnLogin");
 //BA.debugLineNum = 110;BA.debugLine="btnLogin.Text = \"LOGIN\"";
mostCurrent._btnlogin.setText(BA.ObjectToCharSequence("LOGIN"));
 //BA.debugLineNum = 111;BA.debugLine="btnLogin.TextSize = 18";
mostCurrent._btnlogin.setTextSize((float) (18));
 //BA.debugLineNum = 112;BA.debugLine="btnLogin.Color = Colors.RGB(33, 150, 243)";
mostCurrent._btnlogin.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (33),(int) (150),(int) (243)));
 //BA.debugLineNum = 113;BA.debugLine="btnLogin.TextColor = Colors.White";
mostCurrent._btnlogin.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 114;BA.debugLine="pnlLogin.AddView(btnLogin, 10%x, 65%y, 80%x, 55di";
mostCurrent._pnllogin.AddView((android.view.View)(mostCurrent._btnlogin.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (65),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (55)));
 //BA.debugLineNum = 115;BA.debugLine="End Sub";
return "";
}
public static String  _initializerouteselectionui() throws Exception{
 //BA.debugLineNum = 215;BA.debugLine="Sub InitializeRouteSelectionUI";
 //BA.debugLineNum = 216;BA.debugLine="pnlRouteSelection.Initialize(\"\")";
mostCurrent._pnlrouteselection.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 217;BA.debugLine="Activity.AddView(pnlRouteSelection, 0, 0, 100%x,";
mostCurrent._activity.AddView((android.view.View)(mostCurrent._pnlrouteselection.getObject()),(int) (0),(int) (0),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (100),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (100),mostCurrent.activityBA));
 //BA.debugLineNum = 218;BA.debugLine="pnlRouteSelection.Color = Colors.RGB(240, 240, 24";
mostCurrent._pnlrouteselection.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (240),(int) (240),(int) (240)));
 //BA.debugLineNum = 219;BA.debugLine="pnlRouteSelection.Visible = False";
mostCurrent._pnlrouteselection.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 222;BA.debugLine="lblRouteTitle.Initialize(\"\")";
mostCurrent._lblroutetitle.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 223;BA.debugLine="lblRouteTitle.Text = \"Select Your Route\"";
mostCurrent._lblroutetitle.setText(BA.ObjectToCharSequence("Select Your Route"));
 //BA.debugLineNum = 224;BA.debugLine="lblRouteTitle.TextSize = 24";
mostCurrent._lblroutetitle.setTextSize((float) (24));
 //BA.debugLineNum = 225;BA.debugLine="lblRouteTitle.TextColor = Colors.RGB(33, 150, 243";
mostCurrent._lblroutetitle.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (33),(int) (150),(int) (243)));
 //BA.debugLineNum = 226;BA.debugLine="lblRouteTitle.Gravity = Gravity.CENTER";
mostCurrent._lblroutetitle.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 227;BA.debugLine="pnlRouteSelection.AddView(lblRouteTitle, 10%x, 10";
mostCurrent._pnlrouteselection.AddView((android.view.View)(mostCurrent._lblroutetitle.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (60)));
 //BA.debugLineNum = 230;BA.debugLine="lvRoutes.Initialize(\"lvRoutes\")";
mostCurrent._lvroutes.Initialize(mostCurrent.activityBA,"lvRoutes");
 //BA.debugLineNum = 231;BA.debugLine="lvRoutes.TwoLinesAndBitmap.ItemHeight = 80dip";
mostCurrent._lvroutes.getTwoLinesAndBitmap().setItemHeight(anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (80)));
 //BA.debugLineNum = 232;BA.debugLine="lvRoutes.TwoLinesAndBitmap.SecondLabel.TextSize =";
mostCurrent._lvroutes.getTwoLinesAndBitmap().SecondLabel.setTextSize((float) (14));
 //BA.debugLineNum = 233;BA.debugLine="lvRoutes.TwoLinesAndBitmap.SecondLabel.TextColor";
mostCurrent._lvroutes.getTwoLinesAndBitmap().SecondLabel.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.DarkGray);
 //BA.debugLineNum = 234;BA.debugLine="pnlRouteSelection.AddView(lvRoutes, 5%x, 20%y, 90";
mostCurrent._pnlrouteselection.AddView((android.view.View)(mostCurrent._lvroutes.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (5),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (20),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (90),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (60),mostCurrent.activityBA));
 //BA.debugLineNum = 237;BA.debugLine="btnRefreshRoutes.Initialize(\"btnRefreshRoutes\")";
mostCurrent._btnrefreshroutes.Initialize(mostCurrent.activityBA,"btnRefreshRoutes");
 //BA.debugLineNum = 238;BA.debugLine="btnRefreshRoutes.Text = \"REFRESH ROUTES\"";
mostCurrent._btnrefreshroutes.setText(BA.ObjectToCharSequence("REFRESH ROUTES"));
 //BA.debugLineNum = 239;BA.debugLine="btnRefreshRoutes.TextSize = 16";
mostCurrent._btnrefreshroutes.setTextSize((float) (16));
 //BA.debugLineNum = 240;BA.debugLine="btnRefreshRoutes.Color = Colors.RGB(76, 175, 80)";
mostCurrent._btnrefreshroutes.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (76),(int) (175),(int) (80)));
 //BA.debugLineNum = 241;BA.debugLine="btnRefreshRoutes.TextColor = Colors.White";
mostCurrent._btnrefreshroutes.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 242;BA.debugLine="pnlRouteSelection.AddView(btnRefreshRoutes, 10%x,";
mostCurrent._pnlrouteselection.AddView((android.view.View)(mostCurrent._btnrefreshroutes.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (85),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50)));
 //BA.debugLineNum = 243;BA.debugLine="End Sub";
return "";
}
public static String  _initializescanui() throws Exception{
anywheresoftware.b4a.objects.PanelWrapper _pnlcard = null;
 //BA.debugLineNum = 189;BA.debugLine="Sub InitializeScanUI";
 //BA.debugLineNum = 190;BA.debugLine="pnlTagScan.Initialize(\"\")";
mostCurrent._pnltagscan.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 191;BA.debugLine="Activity.AddView(pnlTagScan, 0, 0, 100%x, 100%y)";
mostCurrent._activity.AddView((android.view.View)(mostCurrent._pnltagscan.getObject()),(int) (0),(int) (0),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (100),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (100),mostCurrent.activityBA));
 //BA.debugLineNum = 192;BA.debugLine="pnlTagScan.Color = Colors.ARGB(200, 0, 0, 0) ' Se";
mostCurrent._pnltagscan.setColor(anywheresoftware.b4a.keywords.Common.Colors.ARGB((int) (200),(int) (0),(int) (0),(int) (0)));
 //BA.debugLineNum = 193;BA.debugLine="pnlTagScan.Visible = False";
mostCurrent._pnltagscan.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 196;BA.debugLine="Dim pnlCard As Panel";
_pnlcard = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 197;BA.debugLine="pnlCard.Initialize(\"\")";
_pnlcard.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 198;BA.debugLine="pnlCard.Color = Colors.White";
_pnlcard.setColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 199;BA.debugLine="pnlTagScan.AddView(pnlCard, 10%x, 35%y, 80%x, 30%";
mostCurrent._pnltagscan.AddView((android.view.View)(_pnlcard.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (35),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (30),mostCurrent.activityBA));
 //BA.debugLineNum = 201;BA.debugLine="lblScanStatus.Initialize(\"\")";
mostCurrent._lblscanstatus.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 202;BA.debugLine="lblScanStatus.Text = \"Tap NFC Tag...\"";
mostCurrent._lblscanstatus.setText(BA.ObjectToCharSequence("Tap NFC Tag..."));
 //BA.debugLineNum = 203;BA.debugLine="lblScanStatus.TextSize = 20";
mostCurrent._lblscanstatus.setTextSize((float) (20));
 //BA.debugLineNum = 204;BA.debugLine="lblScanStatus.TextColor = Colors.RGB(33, 150, 243";
mostCurrent._lblscanstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (33),(int) (150),(int) (243)));
 //BA.debugLineNum = 205;BA.debugLine="lblScanStatus.Gravity = Gravity.CENTER";
mostCurrent._lblscanstatus.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 206;BA.debugLine="pnlCard.AddView(lblScanStatus, 5%x, 20%y, 90%x, 4";
_pnlcard.AddView((android.view.View)(mostCurrent._lblscanstatus.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (5),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (20),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (90),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (40),mostCurrent.activityBA));
 //BA.debugLineNum = 208;BA.debugLine="btnCancelScan.Initialize(\"btnCancelScan\")";
mostCurrent._btncancelscan.Initialize(mostCurrent.activityBA,"btnCancelScan");
 //BA.debugLineNum = 209;BA.debugLine="btnCancelScan.Text = \"CANCEL\"";
mostCurrent._btncancelscan.setText(BA.ObjectToCharSequence("CANCEL"));
 //BA.debugLineNum = 210;BA.debugLine="btnCancelScan.Color = Colors.RGB(244, 67, 54)";
mostCurrent._btncancelscan.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (244),(int) (67),(int) (54)));
 //BA.debugLineNum = 211;BA.debugLine="btnCancelScan.TextColor = Colors.White";
mostCurrent._btncancelscan.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 212;BA.debugLine="pnlCard.AddView(btnCancelScan, 25%x, 70%y, 50%x,";
_pnlcard.AddView((android.view.View)(mostCurrent._btncancelscan.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (25),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (70),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (50),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50)));
 //BA.debugLineNum = 213;BA.debugLine="End Sub";
return "";
}
public static String  _initializetrackingui() throws Exception{
 //BA.debugLineNum = 117;BA.debugLine="Sub InitializeTrackingUI";
 //BA.debugLineNum = 119;BA.debugLine="pnlTracking.Initialize(\"\")";
mostCurrent._pnltracking.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 120;BA.debugLine="Activity.AddView(pnlTracking, 0, 0, 100%x, 100%y)";
mostCurrent._activity.AddView((android.view.View)(mostCurrent._pnltracking.getObject()),(int) (0),(int) (0),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (100),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (100),mostCurrent.activityBA));
 //BA.debugLineNum = 121;BA.debugLine="pnlTracking.Color = Colors.White";
mostCurrent._pnltracking.setColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 122;BA.debugLine="pnlTracking.Visible = False";
mostCurrent._pnltracking.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 125;BA.debugLine="lblDriverInfo.Initialize(\"\")";
mostCurrent._lbldriverinfo.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 126;BA.debugLine="lblDriverInfo.Text = \"Driver Dashboard\"";
mostCurrent._lbldriverinfo.setText(BA.ObjectToCharSequence("Driver Dashboard"));
 //BA.debugLineNum = 127;BA.debugLine="lblDriverInfo.TextSize = 22";
mostCurrent._lbldriverinfo.setTextSize((float) (22));
 //BA.debugLineNum = 128;BA.debugLine="lblDriverInfo.TextColor = Colors.RGB(33, 150, 243";
mostCurrent._lbldriverinfo.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (33),(int) (150),(int) (243)));
 //BA.debugLineNum = 129;BA.debugLine="lblDriverInfo.Gravity = Gravity.CENTER";
mostCurrent._lbldriverinfo.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 130;BA.debugLine="pnlTracking.AddView(lblDriverInfo, 10%x, 10%y, 80";
mostCurrent._pnltracking.AddView((android.view.View)(mostCurrent._lbldriverinfo.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (60)));
 //BA.debugLineNum = 133;BA.debugLine="lblStatus.Initialize(\"\")";
mostCurrent._lblstatus.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 134;BA.debugLine="lblStatus.Text = \"Status: IDLE\"";
mostCurrent._lblstatus.setText(BA.ObjectToCharSequence("Status: IDLE"));
 //BA.debugLineNum = 135;BA.debugLine="lblStatus.TextSize = 24";
mostCurrent._lblstatus.setTextSize((float) (24));
 //BA.debugLineNum = 136;BA.debugLine="lblStatus.TextColor = Colors.Red";
mostCurrent._lblstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 137;BA.debugLine="lblStatus.Gravity = Gravity.CENTER";
mostCurrent._lblstatus.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 138;BA.debugLine="pnlTracking.AddView(lblStatus, 10%x, 25%y, 80%x,";
mostCurrent._pnltracking.AddView((android.view.View)(mostCurrent._lblstatus.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (25),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (80)));
 //BA.debugLineNum = 141;BA.debugLine="btnToggle.Initialize(\"btnToggle\")";
mostCurrent._btntoggle.Initialize(mostCurrent.activityBA,"btnToggle");
 //BA.debugLineNum = 142;BA.debugLine="btnToggle.Text = \"START TRACKING\"";
mostCurrent._btntoggle.setText(BA.ObjectToCharSequence("START TRACKING"));
 //BA.debugLineNum = 143;BA.debugLine="btnToggle.TextSize = 20";
mostCurrent._btntoggle.setTextSize((float) (20));
 //BA.debugLineNum = 144;BA.debugLine="btnToggle.Color = Colors.RGB(76, 175, 80)";
mostCurrent._btntoggle.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (76),(int) (175),(int) (80)));
 //BA.debugLineNum = 145;BA.debugLine="btnToggle.TextColor = Colors.White";
mostCurrent._btntoggle.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 146;BA.debugLine="pnlTracking.AddView(btnToggle, 10%x, 45%y, 80%x,";
mostCurrent._pnltracking.AddView((android.view.View)(mostCurrent._btntoggle.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (45),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (70)));
 //BA.debugLineNum = 149;BA.debugLine="btnLogout.Initialize(\"btnLogout\")";
mostCurrent._btnlogout.Initialize(mostCurrent.activityBA,"btnLogout");
 //BA.debugLineNum = 150;BA.debugLine="btnLogout.Text = \"LOGOUT\"";
mostCurrent._btnlogout.setText(BA.ObjectToCharSequence("LOGOUT"));
 //BA.debugLineNum = 151;BA.debugLine="btnLogout.TextSize = 16";
mostCurrent._btnlogout.setTextSize((float) (16));
 //BA.debugLineNum = 152;BA.debugLine="btnLogout.Color = Colors.RGB(244, 67, 54)";
mostCurrent._btnlogout.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (244),(int) (67),(int) (54)));
 //BA.debugLineNum = 153;BA.debugLine="btnLogout.TextColor = Colors.White";
mostCurrent._btnlogout.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 154;BA.debugLine="pnlTracking.AddView(btnLogout, 10%x, 75%y, 80%x,";
mostCurrent._pnltracking.AddView((android.view.View)(mostCurrent._btnlogout.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (75),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50)));
 //BA.debugLineNum = 157;BA.debugLine="btnAttendance.Initialize(\"btnAttendance\")";
mostCurrent._btnattendance.Initialize(mostCurrent.activityBA,"btnAttendance");
 //BA.debugLineNum = 158;BA.debugLine="btnAttendance.Text = \"MARK ATTENDANCE 📋\"";
mostCurrent._btnattendance.setText(BA.ObjectToCharSequence("MARK ATTENDANCE 📋"));
 //BA.debugLineNum = 159;BA.debugLine="btnAttendance.TextSize = 18";
mostCurrent._btnattendance.setTextSize((float) (18));
 //BA.debugLineNum = 160;BA.debugLine="btnAttendance.Color = Colors.RGB(33, 150, 243)";
mostCurrent._btnattendance.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (33),(int) (150),(int) (243)));
 //BA.debugLineNum = 161;BA.debugLine="btnAttendance.TextColor = Colors.White";
mostCurrent._btnattendance.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 162;BA.debugLine="pnlTracking.AddView(btnAttendance, 10%x, 63%y, 80";
mostCurrent._pnltracking.AddView((android.view.View)(mostCurrent._btnattendance.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (63),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (60)));
 //BA.debugLineNum = 163;BA.debugLine="End Sub";
return "";
}
public static String  _jobdone(com.merosee.bustrack.driver.httpjob _job) throws Exception{
anywheresoftware.b4a.objects.collections.JSONParser _parser = null;
anywheresoftware.b4a.objects.collections.Map _root = null;
String _sname = "";
String _action = "";
String _apikey = "";
anywheresoftware.b4a.objects.collections.Map _driver = null;
String _drivername = "";
String _errormsg = "";
anywheresoftware.b4a.objects.collections.List _routes = null;
anywheresoftware.b4a.objects.collections.Map _colroute = null;
String _routename = "";
String _shift = "";
int _studentcount = 0;
String _secondline = "";
 //BA.debugLineNum = 601;BA.debugLine="Sub JobDone(Job As HttpJob)";
 //BA.debugLineNum = 603;BA.debugLine="If Job.Success Then";
if (_job._success /*boolean*/ ) { 
 //BA.debugLineNum = 604;BA.debugLine="If Job.JobName = \"mark_attendance_nfc\" Then";
if ((_job._jobname /*String*/ ).equals("mark_attendance_nfc")) { 
 //BA.debugLineNum = 605;BA.debugLine="Try";
try { //BA.debugLineNum = 606;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 607;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 608;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 609;BA.debugLine="If root.Get(\"success\") = True Then";
if ((_root.Get((Object)("success"))).equals((Object)(anywheresoftware.b4a.keywords.Common.True))) { 
 //BA.debugLineNum = 610;BA.debugLine="Dim sName As String = root.Get(\"student_name\"";
_sname = BA.ObjectToString(_root.Get((Object)("student_name")));
 //BA.debugLineNum = 611;BA.debugLine="Dim action As String = root.Get(\"action\")";
_action = BA.ObjectToString(_root.Get((Object)("action")));
 //BA.debugLineNum = 612;BA.debugLine="ToastMessageShow(\"TAP SUCCESS: \" & sName & \"";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("TAP SUCCESS: "+_sname+" "+_action),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 615;BA.debugLine="If pnlAttendance.Visible Then FetchStudents";
if (mostCurrent._pnlattendance.getVisible()) { 
_fetchstudents();};
 }else {
 //BA.debugLineNum = 617;BA.debugLine="ToastMessageShow(\"TAP ERROR: \" & root.Get(\"er";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("TAP ERROR: "+BA.ObjectToString(_root.Get((Object)("error")))),anywheresoftware.b4a.keywords.Common.True);
 };
 } 
       catch (Exception e16) {
			processBA.setLastException(e16); //BA.debugLineNum = 620;BA.debugLine="Log(\"NFC Parse Error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("41769491","NFC Parse Error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 };
 }else if((_job._jobname /*String*/ ).equals("register_tag")) { 
 //BA.debugLineNum = 623;BA.debugLine="Try";
try { //BA.debugLineNum = 624;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 625;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 626;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 627;BA.debugLine="If root.Get(\"success\") = True Then";
if ((_root.Get((Object)("success"))).equals((Object)(anywheresoftware.b4a.keywords.Common.True))) { 
 //BA.debugLineNum = 628;BA.debugLine="ToastMessageShow(\"SUCCESS: Tag Assigned!\", Tr";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("SUCCESS: Tag Assigned!"),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 629;BA.debugLine="pnlTagScan.Visible = False ' Close modal on s";
mostCurrent._pnltagscan.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 630;BA.debugLine="FetchStudents";
_fetchstudents();
 }else {
 //BA.debugLineNum = 632;BA.debugLine="ToastMessageShow(\"REG ERROR: \" & root.Get(\"er";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("REG ERROR: "+BA.ObjectToString(_root.Get((Object)("error")))),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 634;BA.debugLine="lblScanStatus.Text = \"ERROR: \" & root.Get(\"er";
mostCurrent._lblscanstatus.setText(BA.ObjectToCharSequence("ERROR: "+BA.ObjectToString(_root.Get((Object)("error")))));
 //BA.debugLineNum = 635;BA.debugLine="lblScanStatus.TextColor = Colors.Red";
mostCurrent._lblscanstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 } 
       catch (Exception e33) {
			processBA.setLastException(e33); //BA.debugLineNum = 638;BA.debugLine="Log(\"Reg Parse Error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("41769509","Reg Parse Error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 //BA.debugLineNum = 639;BA.debugLine="Log(\"Server raw response: \" & Job.GetString)";
anywheresoftware.b4a.keywords.Common.LogImpl("41769510","Server raw response: "+_job._getstring /*String*/ (),0);
 };
 }else if((_job._jobname /*String*/ ).equals("login")) { 
 //BA.debugLineNum = 643;BA.debugLine="Try";
try { //BA.debugLineNum = 644;BA.debugLine="Log(\"Login response: \" & Job.GetString)";
anywheresoftware.b4a.keywords.Common.LogImpl("41769515","Login response: "+_job._getstring /*String*/ (),0);
 //BA.debugLineNum = 645;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 646;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 647;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 649;BA.debugLine="If root.ContainsKey(\"success\") And True = root";
if (_root.ContainsKey((Object)("success")) && anywheresoftware.b4a.keywords.Common.True==BA.ObjectToBoolean(_root.Get((Object)("success")))) { 
 //BA.debugLineNum = 650;BA.debugLine="If root.ContainsKey(\"api_key\") Then";
if (_root.ContainsKey((Object)("api_key"))) { 
 //BA.debugLineNum = 651;BA.debugLine="Dim apiKey As String = root.Get(\"api_key\")";
_apikey = BA.ObjectToString(_root.Get((Object)("api_key")));
 //BA.debugLineNum = 652;BA.debugLine="APIModule.SaveToken(apiKey)";
mostCurrent._apimodule._savetoken /*String*/ (mostCurrent.activityBA,_apikey);
 };
 //BA.debugLineNum = 655;BA.debugLine="If root.ContainsKey(\"driver\") Then";
if (_root.ContainsKey((Object)("driver"))) { 
 //BA.debugLineNum = 656;BA.debugLine="Dim driver As Map = root.Get(\"driver\")";
_driver = new anywheresoftware.b4a.objects.collections.Map();
_driver = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_root.Get((Object)("driver"))));
 //BA.debugLineNum = 657;BA.debugLine="If driver.ContainsKey(\"name\") Then";
if (_driver.ContainsKey((Object)("name"))) { 
 //BA.debugLineNum = 658;BA.debugLine="Dim driverName As String = driver.Get(\"name";
_drivername = BA.ObjectToString(_driver.Get((Object)("name")));
 //BA.debugLineNum = 659;BA.debugLine="lblDriverInfo.Text = \"Welcome, \" & driverNa";
mostCurrent._lbldriverinfo.setText(BA.ObjectToCharSequence("Welcome, "+_drivername));
 };
 };
 //BA.debugLineNum = 663;BA.debugLine="ToastMessageShow(\"Login successful\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Login successful"),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 664;BA.debugLine="ShowTracking";
_showtracking();
 }else {
 //BA.debugLineNum = 666;BA.debugLine="Dim errorMsg As String = \"Login failed\"";
_errormsg = "Login failed";
 //BA.debugLineNum = 667;BA.debugLine="If root.ContainsKey(\"error\") Then";
if (_root.ContainsKey((Object)("error"))) { 
 //BA.debugLineNum = 668;BA.debugLine="errorMsg = root.Get(\"error\")";
_errormsg = BA.ObjectToString(_root.Get((Object)("error")));
 };
 //BA.debugLineNum = 670;BA.debugLine="ToastMessageShow(\"Error: \" & errorMsg, True)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Error: "+_errormsg),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 671;BA.debugLine="btnLogin.Enabled = True";
mostCurrent._btnlogin.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 672;BA.debugLine="btnLogin.Text = \"LOGIN\"";
mostCurrent._btnlogin.setText(BA.ObjectToCharSequence("LOGIN"));
 };
 } 
       catch (Exception e66) {
			processBA.setLastException(e66); //BA.debugLineNum = 675;BA.debugLine="Log(\"Login error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("41769546","Login error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 //BA.debugLineNum = 676;BA.debugLine="ToastMessageShow(\"Login failed: Invalid respon";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Login failed: Invalid response"),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 677;BA.debugLine="btnLogin.Enabled = True";
mostCurrent._btnlogin.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 678;BA.debugLine="btnLogin.Text = \"LOGIN\"";
mostCurrent._btnlogin.setText(BA.ObjectToCharSequence("LOGIN"));
 };
 }else if((_job._jobname /*String*/ ).equals("fetch_students")) { 
 //BA.debugLineNum = 681;BA.debugLine="Try";
try { //BA.debugLineNum = 682;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 683;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 684;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 685;BA.debugLine="If root.Get(\"success\") = True Then";
if ((_root.Get((Object)("success"))).equals((Object)(anywheresoftware.b4a.keywords.Common.True))) { 
 //BA.debugLineNum = 686;BA.debugLine="UpdateStudentList(root.Get(\"students\"))";
_updatestudentlist((anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_root.Get((Object)("students")))));
 };
 } 
       catch (Exception e80) {
			processBA.setLastException(e80); //BA.debugLineNum = 689;BA.debugLine="Log(\"Fetch error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("41769560","Fetch error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 };
 }else if((_job._jobname /*String*/ ).equals("mark_attendance")) { 
 //BA.debugLineNum = 692;BA.debugLine="Try";
try { //BA.debugLineNum = 693;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 694;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 695;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 696;BA.debugLine="If root.Get(\"success\") = True Then";
if ((_root.Get((Object)("success"))).equals((Object)(anywheresoftware.b4a.keywords.Common.True))) { 
 //BA.debugLineNum = 697;BA.debugLine="ToastMessageShow(\"Success: Student \" & root.G";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Success: Student "+BA.ObjectToString(_root.Get((Object)("action")))),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 698;BA.debugLine="FetchStudents ' Refresh list";
_fetchstudents();
 }else {
 //BA.debugLineNum = 700;BA.debugLine="ToastMessageShow(\"Failed to update status\", T";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Failed to update status"),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 701;BA.debugLine="FetchStudents ' Reset UI";
_fetchstudents();
 };
 } 
       catch (Exception e95) {
			processBA.setLastException(e95); //BA.debugLineNum = 704;BA.debugLine="Log(\"Mark error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("41769575","Mark error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 };
 }else if((_job._jobname /*String*/ ).equals("get_routes")) { 
 //BA.debugLineNum = 707;BA.debugLine="If Job.Success Then";
if (_job._success /*boolean*/ ) { 
 //BA.debugLineNum = 708;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 709;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 710;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 712;BA.debugLine="If root.Get(\"success\") = True Then";
if ((_root.Get((Object)("success"))).equals((Object)(anywheresoftware.b4a.keywords.Common.True))) { 
 //BA.debugLineNum = 713;BA.debugLine="lvRoutes.Clear";
mostCurrent._lvroutes.Clear();
 //BA.debugLineNum = 714;BA.debugLine="Dim routes As List = root.Get(\"routes\")";
_routes = new anywheresoftware.b4a.objects.collections.List();
_routes = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_root.Get((Object)("routes"))));
 //BA.debugLineNum = 716;BA.debugLine="For Each colRoute As Map In routes";
_colroute = new anywheresoftware.b4a.objects.collections.Map();
{
final anywheresoftware.b4a.BA.IterableList group105 = _routes;
final int groupLen105 = group105.getSize()
;int index105 = 0;
;
for (; index105 < groupLen105;index105++){
_colroute = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(group105.Get(index105)));
 //BA.debugLineNum = 717;BA.debugLine="Dim routeName As String = colRoute.Get(\"rout";
_routename = BA.ObjectToString(_colroute.Get((Object)("route_name")));
 //BA.debugLineNum = 718;BA.debugLine="Dim shift As String = colRoute.Get(\"shift\")";
_shift = BA.ObjectToString(_colroute.Get((Object)("shift")));
 //BA.debugLineNum = 719;BA.debugLine="Dim studentCount As Int = colRoute.Get(\"stud";
_studentcount = (int)(BA.ObjectToNumber(_colroute.Get((Object)("student_count"))));
 //BA.debugLineNum = 721;BA.debugLine="Dim secondLine As String = shift.ToUpperCase";
_secondline = _shift.toUpperCase()+" • "+BA.NumberToString(_studentcount)+" students";
 //BA.debugLineNum = 722;BA.debugLine="lvRoutes.AddTwoLines2(routeName, secondLine,";
mostCurrent._lvroutes.AddTwoLines2(BA.ObjectToCharSequence(_routename),BA.ObjectToCharSequence(_secondline),(Object)(_colroute.getObject()));
 }
};
 //BA.debugLineNum = 725;BA.debugLine="If routes.Size = 0 Then";
if (_routes.getSize()==0) { 
 //BA.debugLineNum = 726;BA.debugLine="ToastMessageShow(\"No routes available\", Fals";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("No routes available"),anywheresoftware.b4a.keywords.Common.False);
 };
 }else {
 //BA.debugLineNum = 729;BA.debugLine="ToastMessageShow(\"Error loading routes\", Fals";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Error loading routes"),anywheresoftware.b4a.keywords.Common.False);
 };
 };
 }else if((_job._jobname /*String*/ ).equals("set_active_route")) { 
 //BA.debugLineNum = 733;BA.debugLine="If Job.Success Then";
if (_job._success /*boolean*/ ) { 
 //BA.debugLineNum = 734;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 735;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 736;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 738;BA.debugLine="If root.Get(\"success\") = True Then";
if ((_root.Get((Object)("success"))).equals((Object)(anywheresoftware.b4a.keywords.Common.True))) { 
 //BA.debugLineNum = 739;BA.debugLine="ToastMessageShow(\"Route selected: \" & ActiveR";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Route selected: "+mostCurrent._activeroutename),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 740;BA.debugLine="ShowTracking";
_showtracking();
 //BA.debugLineNum = 741;BA.debugLine="FetchStudents ' Reload students for this rout";
_fetchstudents();
 }else {
 //BA.debugLineNum = 743;BA.debugLine="ToastMessageShow(\"Error setting route\", False";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Error setting route"),anywheresoftware.b4a.keywords.Common.False);
 };
 };
 };
 }else {
 //BA.debugLineNum = 748;BA.debugLine="ToastMessageShow(\"Network error: \" & Job.ErrorMe";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Network error: "+_job._errormessage /*String*/ ),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 749;BA.debugLine="btnLogin.Enabled = True";
mostCurrent._btnlogin.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 750;BA.debugLine="btnLogin.Text = \"LOGIN\"";
mostCurrent._btnlogin.setText(BA.ObjectToCharSequence("LOGIN"));
 };
 //BA.debugLineNum = 752;BA.debugLine="Job.Release";
_job._release /*String*/ ();
 //BA.debugLineNum = 753;BA.debugLine="End Sub";
return "";
}
public static String  _loadroutes() throws Exception{
com.merosee.bustrack.driver.httpjob _job = null;
 //BA.debugLineNum = 759;BA.debugLine="Sub LoadRoutes";
 //BA.debugLineNum = 761;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 762;BA.debugLine="job.Initialize(\"get_routes\", Me)";
_job._initialize /*String*/ (processBA,"get_routes",main.getObject());
 //BA.debugLineNum = 763;BA.debugLine="job.Download(APIModule.ServerURL & \"/get_routes.p";
_job._download /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/get_routes.php");
 //BA.debugLineNum = 764;BA.debugLine="APIModule.SetAuthHeader(job, APIModule.GetToken)";
mostCurrent._apimodule._setauthheader /*String*/ (mostCurrent.activityBA,_job,mostCurrent._apimodule._gettoken /*String*/ (mostCurrent.activityBA));
 //BA.debugLineNum = 765;BA.debugLine="End Sub";
return "";
}
public static String  _lvroutes_itemclick(int _position,Object _value) throws Exception{
anywheresoftware.b4a.objects.collections.Map _routedata = null;
int _routeid = 0;
String _routename = "";
 //BA.debugLineNum = 771;BA.debugLine="Sub lvRoutes_ItemClick (Position As Int, Value As";
 //BA.debugLineNum = 773;BA.debugLine="Dim routeData As Map = Value";
_routedata = new anywheresoftware.b4a.objects.collections.Map();
_routedata = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_value));
 //BA.debugLineNum = 774;BA.debugLine="Dim routeId As Int = routeData.Get(\"id\")";
_routeid = (int)(BA.ObjectToNumber(_routedata.Get((Object)("id"))));
 //BA.debugLineNum = 775;BA.debugLine="Dim routeName As String = routeData.Get(\"route_na";
_routename = BA.ObjectToString(_routedata.Get((Object)("route_name")));
 //BA.debugLineNum = 778;BA.debugLine="SetActiveRoute(routeId, routeName)";
_setactiveroute(_routeid,_routename);
 //BA.debugLineNum = 779;BA.debugLine="End Sub";
return "";
}
public static String  _nfc_tagdiscovered(byte[] _tagid,anywheresoftware.b4a.objects.IntentWrapper _intent) throws Exception{
 //BA.debugLineNum = 597;BA.debugLine="Sub nfc_TagDiscovered (TagId() As Byte, Intent As";
 //BA.debugLineNum = 599;BA.debugLine="ProcessNFCTag(Intent)";
_processnfctag(_intent);
 //BA.debugLineNum = 600;BA.debugLine="End Sub";
return "";
}

public static void initializeProcessGlobals() {
    
    if (main.processGlobalsRun == false) {
	    main.processGlobalsRun = true;
		try {
		        main._process_globals();
starter._process_globals();
trackingservice._process_globals();
apimodule._process_globals();
routeselectionfunctions._process_globals();
httputils2service._process_globals();
		
        } catch (Exception e) {
			throw new RuntimeException(e);
		}
    }
}public static String  _process_globals() throws Exception{
 //BA.debugLineNum = 7;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 8;BA.debugLine="Private prevIntent As Intent";
_previntent = new anywheresoftware.b4a.objects.IntentWrapper();
 //BA.debugLineNum = 9;BA.debugLine="Private LastTapTime As Long = 0";
_lasttaptime = (long) (0);
 //BA.debugLineNum = 10;BA.debugLine="End Sub";
return "";
}
public static String  _processintent(anywheresoftware.b4a.objects.IntentWrapper _si) throws Exception{
 //BA.debugLineNum = 274;BA.debugLine="Sub ProcessIntent(si As Intent)";
 //BA.debugLineNum = 275;BA.debugLine="If si.IsInitialized = False Then Return";
if (_si.IsInitialized()==anywheresoftware.b4a.keywords.Common.False) { 
if (true) return "";};
 //BA.debugLineNum = 277;BA.debugLine="Log(\"Checking Intent: \" & si.Action)";
anywheresoftware.b4a.keywords.Common.LogImpl("45767171","Checking Intent: "+_si.getAction(),0);
 //BA.debugLineNum = 279;BA.debugLine="If si.Action.EndsWith(\"TECH_DISCOVERED\") OR si.Ac";
if (_si.getAction().endsWith("TECH_DISCOVERED") || _si.getAction().endsWith("TAG_DISCOVERED") || _si.getAction().endsWith("NDEF_DISCOVERED")) { 
 //BA.debugLineNum = 280;BA.debugLine="ProcessNFCTag(si)";
_processnfctag(_si);
 };
 //BA.debugLineNum = 283;BA.debugLine="End Sub";
return "";
}
public static String  _processnfctag(anywheresoftware.b4a.objects.IntentWrapper _si) throws Exception{
anywheresoftware.b4j.object.JavaObject _jo = null;
anywheresoftware.b4j.object.JavaObject _tag = null;
anywheresoftware.b4a.agraham.byteconverter.ByteConverter _bc = null;
byte[] _rawid = null;
String _nfcid = "";
anywheresoftware.b4a.phone.Phone.PhoneVibrate _p = null;
 //BA.debugLineNum = 286;BA.debugLine="Sub ProcessNFCTag(si As Intent)";
 //BA.debugLineNum = 287;BA.debugLine="Try";
try { //BA.debugLineNum = 288;BA.debugLine="Dim jo As JavaObject = si";
_jo = new anywheresoftware.b4j.object.JavaObject();
_jo = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_si.getObject()));
 //BA.debugLineNum = 289;BA.debugLine="Dim tag As JavaObject = jo.RunMethod(\"getParcela";
_tag = new anywheresoftware.b4j.object.JavaObject();
_tag = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_jo.RunMethod("getParcelableExtra",new Object[]{(Object)("android.nfc.extra.TAG")})));
 //BA.debugLineNum = 291;BA.debugLine="If tag.IsInitialized Then";
if (_tag.IsInitialized()) { 
 //BA.debugLineNum = 292;BA.debugLine="Dim bc As ByteConverter";
_bc = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter();
 //BA.debugLineNum = 293;BA.debugLine="Dim rawId() As Byte = tag.RunMethod(\"getId\", Nu";
_rawid = (byte[])(_tag.RunMethod("getId",(Object[])(anywheresoftware.b4a.keywords.Common.Null)));
 //BA.debugLineNum = 294;BA.debugLine="Dim nfcId As String = bc.HexFromBytes(rawId)";
_nfcid = _bc.HexFromBytes(_rawid);
 //BA.debugLineNum = 296;BA.debugLine="Log(\"NFC ID Detected: \" & nfcId)";
anywheresoftware.b4a.keywords.Common.LogImpl("4589834","NFC ID Detected: "+_nfcid,0);
 //BA.debugLineNum = 299;BA.debugLine="If pnlTagScan.Visible Then";
if (mostCurrent._pnltagscan.getVisible()) { 
 //BA.debugLineNum = 300;BA.debugLine="lblScanStatus.Text = \"DETECTED: \" & nfcId & CR";
mostCurrent._lblscanstatus.setText(BA.ObjectToCharSequence("DETECTED: "+_nfcid+anywheresoftware.b4a.keywords.Common.CRLF+"Saving to database..."));
 //BA.debugLineNum = 301;BA.debugLine="lblScanStatus.TextColor = Colors.Green";
mostCurrent._lblscanstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Green);
 }else {
 //BA.debugLineNum = 303;BA.debugLine="ToastMessageShow(\"NFC Tag: \" & nfcId, False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("NFC Tag: "+_nfcid),anywheresoftware.b4a.keywords.Common.False);
 };
 //BA.debugLineNum = 307;BA.debugLine="Dim p As PhoneVibrate";
_p = new anywheresoftware.b4a.phone.Phone.PhoneVibrate();
 //BA.debugLineNum = 308;BA.debugLine="p.Vibrate(150)";
_p.Vibrate(processBA,(long) (150));
 //BA.debugLineNum = 311;BA.debugLine="SendTagToServer(nfcId)";
_sendtagtoserver(_nfcid);
 };
 } 
       catch (Exception e20) {
			processBA.setLastException(e20); //BA.debugLineNum = 314;BA.debugLine="Log(\"NFC Extract Error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("4589852","NFC Extract Error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 };
 //BA.debugLineNum = 316;BA.debugLine="End Sub";
return "";
}
public static String  _sendtagtoserver(String _nfcid) throws Exception{
anywheresoftware.b4a.objects.collections.Map _payload = null;
anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator _gen = null;
com.merosee.bustrack.driver.httpjob _job = null;
 //BA.debugLineNum = 318;BA.debugLine="Sub SendTagToServer(nfcId As String)";
 //BA.debugLineNum = 319;BA.debugLine="Log(\"NFC: Sending to server...\")";
anywheresoftware.b4a.keywords.Common.LogImpl("4655361","NFC: Sending to server...",0);
 //BA.debugLineNum = 320;BA.debugLine="Dim payload As Map";
_payload = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 321;BA.debugLine="payload.Initialize";
_payload.Initialize();
 //BA.debugLineNum = 322;BA.debugLine="payload.Put(\"nfc_id\", nfcId)";
_payload.Put((Object)("nfc_id"),(Object)(_nfcid));
 //BA.debugLineNum = 324;BA.debugLine="If RegistrationTargetID > 0 Then";
if (_registrationtargetid>0) { 
 //BA.debugLineNum = 325;BA.debugLine="payload.Put(\"student_id\", RegistrationTargetID)";
_payload.Put((Object)("student_id"),(Object)(_registrationtargetid));
 //BA.debugLineNum = 326;BA.debugLine="Dim gen As JSONGenerator";
_gen = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 327;BA.debugLine="gen.Initialize(payload)";
_gen.Initialize(_payload);
 //BA.debugLineNum = 328;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 329;BA.debugLine="job.Initialize(\"register_tag\", Me)";
_job._initialize /*String*/ (processBA,"register_tag",main.getObject());
 //BA.debugLineNum = 330;BA.debugLine="job.PostString(APIModule.ServerURL & \"/register_";
_job._poststring /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/register_nfc_tag.php",_gen.ToString());
 //BA.debugLineNum = 331;BA.debugLine="APIModule.SetAuthHeader(job, APIModule.GetToken)";
mostCurrent._apimodule._setauthheader /*String*/ (mostCurrent.activityBA,_job,mostCurrent._apimodule._gettoken /*String*/ (mostCurrent.activityBA));
 //BA.debugLineNum = 332;BA.debugLine="RegistrationTargetID = 0";
_registrationtargetid = (int) (0);
 }else {
 //BA.debugLineNum = 334;BA.debugLine="Dim gen As JSONGenerator";
_gen = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 335;BA.debugLine="gen.Initialize(payload)";
_gen.Initialize(_payload);
 //BA.debugLineNum = 336;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 337;BA.debugLine="job.Initialize(\"mark_attendance_nfc\", Me)";
_job._initialize /*String*/ (processBA,"mark_attendance_nfc",main.getObject());
 //BA.debugLineNum = 338;BA.debugLine="job.PostString(APIModule.ServerURL & \"/mark_atte";
_job._poststring /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/mark_attendance_nfc.php",_gen.ToString());
 //BA.debugLineNum = 339;BA.debugLine="APIModule.SetAuthHeader(job, APIModule.GetToken)";
mostCurrent._apimodule._setauthheader /*String*/ (mostCurrent.activityBA,_job,mostCurrent._apimodule._gettoken /*String*/ (mostCurrent.activityBA));
 };
 //BA.debugLineNum = 341;BA.debugLine="End Sub";
return "";
}
public static String  _setactiveroute(int _routeid,String _routename) throws Exception{
anywheresoftware.b4a.objects.collections.Map _payload = null;
anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator _gen = null;
com.merosee.bustrack.driver.httpjob _job = null;
 //BA.debugLineNum = 781;BA.debugLine="Sub SetActiveRoute(routeId As Int, routeName As St";
 //BA.debugLineNum = 783;BA.debugLine="Dim payload As Map";
_payload = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 784;BA.debugLine="payload.Initialize";
_payload.Initialize();
 //BA.debugLineNum = 785;BA.debugLine="payload.Put(\"route_id\", routeId)";
_payload.Put((Object)("route_id"),(Object)(_routeid));
 //BA.debugLineNum = 787;BA.debugLine="Dim gen As JSONGenerator";
_gen = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 788;BA.debugLine="gen.Initialize(payload)";
_gen.Initialize(_payload);
 //BA.debugLineNum = 790;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 791;BA.debugLine="job.Initialize(\"set_active_route\", Me)";
_job._initialize /*String*/ (processBA,"set_active_route",main.getObject());
 //BA.debugLineNum = 792;BA.debugLine="job.PostString(APIModule.ServerURL & \"/set_active";
_job._poststring /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/set_active_route.php",_gen.ToString());
 //BA.debugLineNum = 793;BA.debugLine="APIModule.SetAuthHeader(job, APIModule.GetToken)";
mostCurrent._apimodule._setauthheader /*String*/ (mostCurrent.activityBA,_job,mostCurrent._apimodule._gettoken /*String*/ (mostCurrent.activityBA));
 //BA.debugLineNum = 796;BA.debugLine="ActiveRouteID = routeId";
_activerouteid = _routeid;
 //BA.debugLineNum = 797;BA.debugLine="ActiveRouteName = routeName";
mostCurrent._activeroutename = _routename;
 //BA.debugLineNum = 798;BA.debugLine="End Sub";
return "";
}
public static String  _showattendance() throws Exception{
 //BA.debugLineNum = 457;BA.debugLine="Sub ShowAttendance";
 //BA.debugLineNum = 458;BA.debugLine="pnlLogin.Visible = False";
mostCurrent._pnllogin.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 459;BA.debugLine="pnlTracking.Visible = False";
mostCurrent._pnltracking.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 460;BA.debugLine="pnlAttendance.Visible = True";
mostCurrent._pnlattendance.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 461;BA.debugLine="FetchStudents";
_fetchstudents();
 //BA.debugLineNum = 462;BA.debugLine="End Sub";
return "";
}
public static String  _showlogin() throws Exception{
 //BA.debugLineNum = 361;BA.debugLine="Sub ShowLogin";
 //BA.debugLineNum = 362;BA.debugLine="pnlLogin.Visible = True";
mostCurrent._pnllogin.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 363;BA.debugLine="pnlRouteSelection.Visible = False";
mostCurrent._pnlrouteselection.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 364;BA.debugLine="pnlTracking.Visible = False";
mostCurrent._pnltracking.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 365;BA.debugLine="pnlAttendance.Visible = False";
mostCurrent._pnlattendance.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 366;BA.debugLine="End Sub";
return "";
}
public static String  _showrouteselection() throws Exception{
 //BA.debugLineNum = 368;BA.debugLine="Sub ShowRouteSelection";
 //BA.debugLineNum = 369;BA.debugLine="pnlLogin.Visible = False";
mostCurrent._pnllogin.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 370;BA.debugLine="pnlRouteSelection.Visible = True";
mostCurrent._pnlrouteselection.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 371;BA.debugLine="pnlTracking.Visible = False";
mostCurrent._pnltracking.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 372;BA.debugLine="pnlAttendance.Visible = False";
mostCurrent._pnlattendance.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 373;BA.debugLine="LoadRoutes";
_loadroutes();
 //BA.debugLineNum = 374;BA.debugLine="End Sub";
return "";
}
public static String  _showtracking() throws Exception{
 //BA.debugLineNum = 376;BA.debugLine="Sub ShowTracking";
 //BA.debugLineNum = 377;BA.debugLine="pnlLogin.Visible = False";
mostCurrent._pnllogin.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 378;BA.debugLine="pnlRouteSelection.Visible = False";
mostCurrent._pnlrouteselection.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 379;BA.debugLine="pnlTracking.Visible = True";
mostCurrent._pnltracking.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 380;BA.debugLine="pnlAttendance.Visible = False";
mostCurrent._pnlattendance.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 383;BA.debugLine="If ActiveRouteName <> \"\" Then";
if ((mostCurrent._activeroutename).equals("") == false) { 
 //BA.debugLineNum = 384;BA.debugLine="lblDriverInfo.Text = \"Route: \" & ActiveRouteName";
mostCurrent._lbldriverinfo.setText(BA.ObjectToCharSequence("Route: "+mostCurrent._activeroutename));
 };
 //BA.debugLineNum = 386;BA.debugLine="UpdateUI";
_updateui();
 //BA.debugLineNum = 387;BA.debugLine="End Sub";
return "";
}
public static String  _updatestudentlist(anywheresoftware.b4a.objects.collections.List _students) throws Exception{
int _itemheight = 0;
int _i = 0;
anywheresoftware.b4a.objects.collections.Map _s = null;
anywheresoftware.b4a.objects.PanelWrapper _p = null;
anywheresoftware.b4a.objects.LabelWrapper _lblname = null;
anywheresoftware.b4a.objects.LabelWrapper _lblstop = null;
String _status = "";
anywheresoftware.b4a.objects.ButtonWrapper _btnpickup = null;
anywheresoftware.b4a.objects.ButtonWrapper _btndrop = null;
boolean _hasnfc = false;
String _nid = "";
anywheresoftware.b4a.objects.ButtonWrapper _btnreg = null;
anywheresoftware.b4a.objects.PanelWrapper _line = null;
 //BA.debugLineNum = 471;BA.debugLine="Sub UpdateStudentList(students As List)";
 //BA.debugLineNum = 472;BA.debugLine="StudentList = students";
mostCurrent._studentlist = _students;
 //BA.debugLineNum = 473;BA.debugLine="clvStudents.Panel.RemoveAllViews";
mostCurrent._clvstudents.getPanel().RemoveAllViews();
 //BA.debugLineNum = 475;BA.debugLine="Dim itemHeight As Int = 110dip";
_itemheight = anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (110));
 //BA.debugLineNum = 476;BA.debugLine="clvStudents.Panel.Height = students.Size * itemHe";
mostCurrent._clvstudents.getPanel().setHeight((int) (_students.getSize()*_itemheight));
 //BA.debugLineNum = 478;BA.debugLine="For i = 0 To students.Size - 1";
{
final int step5 = 1;
final int limit5 = (int) (_students.getSize()-1);
_i = (int) (0) ;
for (;_i <= limit5 ;_i = _i + step5 ) {
 //BA.debugLineNum = 479;BA.debugLine="Dim s As Map = students.Get(i)";
_s = new anywheresoftware.b4a.objects.collections.Map();
_s = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_students.Get(_i)));
 //BA.debugLineNum = 480;BA.debugLine="Dim p As Panel";
_p = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 481;BA.debugLine="p.Initialize(\"\")";
_p.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 482;BA.debugLine="clvStudents.Panel.AddView(p, 0, i * itemHeight,";
mostCurrent._clvstudents.getPanel().AddView((android.view.View)(_p.getObject()),(int) (0),(int) (_i*_itemheight),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (100),mostCurrent.activityBA),_itemheight);
 //BA.debugLineNum = 484;BA.debugLine="Dim lblName As Label";
_lblname = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 485;BA.debugLine="lblName.Initialize(\"\")";
_lblname.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 486;BA.debugLine="lblName.Text = (i+1) & \". \" & s.Get(\"name\") & \"";
_lblname.setText(BA.ObjectToCharSequence(BA.NumberToString((_i+1))+". "+BA.ObjectToString(_s.Get((Object)("name")))+" ("+BA.ObjectToString(_s.Get((Object)("grade")))+")"));
 //BA.debugLineNum = 487;BA.debugLine="lblName.TextSize = 16";
_lblname.setTextSize((float) (16));
 //BA.debugLineNum = 488;BA.debugLine="lblName.Typeface = Typeface.DEFAULT_BOLD";
_lblname.setTypeface(anywheresoftware.b4a.keywords.Common.Typeface.DEFAULT_BOLD);
 //BA.debugLineNum = 489;BA.debugLine="p.AddView(lblName, 10dip, 10dip, 90%x, 30dip)";
_p.AddView((android.view.View)(_lblname.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (10)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (10)),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (90),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (30)));
 //BA.debugLineNum = 491;BA.debugLine="Dim lblStop As Label";
_lblstop = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 492;BA.debugLine="lblStop.Initialize(\"\")";
_lblstop.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 493;BA.debugLine="lblStop.Text = \"📍 \" & s.Get(\"stop_name\")";
_lblstop.setText(BA.ObjectToCharSequence("📍 "+BA.ObjectToString(_s.Get((Object)("stop_name")))));
 //BA.debugLineNum = 494;BA.debugLine="lblStop.TextSize = 14";
_lblstop.setTextSize((float) (14));
 //BA.debugLineNum = 495;BA.debugLine="lblStop.TextColor = Colors.DarkGray";
_lblstop.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.DarkGray);
 //BA.debugLineNum = 496;BA.debugLine="p.AddView(lblStop, 10dip, 40dip, 90%x, 30dip)";
_p.AddView((android.view.View)(_lblstop.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (10)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (40)),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (90),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (30)));
 //BA.debugLineNum = 498;BA.debugLine="Dim status As String = s.GetDefault(\"current_sta";
_status = BA.ObjectToString(_s.GetDefault((Object)("current_status"),(Object)("")));
 //BA.debugLineNum = 500;BA.debugLine="Dim btnPickup As Button";
_btnpickup = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 501;BA.debugLine="btnPickup.Initialize(\"btnAction\")";
_btnpickup.Initialize(mostCurrent.activityBA,"btnAction");
 //BA.debugLineNum = 502;BA.debugLine="btnPickup.Tag = CreateMap(\"id\": s.Get(\"id\"), \"ac";
_btnpickup.setTag((Object)(anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("id"),_s.Get((Object)("id")),(Object)("action"),(Object)("pickup")}).getObject()));
 //BA.debugLineNum = 503;BA.debugLine="btnPickup.Text = \"PICKUP\"";
_btnpickup.setText(BA.ObjectToCharSequence("PICKUP"));
 //BA.debugLineNum = 504;BA.debugLine="btnPickup.TextSize = 12";
_btnpickup.setTextSize((float) (12));
 //BA.debugLineNum = 505;BA.debugLine="If status = \"pickup\" Then";
if ((_status).equals("pickup")) { 
 //BA.debugLineNum = 506;BA.debugLine="btnPickup.Color = Colors.Green";
_btnpickup.setColor(anywheresoftware.b4a.keywords.Common.Colors.Green);
 //BA.debugLineNum = 507;BA.debugLine="btnPickup.Enabled = False";
_btnpickup.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 }else {
 //BA.debugLineNum = 509;BA.debugLine="btnPickup.Color = Colors.RGB(76, 175, 80)";
_btnpickup.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (76),(int) (175),(int) (80)));
 };
 //BA.debugLineNum = 511;BA.debugLine="p.AddView(btnPickup, 10dip, 70dip, 40%x, 35dip)";
_p.AddView((android.view.View)(_btnpickup.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (10)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (70)),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (40),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (35)));
 //BA.debugLineNum = 513;BA.debugLine="Dim btnDrop As Button";
_btndrop = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 514;BA.debugLine="btnDrop.Initialize(\"btnAction\")";
_btndrop.Initialize(mostCurrent.activityBA,"btnAction");
 //BA.debugLineNum = 515;BA.debugLine="btnDrop.Tag = CreateMap(\"id\": s.Get(\"id\"), \"acti";
_btndrop.setTag((Object)(anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("id"),_s.Get((Object)("id")),(Object)("action"),(Object)("drop")}).getObject()));
 //BA.debugLineNum = 516;BA.debugLine="btnDrop.Text = \"DROP\"";
_btndrop.setText(BA.ObjectToCharSequence("DROP"));
 //BA.debugLineNum = 517;BA.debugLine="btnDrop.TextSize = 12";
_btndrop.setTextSize((float) (12));
 //BA.debugLineNum = 518;BA.debugLine="If status = \"drop\" Then";
if ((_status).equals("drop")) { 
 //BA.debugLineNum = 519;BA.debugLine="btnDrop.Color = Colors.Red";
_btndrop.setColor(anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 520;BA.debugLine="btnDrop.Enabled = False";
_btndrop.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 }else {
 //BA.debugLineNum = 522;BA.debugLine="btnDrop.Color = Colors.RGB(244, 67, 54)";
_btndrop.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (244),(int) (67),(int) (54)));
 };
 //BA.debugLineNum = 524;BA.debugLine="p.AddView(btnDrop, 50%x, 70dip, 20%x, 35dip)";
_p.AddView((android.view.View)(_btndrop.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (50),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (70)),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (20),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (35)));
 //BA.debugLineNum = 527;BA.debugLine="Dim hasNfc As Boolean = False";
_hasnfc = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 528;BA.debugLine="If s.ContainsKey(\"nfc_id\") Then";
if (_s.ContainsKey((Object)("nfc_id"))) { 
 //BA.debugLineNum = 529;BA.debugLine="Dim nId As String = s.Get(\"nfc_id\")";
_nid = BA.ObjectToString(_s.Get((Object)("nfc_id")));
 //BA.debugLineNum = 530;BA.debugLine="If nId <> \"\" And nId <> \"null\" Then hasNfc = Tr";
if ((_nid).equals("") == false && (_nid).equals("null") == false) { 
_hasnfc = anywheresoftware.b4a.keywords.Common.True;};
 };
 //BA.debugLineNum = 533;BA.debugLine="If hasNfc = False Then";
if (_hasnfc==anywheresoftware.b4a.keywords.Common.False) { 
 //BA.debugLineNum = 534;BA.debugLine="Dim btnReg As Button";
_btnreg = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 535;BA.debugLine="btnReg.Initialize(\"btnRegTag\")";
_btnreg.Initialize(mostCurrent.activityBA,"btnRegTag");
 //BA.debugLineNum = 536;BA.debugLine="btnReg.Tag = s.Get(\"id\")";
_btnreg.setTag(_s.Get((Object)("id")));
 //BA.debugLineNum = 537;BA.debugLine="btnReg.Text = \"🆔\"";
_btnreg.setText(BA.ObjectToCharSequence("🆔"));
 //BA.debugLineNum = 538;BA.debugLine="btnReg.TextSize = 14";
_btnreg.setTextSize((float) (14));
 //BA.debugLineNum = 539;BA.debugLine="btnReg.Color = Colors.DarkGray";
_btnreg.setColor(anywheresoftware.b4a.keywords.Common.Colors.DarkGray);
 //BA.debugLineNum = 540;BA.debugLine="p.AddView(btnReg, 75%x, 70dip, 20%x, 35dip)";
_p.AddView((android.view.View)(_btnreg.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (75),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (70)),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (20),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (35)));
 };
 //BA.debugLineNum = 543;BA.debugLine="Dim line As Panel";
_line = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 544;BA.debugLine="line.Initialize(\"\")";
_line.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 545;BA.debugLine="line.Color = Colors.LightGray";
_line.setColor(anywheresoftware.b4a.keywords.Common.Colors.LightGray);
 //BA.debugLineNum = 546;BA.debugLine="p.AddView(line, 0, itemHeight - 1dip, 100%x, 1di";
_p.AddView((android.view.View)(_line.getObject()),(int) (0),(int) (_itemheight-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (1))),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (100),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (1)));
 }
};
 //BA.debugLineNum = 548;BA.debugLine="End Sub";
return "";
}
public static String  _updateui() throws Exception{
 //BA.debugLineNum = 583;BA.debugLine="Sub UpdateUI";
 //BA.debugLineNum = 584;BA.debugLine="If TrackingService.IsTracking Then";
if (mostCurrent._trackingservice._istracking /*boolean*/ ) { 
 //BA.debugLineNum = 585;BA.debugLine="btnToggle.Text = \"STOP TRACKING\"";
mostCurrent._btntoggle.setText(BA.ObjectToCharSequence("STOP TRACKING"));
 //BA.debugLineNum = 586;BA.debugLine="btnToggle.Color = Colors.RGB(244, 67, 54)";
mostCurrent._btntoggle.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (244),(int) (67),(int) (54)));
 //BA.debugLineNum = 587;BA.debugLine="lblStatus.Text = \"Status: TRACKING\"";
mostCurrent._lblstatus.setText(BA.ObjectToCharSequence("Status: TRACKING"));
 //BA.debugLineNum = 588;BA.debugLine="lblStatus.TextColor = Colors.RGB(76, 175, 80)";
mostCurrent._lblstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (76),(int) (175),(int) (80)));
 }else {
 //BA.debugLineNum = 590;BA.debugLine="btnToggle.Text = \"START TRACKING\"";
mostCurrent._btntoggle.setText(BA.ObjectToCharSequence("START TRACKING"));
 //BA.debugLineNum = 591;BA.debugLine="btnToggle.Color = Colors.RGB(76, 175, 80)";
mostCurrent._btntoggle.setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (76),(int) (175),(int) (80)));
 //BA.debugLineNum = 592;BA.debugLine="lblStatus.Text = \"Status: IDLE\"";
mostCurrent._lblstatus.setText(BA.ObjectToCharSequence("Status: IDLE"));
 //BA.debugLineNum = 593;BA.debugLine="lblStatus.TextColor = Colors.Red";
mostCurrent._lblstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 595;BA.debugLine="End Sub";
return "";
}
}
